-
Notifications
You must be signed in to change notification settings - Fork 45
A Damage Modifier Bug #107
Copy link
Copy link
Open
Description
When a card applied "DamageMod" deals Multidamage, the bonus from the DamageMod is uncorrectly applied. If there're 3 monsters in a combat room, only the first one take the damage with bonus.
After my search through the source code, I think the problem is in the "DamageModifierPatch" class.
Source Code:
public class DamageModifierPatches {
@SpirePatch(
clz = AbstractCard.class,
method = "calculateCardDamage"
)
public static class ModifyDamage {
/*
Other code......
*/
@SpireInsertPatch(
locator = MultiDamageLocator.class,
localvars = {"tmp", "i", "m"}
)
public static void multi(AbstractCard __instance, AbstractMonster mo, float[] tmp, int i, ArrayList<AbstractMonster> m) {
for(AbstractDamageModifier mod : DamageModifierManager.modifiers(__instance)) {
tmp[i] = mod.atDamageGive(tmp[i], __instance.damageTypeForTurn, (AbstractCreature)m.get(i), __instance);
}
}
}
/*
Other code......
*/
}
The parameter "tmp" should be added "@ByRef" annootation, and be changed to "float[][] tmp", like this:
@SpireInsertPatch(
locator = MultiDamageLocator.class,
localvars = {"tmp", "i", "m"}
)
public static void multi(AbstractCard __instance, AbstractMonster mo, @ByRef float[][] tmp, int i, ArrayList<AbstractMonster> m) {
for(AbstractDamageModifier mod : DamageModifierManager.modifiers(__instance)) {
tmp[0][i] = mod.atDamageGive(tmp[0][i], __instance.damageTypeForTurn, (AbstractCreature)m.get(i), __instance);
}
}
Other similar methods which patch the multidamage function in this class should be also fixed.
You can try to fix the patch class as what I point out. If that dosen't work, maybe there's something else wrong......
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels