diff --git a/src/battle-scene.ts b/src/battle-scene.ts index 6ef5e1a18c0..4f9d10cf40b 100644 --- a/src/battle-scene.ts +++ b/src/battle-scene.ts @@ -131,7 +131,6 @@ export default class BattleScene extends SceneBase { public disableDailyShinies: boolean = true; // Disables shiny luck in Daily Runs to prevent affecting RNG public quickloadDisplayMode: string = "Dailies"; public waveShinyFlag: boolean = false; - public waveShinyMinToBreak: integer = 0; public waveShinyChecked: boolean = false; public tempWaveSeed: string; public tempRngCounter: integer = 0; @@ -1289,9 +1288,7 @@ export default class BattleScene extends SceneBase { doShinyCheck() { this.waveShinyChecked = true; - var r = runShinyCheck(this, 1, this.currentBattle.waveIndex) - this.waveShinyFlag = r[0] as boolean; - this.waveShinyMinToBreak = r[1] as integer; + this.waveShinyFlag = runShinyCheck(this, 1, this.currentBattle.waveIndex); if (this.waveShinyFlag) { this.arenaFlyout.display2() } diff --git a/src/data/move.ts b/src/data/move.ts index c7701e4bcb9..ef3418a3f66 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -1958,8 +1958,8 @@ export class StealHeldItemChanceAttr extends MoveEffectAttr { console.error("Reload discrepancy: Succeeds now, but fails after reload") LoggerTools.flagReset(user.scene, user.scene.currentBattle.waveIndex) } - //*/ - + */ + if (rand >= this.chance) { return resolve(false); } diff --git a/src/phases.ts b/src/phases.ts index a4847984e22..76e362ac9a8 100644 --- a/src/phases.ts +++ b/src/phases.ts @@ -186,9 +186,9 @@ function findBest(scene: BattleScene, pokemon: EnemyPokemon, override?: boolean) } }) if (func_output != "") { - //return func_output + return func_output } - //return "Can't catch" + return "Can't catch" var n = "" switch (rates2[0]) { case rates[0]: @@ -215,7 +215,7 @@ function findBest(scene: BattleScene, pokemon: EnemyPokemon, override?: boolean) return "No balls" } } - //return n + " (FAIL)" + return n + " (FAIL)" return n + Math.round(rates2[0] * 100) + "%"; } export function parseSlotData(slotId: integer): SessionSaveData { @@ -2901,7 +2901,7 @@ export class TurnInitPhase extends FieldPhase { LoggerTools.enemyPlan[2] = "" LoggerTools.enemyPlan[3] = "" - if (true) { + if (false) { this.scene.getField().forEach((pokemon, i) => { if (pokemon?.isActive()) { if (pokemon.isPlayer()) { @@ -3302,8 +3302,8 @@ export class EnemyCommandPhase extends FieldPhase { console.log(enemyPokemon.name + " selects:", "Switch to " + this.scene.getEnemyParty()[index].name) battle.enemySwitchCounter++; - //LoggerTools.enemyPlan[this.fieldIndex*2] = "Switching out" - //LoggerTools.enemyPlan[this.fieldIndex*2 + 1] = "→ " + this.scene.getEnemyParty()[index].name + LoggerTools.enemyPlan[this.fieldIndex*2] = "Switching out" + LoggerTools.enemyPlan[this.fieldIndex*2 + 1] = "→ " + this.scene.getEnemyParty()[index].name enemyPokemon.flyout.setText() @@ -3357,8 +3357,8 @@ export class EnemyCommandPhase extends FieldPhase { console.log(enemyPokemon.name + " selects:", mv.getName() + " → " + nextMove.targets.map((m) => targetLabels[m + 1])) this.scene.currentBattle.enemySwitchCounter = Math.max(this.scene.currentBattle.enemySwitchCounter - 1, 0); - //LoggerTools.enemyPlan[this.fieldIndex*2] = mv.getName() - //LoggerTools.enemyPlan[this.fieldIndex*2 + 1] = "→ " + nextMove.targets.map((m) => targetLabels[m + 1]) + LoggerTools.enemyPlan[this.fieldIndex*2] = mv.getName() + LoggerTools.enemyPlan[this.fieldIndex*2 + 1] = "→ " + nextMove.targets.map((m) => targetLabels[m + 1]) this.scene.arenaFlyout.updateFieldText() var txt = ["Turn: " + this.scene.currentBattle.turn] @@ -3368,9 +3368,6 @@ export class EnemyCommandPhase extends FieldPhase { txt = txt.concat(findBest(this.scene, pk)) }) } - if (txt.length > 2) { - txt = ["Turn: " + this.scene.currentBattle.turn] - } this.scene.arenaFlyout.updateFieldText() @@ -6773,7 +6770,6 @@ const tierNames = [ * @returns */ export function shinyCheckStep(scene: BattleScene, predictionCost: Utils.IntegerHolder, rerollOverride: integer, modifierOverride?: integer) { - var minLuck = -1 var modifierPredictions = [] const party = scene.getParty(); regenerateModifierPoolThresholds(party, ModifierPoolType.PLAYER, rerollOverride); @@ -6792,15 +6788,13 @@ export function shinyCheckStep(scene: BattleScene, predictionCost: Utils.Integer //lastTier = option.alternates[i] //console.log("Conflict found! (" + i + " luck, " + rerollOverride + " rolls, item " + (idx + 1) + ")") isOk = false // Shiny Luck affects this wave in some way - if (minLuck == -1 && i != 0) - minLuck = i } } } }) modifierPredictions.push(typeOptions) predictionCost.value += (Math.min(Math.ceil(scene.currentBattle.waveIndex / 10) * 250 * Math.pow(2, rerollOverride), Number.MAX_SAFE_INTEGER)) - return [isOk, minLuck]; + return isOk; } /** * Simulates modifier rolls for as many rerolls as you can afford, checking to see if shiny luck will alter your results. @@ -6808,7 +6802,6 @@ export function shinyCheckStep(scene: BattleScene, predictionCost: Utils.Integer * @returns `true` if no changes were detected, `false` otherwise */ export function runShinyCheck(scene: BattleScene, mode: integer, wv?: integer) { - var minLuck: integer = -1 if (mode == 1) { scene.emulateReset(wv) } else { @@ -6816,18 +6809,8 @@ export function runShinyCheck(scene: BattleScene, mode: integer, wv?: integer) { } const predictionCost = new Utils.IntegerHolder(0) var isOk = true; - for (var i = 0; predictionCost.value < scene.money && i < 8; i++) { - var r = shinyCheckStep(scene, predictionCost, i) - isOk = isOk && (r[0] as boolean) - if (isOk || (r[1] as integer) === -1) { - // Do nothing - } else if (minLuck == -1) { - minLuck = (r[1] as integer) - console.log("Luck " + r[1] + " breaks") - } else { - console.log("Updated from " + minLuck + " to " + Math.min(minLuck, (r[1] as integer))) - minLuck = Math.min(minLuck, (r[1] as integer)) - } + for (var i = 0; isOk && predictionCost.value < scene.money && i < 20; i++) { + isOk = isOk && shinyCheckStep(scene, predictionCost, i) } if (mode == 1) { scene.restoreSeed(wv) @@ -6837,10 +6820,7 @@ export function runShinyCheck(scene: BattleScene, mode: integer, wv?: integer) { if (!isOk) { console.log("Conflict found!") } - if (minLuck == 15) { - //minLuck = 0 - } - return [isOk, minLuck] + return isOk } export class SelectModifierPhase extends BattlePhase { private rerollCount: integer; diff --git a/src/ui/arena-flyout.ts b/src/ui/arena-flyout.ts index 9eec0768c90..c8548dc7f13 100644 --- a/src/ui/arena-flyout.ts +++ b/src/ui/arena-flyout.ts @@ -15,7 +15,6 @@ import * as LoggerTools from "../logger" import { BattleEndPhase } from "#app/phases.js"; import { Gender } from "#app/data/gender.js"; import { getBiomeName } from "#app/data/biomes.js"; -import { getLuckString } from "#app/modifier/modifier-type.js"; /** Enum used to differentiate {@linkcode Arena} effects */ enum ArenaEffectType { @@ -96,7 +95,6 @@ export class ArenaFlyout extends Phaser.GameObjects.Container { private flyoutTextField: Phaser.GameObjects.Text; private shinyCharmIcon: Phaser.GameObjects.Sprite; - private shinyCharmLuckCount: Phaser.GameObjects.Text; public shinyState: integer = 0; /** Container for all field effects observed by this object */ @@ -200,38 +198,26 @@ export class ArenaFlyout extends Phaser.GameObjects.Container { this.shinyCharmIcon.setScale(0.4) this.shinyCharmIcon.setInteractive(new Phaser.Geom.Rectangle(2, 2, 26, 27), Phaser.Geom.Rectangle.Contains); this.flyoutContainer.add(this.shinyCharmIcon) - - this.shinyCharmLuckCount = addTextObject(this.scene, this.flyoutWidth - 9, 5, "?", TextStyle.BATTLE_INFO); - this.shinyCharmLuckCount.setLineSpacing(-1); - this.shinyCharmLuckCount.setFontSize(40); - this.shinyCharmLuckCount.setAlign("center"); - this.shinyCharmLuckCount.setOrigin(0, 0); - this.flyoutContainer.add(this.shinyCharmLuckCount) } doShinyCharmTooltip() { if ((this.scene as BattleScene).currentBattle.waveIndex % 10 == 0) { this.shinyCharmIcon.setVisible(false) - this.shinyCharmLuckCount.setVisible(false) return; } this.shinyCharmIcon.setVisible(true) - this.shinyCharmLuckCount.setVisible(true) if (true) { // this.shinyCharmIcon.visible this.shinyCharmIcon.removeAllListeners() if (!(this.scene as BattleScene).waveShinyChecked) { this.shinyCharmIcon.setVisible(false) - this.shinyCharmLuckCount.setVisible(false) return; //this.shinyCharmIcon.on("pointerover", () => (this.scene as BattleScene).ui.showTooltip(null, `???`)); } else if ((this.scene as BattleScene).waveShinyFlag) { this.shinyCharmIcon.clearTint() this.shinyCharmIcon.on("pointerover", () => (this.scene as BattleScene).ui.showTooltip(null, `Shinies are OK`)); - this.shinyCharmLuckCount.setVisible(false) } else { this.shinyCharmIcon.setTintFill(0x000000) - this.shinyCharmIcon.on("pointerover", () => (this.scene as BattleScene).ui.showTooltip(null, `Shinies change shop with luck ${(this.scene as BattleScene).waveShinyMinToBreak} or higher`)); - this.shinyCharmLuckCount.text = getLuckString((this.scene as BattleScene).waveShinyMinToBreak) + this.shinyCharmIcon.on("pointerover", () => (this.scene as BattleScene).ui.showTooltip(null, `Shinies change shop`)); } this.shinyCharmIcon.on("pointerout", () => (this.scene as BattleScene).ui.hideTooltip()); } diff --git a/src/ui/battle-flyout.ts b/src/ui/battle-flyout.ts index 6d50c4aa446..443ca594561 100644 --- a/src/ui/battle-flyout.ts +++ b/src/ui/battle-flyout.ts @@ -126,7 +126,6 @@ export default class BattleFlyout extends Phaser.GameObjects.Container { /** Sets and formats the text property for all {@linkcode Phaser.GameObjects.Text} in the flyoutText array */ setText(highlight?: integer) { - highlight = undefined // Disable move highlighting - for now, it shows what the pokemon used last turn, which is confusing var e = this.battleScene.getEnemyField() console.log(this.moveInfo.map(v => v.move.name)) for (let i = 0; i < this.flyoutText.length; i++) {