mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-19 22:09:27 +02:00
Reuse Healing Wish's move attr, update test
This commit is contained in:
parent
ce2709b869
commit
93bb5b1e9b
@ -1881,8 +1881,14 @@ export class FlameBurstAttr extends MoveEffectAttr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class SacrificialFullRestoreAttr extends SacrificialAttr {
|
export class SacrificialFullRestoreAttr extends SacrificialAttr {
|
||||||
constructor() {
|
protected restorePP: boolean;
|
||||||
|
protected moveMessage: string;
|
||||||
|
|
||||||
|
constructor(restorePP: boolean, moveMessage: string) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
|
this.restorePP = restorePP;
|
||||||
|
this.moveMessage = moveMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
||||||
@ -1893,36 +1899,19 @@ export class SacrificialFullRestoreAttr extends SacrificialAttr {
|
|||||||
// We don't know which party member will be chosen, so pick the highest max HP in the party
|
// We don't know which party member will be chosen, so pick the highest max HP in the party
|
||||||
const maxPartyMemberHp = user.scene.getPlayerParty().map(p => p.getMaxHp()).reduce((maxHp: integer, hp: integer) => Math.max(hp, maxHp), 0);
|
const maxPartyMemberHp = user.scene.getPlayerParty().map(p => p.getMaxHp()).reduce((maxHp: integer, hp: integer) => Math.max(hp, maxHp), 0);
|
||||||
|
|
||||||
user.scene.pushPhase(new PokemonHealPhase(user.scene, user.getBattlerIndex(),
|
user.scene.pushPhase(
|
||||||
maxPartyMemberHp, i18next.t("moveTriggers:sacrificialFullRestore", { pokemonName: getPokemonNameWithAffix(user) }), true, false, false, true), true);
|
new PokemonHealPhase(
|
||||||
|
user.scene,
|
||||||
return true;
|
user.getBattlerIndex(),
|
||||||
}
|
maxPartyMemberHp,
|
||||||
|
i18next.t(this.moveMessage, { pokemonName: getPokemonNameWithAffix(user) }),
|
||||||
getUserBenefitScore(user: Pokemon, target: Pokemon, move: Move): integer {
|
true,
|
||||||
return -20;
|
false,
|
||||||
}
|
false,
|
||||||
|
true,
|
||||||
getCondition(): MoveConditionFunc {
|
false,
|
||||||
return (user, _target, _move) => user.scene.getPlayerParty().filter(p => p.isActive()).length > user.scene.currentBattle.getBattlerCount();
|
this.restorePP),
|
||||||
}
|
true);
|
||||||
}
|
|
||||||
|
|
||||||
export class SacrificialFullRestoreAndPPRestoreAttr extends SacrificialAttr {
|
|
||||||
constructor() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
|
||||||
if (!super.apply(user, target, move, args)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// We don't know which party member will be chosen, so pick the highest max HP in the party
|
|
||||||
const maxPartyMemberHp = user.scene.getPlayerParty().map(p => p.getMaxHp()).reduce((maxHp: integer, hp: integer) => Math.max(hp, maxHp), 0);
|
|
||||||
|
|
||||||
user.scene.pushPhase(new PokemonHealPhase(user.scene, user.getBattlerIndex(),
|
|
||||||
maxPartyMemberHp, i18next.t("moveTriggers:lunarDanceRestore", { pokemonName: getPokemonNameWithAffix(user) }), false, false, false, true, false, true), true);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -9030,7 +9019,7 @@ export function initMoves() {
|
|||||||
.attr(GyroBallPowerAttr)
|
.attr(GyroBallPowerAttr)
|
||||||
.ballBombMove(),
|
.ballBombMove(),
|
||||||
new SelfStatusMove(Moves.HEALING_WISH, Type.PSYCHIC, -1, 10, -1, 0, 4)
|
new SelfStatusMove(Moves.HEALING_WISH, Type.PSYCHIC, -1, 10, -1, 0, 4)
|
||||||
.attr(SacrificialFullRestoreAttr)
|
.attr(SacrificialFullRestoreAttr, false, "moveTriggers:sacrificialFullRestore")
|
||||||
.triageMove(),
|
.triageMove(),
|
||||||
new AttackMove(Moves.BRINE, Type.WATER, MoveCategory.SPECIAL, 65, 100, 10, -1, 0, 4)
|
new AttackMove(Moves.BRINE, Type.WATER, MoveCategory.SPECIAL, 65, 100, 10, -1, 0, 4)
|
||||||
.attr(MovePowerMultiplierAttr, (user, target, move) => target.getHpRatio() < 0.5 ? 2 : 1),
|
.attr(MovePowerMultiplierAttr, (user, target, move) => target.getHpRatio() < 0.5 ? 2 : 1),
|
||||||
@ -9307,7 +9296,7 @@ export function initMoves() {
|
|||||||
new AttackMove(Moves.SPACIAL_REND, Type.DRAGON, MoveCategory.SPECIAL, 100, 95, 5, -1, 0, 4)
|
new AttackMove(Moves.SPACIAL_REND, Type.DRAGON, MoveCategory.SPECIAL, 100, 95, 5, -1, 0, 4)
|
||||||
.attr(HighCritAttr),
|
.attr(HighCritAttr),
|
||||||
new SelfStatusMove(Moves.LUNAR_DANCE, Type.PSYCHIC, -1, 10, -1, 0, 4)
|
new SelfStatusMove(Moves.LUNAR_DANCE, Type.PSYCHIC, -1, 10, -1, 0, 4)
|
||||||
.attr(SacrificialFullRestoreAndPPRestoreAttr)
|
.attr(SacrificialFullRestoreAttr, true, "moveTriggers:lunarDanceRestore")
|
||||||
.danceMove()
|
.danceMove()
|
||||||
.triageMove(),
|
.triageMove(),
|
||||||
new AttackMove(Moves.CRUSH_GRIP, Type.NORMAL, MoveCategory.PHYSICAL, -1, 100, 5, -1, 0, 4)
|
new AttackMove(Moves.CRUSH_GRIP, Type.NORMAL, MoveCategory.PHYSICAL, -1, 100, 5, -1, 0, 4)
|
||||||
|
@ -24,16 +24,19 @@ describe("Moves - Lunar Dance", () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
game = new GameManager(phaserGame);
|
game = new GameManager(phaserGame);
|
||||||
game.override
|
game.override
|
||||||
.moveset([ Moves.LUNAR_DANCE, Moves.SPLASH ])
|
|
||||||
.statusEffect(StatusEffect.BURN)
|
.statusEffect(StatusEffect.BURN)
|
||||||
.battleType("double")
|
.battleType("double")
|
||||||
.enemyAbility(Abilities.BALL_FETCH)
|
.enemyAbility(Abilities.BALL_FETCH)
|
||||||
.enemyMoveset(Moves.SPLASH);
|
.enemyMoveset(Moves.SPLASH);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should full restore HP, PP and status of switched in pokemon, using lunar dance after should fail because no pokemon in party", async () => {
|
it("should full restore HP, PP and status of switched in pokemon, then fail second use because no remaining backup pokemon in party", async () => {
|
||||||
await game.classicMode.startBattle([ Species.BULBASAUR, Species.ODDISH, Species.RATTATA ]);
|
await game.classicMode.startBattle([ Species.BULBASAUR, Species.ODDISH, Species.RATTATA ]);
|
||||||
let leftPlayer = game.scene.getPlayerParty()[0];
|
|
||||||
|
const [ bulbasaur, oddish, rattata ] = game.scene.getPlayerParty();
|
||||||
|
game.move.changeMoveset(bulbasaur, [ Moves.LUNAR_DANCE, Moves.SPLASH ]);
|
||||||
|
game.move.changeMoveset(oddish, [ Moves.LUNAR_DANCE, Moves.SPLASH ]);
|
||||||
|
game.move.changeMoveset(rattata, [ Moves.LUNAR_DANCE, Moves.SPLASH ]);
|
||||||
|
|
||||||
game.move.select(Moves.SPLASH, 0);
|
game.move.select(Moves.SPLASH, 0);
|
||||||
game.move.select(Moves.SPLASH, 1);
|
game.move.select(Moves.SPLASH, 1);
|
||||||
@ -41,9 +44,9 @@ describe("Moves - Lunar Dance", () => {
|
|||||||
await game.toNextTurn();
|
await game.toNextTurn();
|
||||||
|
|
||||||
// Bulbasaur should still be burned and have used a PP for splash and not at max hp
|
// Bulbasaur should still be burned and have used a PP for splash and not at max hp
|
||||||
expect(leftPlayer.status?.effect).toBe(StatusEffect.BURN);
|
expect(bulbasaur.status?.effect).toBe(StatusEffect.BURN);
|
||||||
expect(leftPlayer.moveset[1]?.ppUsed).toBe(1);
|
expect(bulbasaur.moveset[1]?.ppUsed).toBe(1);
|
||||||
expect(leftPlayer.hp).toBeLessThan(leftPlayer.getMaxHp());
|
expect(bulbasaur.hp).toBeLessThan(bulbasaur.getMaxHp());
|
||||||
|
|
||||||
// Switch out Bulbasaur for Rattata so we can swtich bulbasaur back in with lunar dance
|
// Switch out Bulbasaur for Rattata so we can swtich bulbasaur back in with lunar dance
|
||||||
game.doSwitchPokemon(2);
|
game.doSwitchPokemon(2);
|
||||||
@ -58,19 +61,17 @@ describe("Moves - Lunar Dance", () => {
|
|||||||
await game.toNextTurn();
|
await game.toNextTurn();
|
||||||
|
|
||||||
// Bulbasaur should NOT have any status and have full PP for splash and be at max hp
|
// Bulbasaur should NOT have any status and have full PP for splash and be at max hp
|
||||||
expect(leftPlayer.status?.effect).toBeUndefined();
|
expect(bulbasaur.status?.effect).toBeUndefined();
|
||||||
expect(leftPlayer.moveset[1]?.ppUsed).toBe(0);
|
expect(bulbasaur.moveset[1]?.ppUsed).toBe(0);
|
||||||
expect(leftPlayer.hp).toBe(leftPlayer.getMaxHp());
|
expect(bulbasaur.isFullHp()).toBe(true);
|
||||||
|
|
||||||
game.move.select(Moves.SPLASH, 0);
|
game.move.select(Moves.SPLASH, 0);
|
||||||
game.move.select(Moves.LUNAR_DANCE);
|
game.move.select(Moves.LUNAR_DANCE);
|
||||||
await game.phaseInterceptor.to(CommandPhase);
|
await game.phaseInterceptor.to(CommandPhase);
|
||||||
await game.toNextTurn();
|
await game.toNextTurn();
|
||||||
|
|
||||||
leftPlayer = game.scene.getPlayerParty()[0];
|
|
||||||
|
|
||||||
// Using Lunar dance again should fail because nothing in party and rattata should be alive
|
// Using Lunar dance again should fail because nothing in party and rattata should be alive
|
||||||
expect(leftPlayer.status?.effect).toBe(StatusEffect.BURN);
|
expect(rattata.status?.effect).toBe(StatusEffect.BURN);
|
||||||
expect(leftPlayer.hp).toBeLessThan(leftPlayer.getMaxHp());
|
expect(rattata.hp).toBeLessThan(rattata.getMaxHp());
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user