mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-21 09:02:47 +02:00
[Move] Make Disable disable most recent move instead of oldest move (#5321)
This commit is contained in:
parent
5fa77b7177
commit
8864347cb0
@ -42,6 +42,7 @@ import { Species } from "#enums/species";
|
|||||||
import { EFFECTIVE_STATS, getStatKey, Stat, type BattleStat, type EffectiveStat } from "#enums/stat";
|
import { EFFECTIVE_STATS, getStatKey, Stat, type BattleStat, type EffectiveStat } from "#enums/stat";
|
||||||
import { StatusEffect } from "#enums/status-effect";
|
import { StatusEffect } from "#enums/status-effect";
|
||||||
import { WeatherType } from "#enums/weather-type";
|
import { WeatherType } from "#enums/weather-type";
|
||||||
|
import * as Utils from "../utils";
|
||||||
|
|
||||||
export enum BattlerTagLapseType {
|
export enum BattlerTagLapseType {
|
||||||
FAINT,
|
FAINT,
|
||||||
@ -274,9 +275,9 @@ export class DisabledTag extends MoveRestrictionBattlerTag {
|
|||||||
override onAdd(pokemon: Pokemon): void {
|
override onAdd(pokemon: Pokemon): void {
|
||||||
super.onAdd(pokemon);
|
super.onAdd(pokemon);
|
||||||
|
|
||||||
const move = pokemon.getLastXMoves()
|
const move = pokemon.getLastXMoves(-1)
|
||||||
.find(m => m.move !== Moves.NONE && m.move !== Moves.STRUGGLE && !m.virtual);
|
.find(m => !m.virtual);
|
||||||
if (move === undefined) {
|
if (Utils.isNullOrUndefined(move) || move.move === Moves.STRUGGLE || move.move === Moves.NONE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8506,7 +8506,10 @@ export function initMoves() {
|
|||||||
.attr(FixedDamageAttr, 20),
|
.attr(FixedDamageAttr, 20),
|
||||||
new StatusMove(Moves.DISABLE, Type.NORMAL, 100, 20, -1, 0, 1)
|
new StatusMove(Moves.DISABLE, Type.NORMAL, 100, 20, -1, 0, 1)
|
||||||
.attr(AddBattlerTagAttr, BattlerTagType.DISABLED, false, true)
|
.attr(AddBattlerTagAttr, BattlerTagType.DISABLED, false, true)
|
||||||
.condition((user, target, move) => target.getMoveHistory().reverse().find(m => m.move !== Moves.NONE && m.move !== Moves.STRUGGLE && !m.virtual) !== undefined)
|
.condition((user, target, move) => {
|
||||||
|
const lastRealMove = target.getLastXMoves(-1).find(m => !m.virtual);
|
||||||
|
return !Utils.isNullOrUndefined(lastRealMove) && lastRealMove.move !== Moves.NONE && lastRealMove.move !== Moves.STRUGGLE;
|
||||||
|
})
|
||||||
.ignoresSubstitute()
|
.ignoresSubstitute()
|
||||||
.reflectable(),
|
.reflectable(),
|
||||||
new AttackMove(Moves.ACID, Type.POISON, MoveCategory.SPECIAL, 40, 100, 30, 10, 0, 1)
|
new AttackMove(Moves.ACID, Type.POISON, MoveCategory.SPECIAL, 40, 100, 30, 10, 0, 1)
|
||||||
|
@ -123,6 +123,26 @@ describe("Moves - Disable", () => {
|
|||||||
await game.toNextTurn();
|
await game.toNextTurn();
|
||||||
|
|
||||||
expect(enemyMon.isMoveRestricted(Moves.NATURE_POWER)).toBe(true);
|
expect(enemyMon.isMoveRestricted(Moves.NATURE_POWER)).toBe(true);
|
||||||
expect(enemyMon.isMoveRestricted(enemyMon.getLastXMoves(2)[1].move)).toBe(false);
|
expect(enemyMon.isMoveRestricted(enemyMon.getLastXMoves(2)[0].move)).toBe(false);
|
||||||
|
}, 20000);
|
||||||
|
|
||||||
|
it("disables most recent move", async() => {
|
||||||
|
game.override.enemyMoveset([ Moves.SPLASH, Moves.TACKLE ]);
|
||||||
|
await game.classicMode.startBattle();
|
||||||
|
|
||||||
|
const enemyMon = game.scene.getEnemyPokemon()!;
|
||||||
|
|
||||||
|
game.move.select(Moves.SPLASH);
|
||||||
|
await game.forceEnemyMove(Moves.SPLASH, BattlerIndex.PLAYER);
|
||||||
|
await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER ]);
|
||||||
|
await game.toNextTurn();
|
||||||
|
|
||||||
|
game.move.select(Moves.DISABLE);
|
||||||
|
await game.forceEnemyMove(Moves.TACKLE, BattlerIndex.PLAYER);
|
||||||
|
await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER ]);
|
||||||
|
await game.toNextTurn();
|
||||||
|
|
||||||
|
expect(enemyMon.isMoveRestricted(Moves.TACKLE)).toBe(true);
|
||||||
|
expect(enemyMon.isMoveRestricted(Moves.SPLASH)).toBe(false);
|
||||||
}, 20000);
|
}, 20000);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user