mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-01-18 15:00:55 +00:00
Implement Healing Wish
This commit is contained in:
parent
9e02d71c75
commit
e99af6f148
@ -109,6 +109,7 @@ export default class BattleScene extends Phaser.Scene {
|
|||||||
private phaseQueue: Phase[];
|
private phaseQueue: Phase[];
|
||||||
private phaseQueuePrepend: Phase[];
|
private phaseQueuePrepend: Phase[];
|
||||||
private phaseQueuePrependSpliceIndex: integer;
|
private phaseQueuePrependSpliceIndex: integer;
|
||||||
|
private nextCommandPhaseQueue: Phase[];
|
||||||
private currentPhase: Phase;
|
private currentPhase: Phase;
|
||||||
private standbyPhase: Phase;
|
private standbyPhase: Phase;
|
||||||
public field: Phaser.GameObjects.Container;
|
public field: Phaser.GameObjects.Container;
|
||||||
@ -171,6 +172,7 @@ export default class BattleScene extends Phaser.Scene {
|
|||||||
this.phaseQueue = [];
|
this.phaseQueue = [];
|
||||||
this.phaseQueuePrepend = [];
|
this.phaseQueuePrepend = [];
|
||||||
this.phaseQueuePrependSpliceIndex = -1;
|
this.phaseQueuePrependSpliceIndex = -1;
|
||||||
|
this.nextCommandPhaseQueue = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
loadImage(key: string, folder: string, filename?: string) {
|
loadImage(key: string, folder: string, filename?: string) {
|
||||||
@ -1450,8 +1452,8 @@ export default class BattleScene extends Phaser.Scene {
|
|||||||
return this.standbyPhase;
|
return this.standbyPhase;
|
||||||
}
|
}
|
||||||
|
|
||||||
pushPhase(phase: Phase): void {
|
pushPhase(phase: Phase, defer: boolean = false): void {
|
||||||
this.phaseQueue.push(phase);
|
(!defer ? this.phaseQueue : this.nextCommandPhaseQueue).push(phase);
|
||||||
}
|
}
|
||||||
|
|
||||||
unshiftPhase(phase: Phase): void {
|
unshiftPhase(phase: Phase): void {
|
||||||
@ -1525,6 +1527,10 @@ export default class BattleScene extends Phaser.Scene {
|
|||||||
}
|
}
|
||||||
|
|
||||||
populatePhaseQueue(): void {
|
populatePhaseQueue(): void {
|
||||||
|
if (this.nextCommandPhaseQueue.length) {
|
||||||
|
this.phaseQueue.push(...this.nextCommandPhaseQueue);
|
||||||
|
this.nextCommandPhaseQueue.splice(0, this.nextCommandPhaseQueue.length);
|
||||||
|
}
|
||||||
this.phaseQueue.push(new TurnInitPhase(this));
|
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
|
// 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);
|
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(),
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
@ -2098,11 +2096,11 @@ export class FirstMoveTypeAttr extends MoveEffectAttr {
|
|||||||
if (!super.apply(user, target, move, args))
|
if (!super.apply(user, target, move, args))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const firstMoveType = target.moveset[0].getMove().type
|
const firstMoveType = target.getMoveset()[0].getMove().type
|
||||||
|
|
||||||
user.summonData.types = [ firstMoveType ];
|
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;
|
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)
|
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)
|
.attr(BattleStatRatioPowerAttr, Stat.SPD, true)
|
||||||
.ballBombMove(),
|
.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),
|
.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)
|
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),
|
.attr(MovePowerMultiplierAttr, (user, target, move) => target.getHpRatio() < 0.5 ? 2 : 1),
|
||||||
|
@ -3369,6 +3369,10 @@ export class PokemonHealPhase extends CommonAnimPhase {
|
|||||||
pokemon.resetStatus();
|
pokemon.resetStatus();
|
||||||
}
|
}
|
||||||
pokemon.updateInfo().then(() => super.end());
|
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)
|
} else if (this.showFullHpMessage)
|
||||||
this.message = getPokemonMessage(pokemon, `'s\nHP is full!`);
|
this.message = getPokemonMessage(pokemon, `'s\nHP is full!`);
|
||||||
|
|
||||||
@ -3378,7 +3382,7 @@ export class PokemonHealPhase extends CommonAnimPhase {
|
|||||||
if (this.healStatus && lastStatusEffect && !hasMessage)
|
if (this.healStatus && lastStatusEffect && !hasMessage)
|
||||||
this.scene.queueMessage(getPokemonMessage(pokemon, getStatusEffectHealText(lastStatusEffect)));
|
this.scene.queueMessage(getPokemonMessage(pokemon, getStatusEffectHealText(lastStatusEffect)));
|
||||||
|
|
||||||
if (fullHp)
|
if (fullHp && !lastStatusEffect)
|
||||||
super.end();
|
super.end();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user