mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-23 16:52:24 +02:00
Test fixes
This commit is contained in:
parent
23ca531534
commit
837d81e1b0
@ -1415,17 +1415,11 @@ export default class BattleScene extends SceneBase {
|
||||
}
|
||||
|
||||
updateFieldScale(): Promise<void> {
|
||||
return new Promise((resolve) => {
|
||||
const fieldScale =
|
||||
Math.floor(
|
||||
Math.pow(
|
||||
1 /
|
||||
this.getField(true)
|
||||
.map((p) => p.getSpriteScale())
|
||||
.reduce((highestScale: number, scale: number) => (highestScale = Math.max(scale, highestScale)), 0),
|
||||
0.7,
|
||||
) * 40,
|
||||
) / 40;
|
||||
return new Promise(resolve => {
|
||||
const fieldScale = Math.floor(Math.pow(1 / this.getField(true)
|
||||
.map(p => p.getSpriteScale())
|
||||
.reduce((highestScale: number, scale: number) => highestScale = Math.max(scale, highestScale), 0), 0.7) * 40
|
||||
) / 40;
|
||||
this.setFieldScale(fieldScale).then(() => resolve());
|
||||
});
|
||||
}
|
||||
|
@ -63,6 +63,7 @@ export class BattleEndPhase extends BattlePhase {
|
||||
}
|
||||
}
|
||||
|
||||
globalScene.updateModifiers().then(() => this.end());
|
||||
globalScene.updateModifiers();
|
||||
this.end();
|
||||
}
|
||||
}
|
||||
|
@ -44,10 +44,9 @@ export class MoveChargePhase extends PokemonPhase {
|
||||
new MoveChargeAnim(move.chargeAnim, move.id, user).play(false, () => {
|
||||
move.showChargeText(user, target);
|
||||
|
||||
applyMoveChargeAttrs(MoveEffectAttr, user, target, move).then(() => {
|
||||
user.addTag(BattlerTagType.CHARGING, 1, move.id, user.id);
|
||||
this.end();
|
||||
});
|
||||
applyMoveChargeAttrs(MoveEffectAttr, user, target, move);
|
||||
user.addTag(BattlerTagType.CHARGING, 1, move.id, user.id);
|
||||
this.end();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -22,9 +22,8 @@ export class MoveHeaderPhase extends BattlePhase {
|
||||
super.start();
|
||||
|
||||
if (this.canMove()) {
|
||||
applyMoveAttrs(MoveHeaderAttr, this.pokemon, null, this.move.getMove()).then(() => this.end());
|
||||
} else {
|
||||
this.end();
|
||||
applyMoveAttrs(MoveHeaderAttr, this.pokemon, null, this.move.getMove());
|
||||
}
|
||||
this.end();
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,10 @@ export class PokemonTransformPhase extends PokemonPhase {
|
||||
return this.end();
|
||||
}
|
||||
|
||||
user.summonData.speciesForm = target.getSpeciesForm();
|
||||
user.summonData.ability = target.getAbility().id;
|
||||
user.summonData.gender = target.getGender();
|
||||
|
||||
// Power Trick's effect is removed after using Transform
|
||||
user.removeTag(BattlerTagType.POWER_TRICK);
|
||||
|
||||
|
@ -391,7 +391,7 @@ describe("Abilities - Unburden", () => {
|
||||
await game.forceEnemyMove(Moves.THIEF, BattlerIndex.PLAYER);
|
||||
await game.forceEnemyMove(Moves.SPLASH);
|
||||
await game.setTurnOrder([ BattlerIndex.PLAYER, BattlerIndex.ENEMY, BattlerIndex.ENEMY_2, BattlerIndex.PLAYER_2 ]);
|
||||
game.doSelectPartyPokemon(0, "MoveEffectPhase");
|
||||
game.doSelectPartyPokemon(0, "RevivalBlessingPhase");
|
||||
await game.toNextTurn();
|
||||
|
||||
expect(game.scene.getPlayerField()[0]).toBe(treecko);
|
||||
|
@ -123,8 +123,6 @@ describe("Dancing Lessons - Mystery Encounter", () => {
|
||||
partyLead.level = 1000;
|
||||
partyLead.calculateStats();
|
||||
await runMysteryEncounterToEnd(game, 1, undefined, true);
|
||||
// For some reason updateModifiers breaks in this test and does not resolve promise
|
||||
vi.spyOn(game.scene, "updateModifiers").mockImplementation(() => new Promise(resolve => resolve()));
|
||||
await skipBattleRunMysteryEncounterRewardsPhase(game);
|
||||
await game.phaseInterceptor.to(SelectModifierPhase, false);
|
||||
expect(scene.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name);
|
||||
|
@ -60,6 +60,7 @@ import { RibbonModifierRewardPhase } from "#app/phases/ribbon-modifier-reward-ph
|
||||
import { GameOverModifierRewardPhase } from "#app/phases/game-over-modifier-reward-phase";
|
||||
import { UnlockPhase } from "#app/phases/unlock-phase";
|
||||
import { PostGameOverPhase } from "#app/phases/post-game-over-phase";
|
||||
import { RevivalBlessingPhase } from "#app/phases/revival-blessing-phase";
|
||||
|
||||
export interface PromptHandler {
|
||||
phaseTarget?: string;
|
||||
@ -126,7 +127,8 @@ type PhaseClass =
|
||||
| typeof EncounterPhase
|
||||
| typeof GameOverPhase
|
||||
| typeof UnlockPhase
|
||||
| typeof PostGameOverPhase;
|
||||
| typeof PostGameOverPhase
|
||||
| typeof RevivalBlessingPhase;
|
||||
|
||||
type PhaseString =
|
||||
| "LoginPhase"
|
||||
@ -185,7 +187,8 @@ type PhaseString =
|
||||
| "EncounterPhase"
|
||||
| "GameOverPhase"
|
||||
| "UnlockPhase"
|
||||
| "PostGameOverPhase";
|
||||
| "PostGameOverPhase"
|
||||
| "RevivalBlessingPhase";
|
||||
|
||||
type PhaseInterceptorPhase = PhaseClass | PhaseString;
|
||||
|
||||
@ -269,6 +272,7 @@ export default class PhaseInterceptor {
|
||||
[ GameOverPhase, this.startPhase ],
|
||||
[ UnlockPhase, this.startPhase ],
|
||||
[ PostGameOverPhase, this.startPhase ],
|
||||
[ RevivalBlessingPhase, this.startPhase ],
|
||||
];
|
||||
|
||||
private endBySetMode = [
|
||||
@ -511,11 +515,11 @@ export default class PhaseInterceptor {
|
||||
if (expireFn) {
|
||||
this.prompts.shift();
|
||||
} else if (
|
||||
currentMode === actionForNextPrompt.mode
|
||||
&& currentPhase === actionForNextPrompt.phaseTarget
|
||||
&& currentHandler.active
|
||||
&& (!actionForNextPrompt.awaitingActionInput
|
||||
|| (actionForNextPrompt.awaitingActionInput && currentHandler.awaitingActionInput))
|
||||
currentMode === actionForNextPrompt.mode &&
|
||||
currentPhase === actionForNextPrompt.phaseTarget &&
|
||||
currentHandler.active &&
|
||||
(!actionForNextPrompt.awaitingActionInput ||
|
||||
(actionForNextPrompt.awaitingActionInput && currentHandler.awaitingActionInput))
|
||||
) {
|
||||
const prompt = this.prompts.shift();
|
||||
if (prompt?.callback) {
|
||||
|
Loading…
Reference in New Issue
Block a user