Skip to content

Commit

Permalink
fix(AbilityModifier.java): Always parse param[1-3] as DynamicFloats
Browse files Browse the repository at this point in the history
  • Loading branch information
KingRainbow44 committed Sep 28, 2024
1 parent 5167253 commit 5b9d386
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -345,9 +345,10 @@ public enum Type {
public DynamicFloat valueRangeMax;
public String overrideMapKey;

public int param1;
public int param2;
public int param3;
public DynamicFloat
param1 = DynamicFloat.ZERO,
param2 = DynamicFloat.ZERO,
param3 = DynamicFloat.ZERO;

public String funcName;
public LuaCallType luaCallType;
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/emu/grasscutter/data/common/DynamicFloat.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ public float get(Ability ability) {
return this.get(ability.getAbilitySpecials(), 0f);
}

public int getInt(Ability ability) {
return (int) this.get(ability.getAbilitySpecials(), 0f);
}

public float get(Object2FloatMap<String> props, float defaultValue) {
if (!this.dynamic) return constant;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@ public boolean execute(
// Investigate if we need to use target

if (owner.getEntityController() != null) {
var param1 = action.param1.getInt(ability);
var param2 = action.param2.getInt(ability);
var param3 = action.param3.getInt(ability);

owner
.getEntityController()
.onClientExecuteRequest(owner, action.param1, action.param2, action.param3);
.onClientExecuteRequest(owner, param1, param2, param3);
return true;
}

Expand Down

0 comments on commit 5b9d386

Please sign in to comment.