Fixed error in damage logic

This commit is contained in:
Roman 2025-05-08 15:23:14 -05:00
parent 22dfbfcc2e
commit b607994f09

View File

@ -840,12 +840,12 @@ export class MoveEffectPhase extends PokemonPhase {
const substitute = target.getTag(SubstituteTag); const substitute = target.getTag(SubstituteTag);
const isBlockedBySubstitute = substitute && this.move.hitsSubstitute(user, target); const isBlockedBySubstitute = substitute && this.move.hitsSubstitute(user, target);
if (isBlockedBySubstitute) { if (isBlockedBySubstitute) {
substitute.hp -= dmg;
if (substitute.hp >= dmg) { if (substitute.hp >= dmg) {
user.turnData.totalDamageDealt += dmg; user.turnData.totalDamageDealt += dmg;
} else { } else {
user.turnData.totalDamageDealt += substitute.hp; user.turnData.totalDamageDealt += substitute.hp;
} }
substitute.hp -= dmg;
} else if (!target.isPlayer() && dmg >= target.hp) { } else if (!target.isPlayer() && dmg >= target.hp) {
globalScene.applyModifiers(EnemyEndureChanceModifier, false, target); globalScene.applyModifiers(EnemyEndureChanceModifier, false, target);
} }