mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-26 09:19:31 +02:00
parent
ba491391b4
commit
2be673463d
@ -131,6 +131,7 @@ 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;
|
||||
@ -1288,7 +1289,9 @@ export default class BattleScene extends SceneBase {
|
||||
|
||||
doShinyCheck() {
|
||||
this.waveShinyChecked = true;
|
||||
this.waveShinyFlag = runShinyCheck(this, 1, this.currentBattle.waveIndex);
|
||||
var r = runShinyCheck(this, 1, this.currentBattle.waveIndex)
|
||||
this.waveShinyFlag = r[0] as boolean;
|
||||
this.waveShinyMinToBreak = r[1] as integer;
|
||||
if (this.waveShinyFlag) {
|
||||
this.arenaFlyout.display2()
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -3368,6 +3368,9 @@ 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()
|
||||
|
||||
@ -6770,6 +6773,7 @@ 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);
|
||||
@ -6788,13 +6792,15 @@ 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;
|
||||
return [isOk, minLuck];
|
||||
}
|
||||
/**
|
||||
* Simulates modifier rolls for as many rerolls as you can afford, checking to see if shiny luck will alter your results.
|
||||
@ -6802,6 +6808,7 @@ 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 {
|
||||
@ -6809,8 +6816,18 @@ export function runShinyCheck(scene: BattleScene, mode: integer, wv?: integer) {
|
||||
}
|
||||
const predictionCost = new Utils.IntegerHolder(0)
|
||||
var isOk = true;
|
||||
for (var i = 0; isOk && predictionCost.value < scene.money && i < 20; i++) {
|
||||
isOk = isOk && shinyCheckStep(scene, predictionCost, i)
|
||||
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))
|
||||
}
|
||||
}
|
||||
if (mode == 1) {
|
||||
scene.restoreSeed(wv)
|
||||
@ -6820,7 +6837,10 @@ export function runShinyCheck(scene: BattleScene, mode: integer, wv?: integer) {
|
||||
if (!isOk) {
|
||||
console.log("Conflict found!")
|
||||
}
|
||||
return isOk
|
||||
if (minLuck == 15) {
|
||||
//minLuck = 0
|
||||
}
|
||||
return [isOk, minLuck]
|
||||
}
|
||||
export class SelectModifierPhase extends BattlePhase {
|
||||
private rerollCount: integer;
|
||||
|
@ -15,6 +15,7 @@ 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 {
|
||||
@ -95,6 +96,7 @@ 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 */
|
||||
@ -198,26 +200,38 @@ 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`));
|
||||
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("pointerout", () => (this.scene as BattleScene).ui.hideTooltip());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user