mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-02 13:42:19 +02:00
Fixed things
This commit is contained in:
parent
218fd487e8
commit
1f418c9d90
@ -1823,7 +1823,7 @@ export default class BattleScene extends SceneBase {
|
||||
this.currentBattle.battleScore += Math.ceil(scoreIncrease);
|
||||
}
|
||||
|
||||
getMaxExpLevel(ignoreLevelCap?: boolean): integer {
|
||||
getMaxExpLevel(ignoreLevelCap: boolean = false): integer {
|
||||
if (Overrides.LEVEL_CAP_OVERRIDE > 0) {
|
||||
return Overrides.LEVEL_CAP_OVERRIDE;
|
||||
} else if (ignoreLevelCap || Overrides.LEVEL_CAP_OVERRIDE < 0) {
|
||||
|
@ -2383,7 +2383,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
* @param exp The amount of experience to add
|
||||
* @param ignoreLevelCap Whether to ignore level caps when adding experience (defaults to false)
|
||||
*/
|
||||
addExp(exp: integer, ignoreLevelCap?: boolean) {
|
||||
addExp(exp: integer, ignoreLevelCap: boolean = false) {
|
||||
const maxExpLevel = this.scene.getMaxExpLevel(ignoreLevelCap);
|
||||
const initialExp = this.exp;
|
||||
this.exp += exp;
|
||||
|
@ -42,12 +42,12 @@ describe("Learn Move Phase", () => {
|
||||
});
|
||||
|
||||
it("If a pokemon has 4 move slots filled, the chosen move will be deleted and replaced", async () => {
|
||||
await game.classicMode.startBattle([ Species.GALAR_MR_MIME ]); // many level up moves
|
||||
const mrMime = game.scene.getPlayerPokemon()!;
|
||||
await game.classicMode.startBattle([ Species.BULBASAUR ]);
|
||||
const bulbasaur = game.scene.getPlayerPokemon()!;
|
||||
const prevMoveset = [ Moves.SPLASH, Moves.ABSORB, Moves.ACID, Moves.VINE_WHIP ];
|
||||
const moveSlotNum = 3;
|
||||
|
||||
game.move.changeMoveset(mrMime, prevMoveset);
|
||||
game.move.changeMoveset(bulbasaur, prevMoveset);
|
||||
game.move.select(Moves.SPLASH);
|
||||
await game.doKillOpponents();
|
||||
|
||||
@ -63,23 +63,23 @@ describe("Learn Move Phase", () => {
|
||||
});
|
||||
await game.phaseInterceptor.to(LearnMovePhase);
|
||||
|
||||
const levelMove = mrMime.getLevelMoves(5)[0];
|
||||
const levelMove = bulbasaur.getLevelMoves(5)[0];
|
||||
const levelReq = levelMove[0];
|
||||
const levelMoveId = levelMove[1];
|
||||
expect(mrMime.level).toBeGreaterThanOrEqual(levelReq);
|
||||
expect(bulbasaur.level).toBeGreaterThanOrEqual(levelReq);
|
||||
// Check each of mr mime's moveslots to make sure the changed move (and ONLY the changed move) is different
|
||||
mrMime.getMoveset().forEach((move, index) => {
|
||||
bulbasaur.getMoveset().forEach((move, index) => {
|
||||
const expectedMove: Moves = (index === moveSlotNum ? levelMoveId : prevMoveset[index]);
|
||||
expect(move?.moveId).toBe(expectedMove);
|
||||
});
|
||||
});
|
||||
|
||||
it("selecting the newly deleted move will reject it and keep old moveset", async () => {
|
||||
await game.classicMode.startBattle([ Species.GALAR_MR_MIME ]); // many level up moves
|
||||
const mrMime = game.scene.getPlayerPokemon()!;
|
||||
await game.classicMode.startBattle([ Species.BULBASAUR ]);
|
||||
const bulbasaur = game.scene.getPlayerPokemon()!;
|
||||
const prevMoveset = [ Moves.SPLASH, Moves.ABSORB, Moves.ACID, Moves.VINE_WHIP ];
|
||||
|
||||
game.move.changeMoveset(mrMime, [ Moves.SPLASH, Moves.ABSORB, Moves.ACID, Moves.VINE_WHIP ]);
|
||||
game.move.changeMoveset(bulbasaur, [ Moves.SPLASH, Moves.ABSORB, Moves.ACID, Moves.VINE_WHIP ]);
|
||||
game.move.select(Moves.SPLASH);
|
||||
await game.doKillOpponents();
|
||||
|
||||
@ -98,38 +98,52 @@ describe("Learn Move Phase", () => {
|
||||
});
|
||||
await game.phaseInterceptor.to(LearnMovePhase);
|
||||
|
||||
const levelReq = mrMime.getLevelMoves(5)[0][0];
|
||||
expect(mrMime.level).toBeGreaterThanOrEqual(levelReq);
|
||||
expect(mrMime.getMoveset()).toEqual(prevMoveset);
|
||||
const levelReq = bulbasaur.getLevelMoves(5)[0][0];
|
||||
expect(bulbasaur.level).toBeGreaterThanOrEqual(levelReq);
|
||||
expect(bulbasaur.getMoveset().map(m => m?.moveId)).toEqual(prevMoveset);
|
||||
});
|
||||
|
||||
it("macro should add moves in free slots normally", async () => {
|
||||
await game.classicMode.startBattle([ Species.GALAR_MR_MIME ]);
|
||||
const mrMime = game.scene.getPlayerPokemon()!;
|
||||
await game.classicMode.startBattle([ Species.BULBASAUR ]);
|
||||
const bulbasaur = game.scene.getPlayerPokemon()!;
|
||||
|
||||
game.move.changeMoveset(mrMime, [ Moves.SPLASH, Moves.ABSORB, Moves.ACID ]);
|
||||
game.move.changeMoveset(bulbasaur, [ Moves.SPLASH, Moves.ABSORB, Moves.ACID ]);
|
||||
game.move.select(Moves.SPLASH);
|
||||
await game.move.learnMove(Moves.SACRED_FIRE, 0, 1);
|
||||
expect(mrMime.getMoveset()).toEqual([ Moves.SPLASH, Moves.ABSORB, Moves.ACID, Moves.SACRED_FIRE ]);
|
||||
expect(bulbasaur.getMoveset().map(m => m?.moveId)).toEqual([ Moves.SPLASH, Moves.ABSORB, Moves.ACID, Moves.SACRED_FIRE ]);
|
||||
|
||||
});
|
||||
|
||||
it("macro should replace moves", async () => {
|
||||
await game.classicMode.startBattle([ Species.GALAR_MR_MIME ]);
|
||||
const mrMime = game.scene.getPlayerPokemon()!;
|
||||
await game.classicMode.startBattle([ Species.BULBASAUR ]);
|
||||
const bulbasaur = game.scene.getPlayerPokemon()!;
|
||||
|
||||
game.move.changeMoveset(mrMime, [ Moves.SPLASH, Moves.ABSORB, Moves.ACID, Moves.VINE_WHIP ]);
|
||||
await game.move.learnMove(Moves.SACRED_FIRE, 0, 3);
|
||||
expect(mrMime.getMoveset()).toEqual([ Moves.SPLASH, Moves.ABSORB, Moves.SACRED_FIRE, Moves.VINE_WHIP ]);
|
||||
game.move.changeMoveset(bulbasaur, [ Moves.SPLASH, Moves.ABSORB, Moves.ACID, Moves.VINE_WHIP ]);
|
||||
game.move.select(Moves.SPLASH);
|
||||
await game.move.learnMove(Moves.SACRED_FIRE, 0, 1);
|
||||
expect(bulbasaur.getMoveset().map(m => m?.moveId)).toEqual([ Moves.SPLASH, Moves.SACRED_FIRE, Moves.ACID, Moves.VINE_WHIP ]);
|
||||
|
||||
});
|
||||
|
||||
it("macro should cancel move learning", async () => {
|
||||
await game.classicMode.startBattle([ Species.GALAR_MR_MIME ]);
|
||||
const mrMime = game.scene.getPlayerPokemon()!;
|
||||
it("macro should allow for cancelling move learning", async () => {
|
||||
await game.classicMode.startBattle([ Species.BULBASAUR ]);
|
||||
const bulbasaur = game.scene.getPlayerPokemon()!;
|
||||
|
||||
game.move.changeMoveset(mrMime, [ Moves.SPLASH, Moves.ABSORB, Moves.ACID, Moves.VINE_WHIP ]);
|
||||
game.move.changeMoveset(bulbasaur, [ Moves.SPLASH, Moves.ABSORB, Moves.ACID, Moves.VINE_WHIP ]);
|
||||
game.move.select(Moves.SPLASH);
|
||||
await game.move.learnMove(Moves.SACRED_FIRE, 0, 4);
|
||||
expect(mrMime.getMoveset()).toEqual([ Moves.SPLASH, Moves.ABSORB, Moves.ACID, Moves.VINE_WHIP ]);
|
||||
expect(bulbasaur.getMoveset().map(m => m?.moveId)).toEqual([ Moves.SPLASH, Moves.ABSORB, Moves.ACID, Moves.VINE_WHIP ]);
|
||||
|
||||
});
|
||||
|
||||
it("macro works on off-field party members", async () => {
|
||||
await game.classicMode.startBattle([ Species.BULBASAUR, Species.SQUIRTLE ]);
|
||||
const squirtle = game.scene.getPlayerParty()[1]!;
|
||||
|
||||
game.move.changeMoveset(squirtle, [ Moves.SPLASH, Moves.WATER_GUN, Moves.FREEZE_DRY, Moves.GROWL ]);
|
||||
game.move.select(Moves.TACKLE);
|
||||
await game.move.learnMove(Moves.SHELL_SMASH, 1, 0);
|
||||
expect(squirtle.getMoveset().map(m => m?.moveId)).toEqual([ Moves.SHELL_SMASH, Moves.WATER_GUN, Moves.FREEZE_DRY, Moves.GROWL ]);
|
||||
|
||||
});
|
||||
|
||||
|
@ -98,30 +98,27 @@ export class MoveHelper extends GameManagerHelper {
|
||||
* Simulates learning a move for a player pokemon.
|
||||
* @param move The {@linkcode Moves} being learnt
|
||||
* @param partyIndex The party position of the {@linkcode PlayerPokemon} learning the move (defaults to 0)
|
||||
* @param slot The move slot index (0-4) to replace if existent move slots are full;
|
||||
* @param moveSlotIndex The INDEX (0-4) of the move slot to replace if existent move slots are full;
|
||||
* defaults to 0 (first slot) and 4 aborts the procedure
|
||||
* @returns a promise that resolves once the move has been successfully learnt
|
||||
*/
|
||||
public async learnMove(move: Moves, partyIndex?: number, slot?: integer) {
|
||||
public async learnMove(move: Moves | integer, partyIndex: integer = 0, moveSlotIndex: integer = 0) {
|
||||
return new Promise<void>(async (resolve, reject) => {
|
||||
if (partyIndex === undefined || partyIndex >= this.game.scene.getPlayerParty().length) {
|
||||
partyIndex = 0;
|
||||
}
|
||||
this.game.scene.pushPhase(new LearnMovePhase(this.game.scene, partyIndex, move));
|
||||
|
||||
// if slots are full, queue up inputs to replace existing moves
|
||||
if (this.game.scene.getPlayerParty()[partyIndex].moveset.filter(m => m).length === 4) {
|
||||
this.game.onNextPrompt("LearnMovePhase", Mode.CONFIRM, () => {
|
||||
this.game.scene.ui.processInput(Button.ACTION);
|
||||
this.game.scene.ui.processInput(Button.ACTION); // "Should a move be forgotten and replaced with XXX?"
|
||||
});
|
||||
this.game.onNextPrompt("LearnMovePhase", Mode.SUMMARY, () => {
|
||||
for (let x = 0; x < (slot ?? 0); x++) {
|
||||
this.game.scene.ui.processInput(Button.DOWN);
|
||||
for (let x = 0; x < (moveSlotIndex ?? 0); x++) {
|
||||
this.game.scene.ui.processInput(Button.DOWN); // Scrolling in summary pane to move position
|
||||
}
|
||||
this.game.scene.ui.processInput(Button.ACTION);
|
||||
if (slot === 4) { // hit confirm 1 last time to give up on learning move
|
||||
if (moveSlotIndex === 4) {
|
||||
this.game.onNextPrompt("LearnMovePhase", Mode.CONFIRM, () => {
|
||||
this.game.scene.ui.processInput(Button.ACTION);
|
||||
this.game.scene.ui.processInput(Button.ACTION); // "Give up on learning XXX?"
|
||||
});
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user