mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-01 05:52:17 +02:00
Fixed remaining tests (I think)
This commit is contained in:
parent
93418b2ac5
commit
4523a51b8a
@ -1068,7 +1068,7 @@ export class PostDefendMoveDisableAbAttr extends PostDefendAbAttr {
|
||||
}
|
||||
|
||||
override canApplyPostDefend(pokemon: Pokemon, passive: boolean, simulated: boolean, attacker: Pokemon, move: Move, hitResult: HitResult | null, args: any[]): boolean {
|
||||
return !isNullOrUndefined(attacker.getTag(BattlerTagType.DISABLED))
|
||||
return isNullOrUndefined(attacker.getTag(BattlerTagType.DISABLED))
|
||||
&& move.doesFlagEffectApply({flag: MoveFlags.MAKES_CONTACT, user: attacker, target: pokemon}) && (this.chance === -1 || pokemon.randSeedInt(100) < this.chance);
|
||||
}
|
||||
|
||||
|
@ -892,8 +892,11 @@ export class DelayedAttackTag extends ArenaTag {
|
||||
const ret = super.lapse(arena);
|
||||
|
||||
if (!ret) {
|
||||
// TODO: When does Future Sight add to move history: on the turn it's used or actually hits?
|
||||
// We currently only add the entry on the turn of the _attack_ and always make it a follow up
|
||||
// (meaning it's never targetable by Spite)
|
||||
globalScene.unshiftPhase(
|
||||
new MoveEffectPhase(this.sourceId!, [this.targetIndex], allMoves[this.sourceMove!], MoveUseType.REFLECTED), // Reflected ensures this doesn't check status, use PP or be copied
|
||||
new MoveEffectPhase(this.sourceId!, [this.targetIndex], allMoves[this.sourceMove!], MoveUseType.FOLLOW_UP),
|
||||
); // TODO: are those bangs correct?
|
||||
}
|
||||
|
||||
|
@ -385,9 +385,10 @@ export class GorillaTacticsTag extends MoveRestrictionBattlerTag {
|
||||
override canAdd(pokemon: Pokemon): boolean {
|
||||
// Choice items ignore struggle
|
||||
// TODO: Check if struggle also gets the 50% power boost
|
||||
const lastSelectedMove = pokemon.getLastNonVirtualMove(false);
|
||||
const lastSelectedMove = pokemon.getLastNonVirtualMove();
|
||||
return (
|
||||
(isNullOrUndefined(lastSelectedMove) || lastSelectedMove.move === Moves.STRUGGLE) &&
|
||||
!isNullOrUndefined(lastSelectedMove) &&
|
||||
lastSelectedMove.move !== Moves.STRUGGLE &&
|
||||
!pokemon.getTag(GorillaTacticsTag)
|
||||
);
|
||||
}
|
||||
@ -398,7 +399,7 @@ export class GorillaTacticsTag extends MoveRestrictionBattlerTag {
|
||||
*/
|
||||
override onAdd(pokemon: Pokemon): void {
|
||||
super.onAdd(pokemon);
|
||||
this.moveId = pokemon.getLastNonVirtualMove(false)!.move; // `canAdd` returns false if no move
|
||||
this.moveId = pokemon.getLastNonVirtualMove()!.move; // `canAdd` returns false if no move
|
||||
pokemon.setStat(Stat.ATK, pokemon.getStat(Stat.ATK, false) * 1.5, false);
|
||||
}
|
||||
|
||||
|
@ -5423,13 +5423,11 @@ export class FrenzyAttr extends MoveEffectAttr {
|
||||
// Otherwise, tick down the existing tag.
|
||||
if (!user.getTag(BattlerTagType.FRENZY) && user.getMoveQueue().length === 0) {
|
||||
const turnCount = user.randSeedIntRange(1, 2);
|
||||
for (let x = 0; x < turnCount; x++) {
|
||||
user.pushMoveQueue({move: move.id, targets: [target.getBattlerIndex()], useType: MoveUseType.IGNORE_PP})
|
||||
}
|
||||
new Array(turnCount).fill(null).map(() => user.getMoveQueue().push({ move: move.id, targets: [ target.getBattlerIndex() ], useType: MoveUseType.IGNORE_PP }));
|
||||
user.addTag(BattlerTagType.FRENZY, turnCount, move.id, user.id);
|
||||
} else {
|
||||
applyMoveAttrs(AddBattlerTagAttr, user, target, move, args);
|
||||
user.lapseTag(BattlerTagType.FRENZY);
|
||||
user.lapseTag(BattlerTagType.FRENZY); // if FRENZY is already in effect (moveQueue.length > 0), lapse the tag
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -51,9 +51,6 @@ export enum MoveUseType {
|
||||
* Reflected moves ignore all the same cancellation checks as {@linkcode MoveUseType.INDIRECT}
|
||||
* and retain the same copy prevention as {@linkcode MoveUseType.FOLLOW_UP}, but additionally
|
||||
* **cannot be reflected by other reflecting effects**.
|
||||
|
||||
* Also used for the "attack" portion of Future Sight and Doom Desire
|
||||
* (in which case the reflection blockage is completely irrelevant.)
|
||||
*/
|
||||
REFLECTED
|
||||
}
|
||||
|
@ -4,7 +4,11 @@ import type Pokemon from "#app/field/pokemon";
|
||||
import { FieldPhase } from "./field-phase";
|
||||
|
||||
export abstract class PokemonPhase extends FieldPhase {
|
||||
protected battlerIndex: BattlerIndex;
|
||||
/**
|
||||
* The battler index this phase refers to, or the pokemon ID if greater than 3.
|
||||
* TODO: Make this either use IDs or `BattlerIndex`es, not a weird mix of both
|
||||
*/
|
||||
protected battlerIndex: BattlerIndex | number;
|
||||
public player: boolean;
|
||||
public fieldIndex: number;
|
||||
|
||||
|
@ -62,7 +62,10 @@ describe("Moves - After You", () => {
|
||||
expect(game.scene.getPlayerField()[1].getLastXMoves(1)[0].result).toBe(MoveResult.FAIL);
|
||||
});
|
||||
|
||||
it("should maintain PP ignore status of rampaging moves", async () => {
|
||||
// TODO: Enable once rampaging moves and move queue are fixed.
|
||||
// Currently does literally nothing because `MoveUseType` is overridden from move queue
|
||||
// within `MovePhase`, but should be enabled once that jank is removed
|
||||
it.todo("should maintain PP ignore status of rampaging moves", async () => {
|
||||
game.override.moveset([]);
|
||||
await game.classicMode.startBattle([Species.ACCELGOR, Species.RATTATA]);
|
||||
|
||||
|
@ -132,7 +132,7 @@ describe("Moves - Disable", () => {
|
||||
game.override.enemyMoveset(moveId);
|
||||
await game.classicMode.startBattle([Species.PIKACHU]);
|
||||
|
||||
const playerMon = game.scene.getEnemyPokemon()!;
|
||||
const playerMon = game.scene.getPlayerPokemon()!;
|
||||
playerMon.pushMoveHistory({ move: Moves.SPLASH, targets: [BattlerIndex.ENEMY], useType: MoveUseType.NORMAL });
|
||||
game.scene.currentBattle.lastMove = Moves.SPLASH;
|
||||
|
||||
@ -141,8 +141,8 @@ describe("Moves - Disable", () => {
|
||||
await game.toNextTurn();
|
||||
|
||||
const enemyMon = game.scene.getEnemyPokemon()!;
|
||||
expect.soft(enemyMon.isMoveRestricted(moveId), `calling move ${Moves[moveId]} was not disabled`).toBe(true);
|
||||
expect.soft(enemyMon.getLastXMoves(-1)).toHaveLength(2);
|
||||
expect(enemyMon.isMoveRestricted(moveId), `calling move ${Moves[moveId]} was not disabled`).toBe(true);
|
||||
expect(enemyMon.getLastXMoves(-1)).toHaveLength(2);
|
||||
const calledMove = enemyMon.getLastXMoves()[0].move;
|
||||
expect(
|
||||
enemyMon.isMoveRestricted(calledMove),
|
||||
|
@ -59,7 +59,10 @@ describe("Moves - Quash", () => {
|
||||
expect(game.scene.getPlayerField()[1].getLastXMoves(1)[0].result).toBe(MoveResult.FAIL);
|
||||
});
|
||||
|
||||
it("should maintain PP ignore status of rampaging moves", async () => {
|
||||
// TODO: Enable once rampaging moves and move queue are fixed.
|
||||
// Currently does literally nothing because `MoveUseType` is overridden from move queue
|
||||
// within `MovePhase`, but should be enabled once that jank is removed
|
||||
it.todo("should maintain PP ignore status of rampaging moves", async () => {
|
||||
game.override.moveset([]);
|
||||
await game.classicMode.startBattle([Species.ACCELGOR, Species.RATTATA]);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user