Luck info stored in logs

Logs now store the highest luck value that doesn't cause any shops to break (this is not the lowest playable luck, though)

They also store the earliest (theoretical) wave in which you can go the rest of a run without a certain luck value breaking your shop (note that this doesn't have very advanced logic, and you may get lucky anyways)

Fixes a bug with teams display
This commit is contained in:
RedstonewolfX 2024-08-14 14:17:35 -04:00
parent 465af8d7a4
commit 86dbf56009
5 changed files with 30 additions and 16 deletions

View File

@ -1295,6 +1295,7 @@ export default class BattleScene extends SceneBase {
if (this.waveShinyFlag) {
this.arenaFlyout.display2()
}
LoggerTools.logLuck(this)
}
newBattle(waveIndex?: integer, battleType?: BattleType, trainerData?: TrainerData, double?: boolean): Battle {

View File

@ -1676,20 +1676,22 @@ export function logPlayerTeam(scene: BattleScene) {
localStorage.setItem(getLogID(scene), JSON.stringify(drpd))
}
/**
* TODO
*
* Checks the minimum luck that will break this floor's shop.
* Checks the minimum luck that will break this floor's shop, and updates the appropriate values.
* @param scene The BattleScene.
*/
export function logLuck(scene: BattleScene) {
var drpd = getDRPD(scene)
console.log(`Logging player starters: ${scene.getParty().map(p => p.name).join(", ")}`)
var P = scene.getParty()
for (var i = 0; i < P.length; i++) {
drpd.starters[i] = exportPokemon(P[i])
if (scene.waveShinyMinToBreak > 0) {
console.log(`Logging luck stats`)
drpd.maxluck = Math.min(drpd.maxluck, scene.waveShinyMinToBreak - 1)
for (var i = scene.waveShinyMinToBreak; i <= 14; i++) {
drpd.minSafeLuckFloor[i] = Math.max(drpd.minSafeLuckFloor[i], scene.currentBattle.waveIndex)
}
console.log("--> ", drpd)
localStorage.setItem(getLogID(scene), JSON.stringify(drpd))
} else {
console.log(`Skipped logging luck stats: Luck has no effect on this floor`)
}
console.log("--> ", drpd)
localStorage.setItem(getLogID(scene), JSON.stringify(drpd))
}
/**
* Logs a wild Pokémon to a wave's data.

View File

@ -2359,9 +2359,11 @@ function getItemIndex(thresholds, tier) {
function getModifierTypeSimulated(pool, tier, index, party): string {
let modifierType: ModifierType = (pool[tier][index]).modifierType;
if (modifierType instanceof ModifierTypeGenerator) {
modifierType.getDescription
modifierType = (modifierType as ModifierTypeGenerator).generateType(party);
if (modifierType === null) {
return ((pool[tier][index]).modifierType as ModifierType).identifier
return "[nothing generated]"
return ((pool[tier][index]).modifierType as ModifierType).name
}
}
return modifierType.name;

View File

@ -2903,12 +2903,15 @@ export class TurnInitPhase extends FieldPhase {
if (true) {
this.scene.getField().forEach((pokemon, i) => {
if (pokemon != undefined && pokemon != null)
console.log("Handle " + pokemon.name)
if (pokemon?.isActive()) {
if (pokemon.isPlayer()) {
this.scene.currentBattle.addParticipant(pokemon as PlayerPokemon);
} else {
pokemon.flyout.setText()
console.log("Marked " + pokemon.name + " as used")
pokemon.usedInBattle = true;
pokemon.flyout.setText()
pokemon.getBattleInfo().iconsActive = true
}
pokemon.resetTurnData();

View File

@ -551,6 +551,7 @@ export default class BattleInfo extends Phaser.GameObjects.Container {
} else {
P = party
}
console.log("Updating ball icons for party (Pokemon: " + P.length + ")", P)
var staticparty = (this.scene as BattleScene).getEnemyParty()
var states = new Array(6)
for (var i = 0; i < 6; i++) {
@ -562,8 +563,12 @@ export default class BattleInfo extends Phaser.GameObjects.Container {
states[i] = "ball"
if (!P[i].hp) {
states[i] = "faint"
console.log(P[i].name + " - fainted")
} else if (P[i].status) {
states[i] = (this.scene as BattleScene).showTeamSprites ? "ball" : "status"
console.log(P[i].name + " - ball (status condition)")
} else {
console.log(P[i].name + " - ball")
}
if (P[i].isOnField()) {
//console.log(P[i].name + " is in battle; set it as seen")
@ -571,9 +576,10 @@ export default class BattleInfo extends Phaser.GameObjects.Container {
}
if (P[i].usedInBattle) total_visible++;
//console.log(P[i].name, P[i].getIconAtlasKey(true))
} else {
console.log("[undefined]: empty")
}
}
console.log("Updating ball icons for party (" + P.length + ")")
if (staticparty.length > 0) {
for (var i = 0; i < staticparty.length; i++) {
//console.log(i, staticparty[i].name)
@ -991,10 +997,10 @@ export default class BattleInfo extends Phaser.GameObjects.Container {
targets: this.teamIconOver,
duration: Utils.fixedInt(125),
ease: "Sine.easeInOut",
alphaTopLeft: visible ? 0.4 : 0,
alphaTopRight: visible ? 0.4 : 0,
alphaBottomLeft: visible ? 0.7 : 0,
alphaBottomRight: visible ? 0.7 : 0,
alphaTopLeft: !this.teamIconsShow ? 0 : (visible ? 0.4 : 0),
alphaTopRight: !this.teamIconsShow ? 0 : (visible ? 0.4 : 0),
alphaBottomLeft: !this.teamIconsShow ? 0 : (visible ? 0.7 : 0),
alphaBottomRight: !this.teamIconsShow ? 0 : (visible ? 0.7 : 0),
});
this.scene.tweens.add({
targets: [ this.championRibbon, this.ownedIcon ],