From 83fae68abfdf6acfde4e9539be703cb334f1839a Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Fri, 10 Nov 2023 15:51:34 -0500 Subject: [PATCH] Add rerolling modifiers for money and fix field UI layering issues --- public/audio/se/buy.wav | Bin 0 -> 134604 bytes src/battle-phases.ts | 71 +++++++++++++--- src/battle-scene.ts | 33 ++++++++ src/data/biome.ts | 2 +- src/data/trainer-type.ts | 95 +++++++++++---------- src/pokemon.ts | 7 +- src/system/game-data.ts | 5 ++ src/ui/modifier-select-ui-handler.ts | 118 ++++++++++++++++++--------- 8 files changed, 237 insertions(+), 94 deletions(-) create mode 100644 public/audio/se/buy.wav diff --git a/public/audio/se/buy.wav b/public/audio/se/buy.wav new file mode 100644 index 0000000000000000000000000000000000000000..2eeb8b1d44d83fb5533718eb8e33a5d35a322740 GIT binary patch literal 134604 zcmeI*U8`irl_ucQhh=@MtcJPnzcPbIc#JVdm>yw-aT_6gGk5)C1|x(J#tefQJi-_u zMAH}jYZ_ZBmF03tmeh0JNrHItRYiC!&(XLTTuHLuy(89&_3_4v*gG>%z5HKZdg))E zd-T?S{g40fpI`rP|Md5_Z{51}$gM|jefw9pZr%RhkKTIx*6mxb{o_CV<6BpK{^8#r zuGg==c<}3{t-K1!p?|w^wRG2SHBif_Z-rO7`g-eLowwYP^Odf?zSE_DE%)db4}NvO z)%h!*&)0)BovzMaUq+9AHecGh^U1dV@#uW*Y*2UON56RG^YMQCvmgC=yvMa1Tjqa# zHeb7O|L3jw`r?uKTE#Ti9m{^x(-V66vCkeGZ`*$O$oXrI`o$yDnlB@Dh=1^n`D!VB zcht`GkN!Mg%9zVwbr=WrO~#y%ZQ{1ob8TqsxIetg*?248cAF=8)4J`q!!7rq^U1(3 zBXzf}>QYjf;Nf?UzU*gAg3X_8UJq8^;Bb!0ob=83Yft;MI#-|E2sY2+)}_D3t9j_T z{fu{G$2yPEx!?Msj6Qii*ck7yI<(L0!Rj|AV*3Q!rVm~Zw%!;AWrF>u4*RvQE8Q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}1SD$#a=jiod+jiJ^wGPkix6^msHsin3 zwc3C0WNg#7j@MBe)F(Dp!M2Ha{j_0ctNOa1=k^oZC)ja!{cIDf&+EY}-QCY~_3h%d zl5xyn|EbUGjkTfM)Nk8P#(p*~`d{R!@|R_7}lcKU2P$`fT)w&c3~ z8t>#roBjm*Pkml*eAK6wJ92*1hMVrEPe*m@&n~X&R;KZ4+@0>$;ko+6t=@V8 z9r+{r>=W#`N8@$0pSs068~$JQbDSN%Xb_B-l_`ou@&cl}oS%zyCepU=mFSN(R^uWQ53)|KwI=dabT z?HK3!G_H-~QCmmfT}Xx!(@n$=zg|Hnd*j-))|+`l&lu z8L|DmeiK;TI~$IUrM{iauHTV(U8;L0w`$W?ard`P-2E;&U+FVe!K;5q`>o`2ePu(- zT+;8TjAQAO*B=&qiBCJ*kLa^c@J`<)ZR)>7{w8vET^qDpU6;n|x<1{64J)6#zQYfL z4LkcTY15}m2KDXm&Q|4)_EY94{yKFZwc%*LqqZLH zw;ERttor<=>koqs+IU@`^e0%|H-XiE6Z($maLk+b>8S3b{f_wau=LTVo3`oe)P2*o zs?Yh?>x%vUTKJ~pdQ{)hewW1My1F06oL$$aOXAovH)(^qf_tpLoj-gL_*>4to}3uh Vn;7Ay_1%O`f79{sML?be{~rRb4m1D& literal 0 HcmV?d00001 diff --git a/src/battle-phases.ts b/src/battle-phases.ts index 4074a694d..0d9b8eada 100644 --- a/src/battle-phases.ts +++ b/src/battle-phases.ts @@ -2204,13 +2204,15 @@ export class TrainerVictoryPhase extends BattlePhase { start() { this.scene.playBgm(this.scene.currentBattle.trainer.config.victoryBgm); + this.scene.unshiftPhase(new MoneyRewardPhase(this.scene, this.scene.currentBattle.trainer.config.moneyMultiplier)); + const modifierRewardFuncs = this.scene.currentBattle.trainer.config.modifierRewardFuncs; for (let modifierRewardFunc of modifierRewardFuncs) this.scene.unshiftPhase(new ModifierRewardPhase(this.scene, modifierRewardFunc)); this.scene.ui.showText(`You defeated\n${this.scene.currentBattle.trainer.getName()}!`, null, () => { const defeatMessages = this.scene.currentBattle.trainer.config.victoryMessages; - let showMessageAndEnd = () => this.end();//this.scene.ui.showText(`You got ₽0\nfor winning!`, null, () => this.end(), null, true); + let showMessageAndEnd = () => this.end(); if (defeatMessages.length) { let message: string; this.scene.executeWithSeedOffset(() => message = Phaser.Math.RND.pick(this.scene.currentBattle.trainer.config.victoryMessages), this.scene.currentBattle.waveIndex); @@ -2235,6 +2237,28 @@ export class TrainerVictoryPhase extends BattlePhase { } } +export class MoneyRewardPhase extends BattlePhase { + private moneyMultiplier: number; + + constructor(scene: BattleScene, moneyMultiplier: number) { + super(scene); + + this.moneyMultiplier = moneyMultiplier; + } + + start() { + const waveIndex = this.scene.currentBattle.waveIndex; + const waveSetIndex = Math.ceil(waveIndex / 10) - 1; + const moneyValue = Math.pow((waveSetIndex + 1 + (0.75 + (((waveIndex - 1) % 10) + 1) / 10)) * 100, 1 + 0.005 * waveSetIndex) * this.moneyMultiplier; + const moneyAmount = Math.floor(moneyValue / 10) * 10; + + this.scene.money += moneyAmount; + this.scene.updateMoneyText(); + + this.scene.ui.showText(`You got ₽${moneyAmount.toLocaleString('en-US')}\nfor winning!`, null, () => this.end(), null, true); + } +} + export class ModifierRewardPhase extends BattlePhase { private modifierType: ModifierType; @@ -2864,14 +2888,19 @@ export class AttemptRunPhase extends PokemonPhase { } export class SelectModifierPhase extends BattlePhase { - constructor(scene: BattleScene) { + private rerollCount: integer; + + constructor(scene: BattleScene, rerollCount: integer = 0) { super(scene); + + this.rerollCount = rerollCount; } start() { super.start(); - this.updateSeed(); + if (!this.rerollCount) + this.updateSeed(); const party = this.scene.getParty(); regenerateModifierPoolThresholds(party, this.getPoolType()); @@ -2884,8 +2913,22 @@ export class SelectModifierPhase extends BattlePhase { if (cursor < 0) { this.scene.ui.setMode(Mode.MESSAGE); super.end(); - return; - } else if (cursor >= typeOptions.length) { + return true; + } else if (cursor === typeOptions.length) { + const rerollCost = this.getRerollCost(); + if (this.scene.money < rerollCost) { + this.scene.ui.playError(); + return false; + } else { + this.scene.unshiftPhase(new SelectModifierPhase(this.scene, this.rerollCount + 1)); + this.scene.ui.clearText(); + this.scene.ui.setMode(Mode.MESSAGE).then(() => super.end()); + this.scene.money -= rerollCost; + this.scene.updateMoneyText(); + this.scene.playSound('buy'); + } + return true; + } else if (cursor === typeOptions.length + 1) { this.scene.ui.setModeWithoutClear(Mode.PARTY, PartyUiMode.MODIFIER_TRANSFER, -1, (fromSlotIndex: integer, itemIndex: integer, toSlotIndex: integer) => { if (toSlotIndex !== undefined && fromSlotIndex < 6 && toSlotIndex < 6 && fromSlotIndex !== toSlotIndex && itemIndex > -1) { this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer()).then(() => { @@ -2898,13 +2941,13 @@ export class SelectModifierPhase extends BattlePhase { this.scene.ui.setMode(Mode.MESSAGE); super.end(); } else - this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), typeOptions, modifierSelectCallback); + this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), typeOptions, modifierSelectCallback, this.getRerollCost()); }); }); } else - this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), typeOptions, modifierSelectCallback); + this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), typeOptions, modifierSelectCallback, this.getRerollCost()); }, PartyUiHandler.FilterItemMaxStacks); - return; + return true; } const modifierType = typeOptions[cursor].type; @@ -2919,7 +2962,7 @@ export class SelectModifierPhase extends BattlePhase { this.scene.addModifier(modifier, false, true).then(() => super.end()); }); } else - this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), typeOptions, modifierSelectCallback); + this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), typeOptions, modifierSelectCallback, this.getRerollCost()); }, modifierType.selectFilter); } else { const pokemonModifierType = modifierType as PokemonModifierType; @@ -2947,7 +2990,7 @@ export class SelectModifierPhase extends BattlePhase { this.scene.addModifier(modifier, false, true).then(() => super.end()); }); } else - this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), typeOptions, modifierSelectCallback, ); + this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), typeOptions, modifierSelectCallback, this.getRerollCost()); }, pokemonModifierType.selectFilter, modifierType instanceof PokemonMoveModifierType ? (modifierType as PokemonMoveModifierType).moveSelectFilter : undefined, tmMoveId); } } else { @@ -2955,8 +2998,10 @@ export class SelectModifierPhase extends BattlePhase { this.scene.ui.clearText(); this.scene.ui.setMode(Mode.MESSAGE); } + + return true; }; - this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), typeOptions, modifierSelectCallback); + this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), typeOptions, modifierSelectCallback, this.getRerollCost()); } updateSeed(): void { @@ -2966,6 +3011,10 @@ export class SelectModifierPhase extends BattlePhase { isPlayer(): boolean { return true; } + + getRerollCost(): integer { + return Math.ceil(this.scene.currentBattle.waveIndex / 10) * 250 * Math.pow(2, this.rerollCount); + } getPoolType(): ModifierPoolType { return ModifierPoolType.PLAYER; diff --git a/src/battle-scene.ts b/src/battle-scene.ts index c17bbb1d4..65e4cf92d 100644 --- a/src/battle-scene.ts +++ b/src/battle-scene.ts @@ -106,6 +106,7 @@ export default class BattleScene extends Phaser.Scene { private moneyText: Phaser.GameObjects.Text; private modifierBar: ModifierBar; private enemyModifierBar: ModifierBar; + private fieldOverlay: Phaser.GameObjects.Rectangle; private modifiers: PersistentModifier[]; private enemyModifiers: PersistentModifier[]; public uiContainer: Phaser.GameObjects.Container; @@ -304,6 +305,7 @@ export default class BattleScene extends Phaser.Scene { this.loadSe('charge'); this.loadSe('beam'); this.loadSe('upgrade'); + this.loadSe('buy'); this.loadSe('error'); this.loadSe('pb_rel'); @@ -370,6 +372,13 @@ export default class BattleScene extends Phaser.Scene { this.uiContainer = uiContainer; + const overlayWidth = this.game.canvas.width / 6; + const overlayHeight = (this.game.canvas.height / 6) - 48; + this.fieldOverlay = this.add.rectangle(0, overlayHeight * -1 - 48, overlayWidth, overlayHeight, 0x424242); + this.fieldOverlay.setOrigin(0, 0); + this.fieldOverlay.setAlpha(0); + this.fieldUI.add(this.fieldOverlay); + this.modifiers = []; this.enemyModifiers = []; @@ -788,6 +797,30 @@ export default class BattleScene extends Phaser.Scene { Phaser.Math.RND.state(state); } + showFieldOverlay(duration: integer): Promise { + return new Promise(resolve => { + this.tweens.add({ + targets: this.fieldOverlay, + alpha: 0.5, + ease: 'Sine.easeOut', + duration: duration, + onComplete: () => resolve() + }); + }); + } + + hideFieldOverlay(duration: integer): Promise { + return new Promise(resolve => { + this.tweens.add({ + targets: this.fieldOverlay, + alpha: 0, + duration: duration, + ease: 'Cubic.easeIn', + onComplete: () => resolve() + }); + }); + } + updateWaveCountText(): void { const isBoss = !(this.currentBattle.waveIndex % 10); this.waveCountText.setText(this.currentBattle.waveIndex.toString()); diff --git a/src/data/biome.ts b/src/data/biome.ts index 1b29f39bf..7dfa35110 100644 --- a/src/data/biome.ts +++ b/src/data/biome.ts @@ -65,7 +65,7 @@ export const biomeLinks: BiomeLinks = { [Biome.PLAINS]: [ Biome.GRASS, Biome.CITY, Biome.LAKE ], [Biome.GRASS]: Biome.TALL_GRASS, [Biome.TALL_GRASS]: [ Biome.FOREST, Biome.CAVE ], - [Biome.CITY]: [ Biome.CONSTRUCTION_SITE ], + [Biome.CITY]: Biome.CONSTRUCTION_SITE, [Biome.FOREST]: [ Biome.JUNGLE, Biome.MEADOW ], [Biome.SEA]: [ Biome.SEABED, Biome.ICE_CAVE ], [Biome.SWAMP]: [ Biome.GRAVEYARD, Biome.TALL_GRASS ], diff --git a/src/data/trainer-type.ts b/src/data/trainer-type.ts index 52ee8170e..7935edfe7 100644 --- a/src/data/trainer-type.ts +++ b/src/data/trainer-type.ts @@ -279,6 +279,7 @@ export class TrainerConfig { public nameFemale: string; public hasGenders: boolean = false; public isDouble: boolean = false; + public moneyMultiplier: number = 1; public isBoss: boolean = false; public hasStaticParty: boolean = false; public battleBgm: string; @@ -349,6 +350,11 @@ export class TrainerConfig { return this; } + setMoneyMultiplier(moneyMultiplier: number): TrainerConfig { + this.moneyMultiplier = moneyMultiplier; + return this; + } + setBoss(): TrainerConfig { this.isBoss = true; return this; @@ -433,6 +439,7 @@ export class TrainerConfig { this.setPartyMemberFunc(-1, getRandomPartyMemberFunc([ signatureSpecies ])); if (specialtyType !== undefined) this.setSpeciesFilter(p => p.isOfType(specialtyType)); + this.setMoneyMultiplier(2.5); this.setBoss(); this.setStaticParty(); this.setBattleBgm('battle_gym'); @@ -447,6 +454,7 @@ export class TrainerConfig { this.setSpeciesFilter(p => p.isOfType(specialtyType) && p.baseTotal >= 450); else this.setSpeciesFilter(p => p.baseTotal >= 450); + this.setMoneyMultiplier(3.25); this.setBoss(); this.setStaticParty(); this.setBattleBgm('battle_elite'); @@ -458,6 +466,7 @@ export class TrainerConfig { this.setPartyTemplates(trainerPartyTemplates.CHAMPION); this.setPartyMemberFunc(-1, getRandomPartyMemberFunc([ signatureSpecies ])); this.setSpeciesFilter(p => p.baseTotal >= 470); + this.setMoneyMultiplier(10); this.setBoss(); this.setStaticParty(); this.setBattleBgm('battle_champion'); @@ -539,23 +548,23 @@ function getSpeciesFilterRandomPartyMemberFunc(speciesFilter: PokemonSpeciesFilt } export const trainerConfigs: TrainerConfigs = { - [TrainerType.ACE_TRAINER]: new TrainerConfig(++t).setHasGenders().setEncounterBgm(TrainerType.ACE_TRAINER) + [TrainerType.ACE_TRAINER]: new TrainerConfig(++t).setHasGenders().setMoneyMultiplier(2.25).setEncounterBgm(TrainerType.ACE_TRAINER) .setPartyTemplateFunc(scene => getWavePartyTemplate(scene, trainerPartyTemplates.THREE_WEAK_BALANCED, trainerPartyTemplates.FOUR_WEAK_BALANCED, trainerPartyTemplates.FIVE_WEAK_BALANCED, trainerPartyTemplates.SIX_WEAK_BALANCED)), [TrainerType.ARTIST]: new TrainerConfig(++t).setEncounterBgm(TrainerType.RICH).setPartyTemplates(trainerPartyTemplates.ONE_STRONG, trainerPartyTemplates.TWO_AVG, trainerPartyTemplates.THREE_AVG).setSpeciesPools([ Species.SMEARGLE ]), [TrainerType.BACKERS]: new TrainerConfig(++t).setHasGenders().setDouble().setEncounterBgm(TrainerType.CYCLIST), [TrainerType.BACKPACKER]: new TrainerConfig(++t).setHasGenders().setSpeciesFilter(s => s.isOfType(Type.FLYING) || s.isOfType(Type.ROCK)).setEncounterBgm(TrainerType.BACKPACKER), - [TrainerType.BAKER]: new TrainerConfig(++t).setEncounterBgm(TrainerType.CLERK).setSpeciesFilter(s => s.isOfType(Type.GRASS) || s.isOfType(Type.FIRE)), - [TrainerType.BEAUTY]: new TrainerConfig(++t).setEncounterBgm(TrainerType.PARASOL_LADY), - [TrainerType.BIKER]: new TrainerConfig(++t).setEncounterBgm(TrainerType.ROUGHNECK).setSpeciesFilter(s => s.isOfType(Type.POISON)), + [TrainerType.BAKER]: new TrainerConfig(++t).setEncounterBgm(TrainerType.CLERK).setMoneyMultiplier(1.35).setSpeciesFilter(s => s.isOfType(Type.GRASS) || s.isOfType(Type.FIRE)), + [TrainerType.BEAUTY]: new TrainerConfig(++t).setMoneyMultiplier(1.55).setEncounterBgm(TrainerType.PARASOL_LADY), + [TrainerType.BIKER]: new TrainerConfig(++t).setMoneyMultiplier(1.4).setEncounterBgm(TrainerType.ROUGHNECK).setSpeciesFilter(s => s.isOfType(Type.POISON)), [TrainerType.BLACK_BELT]: new TrainerConfig(++t).setHasGenders('Battle Girl', TrainerType.PSYCHIC).setEncounterBgm(TrainerType.ROUGHNECK).setSpeciesFilter(s => s.isOfType(Type.FIGHTING)), - [TrainerType.BREEDER]: new TrainerConfig(++t).setEncounterBgm(TrainerType.POKEFAN).setHasGenders().setDouble() + [TrainerType.BREEDER]: new TrainerConfig(++t).setMoneyMultiplier(1.325).setEncounterBgm(TrainerType.POKEFAN).setHasGenders().setDouble() .setPartyTemplateFunc(scene => getWavePartyTemplate(scene, trainerPartyTemplates.FOUR_WEAKER, trainerPartyTemplates.FIVE_WEAKER, trainerPartyTemplates.SIX_WEAKER)), [TrainerType.CLERK]: new TrainerConfig(++t).setHasGenders().setEncounterBgm(TrainerType.CLERK), - [TrainerType.CYCLIST]: new TrainerConfig(++t).setHasGenders().setEncounterBgm(TrainerType.CYCLIST).setSpeciesFilter(s => !!s.getLevelMoves().find(plm => plm[1] === Moves.QUICK_ATTACK)), - [TrainerType.DANCER]: new TrainerConfig(++t).setEncounterBgm(TrainerType.CYCLIST), - [TrainerType.DEPOT_AGENT]: new TrainerConfig(++t).setEncounterBgm(TrainerType.CLERK), - [TrainerType.DOCTOR]: new TrainerConfig(++t).setEncounterBgm(TrainerType.CLERK), - [TrainerType.FISHERMAN]: new TrainerConfig(++t).setEncounterBgm(TrainerType.BACKPACKER) + [TrainerType.CYCLIST]: new TrainerConfig(++t).setMoneyMultiplier(1.3).setHasGenders().setEncounterBgm(TrainerType.CYCLIST).setSpeciesFilter(s => !!s.getLevelMoves().find(plm => plm[1] === Moves.QUICK_ATTACK)), + [TrainerType.DANCER]: new TrainerConfig(++t).setMoneyMultiplier(1.55).setEncounterBgm(TrainerType.CYCLIST), + [TrainerType.DEPOT_AGENT]: new TrainerConfig(++t).setMoneyMultiplier(1.45).setEncounterBgm(TrainerType.CLERK), + [TrainerType.DOCTOR]: new TrainerConfig(++t).setMoneyMultiplier(3).setEncounterBgm(TrainerType.CLERK), + [TrainerType.FISHERMAN]: new TrainerConfig(++t).setMoneyMultiplier(1.25).setEncounterBgm(TrainerType.BACKPACKER) .setPartyTemplates(trainerPartyTemplates.TWO_WEAK_SAME_ONE_AVG, trainerPartyTemplates.ONE_AVG, trainerPartyTemplates.THREE_WEAK_SAME, trainerPartyTemplates.ONE_STRONG, trainerPartyTemplates.SIX_WEAKER) .setSpeciesPools({ [TrainerPoolTier.COMMON]: [ Species.TENTACOOL, Species.MAGIKARP, Species.GOLDEEN, Species.STARYU, Species.REMORAID ], @@ -564,46 +573,48 @@ export const trainerConfigs: TrainerConfigs = { [TrainerPoolTier.SUPER_RARE]: [ Species.LAPRAS, Species.FEEBAS, Species.RELICANTH ] } ), - [TrainerType.GUITARIST]: new TrainerConfig(++t).setEncounterBgm(TrainerType.ROUGHNECK).setSpeciesFilter(s => s.isOfType(Type.ELECTRIC)), + [TrainerType.GUITARIST]: new TrainerConfig(++t).setMoneyMultiplier(1.2).setEncounterBgm(TrainerType.ROUGHNECK).setSpeciesFilter(s => s.isOfType(Type.ELECTRIC)), [TrainerType.HARLEQUIN]: new TrainerConfig(++t).setEncounterBgm(TrainerType.PSYCHIC).setSpeciesFilter(s => tmSpecies[Moves.TRICK_ROOM].indexOf(s.speciesId) > -1), [TrainerType.HIKER]: new TrainerConfig(++t).setEncounterBgm(TrainerType.BACKPACKER).setSpeciesFilter(s => s.isOfType(Type.GROUND) || s.isOfType(Type.ROCK)) .setPartyTemplates(trainerPartyTemplates.TWO_AVG_SAME_ONE_AVG, trainerPartyTemplates.TWO_AVG_SAME_ONE_STRONG, trainerPartyTemplates.TWO_AVG, trainerPartyTemplates.FOUR_WEAK, trainerPartyTemplates.ONE_STRONG), [TrainerType.HOOLIGANS]: new TrainerConfig(++t).setDouble().setEncounterBgm(TrainerType.ROUGHNECK).setSpeciesFilter(s => s.isOfType(Type.POISON) || s.isOfType(Type.DARK)), - [TrainerType.HOOPSTER]: new TrainerConfig(++t).setEncounterBgm(TrainerType.CYCLIST), - [TrainerType.INFIELDER]: new TrainerConfig(++t).setEncounterBgm(TrainerType.CYCLIST), - [TrainerType.JANITOR]: new TrainerConfig(++t).setEncounterBgm(TrainerType.CLERK), - [TrainerType.LINEBACKER]: new TrainerConfig(++t).setEncounterBgm(TrainerType.CYCLIST), - [TrainerType.MAID]: new TrainerConfig(++t).setEncounterBgm(TrainerType.RICH).setSpeciesFilter(s => s.eggType1 === 'Field' || s.eggType2 === 'Field'), + [TrainerType.HOOPSTER]: new TrainerConfig(++t).setMoneyMultiplier(1.2).setEncounterBgm(TrainerType.CYCLIST), + [TrainerType.INFIELDER]: new TrainerConfig(++t).setMoneyMultiplier(1.2).setEncounterBgm(TrainerType.CYCLIST), + [TrainerType.JANITOR]: new TrainerConfig(++t).setMoneyMultiplier(1.1).setEncounterBgm(TrainerType.CLERK), + [TrainerType.LINEBACKER]: new TrainerConfig(++t).setMoneyMultiplier(1.2).setEncounterBgm(TrainerType.CYCLIST), + [TrainerType.MAID]: new TrainerConfig(++t).setMoneyMultiplier(1.6).setEncounterBgm(TrainerType.RICH).setSpeciesFilter(s => s.eggType1 === 'Field' || s.eggType2 === 'Field'), [TrainerType.MUSICIAN]: new TrainerConfig(++t).setEncounterBgm(TrainerType.ROUGHNECK).setSpeciesFilter(s => !!s.getLevelMoves().find(plm => plm[1] === Moves.SING)), - [TrainerType.NURSE]: new TrainerConfig(++t).setEncounterBgm('lass').setSpeciesFilter(s => !!s.getLevelMoves().find(plm => plm[1] === Moves.CHARM) || !!s.getLevelMoves().find(plm => plm[1] === Moves.HEAL_PULSE)), - [TrainerType.NURSERY_AIDE]: new TrainerConfig(++t).setEncounterBgm('lass'), - [TrainerType.OFFICER]: new TrainerConfig(++t).setEncounterBgm(TrainerType.CLERK).setSpeciesPools([ Species.VULPIX, Species.GROWLITHE, Species.SNUBBULL, Species.HOUNDOUR, Species.POOCHYENA, Species.ELECTRIKE, Species.LILLIPUP ]), - [TrainerType.PARASOL_LADY]: new TrainerConfig(++t).setEncounterBgm(TrainerType.PARASOL_LADY).setSpeciesFilter(s => s.isOfType(Type.WATER)), + [TrainerType.NURSE]: new TrainerConfig(++t).setMoneyMultiplier(1.8).setEncounterBgm('lass').setSpeciesFilter(s => !!s.getLevelMoves().find(plm => plm[1] === Moves.CHARM) || !!s.getLevelMoves().find(plm => plm[1] === Moves.HEAL_PULSE)), + [TrainerType.NURSERY_AIDE]: new TrainerConfig(++t).setMoneyMultiplier(1.3).setEncounterBgm('lass'), + [TrainerType.OFFICER]: new TrainerConfig(++t).setMoneyMultiplier(1.55).setEncounterBgm(TrainerType.CLERK).setSpeciesPools([ Species.VULPIX, Species.GROWLITHE, Species.SNUBBULL, Species.HOUNDOUR, Species.POOCHYENA, Species.ELECTRIKE, Species.LILLIPUP ]), + [TrainerType.PARASOL_LADY]: new TrainerConfig(++t).setMoneyMultiplier(1.55).setEncounterBgm(TrainerType.PARASOL_LADY).setSpeciesFilter(s => s.isOfType(Type.WATER)), [TrainerType.PILOT]: new TrainerConfig(++t).setEncounterBgm(TrainerType.CLERK).setSpeciesFilter(s => tmSpecies[Moves.FLY].indexOf(s.speciesId) > -1), - [TrainerType.POKEFAN]: new TrainerConfig(++t).setHasGenders().setEncounterBgm(TrainerType.POKEFAN) + [TrainerType.POKEFAN]: new TrainerConfig(++t).setMoneyMultiplier(1.4).setHasGenders().setEncounterBgm(TrainerType.POKEFAN) .setPartyTemplates(trainerPartyTemplates.SIX_WEAKER, trainerPartyTemplates.FOUR_WEAK, trainerPartyTemplates.TWO_AVG, trainerPartyTemplates.ONE_STRONG, trainerPartyTemplates.FOUR_WEAK_SAME, trainerPartyTemplates.FIVE_WEAK, trainerPartyTemplates.SIX_WEAKER_SAME), - [TrainerType.PRESCHOOLER]: new TrainerConfig(++t).setEncounterBgm(TrainerType.YOUNGSTER).setHasGenders(undefined, 'lass'), - [TrainerType.PSYCHIC]: new TrainerConfig(++t).setHasGenders().setEncounterBgm(TrainerType.PSYCHIC), - [TrainerType.RANGER]: new TrainerConfig(++t).setEncounterBgm(TrainerType.BACKPACKER).setHasGenders(), - [TrainerType.RICH]: new TrainerConfig(++t).setName('Gentleman').setHasGenders().setSpeciesFilter(s => s.eggType1 === 'Field' || s.eggType2 === 'Field'), - [TrainerType.RICH_KID]: new TrainerConfig(++t).setName('Rich Boy').setHasGenders('Lady').setEncounterBgm(TrainerType.RICH), - [TrainerType.ROUGHNECK]: new TrainerConfig(++t).setEncounterBgm(TrainerType.ROUGHNECK).setSpeciesFilter(s => s.isOfType(Type.DARK)), - [TrainerType.SCIENTIST]: new TrainerConfig(++t).setHasGenders().setEncounterBgm(TrainerType.SCIENTIST).setSpeciesPools({ + [TrainerType.PRESCHOOLER]: new TrainerConfig(++t).setMoneyMultiplier(0.2).setEncounterBgm(TrainerType.YOUNGSTER).setHasGenders(undefined, 'lass'), + [TrainerType.PSYCHIC]: new TrainerConfig(++t).setHasGenders().setMoneyMultiplier(1.4).setEncounterBgm(TrainerType.PSYCHIC), + [TrainerType.RANGER]: new TrainerConfig(++t).setMoneyMultiplier(1.4).setEncounterBgm(TrainerType.BACKPACKER).setHasGenders(), + [TrainerType.RICH]: new TrainerConfig(++t).setMoneyMultiplier(5).setName('Gentleman').setHasGenders().setSpeciesFilter(s => s.eggType1 === 'Field' || s.eggType2 === 'Field'), + [TrainerType.RICH_KID]: new TrainerConfig(++t).setMoneyMultiplier(3.75).setName('Rich Boy').setHasGenders('Lady').setEncounterBgm(TrainerType.RICH), + [TrainerType.ROUGHNECK]: new TrainerConfig(++t).setMoneyMultiplier(1.4).setEncounterBgm(TrainerType.ROUGHNECK).setSpeciesFilter(s => s.isOfType(Type.DARK)), + [TrainerType.SCIENTIST]: new TrainerConfig(++t).setHasGenders().setMoneyMultiplier(1.7).setEncounterBgm(TrainerType.SCIENTIST).setSpeciesPools({ [TrainerPoolTier.COMMON]: [ Species.MAGNEMITE, Species.GRIMER, Species.DROWZEE, Species.VOLTORB, Species.KOFFING ], [TrainerPoolTier.UNCOMMON]: [ Species.KLINK ], [TrainerPoolTier.RARE ]: [ Species.ABRA, Species.PORYGON ], [TrainerPoolTier.SUPER_RARE ]: [ Species.OMANYTE, Species.KABUTO, Species.AERODACTYL, Species.LILEEP, Species.ANORITH, Species.CRANIDOS, Species.SHIELDON, Species.TIRTOUGA, Species.ARCHEN ] }), - [TrainerType.SMASHER]: new TrainerConfig(++t).setEncounterBgm(TrainerType.CYCLIST), - [TrainerType.SNOW_WORKER]: new TrainerConfig(++t).setName('Worker').setEncounterBgm(TrainerType.CLERK).setSpeciesFilter(s => s.isOfType(Type.ICE) || s.isOfType(Type.STEEL)), - [TrainerType.STRIKER]: new TrainerConfig(++t).setEncounterBgm(TrainerType.CYCLIST), + [TrainerType.SMASHER]: new TrainerConfig(++t).setMoneyMultiplier(1.2).setEncounterBgm(TrainerType.CYCLIST), + [TrainerType.SNOW_WORKER]: new TrainerConfig(++t).setName('Worker').setMoneyMultiplier(1.7).setEncounterBgm(TrainerType.CLERK).setSpeciesFilter(s => s.isOfType(Type.ICE) || s.isOfType(Type.STEEL)), + [TrainerType.STRIKER]: new TrainerConfig(++t).setMoneyMultiplier(1.2).setEncounterBgm(TrainerType.CYCLIST), [TrainerType.STUDENT]: new TrainerConfig(++t).setHasGenders(), - [TrainerType.SWIMMER]: new TrainerConfig(++t).setEncounterBgm(TrainerType.PARASOL_LADY).setHasGenders().setSpeciesFilter(s => s.isOfType(Type.WATER)), - [TrainerType.TWINS]: new TrainerConfig(++t).setDouble().setEncounterBgm(TrainerType.TWINS), - [TrainerType.VETERAN]: new TrainerConfig(++t).setHasGenders().setEncounterBgm(TrainerType.RICH), - [TrainerType.WAITER]: new TrainerConfig(++t).setHasGenders().setEncounterBgm(TrainerType.CLERK), - [TrainerType.WORKER]: new TrainerConfig(++t).setEncounterBgm(TrainerType.CLERK).setSpeciesFilter(s => s.isOfType(Type.ROCK) || s.isOfType(Type.STEEL)), - [TrainerType.YOUNGSTER]: new TrainerConfig(++t).setEncounterBgm(TrainerType.YOUNGSTER).setHasGenders('Lass', 'lass').setPartyTemplates(trainerPartyTemplates.TWO_WEAKER) + [TrainerType.SWIMMER]: new TrainerConfig(++t).setMoneyMultiplier(1.3).setEncounterBgm(TrainerType.PARASOL_LADY).setHasGenders().setSpeciesFilter(s => s.isOfType(Type.WATER)), + [TrainerType.TWINS]: new TrainerConfig(++t).setDouble().setMoneyMultiplier(0.65) + .setPartyTemplateFunc(scene => getWavePartyTemplate(scene, trainerPartyTemplates.TWO_WEAK, trainerPartyTemplates.FOUR_WEAK)) + .setEncounterBgm(TrainerType.TWINS), + [TrainerType.VETERAN]: new TrainerConfig(++t).setHasGenders().setMoneyMultiplier(2.5).setEncounterBgm(TrainerType.RICH), + [TrainerType.WAITER]: new TrainerConfig(++t).setHasGenders().setMoneyMultiplier(2.25).setEncounterBgm(TrainerType.CLERK), + [TrainerType.WORKER]: new TrainerConfig(++t).setEncounterBgm(TrainerType.CLERK).setMoneyMultiplier(1.7).setSpeciesFilter(s => s.isOfType(Type.ROCK) || s.isOfType(Type.STEEL)), + [TrainerType.YOUNGSTER]: new TrainerConfig(++t).setMoneyMultiplier(0.5).setEncounterBgm(TrainerType.YOUNGSTER).setHasGenders('Lass', 'lass').setPartyTemplates(trainerPartyTemplates.TWO_WEAKER) .setSpeciesPools( [ Species.CATERPIE, Species.WEEDLE, Species.RATTATA, Species.SENTRET, Species.POOCHYENA, Species.ZIGZAGOON, Species.WURMPLE, Species.BIDOOF, Species.PATRAT, Species.LILLIPUP ] ).setEncounterMessages([ @@ -693,7 +704,7 @@ export const trainerConfigs: TrainerConfigs = { $Do your best like always! I believe in you!` ]).setModifierRewardFuncs(() => modifierTypes.EXP_CHARM, () => modifierTypes.EXP_SHARE).setPartyMemberFunc(0, getRandomPartyMemberFunc([ Species.BULBASAUR, Species.CHARMANDER, Species.SQUIRTLE, Species.CHIKORITA, Species.CYNDAQUIL, Species.TOTODILE, Species.TREECKO, Species.TORCHIC, Species.MUDKIP, Species.TURTWIG, Species.CHIMCHAR, Species.PIPLUP, Species.SNIVY, Species.TEPIG, Species.OSHAWOTT ])) .setPartyMemberFunc(1, getRandomPartyMemberFunc([ Species.PIDGEY, Species.HOOTHOOT, Species.TAILLOW, Species.STARLY, Species.PIDOVE ])), - [TrainerType.RIVAL_2]: new TrainerConfig(++t).setStaticParty().setEncounterBgm(TrainerType.RIVAL).setBattleBgm('battle_rival').setPartyTemplates(trainerPartyTemplates.RIVAL_2).setEncounterMessages([ + [TrainerType.RIVAL_2]: new TrainerConfig(++t).setStaticParty().setMoneyMultiplier(1.25).setEncounterBgm(TrainerType.RIVAL).setBattleBgm('battle_rival').setPartyTemplates(trainerPartyTemplates.RIVAL_2).setEncounterMessages([ `Oh, fancy meeting you here. Looks like you're still undefeated. Right on! $I know what you're thinking, and no, I wasn't following you. I just happened to be in the area. $I'm happy for you but I just want to let you know that it's OK to lose sometimes. @@ -704,7 +715,7 @@ export const trainerConfigs: TrainerConfigs = { ]).setPartyMemberFunc(0, getRandomPartyMemberFunc([ Species.IVYSAUR, Species.CHARMELEON, Species.WARTORTLE, Species.BAYLEEF, Species.QUILAVA, Species.CROCONAW, Species.GROVYLE, Species.COMBUSKEN, Species.MARSHTOMP, Species.GROTLE, Species.MONFERNO, Species.PRINPLUP, Species.SERVINE, Species.PIGNITE, Species.DEWOTT ])) .setPartyMemberFunc(1, getRandomPartyMemberFunc([ Species.PIDGEOTTO, Species.HOOTHOOT, Species.TAILLOW, Species.STARAVIA, Species.TRANQUILL ])) .setPartyMemberFunc(2, getSpeciesFilterRandomPartyMemberFunc((species: PokemonSpecies) => !pokemonEvolutions.hasOwnProperty(species.speciesId) && !pokemonPrevolutions.hasOwnProperty(species.speciesId) && species.baseTotal >= 450)), - [TrainerType.RIVAL_3]: new TrainerConfig(++t).setStaticParty().setEncounterBgm(TrainerType.RIVAL).setBattleBgm('battle_rival').setPartyTemplates(trainerPartyTemplates.RIVAL_3).setEncounterMessages([ + [TrainerType.RIVAL_3]: new TrainerConfig(++t).setStaticParty().setMoneyMultiplier(1.5).setEncounterBgm(TrainerType.RIVAL).setBattleBgm('battle_rival').setPartyTemplates(trainerPartyTemplates.RIVAL_3).setEncounterMessages([ `Long time no see! Still haven't lost, huh.\nYou're starting to get on my nerves. Just kidding! $But really, I think it's about time you came home.\nYour family and friends miss you, you know. $I know your dream means a lot to you, but the reality is you're going to lose sooner or later. @@ -715,7 +726,7 @@ export const trainerConfigs: TrainerConfigs = { .setPartyMemberFunc(1, getRandomPartyMemberFunc([ Species.PIDGEOT, Species.NOCTOWL, Species.SWELLOW, Species.STARAPTOR, Species.UNFEZANT ])) .setPartyMemberFunc(2, getSpeciesFilterRandomPartyMemberFunc((species: PokemonSpecies) => !pokemonEvolutions.hasOwnProperty(species.speciesId) && !pokemonPrevolutions.hasOwnProperty(species.speciesId) && species.baseTotal >= 450)) .setSpeciesFilter(species => species.baseTotal >= 540), - [TrainerType.RIVAL_4]: new TrainerConfig(++t).setBoss().setStaticParty().setEncounterBgm(TrainerType.RIVAL).setBattleBgm('battle_rival_2').setPartyTemplates(trainerPartyTemplates.RIVAL_4).setEncounterMessages([ + [TrainerType.RIVAL_4]: new TrainerConfig(++t).setBoss().setStaticParty().setMoneyMultiplier(1.75).setEncounterBgm(TrainerType.RIVAL).setBattleBgm('battle_rival_2').setPartyTemplates(trainerPartyTemplates.RIVAL_4).setEncounterMessages([ `It's me! You didn't forget about me again did you? $You made it really far! I'm proud of you.\nBut it looks like it's the end of your journey. $You've awoken something in me I never knew was there.\nIt seems like all I do now is train. @@ -729,13 +740,13 @@ export const trainerConfigs: TrainerConfigs = { .setPartyMemberFunc(1, getRandomPartyMemberFunc([ Species.PIDGEOT, Species.NOCTOWL, Species.SWELLOW, Species.STARAPTOR, Species.UNFEZANT ])) .setPartyMemberFunc(2, getSpeciesFilterRandomPartyMemberFunc((species: PokemonSpecies) => !pokemonEvolutions.hasOwnProperty(species.speciesId) && !pokemonPrevolutions.hasOwnProperty(species.speciesId) && species.baseTotal >= 450)) .setSpeciesFilter(species => species.baseTotal >= 540), - [TrainerType.RIVAL_5]: new TrainerConfig(++t).setBoss().setStaticParty().setEncounterBgm(TrainerType.RIVAL).setBattleBgm('battle_rival_3').setPartyTemplates(trainerPartyTemplates.RIVAL_5).setEncounterMessages([ `…` ]).setVictoryMessages([ '…' ]) + [TrainerType.RIVAL_5]: new TrainerConfig(++t).setBoss().setStaticParty().setMoneyMultiplier(2.25).setEncounterBgm(TrainerType.RIVAL).setBattleBgm('battle_rival_3').setPartyTemplates(trainerPartyTemplates.RIVAL_5).setEncounterMessages([ `…` ]).setVictoryMessages([ '…' ]) .setPartyMemberFunc(0, getRandomPartyMemberFunc([ Species.VENUSAUR, Species.CHARIZARD, Species.BLASTOISE, Species.MEGANIUM, Species.TYPHLOSION, Species.FERALIGATR, Species.SCEPTILE, Species.BLAZIKEN, Species.SWAMPERT, Species.TORTERRA, Species.INFERNAPE, Species.EMPOLEON, Species.SERPERIOR, Species.EMBOAR, Species.SAMUROTT ])) .setPartyMemberFunc(1, getRandomPartyMemberFunc([ Species.PIDGEOT, Species.NOCTOWL, Species.SWELLOW, Species.STARAPTOR, Species.UNFEZANT ])) .setPartyMemberFunc(2, getSpeciesFilterRandomPartyMemberFunc((species: PokemonSpecies) => !pokemonEvolutions.hasOwnProperty(species.speciesId) && !pokemonPrevolutions.hasOwnProperty(species.speciesId) && species.baseTotal >= 450)) .setSpeciesFilter(species => species.baseTotal >= 540) .setPartyMemberFunc(5, getRandomPartyMemberFunc([ Species.RAYQUAZA ])), - [TrainerType.RIVAL_6]: new TrainerConfig(++t).setBoss().setStaticParty().setEncounterBgm('final').setBattleBgm('battle_rival_3').setPartyTemplates(trainerPartyTemplates.RIVAL_6) + [TrainerType.RIVAL_6]: new TrainerConfig(++t).setBoss().setStaticParty().setMoneyMultiplier(3).setEncounterBgm('final').setBattleBgm('battle_rival_3').setPartyTemplates(trainerPartyTemplates.RIVAL_6) .setPartyMemberFunc(0, getRandomPartyMemberFunc([ Species.VENUSAUR, Species.CHARIZARD, Species.BLASTOISE, Species.MEGANIUM, Species.TYPHLOSION, Species.FERALIGATR, Species.SCEPTILE, Species.BLAZIKEN, Species.SWAMPERT, Species.TORTERRA, Species.INFERNAPE, Species.EMPOLEON, Species.SERPERIOR, Species.EMBOAR, Species.SAMUROTT ])) .setPartyMemberFunc(1, getRandomPartyMemberFunc([ Species.PIDGEOT, Species.NOCTOWL, Species.SWELLOW, Species.STARAPTOR, Species.UNFEZANT ])) .setPartyMemberFunc(2, getSpeciesFilterRandomPartyMemberFunc((species: PokemonSpecies) => !pokemonEvolutions.hasOwnProperty(species.speciesId) && !pokemonPrevolutions.hasOwnProperty(species.speciesId) && species.baseTotal >= 450)) diff --git a/src/pokemon.ts b/src/pokemon.ts index 7587ab748..ccc6fbc6e 100644 --- a/src/pokemon.ts +++ b/src/pokemon.ts @@ -165,7 +165,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { this.fieldPosition = FieldPosition.CENTER; - scene.fieldUI.add(this.battleInfo); + scene.fieldUI.addAt(this.battleInfo, 0); this.battleInfo.initInfo(this); @@ -684,6 +684,11 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { showInfo() { if (!this.battleInfo.visible) { + const otherBattleInfo = this.scene.fieldUI.getAll().slice(0, 4).filter(ui => ui instanceof BattleInfo && ((ui as BattleInfo) instanceof PlayerBattleInfo) === this.isPlayer()).find(() => true); + if (!otherBattleInfo || !this.getFieldIndex()) + this.scene.fieldUI.sendToBack(this.battleInfo); + else + this.scene.fieldUI.moveAbove(this.battleInfo, otherBattleInfo); this.battleInfo.setX(this.battleInfo.x + (this.isPlayer() ? 150 : -150)); this.battleInfo.setVisible(true); this.scene.tweens.add({ diff --git a/src/system/game-data.ts b/src/system/game-data.ts index 626710831..efda3cc74 100644 --- a/src/system/game-data.ts +++ b/src/system/game-data.ts @@ -34,6 +34,7 @@ interface SessionSaveData { enemyModifiers: PersistentModifierData[]; arena: ArenaData; pokeballCounts: PokeballCounts; + money: integer; waveIndex: integer; battleType: BattleType; trainer: TrainerData; @@ -173,6 +174,7 @@ export class GameData { enemyModifiers: scene.findModifiers(() => true, false).map(m => new PersistentModifierData(m, false)), arena: new ArenaData(scene.arena), pokeballCounts: scene.pokeballCounts, + money: scene.money, waveIndex: scene.currentBattle.waveIndex, battleType: scene.currentBattle.battleType, trainer: scene.currentBattle.battleType == BattleType.TRAINER ? new TrainerData(scene.currentBattle.trainer) : null, @@ -244,6 +246,9 @@ export class GameData { scene.pokeballCounts[key] = sessionData.pokeballCounts[key] || 0; }); + scene.money = sessionData.money || 0; + scene.updateMoneyText(); + // TODO: Remove this if (sessionData.enemyField) sessionData.enemyParty = sessionData.enemyField; diff --git a/src/ui/modifier-select-ui-handler.ts b/src/ui/modifier-select-ui-handler.ts index 45db56e7a..4a6a8408e 100644 --- a/src/ui/modifier-select-ui-handler.ts +++ b/src/ui/modifier-select-ui-handler.ts @@ -1,15 +1,16 @@ import BattleScene, { Button } from "../battle-scene"; -import { ModifierTier, ModifierTypeOption } from "../modifier/modifier-type"; +import { ModifierTypeOption } from "../modifier/modifier-type"; import { getPokeballAtlasKey, PokeballType } from "../data/pokeball"; -import { addTextObject, getModifierTierTextTint, TextStyle } from "./text"; +import { addTextObject, getModifierTierTextTint, getTextColor, TextStyle } from "./text"; import AwaitableUiHandler from "./awaitable-ui-handler"; import { Mode } from "./ui"; import { PokemonHeldItemModifier } from "../modifier/modifier"; export default class ModifierSelectUiHandler extends AwaitableUiHandler { - private overlayBg: Phaser.GameObjects.Rectangle; private modifierContainer: Phaser.GameObjects.Container; + private rerollButtonContainer: Phaser.GameObjects.Container; private transferButtonContainer: Phaser.GameObjects.Container; + private rerollCostText: Phaser.GameObjects.Text; private lastCursor: integer = 0; private player: boolean; @@ -26,13 +27,6 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler { setup() { const ui = this.getUi(); - - const overlayWidth = this.scene.game.canvas.width / 6; - const overlayHeight = (this.scene.game.canvas.height / 6) - 48; - this.overlayBg = this.scene.add.rectangle(0, overlayHeight * -1 - 48, overlayWidth, overlayHeight, 0x424242); - this.overlayBg.setOrigin(0, 0); - this.overlayBg.setAlpha(0); - ui.add(this.overlayBg); this.modifierContainer = this.scene.add.container(0, 0); ui.add(this.modifierContainer); @@ -44,18 +38,31 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler { const transferButtonText = addTextObject(this.scene, -4, -2, 'Transfer', TextStyle.PARTY); transferButtonText.setOrigin(1, 0); this.transferButtonContainer.add(transferButtonText); + + this.rerollButtonContainer = this.scene.add.container(16, -64); + this.rerollButtonContainer.setVisible(false); + ui.add(this.rerollButtonContainer); + + const rerollButtonText = addTextObject(this.scene, -4, -2, 'Reroll', TextStyle.PARTY); + rerollButtonText.setOrigin(0, 0); + this.rerollButtonContainer.add(rerollButtonText); + + this.rerollCostText = addTextObject(this.scene, 0, 0, '', TextStyle.MONEY); + this.rerollCostText.setOrigin(0, 0); + this.rerollCostText.setPositionRelative(rerollButtonText, rerollButtonText.displayWidth + 5, 1); + this.rerollButtonContainer.add(this.rerollCostText); } show(args: any[]) { if (this.active) { - if (args.length === 3) { + if (args.length >= 3) { this.awaitingActionInput = true; this.onActionInput = args[2]; } return; } - if (args.length !== 3 || !(args[1] instanceof Array) || !args[1].length || !(args[2] instanceof Function)) + if (args.length !== 4 || !(args[1] instanceof Array) || !args[1].length || !(args[2] instanceof Function)) return; super.show(args); @@ -69,6 +76,11 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler { this.transferButtonContainer.setVisible(false); this.transferButtonContainer.setAlpha(0); + this.rerollButtonContainer.setVisible(false); + this.rerollButtonContainer.setAlpha(0); + + this.updateRerollCostText(args[3] as integer); + const typeOptions = args[1] as ModifierTypeOption[]; for (let m = 0; m < typeOptions.length; m++) { const sliceWidth = (this.scene.game.canvas.width / 6) / (typeOptions.length + 2); @@ -81,12 +93,7 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler { const hasUpgrade = typeOptions.filter(to => to.upgraded).length; - this.scene.tweens.add({ - targets: this.overlayBg, - alpha: 0.5, - ease: 'Sine.easeOut', - duration: 750 - }); + this.scene.showFieldOverlay(750); let i = 0; @@ -114,6 +121,16 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler { }); } + if (this.scene.currentBattle.waveIndex % 10) { + this.rerollButtonContainer.setAlpha(0); + this.rerollButtonContainer.setVisible(true); + this.scene.tweens.add({ + targets: this.rerollButtonContainer, + alpha: 1, + duration: 250 + }); + } + this.setCursor(0); this.awaitingActionInput = true; this.onActionInput = args[2]; @@ -134,7 +151,10 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler { const originalOnActionInput = this.onActionInput; this.awaitingActionInput = false; this.onActionInput = null; - originalOnActionInput(this.cursor); + if (!originalOnActionInput(this.cursor)) { + this.awaitingActionInput = true; + this.onActionInput = originalOnActionInput; + } } } else if (button === Button.CANCEL) { if (this.player) { @@ -149,20 +169,24 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler { } else { switch (button) { case Button.UP: - if (this.cursor === this.options.length) - success = this.setCursor(this.lastCursor); + if (this.cursor >= this.options.length) + success = this.setCursor(this.lastCursor < this.options.length ? this.lastCursor : this.cursor - this.options.length ? this.options.length - 1 : 0); break; case Button.DOWN: - if (this.cursor < this.options.length && this.transferButtonContainer.visible) - success = this.setCursor(this.options.length); + if (this.cursor < this.options.length && (this.rerollButtonContainer.visible || this.transferButtonContainer.visible)) { + const isLeftOption = this.cursor <= Math.floor(this.options.length / 2); + success = this.setCursor(this.options.length + (this.rerollButtonContainer.visible && (isLeftOption || !this.transferButtonContainer.visible) ? 0 : 1)); + } break; case Button.LEFT: - if (this.cursor) - success = this.setCursor(this.cursor - 1); + if ((this.cursor || this.rerollButtonContainer.visible) && this.cursor !== this.options.length) + success = this.setCursor(this.cursor ? this.cursor - 1 : this.options.length); break; case Button.RIGHT: - if (this.cursor < this.options.length - (this.transferButtonContainer.visible ? 0 : 1)) + if (this.cursor < this.options.length - 1) success = this.setCursor(this.cursor + 1); + else if (this.cursor === this.options.length && this.transferButtonContainer.visible) + success = this.setCursor(this.options.length + 1); break; } } @@ -191,6 +215,9 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler { const sliceWidth = (this.scene.game.canvas.width / 6) / (this.options.length + 2); this.cursorObj.setPosition(sliceWidth * (cursor + 1) + (sliceWidth * 0.5) - 20, -this.scene.game.canvas.height / 12 - 20); ui.showText(this.options[this.cursor].modifierTypeOption.type.description); + } else if (cursor === this.options.length) { + this.cursorObj.setPosition(6, -60); + ui.showText('Spend money to reroll your item options'); } else { this.cursorObj.setPosition((this.scene.game.canvas.width / 6) - 50, -60); ui.showText('Transfer a held item from one Pokémon to another instead of selecting an item'); @@ -199,6 +226,14 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler { return ret; } + updateRerollCostText(rerollCost: integer): void { + const canReroll = this.scene.money >= rerollCost; + + this.rerollCostText.setText(`₽${rerollCost.toLocaleString('en-US')}`); + this.rerollCostText.setColor(getTextColor(canReroll ? TextStyle.MONEY : TextStyle.PARTY_RED)); + this.rerollCostText.setShadowColor(getTextColor(canReroll ? TextStyle.MONEY : TextStyle.PARTY_RED, true)); + } + clear() { super.clear(); @@ -207,29 +242,34 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler { this.getUi().clearText(); this.eraseCursor(); + this.scene.hideFieldOverlay(250); + + const options = this.options.slice(0); + this.options.splice(0, this.options.length); + this.scene.tweens.add({ - targets: this.overlayBg, - alpha: 0, - duration: 250, - ease: 'Cubic.easeIn' - }); - this.scene.tweens.add({ - targets: this.options, + targets: options, scale: 0.01, duration: 250, ease: 'Cubic.easeIn', - onComplete: () => { - this.options.forEach(o => o.destroy()); - this.options.splice(0, this.options.length); - } + onComplete: () => options.forEach(o => o.destroy()) }); + if (this.transferButtonContainer.visible) { this.scene.tweens.add({ - targets: this.transferButtonContainer, + targets: [ this.rerollButtonContainer, this.transferButtonContainer ], alpha: 0, duration: 250, ease: 'Cubic.easeIn', - onComplete: () => this.transferButtonContainer.setVisible(false) + onComplete: () => { + if (!this.options.length) { + this.rerollButtonContainer.setVisible(false); + this.transferButtonContainer.setVisible(false); + } else { + this.rerollButtonContainer.setAlpha(1); + this.transferButtonContainer.setAlpha(1); + } + } }) } }