mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-11-26 13:08:17 +01:00
* Stop ShowAbilityPhase from ending until the bar has popped out * Remove ability bar hiding from messagePhase * Remove abilityBar reference from base Phase class * Add HideAbilityPhase to hide ability bar after effects * Add willSucceed to ability attrs * Update AbAttrs and PostInitAbAttrs * Update PreDefendAbAttrs * Update postDefend, postMoveUsed, StatStage, postSetStatus, and PostDamage * Update preAttack and fieldStat * Partially implement postAttack * Finish PostAttack * Update PostSummon * Update PreSwitchOut * Update preStatStageChange * Update PostStatStageChange, PreSetStatus, PreApplyBattlerTag * Update postTurn and preWeatherEffect * Update postWeatherChange * Update postWeatherChange * Update PostTerrainChange * Update CheckTrapped and PostBattle * Update postFaint * Update PostItemLost * Bug fixes from test cases * Fix intimidate display * Stop trace from displaying itself * Rename to canApply * Fix ability displays using getTriggerMessage * Ensure abilities which are mistakenly shown are still hidden * Fix ability bar showing the wrong ability with imposter * Add canApply for imposter * Update abilities using promises and `trySet...` functions * Committing overrides changes is bad * Document apply and canApply * Update PreLeaveFieldAbAttr * Remove boolean return type apply functions * Remove redundant assignment * Remove ability display from abilities that shouldn't have it * Move queueAbilityDisplay to battlescene * Remove unused shown variable * Minor changes * Fix using id instead of battlerindex in queueAbilityDisplay * Fix PostBattleInitFormChangeAbAttr displaying * Prevent crashes in case an ability for a pokemon not on the field is shown * Stop more abilities from displaying * Move enemy ability bar to the right side * Automatically reload bar if shown while already out, fix specific abilities * Remove duplicate call to clearPhaseQueueSplice * Remove ShowAbilityPhase import from ability.ts * Update PostDefendTypeChangeAbAttr to use PokemonType * Update PostSummonAddArenaTagAbAttr * Minor changes
65 lines
1.6 KiB
TypeScript
65 lines
1.6 KiB
TypeScript
import { globalScene } from "#app/global-scene";
|
|
import { Phase } from "#app/phase";
|
|
|
|
export class MessagePhase extends Phase {
|
|
private text: string;
|
|
private callbackDelay: number | null;
|
|
private prompt: boolean | null;
|
|
private promptDelay: number | null;
|
|
private speaker?: string;
|
|
|
|
constructor(
|
|
text: string,
|
|
callbackDelay?: number | null,
|
|
prompt?: boolean | null,
|
|
promptDelay?: number | null,
|
|
speaker?: string,
|
|
) {
|
|
super();
|
|
|
|
this.text = text;
|
|
this.callbackDelay = callbackDelay!; // TODO: is this bang correct?
|
|
this.prompt = prompt!; // TODO: is this bang correct?
|
|
this.promptDelay = promptDelay!; // TODO: is this bang correct?
|
|
this.speaker = speaker;
|
|
}
|
|
|
|
start() {
|
|
super.start();
|
|
|
|
if (this.text.indexOf("$") > -1) {
|
|
const pageIndex = this.text.indexOf("$");
|
|
globalScene.unshiftPhase(
|
|
new MessagePhase(
|
|
this.text.slice(pageIndex + 1),
|
|
this.callbackDelay,
|
|
this.prompt,
|
|
this.promptDelay,
|
|
this.speaker,
|
|
),
|
|
);
|
|
this.text = this.text.slice(0, pageIndex).trim();
|
|
}
|
|
|
|
if (this.speaker) {
|
|
globalScene.ui.showDialogue(
|
|
this.text,
|
|
this.speaker,
|
|
null,
|
|
() => this.end(),
|
|
this.callbackDelay || (this.prompt ? 0 : 1500),
|
|
this.promptDelay ?? 0,
|
|
);
|
|
} else {
|
|
globalScene.ui.showText(
|
|
this.text,
|
|
null,
|
|
() => this.end(),
|
|
this.callbackDelay || (this.prompt ? 0 : 1500),
|
|
this.prompt,
|
|
this.promptDelay,
|
|
);
|
|
}
|
|
}
|
|
}
|