mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-19 22:09:27 +02:00
Suggested changes to getLastXMoves()
This commit is contained in:
parent
32f9f3ed74
commit
8581f9739f
@ -3223,13 +3223,13 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
/**
|
||||
* Returns a list of the most recent move entries in this Pokemon's move history.
|
||||
* The retrieved move entries are sorted in order from NEWEST to OLDEST.
|
||||
* @param turnCount The number of move entries to retrieve. If `0`, retrieve exactly 1 move entry. If negative, retrieve the Pokemon's entire move history. Default is `1`.
|
||||
* @param turnCount The number of move entries to retrieve. If negative, retrieve the Pokemon's entire move history. Default is `1`.
|
||||
* @returns A list of {@linkcode TurnMove}, as specified above.
|
||||
*/
|
||||
getLastXMoves(turnCount: integer = 1): TurnMove[] {
|
||||
getLastXMoves(turnCount: number = 1): TurnMove[] {
|
||||
const moveHistory = this.getMoveHistory();
|
||||
if (turnCount >= 0) {
|
||||
return moveHistory.slice(Math.max(moveHistory.length - (turnCount || 1), 0)).reverse();
|
||||
return moveHistory.slice(Math.max(moveHistory.length - turnCount, 0)).reverse();
|
||||
} else {
|
||||
return moveHistory.slice(0).reverse();
|
||||
}
|
||||
|
@ -728,10 +728,10 @@ export abstract class PokemonHeldItemModifier extends PersistentModifier {
|
||||
//Applies to items with chance of activating secondary effects ie Kings Rock
|
||||
getSecondaryChanceMultiplier(pokemon: Pokemon): number {
|
||||
// Temporary quickfix to stop game from freezing when the opponet uses u-turn while holding on to king's rock
|
||||
if (!pokemon.getLastXMoves(0)[0]) {
|
||||
if (!pokemon.getLastXMoves()[0]) {
|
||||
return 1;
|
||||
}
|
||||
const sheerForceAffected = allMoves[pokemon.getLastXMoves(0)[0].move].chance >= 0 && pokemon.hasAbility(Abilities.SHEER_FORCE);
|
||||
const sheerForceAffected = allMoves[pokemon.getLastXMoves()[0].move].chance >= 0 && pokemon.hasAbility(Abilities.SHEER_FORCE);
|
||||
|
||||
if (sheerForceAffected) {
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user