mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-02-16 17:27:41 +00:00
Full implementation of freeze-dry including edge cases such as Normalize and Electrify plus tests
This commit is contained in:
parent
c6cc187c96
commit
ed70de7051
@ -4945,7 +4945,22 @@ export class WaterSuperEffectTypeMultiplierAttr extends VariableMoveTypeMultipli
|
||||
const effectivenessAgainstWater = new Utils.NumberHolder(getTypeDamageMultiplier(move.type, Type.WATER));
|
||||
applyChallenges(user.scene.gameMode, ChallengeType.TYPE_EFFECTIVENESS, effectivenessAgainstWater);
|
||||
if (effectivenessAgainstWater.value !== 0) {
|
||||
multiplier.value *= 2 / effectivenessAgainstWater.value;
|
||||
/**
|
||||
* During Normalize the given multiplier value against water Pkm is 1x but should be 2x.
|
||||
*
|
||||
* For more information about special interactions visit [Bulbapedia](https://bulbapedia.bulbagarden.net/wiki/Freeze-Dry_(move))
|
||||
*/
|
||||
if (user.getAbility().id === Abilities.NORMALIZE) {
|
||||
multiplier.value *= 2;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* If move is of type electric or grass it already has super effectiveness against water types and multiplier does not need to recalculate its value.
|
||||
*/
|
||||
if (user.getMoveType(move) !== Type.ELECTRIC) {
|
||||
multiplier.value *= 2 / effectivenessAgainstWater.value;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -97,8 +97,7 @@ describe("Moves - Freeze-Dry", () => {
|
||||
expect(enemy.hp).toBeLessThan(enemy.getMaxHp());
|
||||
});
|
||||
|
||||
// enable if this is ever fixed (lol)
|
||||
it.todo("should deal 2x damage to water types under Normalize", async () => {
|
||||
it("should deal 2x damage to water types under Normalize", async () => {
|
||||
game.override.ability(Abilities.NORMALIZE);
|
||||
await game.classicMode.startBattle();
|
||||
|
||||
@ -112,8 +111,23 @@ describe("Moves - Freeze-Dry", () => {
|
||||
expect(enemy.getMoveEffectiveness).toHaveReturnedWith(2);
|
||||
});
|
||||
|
||||
// enable once Electrify is implemented (and the interaction is fixed, as above)
|
||||
it.todo("should deal 2x damage to water types under Electrify", async () => {
|
||||
it("should deal 0.25x damage to rock AND steel type Pkm under Normalize", async () => {
|
||||
game.override
|
||||
.ability(Abilities.NORMALIZE)
|
||||
.enemySpecies(Species.SHIELDON);
|
||||
await game.classicMode.startBattle();
|
||||
|
||||
const enemy = game.scene.getEnemyPokemon()!;
|
||||
vi.spyOn(enemy, "getMoveEffectiveness");
|
||||
|
||||
game.move.select(Moves.FREEZE_DRY);
|
||||
await game.setTurnOrder([ BattlerIndex.PLAYER, BattlerIndex.ENEMY ]);
|
||||
await game.phaseInterceptor.to("MoveEffectPhase");
|
||||
|
||||
expect(enemy.getMoveEffectiveness).toHaveReturnedWith(0.25);
|
||||
});
|
||||
|
||||
it("should deal 2x damage to water types under Electrify", async () => {
|
||||
game.override.enemyMoveset([ Moves.ELECTRIFY ]);
|
||||
await game.classicMode.startBattle();
|
||||
|
||||
@ -126,4 +140,36 @@ describe("Moves - Freeze-Dry", () => {
|
||||
|
||||
expect(enemy.getMoveEffectiveness).toHaveReturnedWith(2);
|
||||
});
|
||||
|
||||
it("should deal 4x damage to water/flying types under Electrify", async () => {
|
||||
game.override
|
||||
.enemyMoveset([ Moves.ELECTRIFY ])
|
||||
.enemySpecies(Species.GYARADOS);
|
||||
await game.classicMode.startBattle();
|
||||
|
||||
const enemy = game.scene.getEnemyPokemon()!;
|
||||
vi.spyOn(enemy, "getMoveEffectiveness");
|
||||
|
||||
game.move.select(Moves.FREEZE_DRY);
|
||||
await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER ]);
|
||||
await game.phaseInterceptor.to("BerryPhase");
|
||||
|
||||
expect(enemy.getMoveEffectiveness).toHaveReturnedWith(4);
|
||||
});
|
||||
|
||||
it("should deal 0.25x damage to Grass/Dragon types under Electrify", async () => {
|
||||
game.override
|
||||
.enemyMoveset([ Moves.ELECTRIFY ])
|
||||
.enemySpecies(Species.FLAPPLE);
|
||||
await game.classicMode.startBattle();
|
||||
|
||||
const enemy = game.scene.getEnemyPokemon()!;
|
||||
vi.spyOn(enemy, "getMoveEffectiveness");
|
||||
|
||||
game.move.select(Moves.FREEZE_DRY);
|
||||
await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER ]);
|
||||
await game.phaseInterceptor.to("BerryPhase");
|
||||
|
||||
expect(enemy.getMoveEffectiveness).toHaveReturnedWith(0.25);
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user