Fix unit tests
This commit is contained in:
parent
bdd0850e6f
commit
17e5ef789d
|
@ -2207,12 +2207,12 @@ export class TarShotTag extends BattlerTag {
|
|||
*/
|
||||
export class AutotomizedTag extends BattlerTag {
|
||||
public autotomizeCount: number = 0;
|
||||
constructor(sourceMove: Moves = Moves.NONE) {
|
||||
constructor(sourceMove: Moves = Moves.AUTOTOMIZE) {
|
||||
super(BattlerTagType.AUTOTOMIZED, BattlerTagLapseType.CUSTOM, 1, sourceMove);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an autotmize count to the Pokemon. Each stack reduces weight by 100kg
|
||||
* Adds an autotomize count to the Pokemon. Each stack reduces weight by 100kg
|
||||
* If the Pokemon is over 0.1kg it also displays a message.
|
||||
* @param pokemon The Pokemon that is being autotomized
|
||||
*/
|
||||
|
|
|
@ -1401,7 +1401,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
getWeight(): number {
|
||||
const autotomizedTag = this.getTag(AutotomizedTag);
|
||||
let weightRemoved = 0;
|
||||
if (autotomizedTag !== null && autotomizedTag !== undefined) {
|
||||
if (!Utils.isNullOrUndefined(autotomizedTag)) {
|
||||
weightRemoved = 100 * autotomizedTag.autotomizeCount;
|
||||
}
|
||||
const minWeight = 0.1;
|
||||
|
|
|
@ -39,17 +39,16 @@ describe("Moves - Autotomize", () => {
|
|||
const playerPokemon = game.scene.getPlayerPokemon()!;
|
||||
expect(playerPokemon.getWeight()).toBe(baseDracozoltWeight);
|
||||
game.move.select(Moves.AUTOTOMIZE);
|
||||
// expect a queued message here
|
||||
await game.toNextTurn();
|
||||
expect(playerPokemon.getWeight()).toBe(oneAutotomizeDracozoltWeight);
|
||||
await game.toNextTurn();
|
||||
|
||||
game.move.select(Moves.AUTOTOMIZE);
|
||||
//expect a queued message here
|
||||
await game.toNextTurn();
|
||||
expect(playerPokemon.getWeight()).toBe(twoAutotomizeDracozoltWeight);
|
||||
await game.toNextTurn();
|
||||
|
||||
|
||||
game.move.select(Moves.AUTOTOMIZE);
|
||||
// expect no queued message here
|
||||
await game.toNextTurn();
|
||||
expect(playerPokemon.getWeight()).toBe(threeAutotomizeDracozoltWeight);
|
||||
}, TIMEOUT);
|
||||
|
||||
|
@ -62,21 +61,38 @@ describe("Moves - Autotomize", () => {
|
|||
|
||||
expect(playerPokemon.getWeight()).toBe(baseAegislashWeight);
|
||||
game.move.select(Moves.AUTOTOMIZE);
|
||||
await game.toNextTurn();
|
||||
expect(playerPokemon.getWeight()).toBe(autotomizeAegislashWeight);
|
||||
game.move.select(Moves.FALSE_SWIPE);
|
||||
await game.toNextTurn();
|
||||
|
||||
game.move.select(Moves.KINGS_SHIELD);
|
||||
expect(playerPokemon.getWeight()).toBe(baseAegislashWeight);
|
||||
await game.toNextTurn();
|
||||
expect(playerPokemon.getWeight()).toBe(baseAegislashWeight);
|
||||
|
||||
|
||||
game.move.select(Moves.AUTOTOMIZE);
|
||||
await game.toNextTurn();
|
||||
expect(playerPokemon.getWeight()).toBe(autotomizeAegislashWeight);
|
||||
|
||||
game.move.select(Moves.FALSE_SWIPE);
|
||||
expect(playerPokemon.getWeight()).toBe(baseAegislashWeight);
|
||||
await game.toNextTurn();
|
||||
expect(playerPokemon.getWeight()).toBe(baseAegislashWeight);
|
||||
|
||||
game.move.select(Moves.AUTOTOMIZE);
|
||||
await game.toNextTurn();
|
||||
expect(playerPokemon.getWeight()).toBe(autotomizeAegislashWeight);
|
||||
}, TIMEOUT);
|
||||
|
||||
it("Autotomize should interact with light metal correctly", async () => {
|
||||
const baseLightGroudonWeight = 475;
|
||||
const autotomizeLightGroudonWeight = 425;
|
||||
game.override.ability(Abilities.LIGHT_METAL);
|
||||
await game.classicMode.startBattle([Species.GROUDON]);
|
||||
const playerPokemon = game.scene.getPlayerPokemon()!;
|
||||
expect(playerPokemon.getWeight()).toBe(baseLightGroudonWeight);
|
||||
game.move.select(Moves.AUTOTOMIZE);
|
||||
await game.toNextTurn();
|
||||
expect(playerPokemon.getWeight()).toBe(autotomizeLightGroudonWeight);
|
||||
}, TIMEOUT);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue