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
This commit is contained in:
RedstonewolfX 2024-08-11 14:24:48 -04:00
parent 8caf853b8d
commit 2e388475a1
4 changed files with 24 additions and 9 deletions

View File

@ -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 {

View File

@ -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;

View File

@ -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)")
}
}
}

View File

@ -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() {