beginning immplementation of lunar dance

This commit is contained in:
PrabbyDD 2024-11-20 14:37:12 -08:00
parent 6442b8345f
commit f9bae3aa4b
2 changed files with 40 additions and 4 deletions

View File

@ -1884,6 +1884,34 @@ export class SacrificialFullRestoreAttr extends SacrificialAttr {
}
}
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:sacrificialFullRestore", { pokemonName: getPokemonNameWithAffix(user) }), true, false, false, true, false, true), true);
return true;
}
getUserBenefitScore(user: Pokemon, target: Pokemon, move: Move): integer {
return -20;
}
getCondition(): MoveConditionFunc {
return (user, _target, _move) => user.scene.getPlayerParty().filter(p => p.isActive()).length > user.scene.currentBattle.getBattlerCount();
}
}
/**
* Attribute used for moves which ignore type-based debuffs from weather, namely Hydro Steam.
* Called during damage calculation after getting said debuff from getAttackTypeMultiplier in the Pokemon class.
@ -9069,10 +9097,9 @@ export function initMoves() {
new AttackMove(Moves.SPACIAL_REND, Type.DRAGON, MoveCategory.SPECIAL, 100, 95, 5, -1, 0, 4)
.attr(HighCritAttr),
new SelfStatusMove(Moves.LUNAR_DANCE, Type.PSYCHIC, -1, 10, -1, 0, 4)
.attr(SacrificialAttrOnHit)
.attr(SacrificialFullRestoreAndPPRestoreAttr)
.danceMove()
.triageMove()
.unimplemented(),
.triageMove(),
new AttackMove(Moves.CRUSH_GRIP, Type.NORMAL, MoveCategory.PHYSICAL, -1, 100, 5, -1, 0, 4)
.attr(OpponentHighHpPowerAttr, 120),
new AttackMove(Moves.MAGMA_STORM, Type.FIRE, MoveCategory.SPECIAL, 100, 75, 5, -1, 0, 4)

View File

@ -21,8 +21,9 @@ export class PokemonHealPhase extends CommonAnimPhase {
private revive: boolean;
private healStatus: boolean;
private preventFullHeal: boolean;
private fullRestorePP: boolean;
constructor(scene: BattleScene, battlerIndex: BattlerIndex, hpHealed: integer, message: string | null, showFullHpMessage: boolean, skipAnim: boolean = false, revive: boolean = false, healStatus: boolean = false, preventFullHeal: boolean = false) {
constructor(scene: BattleScene, battlerIndex: BattlerIndex, hpHealed: integer, message: string | null, showFullHpMessage: boolean, skipAnim: boolean = false, revive: boolean = false, healStatus: boolean = false, preventFullHeal: boolean = false, fullRestorePP: boolean = false) {
super(scene, battlerIndex, undefined, CommonAnim.HEALTH_UP);
this.hpHealed = hpHealed;
@ -32,6 +33,7 @@ export class PokemonHealPhase extends CommonAnimPhase {
this.revive = revive;
this.healStatus = healStatus;
this.preventFullHeal = preventFullHeal;
this.fullRestorePP = fullRestorePP;
}
start() {
@ -86,6 +88,13 @@ export class PokemonHealPhase extends CommonAnimPhase {
lastStatusEffect = pokemon.status.effect;
pokemon.resetStatus();
}
if (this.fullRestorePP) {
for (const move of this.getPokemon().getMoveset()) {
if (move) {
move.ppUsed = 0;
}
}
}
pokemon.updateInfo().then(() => super.end());
} else if (this.healStatus && !this.revive && pokemon.status) {
lastStatusEffect = pokemon.status.effect;