mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-04-23 01:54:49 +01:00
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)
|
if (cancelled.value)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const recoilDamage = Math.max(Math.floor((!this.useHp ? user.turnData.damageDealt : user.getMaxHp()) * this.damageRatio),
|
const recoilDamage = Math.max(Math.floor((!this.useHp ? user.turnData.currDamageDealt : user.getMaxHp()) * this.damageRatio),
|
||||||
user.turnData.damageDealt ? 1 : 0);
|
user.turnData.currDamageDealt ? 1 : 0);
|
||||||
if (!recoilDamage)
|
if (!recoilDamage)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -1659,6 +1659,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
this.scene.gameData.gameStats.highestDamage = damage.value;
|
this.scene.gameData.gameStats.highestDamage = damage.value;
|
||||||
}
|
}
|
||||||
source.turnData.damageDealt += damage.value;
|
source.turnData.damageDealt += damage.value;
|
||||||
|
source.turnData.currDamageDealt = damage.value;
|
||||||
this.battleData.hitCount++;
|
this.battleData.hitCount++;
|
||||||
const attackResult = { move: move.id, result: result as DamageResult, damage: damage.value, critical: isCritical, sourceId: source.id };
|
const attackResult = { move: move.id, result: result as DamageResult, damage: damage.value, critical: isCritical, sourceId: source.id };
|
||||||
this.turnData.attacksReceived.unshift(attackResult);
|
this.turnData.attacksReceived.unshift(attackResult);
|
||||||
@ -3381,6 +3382,7 @@ export class PokemonTurnData {
|
|||||||
public hitCount: integer;
|
public hitCount: integer;
|
||||||
public hitsLeft: integer;
|
public hitsLeft: integer;
|
||||||
public damageDealt: integer = 0;
|
public damageDealt: integer = 0;
|
||||||
|
public currDamageDealt: integer = 0;
|
||||||
public damageTaken: integer = 0;
|
public damageTaken: integer = 0;
|
||||||
public attacksReceived: AttackMoveResult[] = [];
|
public attacksReceived: AttackMoveResult[] = [];
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user