From 2e388475a1765d58d2369aeb858aaa33150caff1 Mon Sep 17 00:00:00 2001 From: RedstonewolfX <108761527+RedstonewolfX@users.noreply.github.com> Date: Sun, 11 Aug 2024 14:24:48 -0400 Subject: [PATCH] One last reroll predictions update The arena flyout now shows whether or not Shiny Pokemon in your party will affect the shop rewards Fixed some bugs with reroll listing and luck-based item predictions --- src/battle-scene.ts | 3 +++ src/modifier/modifier-type.ts | 4 ++-- src/phases.ts | 19 ++++++++++++------- src/ui/arena-flyout.ts | 7 +++++++ 4 files changed, 24 insertions(+), 9 deletions(-) diff --git a/src/battle-scene.ts b/src/battle-scene.ts index d35d73a4272..e0c19edb16b 100644 --- a/src/battle-scene.ts +++ b/src/battle-scene.ts @@ -1286,6 +1286,9 @@ export default class BattleScene extends SceneBase { doShinyCheck() { this.waveShinyChecked = true; this.waveShinyFlag = runShinyCheck(this, 1, this.currentBattle.waveIndex); + if (this.waveShinyFlag) { + this.arenaFlyout.display2() + } } newBattle(waveIndex?: integer, battleType?: BattleType, trainerData?: TrainerData, double?: boolean): Battle { diff --git a/src/modifier/modifier-type.ts b/src/modifier/modifier-type.ts index e33e69aa57f..3bd05690f24 100644 --- a/src/modifier/modifier-type.ts +++ b/src/modifier/modifier-type.ts @@ -2356,12 +2356,12 @@ function getItemIndex(thresholds, tier) { * @param party The player's party, used for generating some specific items * @returns An item name, or `[Failed to generate]` if a `ModifierTypeGenerator` was rolled, but no item was available to generate (It won't retry) */ -function getModifierTypeSimulated(pool, tier, index, party) { +function getModifierTypeSimulated(pool, tier, index, party): string { let modifierType: ModifierType = (pool[tier][index]).modifierType; if (modifierType instanceof ModifierTypeGenerator) { modifierType = (modifierType as ModifierTypeGenerator).generateType(party); if (modifierType === null) { - return "[Failed to generate]" + return ((pool[tier][index]).modifierType as ModifierType).identifier } } return modifierType.name; diff --git a/src/phases.ts b/src/phases.ts index 1f3eea91d2c..0f966aef605 100644 --- a/src/phases.ts +++ b/src/phases.ts @@ -18,7 +18,7 @@ import { Phase } from "./phase"; import { BattleStat, getBattleStatLevelChangeDescription, getBattleStatName } from "./data/battle-stat"; import { biomeLinks, getBiomeName } from "./data/biomes"; import { ModifierTier } from "./modifier/modifier-tier"; -import { FusePokemonModifierType, ModifierPoolType, ModifierType, ModifierTypeFunc, ModifierTypeOption, PokemonModifierType, PokemonMoveModifierType, PokemonPpRestoreModifierType, PokemonPpUpModifierType, RememberMoveModifierType, TmModifierType, getDailyRunStarterModifiers, getEnemyBuffModifierForWave, getModifierType, getPlayerModifierTypeOptions, getPlayerShopModifierTypeOptionsForWave, modifierTypes, regenerateModifierPoolThresholds } from "./modifier/modifier-type"; +import { FusePokemonModifierType, ModifierPoolType, ModifierType, ModifierTypeFunc, ModifierTypeOption, PokemonModifierType, PokemonMoveModifierType, PokemonPpRestoreModifierType, PokemonPpUpModifierType, RememberMoveModifierType, TmModifierType, getDailyRunStarterModifiers, getEnemyBuffModifierForWave, getLuckString, getModifierType, getPartyLuckValue, getPlayerModifierTypeOptions, getPlayerShopModifierTypeOptionsForWave, modifierTypes, regenerateModifierPoolThresholds } from "./modifier/modifier-type"; import SoundFade from "phaser3-rex-plugins/plugins/soundfade"; import { BattlerTagLapseType, CenterOfAttentionTag, EncoreTag, ProtectedTag, SemiInvulnerableTag, TrappedTag } from "./data/battler-tags"; import { getPokemonMessage, getPokemonNameWithAffix } from "./messages"; @@ -6865,7 +6865,7 @@ export class SelectModifierPhase extends BattlePhase { if (!this.rerollCount) { this.updateSeed(); - console.log("\n\nPerforming reroll prediction\n\n") + console.log("\n\nPerforming reroll prediction\n\n\n") this.predictionCost = 0 for (var idx = 0; idx < 10 && this.predictionCost < this.scene.money; idx++) { this.generateSelection(idx) @@ -7087,17 +7087,22 @@ export class SelectModifierPhase extends BattlePhase { mp.forEach((m, i) => { console.log(" " + m.type.name) if (m.alternates) { + let showedLuckFlag = false for (var j = 0, currentTier = m.type.tier; j < m.alternates.length; j++) { if (m.alternates[j] > currentTier) { currentTier = m.alternates[j] if (m.advancedAlternates) { - if (m.advancedAlternates[j] != "[Failed to generate]") { - console.log(" At " + j + " luck: " + tierNames[currentTier] + "-tier item (failed to generate item from ModifierGenerator)") - } else { - console.log(" At " + j + " luck: " + m.advancedAlternates[j]) + if (!showedLuckFlag) { + showedLuckFlag = true + console.log(" Your luck: " + getPartyLuckValue(party) + " (" + getLuckString(getPartyLuckValue(party)) + ")") } + console.log(" At " + j + " luck (" + getLuckString(j) + "): " + m.advancedAlternates[j]) } else { - console.log(" At " + j + " luck: " + tierNames[currentTier] + "-tier item (failed to generate item)") + if (!showedLuckFlag) { + showedLuckFlag = true + console.log(" Your luck: " + getPartyLuckValue(party) + " (" + getLuckString(getPartyLuckValue(party)) + ")") + } + console.log(" At " + j + " luck (" + getLuckString(j) + "): " + tierNames[currentTier] + "-tier item (failed to generate item)") } } } diff --git a/src/ui/arena-flyout.ts b/src/ui/arena-flyout.ts index 0b9ab9c0ab7..f9c3e4d8b2e 100644 --- a/src/ui/arena-flyout.ts +++ b/src/ui/arena-flyout.ts @@ -281,6 +281,13 @@ export class ArenaFlyout extends Phaser.GameObjects.Container { this.flyoutTextPlayer.text += ", Sp.D: " + poke[i].ivs[4] this.flyoutTextPlayer.text += ", Speed: " + poke[i].ivs[5] + "\n\n" } + if (poke.length < 2) { + this.flyoutTextEnemy.text += "\n" + } + if (poke.length < 1) { + this.flyoutTextEnemy.text += "\n\n" + } + this.flyoutTextEnemy.text += ((this.scene as BattleScene).waveShinyChecked ? ((this.scene as BattleScene).waveShinyFlag ? "Shiny Luck: OK" : "Shiny Pokemon will change this floor's shop!") : "Shiny Luck: Not checked") } public printIVs() {