mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-02-23 04:27:55 +00:00
* Implement Substitute Squashed commit from working branch * Fix integration test imports * Use Override Helper utils + Fix Baton Pass test * Update src/test/moves/substitute.test.ts Co-authored-by: Adrian T. <68144167+torranx@users.noreply.github.com> * Fix test imports + nits * Document RemoveAllSubstitutesAttr * Fix some strict-null issues * more strict-null fixes * Fix baton pass test * Reorganized Substitute translation keys * Added checks for substitute in contact logic * Clean up Unseen Fist contact logic * Remove misleading comment in Download attr * RIP phases.ts * Fix imports post-phase migration * Rewrite `move.canIgnoreSubstitute` to `move.hitsSubstitute` * Also fixed interactions with Shell Trap and Beak Blast * Removed some leftover `canIgnoreSubstitute`s * fix issues after beta merge * Status move effectiveness now accounts for substitute * More edge case tests (Counter test failing) * Fix Counter + Trap edge cases + add Fail messagesd * Fix leftover nit * Resolve leftover test issues * Fix Sub offset carrying over to Trainer fights * Hide substitute sprite during catch attempts * Make substitutes baton-passable again * Remove placeholder locale keys and SPLASH_ONLY * Fix imports and other nits Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * ESLint * Fix imports * Fix incorrect `resetSprite` timing * Fix substitute disappearing on hit (maybe?) * More animation fixes (mostly for Roar) --------- Co-authored-by: Adrian T. <68144167+torranx@users.noreply.github.com> Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com> Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
47 lines
1.6 KiB
TypeScript
47 lines
1.6 KiB
TypeScript
import BattleScene from "#app/battle-scene";
|
|
import { initMoveAnim, loadMoveAnimAssets, MoveAnim } from "#app/data/battle-anims";
|
|
import { allMoves, SelfStatusMove } from "#app/data/move";
|
|
import { Moves } from "#app/enums/moves";
|
|
import * as Utils from "#app/utils";
|
|
import { BattlePhase } from "./battle-phase";
|
|
|
|
export class MoveAnimTestPhase extends BattlePhase {
|
|
private moveQueue: Moves[];
|
|
|
|
constructor(scene: BattleScene, moveQueue?: Moves[]) {
|
|
super(scene);
|
|
|
|
this.moveQueue = moveQueue || Utils.getEnumValues(Moves).slice(1);
|
|
}
|
|
|
|
start() {
|
|
const moveQueue = this.moveQueue.slice(0);
|
|
this.playMoveAnim(moveQueue, true);
|
|
}
|
|
|
|
playMoveAnim(moveQueue: Moves[], player: boolean) {
|
|
const moveId = player ? moveQueue[0] : moveQueue.shift();
|
|
if (moveId === undefined) {
|
|
this.playMoveAnim(this.moveQueue.slice(0), true);
|
|
return;
|
|
} else if (player) {
|
|
console.log(Moves[moveId]);
|
|
}
|
|
|
|
initMoveAnim(this.scene, moveId).then(() => {
|
|
loadMoveAnimAssets(this.scene, [moveId], true)
|
|
.then(() => {
|
|
const user = player ? this.scene.getPlayerPokemon()! : this.scene.getEnemyPokemon()!;
|
|
const target = (player !== (allMoves[moveId] instanceof SelfStatusMove)) ? this.scene.getEnemyPokemon()! : this.scene.getPlayerPokemon()!;
|
|
new MoveAnim(moveId, user, target.getBattlerIndex()).play(this.scene, allMoves[moveId].hitsSubstitute(user, target), () => { // TODO: are the bangs correct here?
|
|
if (player) {
|
|
this.playMoveAnim(moveQueue, false);
|
|
} else {
|
|
this.playMoveAnim(moveQueue, true);
|
|
}
|
|
});
|
|
});
|
|
});
|
|
}
|
|
}
|