Rename `PokemonTurnData`'s `damageDealt` and `currDamageDealt` (#4784)
This commit is contained in:
parent
f0ae36de6c
commit
5e2dfa975a
|
@ -4969,7 +4969,7 @@ class ForceSwitchOutHelper {
|
|||
function calculateShellBellRecovery(pokemon: Pokemon): number {
|
||||
const shellBellModifier = pokemon.getHeldItems().find(m => m instanceof HitHealModifier);
|
||||
if (shellBellModifier) {
|
||||
return Utils.toDmgValue(pokemon.turnData.damageDealt / 8) * shellBellModifier.stackCount;
|
||||
return Utils.toDmgValue(pokemon.turnData.totalDamageDealt / 8) * shellBellModifier.stackCount;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1474,8 +1474,8 @@ export class RecoilAttr extends MoveEffectAttr {
|
|||
return false;
|
||||
}
|
||||
|
||||
const damageValue = (!this.useHp ? user.turnData.damageDealt : user.getMaxHp()) * this.damageRatio;
|
||||
const minValue = user.turnData.damageDealt ? 1 : 0;
|
||||
const damageValue = (!this.useHp ? user.turnData.totalDamageDealt : user.getMaxHp()) * this.damageRatio;
|
||||
const minValue = user.turnData.totalDamageDealt ? 1 : 0;
|
||||
const recoilDamage = Utils.toDmgValue(damageValue, minValue);
|
||||
if (!recoilDamage) {
|
||||
return false;
|
||||
|
@ -2006,7 +2006,7 @@ export class HitHealAttr extends MoveEffectAttr {
|
|||
message = i18next.t("battle:drainMessage", { pokemonName: getPokemonNameWithAffix(target) });
|
||||
} else {
|
||||
// Default healing formula used by draining moves like Absorb, Draining Kiss, Bitter Blade, etc.
|
||||
healAmount = Utils.toDmgValue(user.turnData.currDamageDealt * this.healRatio);
|
||||
healAmount = Utils.toDmgValue(user.turnData.singleHitDamageDealt * this.healRatio);
|
||||
message = i18next.t("battle:regainHealth", { pokemonName: getPokemonNameWithAffix(user) });
|
||||
}
|
||||
if (reverseDrain) {
|
||||
|
|
|
@ -2827,8 +2827,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
this.scene.gameData.gameStats.highestDamage = damage;
|
||||
}
|
||||
}
|
||||
source.turnData.damageDealt += damage;
|
||||
source.turnData.currDamageDealt = damage;
|
||||
source.turnData.totalDamageDealt += damage;
|
||||
source.turnData.singleHitDamageDealt = damage;
|
||||
this.turnData.damageTaken += damage;
|
||||
this.battleData.hitCount++;
|
||||
|
||||
|
@ -5130,7 +5130,6 @@ export class PokemonSummonData {
|
|||
public tags: BattlerTag[] = [];
|
||||
public abilitySuppressed: boolean = false;
|
||||
public abilitiesApplied: Abilities[] = [];
|
||||
|
||||
public speciesForm: PokemonSpeciesForm | null;
|
||||
public fusionSpeciesForm: PokemonSpeciesForm;
|
||||
public ability: Abilities = Abilities.NONE;
|
||||
|
@ -5170,8 +5169,8 @@ export class PokemonTurnData {
|
|||
* - `0` = Move is finished
|
||||
*/
|
||||
public hitsLeft: number = -1;
|
||||
public damageDealt: number = 0;
|
||||
public currDamageDealt: number = 0;
|
||||
public totalDamageDealt: number = 0;
|
||||
public singleHitDamageDealt: number = 0;
|
||||
public damageTaken: number = 0;
|
||||
public attacksReceived: AttackMoveResult[] = [];
|
||||
public order: number;
|
||||
|
|
|
@ -1767,10 +1767,10 @@ export class HitHealModifier extends PokemonHeldItemModifier {
|
|||
* @returns `true` if the {@linkcode Pokemon} was healed
|
||||
*/
|
||||
override apply(pokemon: Pokemon): boolean {
|
||||
if (pokemon.turnData.damageDealt && !pokemon.isFullHp()) {
|
||||
if (pokemon.turnData.totalDamageDealt && !pokemon.isFullHp()) {
|
||||
const scene = pokemon.scene;
|
||||
scene.unshiftPhase(new PokemonHealPhase(scene, pokemon.getBattlerIndex(),
|
||||
toDmgValue(pokemon.turnData.damageDealt / 8) * this.stackCount, i18next.t("modifier:hitHealApply", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), typeName: this.type.name }), true));
|
||||
toDmgValue(pokemon.turnData.totalDamageDealt / 8) * this.stackCount, i18next.t("modifier:hitHealApply", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), typeName: this.type.name }), true));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -59,7 +59,7 @@ describe("Moves - Focus Punch", () => {
|
|||
|
||||
expect(enemyPokemon.hp).toBeLessThan(enemyStartingHp);
|
||||
expect(leadPokemon.getMoveHistory().length).toBe(1);
|
||||
expect(leadPokemon.turnData.damageDealt).toBe(enemyStartingHp - enemyPokemon.hp);
|
||||
expect(leadPokemon.turnData.totalDamageDealt).toBe(enemyStartingHp - enemyPokemon.hp);
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -86,7 +86,7 @@ describe("Moves - Focus Punch", () => {
|
|||
|
||||
expect(enemyPokemon.hp).toBe(enemyStartingHp);
|
||||
expect(leadPokemon.getMoveHistory().length).toBe(1);
|
||||
expect(leadPokemon.turnData.damageDealt).toBe(0);
|
||||
expect(leadPokemon.turnData.totalDamageDealt).toBe(0);
|
||||
}
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in New Issue