-
Notifications
You must be signed in to change notification settings - Fork 7
NEW API + EVENT HOOKS (While_Leeching + Resource Tracker/Thresholds) #29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 1.20-Forge
Are you sure you want to change the base?
Changes from 10 commits
ff6fb59
bf52165
7336969
62bcd68
2559965
211c0ff
6ec6525
c0a0476
5aece79
1fdcb7f
f06bf30
e83314d
0ee8eb6
c364377
26310f1
5976286
308fd77
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,5 +1,6 @@ | ||||||
| package com.robertx22.mine_and_slash.aoe_data.database.exile_effects.adders; | ||||||
|
|
||||||
| import com.robertx22.mine_and_slash.saveclasses.unit.ResourceType; | ||||||
| import com.robertx22.library_of_exile.registry.ExileRegistryInit; | ||||||
| import com.robertx22.mine_and_slash.aoe_data.database.ailments.Ailments; | ||||||
| import com.robertx22.mine_and_slash.aoe_data.database.exile_effects.ExileEffectBuilder; | ||||||
|
|
@@ -36,8 +37,10 @@ | |||||
|
|
||||||
| import java.util.ArrayList; | ||||||
| import java.util.Arrays; | ||||||
| import java.util.EnumMap; | ||||||
| import java.util.List; | ||||||
| import java.util.UUID; | ||||||
| import java.util.Map; | ||||||
|
|
||||||
| import static net.minecraft.world.entity.ai.attributes.Attributes.*; | ||||||
|
|
||||||
|
|
@@ -68,6 +71,8 @@ public class ModEffects implements ExileRegistryInit { | |||||
| public static EffectCtx BLIND = new EffectCtx("blind", "Blind", Elements.Shadow, EffectType.negative); | ||||||
| public static EffectCtx STUN = new EffectCtx("stun", "Stun", Elements.Physical, EffectType.negative); | ||||||
| public static EffectCtx GALE_FORCE = new EffectCtx("gale_force", "Gale Force", Elements.Physical, EffectType.beneficial); | ||||||
| public static EffectCtx WRATH_OF_THE_JUGGERNAUT = new EffectCtx("wrath_of_the_juggernaut", "Wrath of the Juggernaut", Elements.Physical, EffectType.beneficial); | ||||||
| public static EffectCtx BURNOUT = new EffectCtx("burnout", "Burnout", Elements.Physical, EffectType.negative); | ||||||
|
|
||||||
| // these could be used for map affixes | ||||||
| public static EffectCtx SLOW = new EffectCtx("slow", "Lethargy", Elements.Physical, EffectType.negative); | ||||||
|
|
@@ -100,6 +105,47 @@ public static List<EffectCtx> getCurses() { | |||||
|
|
||||||
| public static int ESSENCE_OF_FROST_MAX_STACKS = 5; | ||||||
|
|
||||||
| // ---------- Helper ---------- | ||||||
| private static EffectCtx state(String id, String name, Elements elem) { | ||||||
| return new EffectCtx(id, name, (elem != null ? elem : Elements.Physical), EffectType.beneficial); | ||||||
| } | ||||||
|
|
||||||
| // Pretty names for resources (UI text) | ||||||
| private static final Map<ResourceType, String> RES_NAME = Map.of( | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In next PR after you move thresholds generation into
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had figured that leeching was hardcoded and wouldn't need datapack functionality, unless you want me to use datadriven resource types. |
||||||
| ResourceType.health, "Health", | ||||||
| ResourceType.mana, "Mana", | ||||||
| ResourceType.energy, "Energy", | ||||||
| ResourceType.magic_shield, "Magic Shield", | ||||||
| ResourceType.blood, "Blood" | ||||||
| ); | ||||||
|
|
||||||
| // Suggested elements per resource (only used for coloring/category) | ||||||
|
|
||||||
| // ---------- Generic flags ---------- | ||||||
| public static final EffectCtx LEECHING_STATE = state( | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In next PR after you move thresholds generation into |
||||||
| "leeching_state", "Leeching (State)", Elements.Physical | ||||||
| ); | ||||||
| public static final EffectCtx REGEN_STATE = state( | ||||||
| "regen_state", "Regenerating (State)", Elements.Physical | ||||||
| ); | ||||||
|
|
||||||
| // ---------- Per-resource flags (generated) ---------- | ||||||
| public static final EnumMap<ResourceType, EffectCtx> LEECHING_STATE_BY_RES = new EnumMap<>(ResourceType.class); | ||||||
| public static final EnumMap<ResourceType, EffectCtx> REGEN_STATE_BY_RES = new EnumMap<>(ResourceType.class); | ||||||
|
|
||||||
| static { | ||||||
| for (var rt : RES_NAME.keySet()) { | ||||||
| var nice = RES_NAME.get(rt); | ||||||
|
|
||||||
| LEECHING_STATE_BY_RES.put( | ||||||
| rt, state("leeching_" + rt.id + "_state", "Leeching " + nice, null) | ||||||
|
||||||
| rt, state("leeching_" + rt.id + "_state", "Leeching " + nice, null) | |
| rt, statePhysical("leeching_" + rt.id + "_state", "Leeching " + nice) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, same thing here. I can't remove null. It causes errors because of how EffectCtx is setup.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| rt, state("regen_" + rt.id + "_state", "Regenerating " + nice, null) | |
| rt, statePhysical("regen_" + rt.id + "_state", "Regenerating " + nice) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why statePhysical?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also changing it to:
REGEN_STATE_BY_RES.put(
rt, statePhysical("regen_" + rt.id + "_state", "Regenerating " + nice)
);
causes errors. Only rt, state("regen_" + rt.id + "_state", "Regenerating " + nice, null) is accepted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because that null you had before meant Elements.Physical in your state method little higher here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because that
nullyou had before meantElements.Physicalin yourstatemethod little higher here
Sure, but I can not change it to anything else other than using physical or another element. If you want me to change it to rt, state("regen_" + rt.id + "_state", "Regenerating " + nice, Elements.Physical) I can do that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, but I can not change it to anything else other than using physical. If you want me to change it to
rt, state("regen_" + rt.id + "_state", "Regenerating " + nice, Elements.Physical)I can do that.
Yea, either this or what I suggested before
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, but I can not change it to anything else other than using physical. If you want me to change it to
rt, state("regen_" + rt.id + "_state", "Regenerating " + nice, Elements.Physical)I can do that.Yea, either this or what I suggested before
I can't do what you suggested before because of how EffectCtx is defined. I will have to use a specific element from now on. Which I assume I can just default everything to phys if I have to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has to be done as method overload