Condense actions

This commit is contained in:
RedstonewolfX 2024-07-14 19:29:16 -04:00
parent e3272af46e
commit 54ddc63a14
2 changed files with 30 additions and 1 deletions

View File

@ -187,6 +187,11 @@ export function getDRPD(scene: BattleScene): DRPD {
return drpd; return drpd;
} }
export function save(scene: BattleScene, drpd: DRPD) {
console.log(drpd)
localStorage.setItem(getLogID(scene), JSON.stringify(drpd))
}
/** /**
* Testing purposes only. * Testing purposes only.
*/ */

View File

@ -73,7 +73,7 @@ import ChallengeData from "./system/challenge-data";
import { Challenges } from "./enums/challenges" import { Challenges } from "./enums/challenges"
import PokemonData from "./system/pokemon-data" import PokemonData from "./system/pokemon-data"
import * as LoggerTools from "./logger" import * as LoggerTools from "./logger"
import { getNatureName } from "./data/nature"; import { getNatureDecrease, getNatureIncrease, getNatureName } from "./data/nature";
import { GameDataType } from "./enums/game-data-type"; import { GameDataType } from "./enums/game-data-type";
import { Session } from "inspector"; import { Session } from "inspector";
@ -3383,6 +3383,30 @@ export class BattleEndPhase extends BattlePhase {
this.scene.currentBattle.addBattleScore(this.scene); this.scene.currentBattle.addBattleScore(this.scene);
var drpd: LoggerTools.DRPD = LoggerTools.getDRPD(this.scene)
var wv: LoggerTools.Wave = LoggerTools.getWave(drpd, this.scene.currentBattle.waveIndex, this.scene)
var lastcount = 0;
var lastval = undefined;
var tempActions = wv.actions.slice();
wv.actions = []
// Loop through each action
for (var i = 0; i < tempActions.length; i++) {
if (tempActions[i] != lastval) {
if (lastcount > 0) {
wv.actions.push(lastval + (lastcount == 1 ? "" : " x" + lastcount))
}
lastval = tempActions[i]
lastcount = 1
} else {
lastcount++
}
}
if (lastcount > 0) {
wv.actions.push(lastval + (lastcount == 1 ? "" : " x" + lastcount))
}
console.log(tempActions, wv.actions)
LoggerTools.save(this.scene, drpd)
this.scene.gameData.gameStats.battles++; this.scene.gameData.gameStats.battles++;
if (this.scene.currentBattle.trainer) { if (this.scene.currentBattle.trainer) {
this.scene.gameData.gameStats.trainersDefeated++; this.scene.gameData.gameStats.trainersDefeated++;