Implement Healing Wish
parent
9e02d71c75
commit
e99af6f148
|
@ -109,6 +109,7 @@ export default class BattleScene extends Phaser.Scene {
|
|||
private phaseQueue: Phase[];
|
||||
private phaseQueuePrepend: Phase[];
|
||||
private phaseQueuePrependSpliceIndex: integer;
|
||||
private nextCommandPhaseQueue: Phase[];
|
||||
private currentPhase: Phase;
|
||||
private standbyPhase: Phase;
|
||||
public field: Phaser.GameObjects.Container;
|
||||
|
@ -171,6 +172,7 @@ export default class BattleScene extends Phaser.Scene {
|
|||
this.phaseQueue = [];
|
||||
this.phaseQueuePrepend = [];
|
||||
this.phaseQueuePrependSpliceIndex = -1;
|
||||
this.nextCommandPhaseQueue = [];
|
||||
}
|
||||
|
||||
loadImage(key: string, folder: string, filename?: string) {
|
||||
|
@ -1450,8 +1452,8 @@ export default class BattleScene extends Phaser.Scene {
|
|||
return this.standbyPhase;
|
||||
}
|
||||
|
||||
pushPhase(phase: Phase): void {
|
||||
this.phaseQueue.push(phase);
|
||||
pushPhase(phase: Phase, defer: boolean = false): void {
|
||||
(!defer ? this.phaseQueue : this.nextCommandPhaseQueue).push(phase);
|
||||
}
|
||||
|
||||
unshiftPhase(phase: Phase): void {
|
||||
|
@ -1525,6 +1527,10 @@ export default class BattleScene extends Phaser.Scene {
|
|||
}
|
||||
|
||||
populatePhaseQueue(): void {
|
||||
if (this.nextCommandPhaseQueue.length) {
|
||||
this.phaseQueue.push(...this.nextCommandPhaseQueue);
|
||||
this.nextCommandPhaseQueue.splice(0, this.nextCommandPhaseQueue.length);
|
||||
}
|
||||
this.phaseQueue.push(new TurnInitPhase(this));
|
||||
}
|
||||
|
||||
|
|
|
@ -624,10 +624,8 @@ export class SacrificialFullRestoreAttr extends SacrificialAttr {
|
|||
// We don't know which party member will be chosen, so pick the highest max HP in the party
|
||||
const maxPartyMemberHp = user.scene.getParty().map(p => p.getMaxHp()).reduce((maxHp: integer, hp: integer) => Math.max(hp, maxHp), 0);
|
||||
|
||||
console.log(maxPartyMemberHp);
|
||||
|
||||
user.scene.pushPhase(new PokemonHealPhase(user.scene, user.getBattlerIndex(),
|
||||
maxPartyMemberHp, getPokemonMessage(user, '\'s Healing Wish\nwas granted!'), true, false, false, true));
|
||||
maxPartyMemberHp, getPokemonMessage(user, '\'s Healing Wish\nwas granted!'), true, false, false, true), true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -2098,11 +2096,11 @@ export class FirstMoveTypeAttr extends MoveEffectAttr {
|
|||
if (!super.apply(user, target, move, args))
|
||||
return false;
|
||||
|
||||
const firstMoveType = target.moveset[0].getMove().type
|
||||
const firstMoveType = target.getMoveset()[0].getMove().type
|
||||
|
||||
user.summonData.types = [ firstMoveType ];
|
||||
|
||||
user.scene.queueMessage(getPokemonMessage(user, ` converted\ninto the ${Utils.toReadableString(Type[firstMoveType])} type!`));
|
||||
user.scene.queueMessage(getPokemonMessage(user, ` transformed\ninto to the ${Utils.toReadableString(Type[firstMoveType])} type!`));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -3394,7 +3392,7 @@ export function initMoves() {
|
|||
new AttackMove(Moves.GYRO_BALL, "Gyro Ball", Type.STEEL, MoveCategory.PHYSICAL, -1, 100, 5, -1, "The user tackles the target with a high-speed spin. The slower the user compared to the target, the greater the move's power.", -1, 0, 4)
|
||||
.attr(BattleStatRatioPowerAttr, Stat.SPD, true)
|
||||
.ballBombMove(),
|
||||
new SelfStatusMove(Moves.HEALING_WISH, "Healing Wish (N)", Type.PSYCHIC, -1, 10, -1, "The user faints. In return, the Pokémon taking its place will have its HP restored and status conditions cured.", -1, 0, 4)
|
||||
new SelfStatusMove(Moves.HEALING_WISH, "Healing Wish", Type.PSYCHIC, -1, 10, -1, "The user faints. In return, the Pokémon taking its place will have its HP restored and status conditions cured.", -1, 0, 4)
|
||||
.attr(SacrificialFullRestoreAttr),
|
||||
new AttackMove(Moves.BRINE, "Brine", Type.WATER, MoveCategory.SPECIAL, 65, 100, 10, -1, "If the target's HP is half or less, this attack will hit with double the power.", -1, 0, 4)
|
||||
.attr(MovePowerMultiplierAttr, (user, target, move) => target.getHpRatio() < 0.5 ? 2 : 1),
|
||||
|
|
|
@ -3369,6 +3369,10 @@ export class PokemonHealPhase extends CommonAnimPhase {
|
|||
pokemon.resetStatus();
|
||||
}
|
||||
pokemon.updateInfo().then(() => super.end());
|
||||
} else if (this.healStatus && !this.revive && pokemon.status) {
|
||||
lastStatusEffect = pokemon.status.effect;
|
||||
pokemon.resetStatus();
|
||||
pokemon.updateInfo().then(() => super.end());
|
||||
} else if (this.showFullHpMessage)
|
||||
this.message = getPokemonMessage(pokemon, `'s\nHP is full!`);
|
||||
|
||||
|
@ -3378,7 +3382,7 @@ export class PokemonHealPhase extends CommonAnimPhase {
|
|||
if (this.healStatus && lastStatusEffect && !hasMessage)
|
||||
this.scene.queueMessage(getPokemonMessage(pokemon, getStatusEffectHealText(lastStatusEffect)));
|
||||
|
||||
if (fullHp)
|
||||
if (fullHp && !lastStatusEffect)
|
||||
super.end();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue