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