Skip to content

A Damage Modifier Bug #107

@Icarrus012

Description

@Icarrus012

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......

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions