Fixes recoil damage calculation (#1063)
Recoil damage previously used the total damage dealt by the user instead of using the damage dealt in the current turn.
This commit is contained in:
parent
f649179e24
commit
f1394307f4
|
@ -782,8 +782,8 @@ export class RecoilAttr extends MoveEffectAttr {
|
|||
if (cancelled.value)
|
||||
return false;
|
||||
|
||||
const recoilDamage = Math.max(Math.floor((!this.useHp ? user.turnData.damageDealt : user.getMaxHp()) * this.damageRatio),
|
||||
user.turnData.damageDealt ? 1 : 0);
|
||||
const recoilDamage = Math.max(Math.floor((!this.useHp ? user.turnData.currDamageDealt : user.getMaxHp()) * this.damageRatio),
|
||||
user.turnData.currDamageDealt ? 1 : 0);
|
||||
if (!recoilDamage)
|
||||
return false;
|
||||
|
||||
|
|
|
@ -1659,6 +1659,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
this.scene.gameData.gameStats.highestDamage = damage.value;
|
||||
}
|
||||
source.turnData.damageDealt += damage.value;
|
||||
source.turnData.currDamageDealt = damage.value;
|
||||
this.battleData.hitCount++;
|
||||
const attackResult = { move: move.id, result: result as DamageResult, damage: damage.value, critical: isCritical, sourceId: source.id };
|
||||
this.turnData.attacksReceived.unshift(attackResult);
|
||||
|
@ -3381,6 +3382,7 @@ export class PokemonTurnData {
|
|||
public hitCount: integer;
|
||||
public hitsLeft: integer;
|
||||
public damageDealt: integer = 0;
|
||||
public currDamageDealt: integer = 0;
|
||||
public damageTaken: integer = 0;
|
||||
public attacksReceived: AttackMoveResult[] = [];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue