Add endings for classic mode
This commit is contained in:
parent
71d9f11d94
commit
7561521020
Binary file not shown.
After Width: | Height: | Size: 52 KiB |
Binary file not shown.
After Width: | Height: | Size: 41 KiB |
|
@ -2290,6 +2290,25 @@ export const battleSpecDialogue = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const miscDialogue = {
|
||||||
|
ending: [
|
||||||
|
`@c{smile}Oh? You won?@d{96} @c{smile_eclosed}I guess I should've known.\nBut, you're back now.
|
||||||
|
$@c{smile}It's over.@d{64} You ended the loop.
|
||||||
|
$@c{serious_smile_fists}You fulfilled your dream too, didn't you?\nYou didn't lose even once.
|
||||||
|
$@c{neutral}I'm the only one who'll remember what you did.@d{96}\nI guess that's okay, isn't it?
|
||||||
|
$@c{serious_smile_fists}Your legend will always live on in our hearts.
|
||||||
|
$@c{smile_eclosed}Anyway, I've had about enough of this place, haven't you? Let's head home.
|
||||||
|
$@c{serious_smile_fists}Maybe when we get back, we can have another battle?\nIf you're up to it.`,
|
||||||
|
`@c{shock}You're back?@d{32} Does that mean…@d{96} you won?!\n@c{smile_ehalf}I should have known you had it in you.
|
||||||
|
$@c{smile_eclosed}Of course… I always had that feeling.\n@c{smile}It's over now, right? You ended the loop.
|
||||||
|
$@c{smile_ehalf}You fulfilled your dream too, didn't you?\nYou didn't lose even once.
|
||||||
|
$I'll be the only one to remember what you did.\n@c{angry_mopen}I'll try not to forget!
|
||||||
|
$@c{smile_wave_wink}Just kidding!@d{64} @c{smile}I'd never forget.@d{32}\nYour legend will live on in our hearts.
|
||||||
|
$@c{smile_wave}Anyway,@d{64} it's getting late…@d{96} I think?\nIt's hard to tell in this place.
|
||||||
|
$Let's go home. @c{smile_wave_wink}Maybe tomorrow, we can have another battle, for old time's sake?`
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
export function getCharVariantFromDialogue(message: string): string {
|
export function getCharVariantFromDialogue(message: string): string {
|
||||||
const variantMatch = /@c\{(.*?)\}/.exec(message);
|
const variantMatch = /@c\{(.*?)\}/.exec(message);
|
||||||
if (variantMatch)
|
if (variantMatch)
|
||||||
|
|
|
@ -209,6 +209,9 @@ export class LoadingScene extends SceneBase {
|
||||||
|
|
||||||
this.loadImage('egg_list_bg', 'ui');
|
this.loadImage('egg_list_bg', 'ui');
|
||||||
|
|
||||||
|
this.loadImage('end_m', 'cg');
|
||||||
|
this.loadImage('end_f', 'cg');
|
||||||
|
|
||||||
for (let i = 0; i < 10; i++) {
|
for (let i = 0; i < 10; i++) {
|
||||||
this.loadAtlas(`pokemon_icons_${i}`, '');
|
this.loadAtlas(`pokemon_icons_${i}`, '');
|
||||||
if (i)
|
if (i)
|
||||||
|
|
|
@ -37,7 +37,7 @@ import { BattleType, BattlerIndex, TurnCommand } from "./battle";
|
||||||
import { BattleSpec } from "./enums/battle-spec";
|
import { BattleSpec } from "./enums/battle-spec";
|
||||||
import { Species } from "./data/enums/species";
|
import { Species } from "./data/enums/species";
|
||||||
import { HealAchv, LevelAchv, achvs } from "./system/achv";
|
import { HealAchv, LevelAchv, achvs } from "./system/achv";
|
||||||
import { TrainerSlot, trainerConfigs } from "./data/trainer-config";
|
import { TrainerConfig, TrainerSlot, trainerConfigs } from "./data/trainer-config";
|
||||||
import { TrainerType } from "./data/enums/trainer-type";
|
import { TrainerType } from "./data/enums/trainer-type";
|
||||||
import { EggHatchPhase } from "./egg-hatch-phase";
|
import { EggHatchPhase } from "./egg-hatch-phase";
|
||||||
import { Egg } from "./data/egg";
|
import { Egg } from "./data/egg";
|
||||||
|
@ -46,7 +46,7 @@ import { loggedInUser, updateUserInfo } from "./account";
|
||||||
import { PlayerGender, SessionSaveData } from "./system/game-data";
|
import { PlayerGender, SessionSaveData } from "./system/game-data";
|
||||||
import { addPokeballCaptureStars, addPokeballOpenParticles } from "./field/anims";
|
import { addPokeballCaptureStars, addPokeballOpenParticles } from "./field/anims";
|
||||||
import { SpeciesFormChangeActiveTrigger, SpeciesFormChangeManualTrigger, SpeciesFormChangeMoveLearnedTrigger, SpeciesFormChangePostMoveTrigger, SpeciesFormChangePreMoveTrigger } from "./data/pokemon-forms";
|
import { SpeciesFormChangeActiveTrigger, SpeciesFormChangeManualTrigger, SpeciesFormChangeMoveLearnedTrigger, SpeciesFormChangePostMoveTrigger, SpeciesFormChangePreMoveTrigger } from "./data/pokemon-forms";
|
||||||
import { battleSpecDialogue, getCharVariantFromDialogue } from "./data/dialogue";
|
import { battleSpecDialogue, getCharVariantFromDialogue, miscDialogue } from "./data/dialogue";
|
||||||
import ModifierSelectUiHandler, { SHOP_OPTIONS_ROW_LIMIT } from "./ui/modifier-select-ui-handler";
|
import ModifierSelectUiHandler, { SHOP_OPTIONS_ROW_LIMIT } from "./ui/modifier-select-ui-handler";
|
||||||
import { Setting } from "./system/settings";
|
import { Setting } from "./system/settings";
|
||||||
import { Tutorial, handleTutorial } from "./tutorial";
|
import { Tutorial, handleTutorial } from "./tutorial";
|
||||||
|
@ -59,6 +59,7 @@ import PokemonSpecies, { getPokemonSpecies, getPokemonSpeciesForm, speciesStarte
|
||||||
import i18next from './plugins/i18n';
|
import i18next from './plugins/i18n';
|
||||||
import { Abilities } from "./data/enums/abilities";
|
import { Abilities } from "./data/enums/abilities";
|
||||||
import * as Overrides from './overrides';
|
import * as Overrides from './overrides';
|
||||||
|
import { TextStyle, addTextObject } from "./ui/text";
|
||||||
|
|
||||||
export class LoginPhase extends Phase {
|
export class LoginPhase extends Phase {
|
||||||
private showText: boolean;
|
private showText: boolean;
|
||||||
|
@ -160,7 +161,6 @@ export class TitlePhase extends Phase {
|
||||||
this.scene.gameData.getSession(loggedInUser.lastSessionSlot).then(sessionData => {
|
this.scene.gameData.getSession(loggedInUser.lastSessionSlot).then(sessionData => {
|
||||||
if (sessionData) {
|
if (sessionData) {
|
||||||
this.lastSessionData = sessionData;
|
this.lastSessionData = sessionData;
|
||||||
console.log(sessionData);
|
|
||||||
const biomeKey = getBiomeKey(sessionData.arena.biome);
|
const biomeKey = getBiomeKey(sessionData.arena.biome);
|
||||||
const bgTexture = `${biomeKey}_bg`;
|
const bgTexture = `${biomeKey}_bg`;
|
||||||
this.scene.arenaBg.setTexture(bgTexture);
|
this.scene.arenaBg.setTexture(bgTexture);
|
||||||
|
@ -3219,14 +3219,13 @@ export class FaintPhase extends PokemonPhase {
|
||||||
if (defeatSource?.isOnField()) {
|
if (defeatSource?.isOnField()) {
|
||||||
applyPostVictoryAbAttrs(PostVictoryAbAttr, defeatSource);
|
applyPostVictoryAbAttrs(PostVictoryAbAttr, defeatSource);
|
||||||
const pvmove = allMoves[pokemon.turnData.attacksReceived[0].move];
|
const pvmove = allMoves[pokemon.turnData.attacksReceived[0].move];
|
||||||
const pvattrs = pvmove.getAttrs(PostVictoryStatChangeAttr);
|
const pvattrs = pvmove.getAttrs(PostVictoryStatChangeAttr) as PostVictoryStatChangeAttr[];
|
||||||
if (pvattrs.length) {
|
if (pvattrs.length) {
|
||||||
for (let pvattr of pvattrs) {
|
for (let pvattr of pvattrs)
|
||||||
pvattr.applyPostVictory(defeatSource, defeatSource, pvmove);
|
pvattr.applyPostVictory(defeatSource, defeatSource, pvmove);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (this.player) {
|
if (this.player) {
|
||||||
const nonFaintedPartyMembers = this.scene.getParty().filter(p => !p.isFainted());
|
const nonFaintedPartyMembers = this.scene.getParty().filter(p => !p.isFainted());
|
||||||
|
@ -3537,13 +3536,11 @@ export class GameOverModifierRewardPhase extends ModifierRewardPhase {
|
||||||
this.scene.addModifier(newModifier).then(() => {
|
this.scene.addModifier(newModifier).then(() => {
|
||||||
this.scene.playSound('level_up_fanfare');
|
this.scene.playSound('level_up_fanfare');
|
||||||
this.scene.ui.setMode(Mode.MESSAGE);
|
this.scene.ui.setMode(Mode.MESSAGE);
|
||||||
this.scene.ui.fadeIn(250).then(() => {
|
|
||||||
this.scene.ui.showText(`You received\n${newModifier.type.name}!`, null, () => {
|
this.scene.ui.showText(`You received\n${newModifier.type.name}!`, null, () => {
|
||||||
this.scene.time.delayedCall(1500, () => this.scene.arenaBg.setVisible(true));
|
this.scene.time.delayedCall(1500, () => this.scene.arenaBg.setVisible(true));
|
||||||
resolve();
|
resolve();
|
||||||
}, null, true, 1500);
|
}, null, true, 1500);
|
||||||
});
|
});
|
||||||
});
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3563,12 +3560,10 @@ export class RibbonModifierRewardPhase extends ModifierRewardPhase {
|
||||||
this.scene.addModifier(newModifier).then(() => {
|
this.scene.addModifier(newModifier).then(() => {
|
||||||
this.scene.playSound('level_up_fanfare');
|
this.scene.playSound('level_up_fanfare');
|
||||||
this.scene.ui.setMode(Mode.MESSAGE);
|
this.scene.ui.setMode(Mode.MESSAGE);
|
||||||
this.scene.ui.fadeIn(250).then(() => {
|
|
||||||
this.scene.ui.showText(`${this.species.name} beat ${this.scene.gameMode.getName()} Mode for the first time!\nYou received ${newModifier.type.name}!`, null, () => {
|
this.scene.ui.showText(`${this.species.name} beat ${this.scene.gameMode.getName()} Mode for the first time!\nYou received ${newModifier.type.name}!`, null, () => {
|
||||||
resolve();
|
resolve();
|
||||||
}, null, true, 1500);
|
}, null, true, 1500);
|
||||||
});
|
});
|
||||||
});
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3619,6 +3614,7 @@ export class GameOverPhase extends BattlePhase {
|
||||||
|
|
||||||
handleGameOver(): void {
|
handleGameOver(): void {
|
||||||
const doGameOver = (newClear: boolean) => {
|
const doGameOver = (newClear: boolean) => {
|
||||||
|
this.scene.disableMenu = true;
|
||||||
this.scene.time.delayedCall(1000, () => {
|
this.scene.time.delayedCall(1000, () => {
|
||||||
let firstClear = false;
|
let firstClear = false;
|
||||||
if (this.victory && newClear) {
|
if (this.victory && newClear) {
|
||||||
|
@ -3640,10 +3636,12 @@ export class GameOverPhase extends BattlePhase {
|
||||||
const activeBattlers = this.scene.getField().filter(p => p?.isActive(true));
|
const activeBattlers = this.scene.getField().filter(p => p?.isActive(true));
|
||||||
activeBattlers.map(p => p.hideInfo());
|
activeBattlers.map(p => p.hideInfo());
|
||||||
this.scene.ui.fadeOut(fadeDuration).then(() => {
|
this.scene.ui.fadeOut(fadeDuration).then(() => {
|
||||||
[ this.scene.field, ...activeBattlers ].map(a => a.setVisible(false));
|
activeBattlers.map(a => a.setVisible(false));
|
||||||
this.scene.setFieldScale(1, true);
|
this.scene.setFieldScale(1, true);
|
||||||
this.scene.clearPhaseQueue();
|
this.scene.clearPhaseQueue();
|
||||||
this.scene.ui.clearText();
|
this.scene.ui.clearText();
|
||||||
|
|
||||||
|
const clear = (endCardPhase?: EndCardPhase) => {
|
||||||
if (newClear)
|
if (newClear)
|
||||||
this.handleUnlocks();
|
this.handleUnlocks();
|
||||||
if (this.victory && newClear) {
|
if (this.victory && newClear) {
|
||||||
|
@ -3652,8 +3650,26 @@ export class GameOverPhase extends BattlePhase {
|
||||||
if (!firstClear)
|
if (!firstClear)
|
||||||
this.scene.unshiftPhase(new GameOverModifierRewardPhase(this.scene, modifierTypes.VOUCHER_PREMIUM));
|
this.scene.unshiftPhase(new GameOverModifierRewardPhase(this.scene, modifierTypes.VOUCHER_PREMIUM));
|
||||||
}
|
}
|
||||||
this.scene.pushPhase(new PostGameOverPhase(this.scene));
|
this.scene.pushPhase(new PostGameOverPhase(this.scene, endCardPhase));
|
||||||
this.end();
|
this.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.victory) {
|
||||||
|
this.scene.ui.fadeIn(500).then(() => {
|
||||||
|
this.scene.charSprite.showCharacter(`rival_${this.scene.gameData.gender === PlayerGender.FEMALE ? 'm' : 'f'}`, getCharVariantFromDialogue(miscDialogue.ending[this.scene.gameData.gender === PlayerGender.FEMALE ? 0 : 1])).then(() => {
|
||||||
|
this.scene.ui.showDialogue(miscDialogue.ending[this.scene.gameData.gender === PlayerGender.FEMALE ? 0 : 1], this.scene.gameData.gender === PlayerGender.FEMALE ? trainerConfigs[TrainerType.RIVAL].name : trainerConfigs[TrainerType.RIVAL].nameFemale, null, () => {
|
||||||
|
this.scene.ui.fadeOut(500).then(() => {
|
||||||
|
this.scene.charSprite.hide().then(() => {
|
||||||
|
const endCardPhase = new EndCardPhase(this.scene);
|
||||||
|
this.scene.unshiftPhase(endCardPhase);
|
||||||
|
clear(endCardPhase);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} else
|
||||||
|
clear();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -3696,6 +3712,41 @@ export class GameOverPhase extends BattlePhase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class EndCardPhase extends Phase {
|
||||||
|
public endCard: Phaser.GameObjects.Image;
|
||||||
|
public text: Phaser.GameObjects.Text;
|
||||||
|
|
||||||
|
constructor(scene: BattleScene) {
|
||||||
|
super(scene);
|
||||||
|
}
|
||||||
|
|
||||||
|
start(): void {
|
||||||
|
super.start();
|
||||||
|
|
||||||
|
this.scene.ui.getMessageHandler().bg.setVisible(false);
|
||||||
|
this.scene.ui.getMessageHandler().nameBoxContainer.setVisible(false);
|
||||||
|
|
||||||
|
this.endCard = this.scene.add.image(0, 0, `end_${this.scene.gameData.gender === PlayerGender.FEMALE ? 'f' : 'm'}`);
|
||||||
|
this.endCard.setOrigin(0);
|
||||||
|
this.endCard.setScale(0.5);
|
||||||
|
this.scene.field.add(this.endCard);
|
||||||
|
|
||||||
|
this.text = addTextObject(this.scene, this.scene.game.canvas.width / 12, (this.scene.game.canvas.height / 6) - 16, 'Congratulations!', TextStyle.SUMMARY, { fontSize: '128px' });
|
||||||
|
this.text.setOrigin(0.5);
|
||||||
|
this.scene.field.add(this.text);
|
||||||
|
|
||||||
|
this.scene.ui.clearText();
|
||||||
|
|
||||||
|
this.scene.ui.fadeIn(1000).then(() => {
|
||||||
|
|
||||||
|
this.scene.ui.showText('', null, () => {
|
||||||
|
this.scene.ui.getMessageHandler().bg.setVisible(true);
|
||||||
|
this.end();
|
||||||
|
}, null, true);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export class UnlockPhase extends Phase {
|
export class UnlockPhase extends Phase {
|
||||||
private unlockable: Unlockables;
|
private unlockable: Unlockables;
|
||||||
|
|
||||||
|
@ -3710,24 +3761,27 @@ export class UnlockPhase extends Phase {
|
||||||
this.scene.gameData.unlocks[this.unlockable] = true;
|
this.scene.gameData.unlocks[this.unlockable] = true;
|
||||||
this.scene.playSound('level_up_fanfare');
|
this.scene.playSound('level_up_fanfare');
|
||||||
this.scene.ui.setMode(Mode.MESSAGE);
|
this.scene.ui.setMode(Mode.MESSAGE);
|
||||||
this.scene.ui.fadeIn(250).then(() => {
|
|
||||||
this.scene.ui.showText(`${getUnlockableName(this.unlockable)}\nhas been unlocked.`, null, () => {
|
this.scene.ui.showText(`${getUnlockableName(this.unlockable)}\nhas been unlocked.`, null, () => {
|
||||||
this.scene.time.delayedCall(1500, () => this.scene.arenaBg.setVisible(true));
|
this.scene.time.delayedCall(1500, () => this.scene.arenaBg.setVisible(true));
|
||||||
this.end();
|
this.end();
|
||||||
}, null, true, 1500);
|
}, null, true, 1500);
|
||||||
});
|
});
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class PostGameOverPhase extends Phase {
|
export class PostGameOverPhase extends Phase {
|
||||||
constructor(scene: BattleScene) {
|
private endCardPhase: EndCardPhase;
|
||||||
|
|
||||||
|
constructor(scene: BattleScene, endCardPhase: EndCardPhase) {
|
||||||
super(scene);
|
super(scene);
|
||||||
|
|
||||||
|
this.endCardPhase = endCardPhase;
|
||||||
}
|
}
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
super.start();
|
super.start();
|
||||||
|
|
||||||
|
const saveAndReset = () => {
|
||||||
this.scene.gameData.saveAll(this.scene, true, true, true).then(success => {
|
this.scene.gameData.saveAll(this.scene, true, true, true).then(success => {
|
||||||
if (!success)
|
if (!success)
|
||||||
return this.scene.reset(true);
|
return this.scene.reset(true);
|
||||||
|
@ -3739,6 +3793,18 @@ export class PostGameOverPhase extends Phase {
|
||||||
this.end();
|
this.end();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
if (this.endCardPhase) {
|
||||||
|
this.scene.ui.fadeOut(500).then(() => {
|
||||||
|
this.scene.ui.getMessageHandler().bg.setVisible(true);
|
||||||
|
|
||||||
|
this.endCardPhase.endCard.destroy();
|
||||||
|
this.endCardPhase.text.destroy();
|
||||||
|
saveAndReset();
|
||||||
|
});
|
||||||
|
} else
|
||||||
|
saveAndReset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue