Skip to content

Commit a204473

Browse files
committed
leech cap stat
1 parent 1604de8 commit a204473

9 files changed

Lines changed: 59 additions & 18 deletions

File tree

CHANGELOG.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,4 +166,6 @@ v5.0.4
166166

167167
- death favor added. If you die you lose favor, if you loot chests you gain favor. You can also regain favor slowly over time if it's below a certain point.
168168

169-
- added new supp gems: LMP, GMP, Barrage versions, faster projectiles
169+
- added new supp gems: LMP, GMP, Barrage versions, faster projectiles
170+
171+
- added leech cap stat, and base leech is now 5% total hp etc capped per second

src/main/java/com/robertx22/age_of_exile/capability/entity/EntityLeechData.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.robertx22.age_of_exile.capability.entity;
22

3+
import com.robertx22.age_of_exile.database.data.stats.types.resources.LeechCapStat;
34
import com.robertx22.age_of_exile.saveclasses.unit.ResourceType;
45

56
import java.util.HashMap;
@@ -19,15 +20,15 @@ public void addLeech(ResourceType type, float num) {
1920
map.put(type, fi);
2021
}
2122

22-
static float MAX_LEECH_PERCENT_PER_SECOND = 0.1F; // todo maybe a stat
23-
2423
public void onSecondUseLeeches(EntityData data) {
2524

25+
float leechMaxPerSec = data.getUnit().getCalculatedStat(LeechCapStat.getInstance()).getValueOrBase(LeechCapStat.getInstance()) / 100F;
26+
2627
for (Map.Entry<ResourceType, Float> entry : map.entrySet()) {
2728

2829
float num = entry.getValue();
2930

30-
float max = MAX_LEECH_PERCENT_PER_SECOND * data.getResources().get(data.entity, entry.getKey());
31+
float max = leechMaxPerSec * data.getResources().getMax(data.entity, entry.getKey());
3132

3233
if (num > max) {
3334
num = max;
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package com.robertx22.age_of_exile.database.data.stats.types.resources;
2+
3+
import com.robertx22.age_of_exile.database.data.stats.Stat;
4+
import com.robertx22.age_of_exile.uncommon.enumclasses.Elements;
5+
6+
public class LeechCapStat extends Stat {
7+
public static LeechCapStat getInstance() {
8+
return SingletonHolder.INSTANCE;
9+
}
10+
11+
private static class SingletonHolder {
12+
private static final LeechCapStat INSTANCE = new LeechCapStat();
13+
}
14+
15+
@Override
16+
public Elements getElement() {
17+
return Elements.Physical;
18+
}
19+
20+
@Override
21+
public String locDescForLangFile() {
22+
return "Your leech/resource on hits are capped to x% per second, this stat increases that.";
23+
}
24+
25+
@Override
26+
public String locNameForLangFile() {
27+
return "Total Leech Per Second";
28+
}
29+
30+
@Override
31+
public String GUID() {
32+
return "leech_per_sec";
33+
}
34+
}

src/main/java/com/robertx22/age_of_exile/database/data/stats/types/resources/blood/BloodUser.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
import com.robertx22.age_of_exile.uncommon.enumclasses.Elements;
99
import net.minecraft.ChatFormatting;
1010

11-
import com.robertx22.age_of_exile.database.data.stats.Stat.StatGroup;
12-
1311
public class BloodUser extends Stat {
1412
public static String GUID = "blood_user";
1513

@@ -28,9 +26,6 @@ public StatNameRegex getStatNameRegex() {
2826
return StatNameRegex.JUST_NAME;
2927
}
3028

31-
public static BloodUser getInstance() {
32-
return BloodUser.SingletonHolder.INSTANCE;
33-
}
3429

3530
@Override
3631
public String locDescForLangFile() {
@@ -55,8 +50,12 @@ public boolean IsPercent() {
5550
@Override
5651
public String locNameForLangFile() {
5752
return ChatFormatting.GRAY + "You now use " + Blood.getInstance()
58-
.getIconNameFormat() + " instead of " + Mana.getInstance()
59-
.getIconNameFormat();
53+
.getIconNameFormat() + " instead of " + Mana.getInstance()
54+
.getIconNameFormat();
55+
}
56+
57+
public static BloodUser getInstance() {
58+
return BloodUser.SingletonHolder.INSTANCE;
6059
}
6160

6261
private static class SingletonHolder {

src/main/java/com/robertx22/age_of_exile/database/registrators/StatsRegister.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import com.robertx22.age_of_exile.database.data.stats.types.offense.SkillDamage;
2121
import com.robertx22.age_of_exile.database.data.stats.types.offense.WeaponDamage;
2222
import com.robertx22.age_of_exile.database.data.stats.types.resources.DamageAbsorbedByMana;
23+
import com.robertx22.age_of_exile.database.data.stats.types.resources.LeechCapStat;
2324
import com.robertx22.age_of_exile.database.data.stats.types.resources.RegeneratePercentStat;
2425
import com.robertx22.age_of_exile.database.data.stats.types.resources.blood.Blood;
2526
import com.robertx22.age_of_exile.database.data.stats.types.resources.blood.BloodUser;
@@ -66,8 +67,10 @@ public void registerAll() {
6667
add(new AilmentProcStat(ailment));
6768
}
6869

69-
add(JewelSocketStat.getInstance());
70+
add(LeechCapStat.getInstance());
7071

72+
add(JewelSocketStat.getInstance());
73+
7174
add(new BonusPhysicalAsElemental(Elements.Elemental));
7275
add(new MaxElementalResist(Elements.Elemental));
7376

src/main/java/com/robertx22/age_of_exile/mmorpg/MMORPG.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
public class MMORPG {
6161

6262
// DISABLE WHEN PUBLIC BUILD
63-
public static boolean RUN_DEV_TOOLS = false;
63+
public static boolean RUN_DEV_TOOLS = true;
6464

6565
private static final String PROTOCOL_VERSION = "1";
6666
public static final SimpleChannel NETWORK = NetworkRegistry.newSimpleChannel(

src/main/java/com/robertx22/age_of_exile/saveclasses/unit/StatData.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@ public float getValue() {
5858
// todo this shouldnt be needed return Mth.clamp(v1, stat.min, stat.max);
5959
}
6060

61+
public float getValueOrBase(Stat stat) {
62+
63+
if (this.isNotZero()) {
64+
return v1;
65+
}
66+
return stat.base;
67+
}
6168

6269
public boolean isNotZero() {
6370
return v1 != 0 || this.m != 1;

src/main/java/com/robertx22/age_of_exile/saveclasses/unit/Unit.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,10 @@ public StatData getCalculatedStat(Stat stat) {
8080
}
8181

8282
public StatData getCalculatedStat(String guid) {
83-
8483
if (getStats().stats == null) {
8584
this.initStats();
8685
}
87-
8886
return getStats().stats.getOrDefault(guid, StatData.empty());
89-
9087
}
9188

9289
public Unit() {

src/main/java/com/robertx22/age_of_exile/uncommon/effectdatas/rework/action/RestoreResourceAction.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,11 @@ public void activate(EffectEvent event, EffectSides statSource, StatData data, S
3535
float val = num_provider.getValue(event, event.getSide(statSource), data);
3636
val *= event.data.getNumber(EventData.ATTACK_COOLDOWN).number; // todo test
3737

38-
3938
if (this.restore_type == RestoreType.leech) {
4039
event.targetData.leech.addLeech(type, val);
4140
return;
4241
}
4342

44-
4543
EventBuilder<RestoreResourceEvent> restore = EventBuilder.ofRestore(event.source, event.getSide(side), type, restore_type, val);
4644
if (event.data.isSpellEffect()) {
4745
restore.setSpell(event.getSpell());

0 commit comments

Comments
 (0)