pokerogue/src/data/custom-pokemon-data.ts
geeilhan f3256ec5d4
[Move] Improve implementation of Rage Fist damage increase (#5129)
* implementation of rage fist

* Apply suggestions from code review

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>

* Update src/test/moves/rage_fist.test.ts

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>

* added removed TODO from some test cases

* Apply suggestions from code review

Added changes to documentation and cleaning up code

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>

* added protected to updateHitReceivedCount()

---------

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
Co-authored-by: damocleas <damocleas25@gmail.com>
2025-01-19 11:52:50 -06:00

37 lines
1.2 KiB
TypeScript

import type { Abilities } from "#enums/abilities";
import type { Type } from "#enums/type";
import { isNullOrUndefined } from "#app/utils";
import type { Nature } from "#enums/nature";
/**
* Data that can customize a Pokemon in non-standard ways from its Species
* Used by Mystery Encounters and Mints
* Also used as a counter how often a Pokemon got hit until new arena encounter
*/
export class CustomPokemonData {
public spriteScale: number;
public ability: Abilities | -1;
public passive: Abilities | -1;
public nature: Nature | -1;
public types: Type[];
/** `hitsReceivedCount` aka `hitsRecCount` saves how often the pokemon got hit until a new arena encounter (used for Rage Fist) */
public hitsRecCount: number;
constructor(data?: CustomPokemonData | Partial<CustomPokemonData>) {
if (!isNullOrUndefined(data)) {
Object.assign(this, data);
}
this.spriteScale = this.spriteScale ?? -1;
this.ability = this.ability ?? -1;
this.passive = this.passive ?? -1;
this.nature = this.nature ?? -1;
this.types = this.types ?? [];
this.hitsRecCount = this.hitsRecCount ?? 0;
}
resetHitReceivedCount(): void {
this.hitsRecCount = 0;
}
}