Fix stuff

I had to dump a ton of other progress due to a major issue so idk what this update added
This commit is contained in:
RedstonewolfX 2024-07-18 17:50:41 -04:00
parent e522348462
commit 8882d7bb12
2 changed files with 86 additions and 71 deletions

View File

@ -381,7 +381,7 @@ export class TitlePhase extends Phase {
start(): void { start(): void {
super.start(); super.start();
console.log(LoggerTools.importDocument(JSON.stringify(LoggerTools.newDocument()))) //console.log(LoggerTools.importDocument(JSON.stringify(LoggerTools.newDocument())))
this.scene.ui.clearText(); this.scene.ui.clearText();
this.scene.ui.fadeIn(250); this.scene.ui.fadeIn(250);
@ -2678,12 +2678,10 @@ export class TurnInitPhase extends FieldPhase {
}); });
var Pt = this.scene.getEnemyParty() var Pt = this.scene.getEnemyParty()
var Pt2 = Pt.slice() var Pt1 = [this.scene.getEnemyParty()[0], this.scene.getEnemyParty()[2], this.scene.getEnemyParty()[4]]
if (Pt2.length > 1) { var Pt2 = [this.scene.getEnemyParty()[1], this.scene.getEnemyParty()[3], this.scene.getEnemyParty()[5]]
Pt2[1] = Pt[0]
Pt2[0] = Pt[1]
}
Pt.forEach((pokemon, i) => { Pt.forEach((pokemon, i) => {
if (pokemon != undefined)
if (pokemon.hasTrainer() || true) { if (pokemon.hasTrainer() || true) {
console.log(i) console.log(i)
if (pokemon.getFieldIndex() == 1 && pokemon.isOnField()) { if (pokemon.getFieldIndex() == 1 && pokemon.isOnField()) {
@ -2698,7 +2696,7 @@ export class TurnInitPhase extends FieldPhase {
pokemon.getBattleInfo().displayParty(Pt2) pokemon.getBattleInfo().displayParty(Pt2)
} }
} else { } else {
pokemon.getBattleInfo().displayParty(Pt) pokemon.getBattleInfo().displayParty((this.scene.currentBattle.double ? Pt1 : Pt))
} }
} }
}) })
@ -2772,7 +2770,7 @@ export class CommandPhase extends FieldPhase {
} else { } else {
const moveIndex = playerPokemon.getMoveset().findIndex(m => m.moveId === queuedMove.move); const moveIndex = playerPokemon.getMoveset().findIndex(m => m.moveId === queuedMove.move);
if (moveIndex > -1 && playerPokemon.getMoveset()[moveIndex].isUsable(playerPokemon, queuedMove.ignorePP)) { if (moveIndex > -1 && playerPokemon.getMoveset()[moveIndex].isUsable(playerPokemon, queuedMove.ignorePP)) {
this.handleCommand(Command.FIGHT, moveIndex, queuedMove.ignorePP, { targets: queuedMove.targets, multiple: queuedMove.targets.length > 1 }); this.handleCommand(Command.FIGHT, moveIndex, queuedMove.ignorePP, { targets: queuedMove.targets, multiple: queuedMove.targets.length > 1, isContinuing: true });
} else { } else {
this.scene.ui.setMode(Mode.COMMAND, this.fieldIndex); this.scene.ui.setMode(Mode.COMMAND, this.fieldIndex);
} }
@ -3163,7 +3161,12 @@ export class TurnStartPhase extends FieldPhase {
//this.scene.unshiftPhase(new AttemptCapturePhase(this.scene, turnCommand.targets[0] % 2, turnCommand.cursor)); //this.scene.unshiftPhase(new AttemptCapturePhase(this.scene, turnCommand.targets[0] % 2, turnCommand.cursor));
break; break;
case Command.POKEMON: case Command.POKEMON:
if (this.scene.currentBattle.double) {
LoggerTools.Actions[pokemon.getBattlerIndex()] = ((turnCommand.args[0] as boolean) ? "Baton" : "Switch") + " " + LoggerTools.playerPokeName(this.scene, pokemon) + " to " + LoggerTools.playerPokeName(this.scene, turnCommand.cursor) LoggerTools.Actions[pokemon.getBattlerIndex()] = ((turnCommand.args[0] as boolean) ? "Baton" : "Switch") + " " + LoggerTools.playerPokeName(this.scene, pokemon) + " to " + LoggerTools.playerPokeName(this.scene, turnCommand.cursor)
} else {
//LoggerTools.Actions[pokemon.getBattlerIndex()] = ((turnCommand.args[0] as boolean) ? "Baton" : "Switch") + " " + LoggerTools.playerPokeName(this.scene, pokemon) + " to " + LoggerTools.playerPokeName(this.scene, turnCommand.cursor)
LoggerTools.Actions[pokemon.getBattlerIndex()] = ((turnCommand.args[0] as boolean) ? "Baton" : "Switch") + " to " + LoggerTools.playerPokeName(this.scene, turnCommand.cursor)
}
break; break;
case Command.RUN: case Command.RUN:
LoggerTools.Actions[pokemon.getBattlerIndex()] = "Run" LoggerTools.Actions[pokemon.getBattlerIndex()] = "Run"
@ -3244,11 +3247,11 @@ export class TurnStartPhase extends FieldPhase {
console.log(turnCommand.targets, turnCommand.move.targets) console.log(turnCommand.targets, turnCommand.move.targets)
LoggerTools.Actions[pokemon.getBattlerIndex()] = mv.getName() LoggerTools.Actions[pokemon.getBattlerIndex()] = mv.getName()
if (this.scene.currentBattle.double) { if (this.scene.currentBattle.double) {
var targIDs = ["Counter", "Self", "Ally", "L", "R"] var targIDs = ["Self", "Self", "Ally", "L", "R"]
if (pokemon.getBattlerIndex() == 1) targIDs = ["Counter", "Ally", "Self", "L", "R"] if (pokemon.getBattlerIndex() == 1) targIDs = ["Counter", "Ally", "Self", "L", "R"]
LoggerTools.Actions[pokemon.getBattlerIndex()] += " → " + targets.map(v => targIDs[v+1]) LoggerTools.Actions[pokemon.getBattlerIndex()] += " → " + targets.map(v => targIDs[v+1])
} else { } else {
var targIDs = ["Counter", "", "", "", ""] var targIDs = ["Self", "", "", "", ""]
var myField = this.scene.getField() var myField = this.scene.getField()
if (myField[0]) if (myField[0])
targIDs[1] = myField[0].name targIDs[1] = myField[0].name
@ -3264,19 +3267,22 @@ export class TurnStartPhase extends FieldPhase {
console.log(mv.getName(), targets) console.log(mv.getName(), targets)
} }
} else { } else {
console.log("turncommand = ", turnCommand, " -- running BOTTO< block") console.log("turncommand = ", turnCommand, " -- running BOTTOM block")
const playerPhase = new MovePhase(this.scene, pokemon, turnCommand.targets || turnCommand.move.targets, move, false, queuedMove.ignorePP); const playerPhase = new MovePhase(this.scene, pokemon, turnCommand.targets || turnCommand.move.targets, move, false, queuedMove.ignorePP);
var targets = turnCommand.targets || turnCommand.move.targets var targets = turnCommand.targets || turnCommand.move.targets
var mv = move var mv = move
if (pokemon.isPlayer()) { if (pokemon.isPlayer()) {
console.log(turnCommand.targets, turnCommand.move.targets) console.log(turnCommand.targets, turnCommand.move.targets)
if (turnCommand.args[1] && turnCommand.args[1].isContinuing != undefined) {
console.log(mv.getName(), targets)
} else {
LoggerTools.Actions[pokemon.getBattlerIndex()] = mv.getName() LoggerTools.Actions[pokemon.getBattlerIndex()] = mv.getName()
if (this.scene.currentBattle.double) { if (this.scene.currentBattle.double) {
var targIDs = ["Counter", "Self", "Ally", "L", "R"] var targIDs = ["Self", "Self", "Ally", "L", "R"]
if (pokemon.getBattlerIndex() == 1) targIDs = ["Counter", "Ally", "Self", "L", "R"] if (pokemon.getBattlerIndex() == 1) targIDs = ["Counter", "Ally", "Self", "L", "R"]
LoggerTools.Actions[pokemon.getBattlerIndex()] += " → " + targets.map(v => targIDs[v+1]) LoggerTools.Actions[pokemon.getBattlerIndex()] += " → " + targets.map(v => targIDs[v+1])
} else { } else {
var targIDs = ["Counter", "", "", "", ""] var targIDs = ["Self", "", "", "", ""]
var myField = this.scene.getField() var myField = this.scene.getField()
if (myField[0]) if (myField[0])
targIDs[1] = myField[0].name targIDs[1] = myField[0].name
@ -3291,6 +3297,7 @@ export class TurnStartPhase extends FieldPhase {
} }
console.log(mv.getName(), targets) console.log(mv.getName(), targets)
} }
}
this.scene.pushPhase(playerPhase); this.scene.pushPhase(playerPhase);
} }
} else { } else {
@ -3477,30 +3484,6 @@ 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++;
@ -3542,6 +3525,36 @@ export class BattleEndPhase extends BattlePhase {
} }
} }
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();
var prevWaveActions = []
wv.actions = []
// Loop through each action
for (var i = 0; i < tempActions.length; i++) {
if (tempActions[i].substring(0, 10) == "[MOVEBACK]") {
prevWaveActions.push(tempActions[i].substring(10))
} else 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)
var wv2: LoggerTools.Wave = LoggerTools.getWave(drpd, this.scene.currentBattle.waveIndex - 1, this.scene)
wv2.actions = wv2.actions.concat(prevWaveActions)
console.log(drpd)
LoggerTools.save(this.scene, drpd)
this.scene.updateModifiers().then(() => this.end()); this.scene.updateModifiers().then(() => this.end());
} }
} }
@ -5871,7 +5884,8 @@ export class LearnMovePhase extends PlayerPartyMemberPokemonPhase {
if (W.shop != "") { if (W.shop != "") {
LoggerTools.logShop(this.scene, this.scene.currentBattle.waveIndex, W.shop + "; skip learning it") LoggerTools.logShop(this.scene, this.scene.currentBattle.waveIndex, W.shop + "; skip learning it")
} else { } else {
LoggerTools.logActions(this.scene, this.scene.currentBattle.waveIndex, LoggerTools.playerPokeName(this.scene, pokemon) + " | Skip " + move.name) var actions = LoggerTools.getActionCount(this.scene, this.scene.currentBattle.waveIndex)
LoggerTools.logActions(this.scene, this.scene.currentBattle.waveIndex, (actions == 0 ? "[MOVEBACK]" : "") + LoggerTools.playerPokeName(this.scene, pokemon) + " | Skip " + move.name)
} }
this.scene.ui.showText(i18next.t("battle:learnMoveNotLearned", { pokemonName: pokemon.name, moveName: move.name }), null, () => this.end(), null, true); this.scene.ui.showText(i18next.t("battle:learnMoveNotLearned", { pokemonName: pokemon.name, moveName: move.name }), null, () => this.end(), null, true);
}, () => { }, () => {
@ -5898,7 +5912,8 @@ export class LearnMovePhase extends PlayerPartyMemberPokemonPhase {
if (W.shop != "") { if (W.shop != "") {
LoggerTools.logShop(this.scene, this.scene.currentBattle.waveIndex, W.shop + " → learn " + new PokemonMove(this.moveId).getName() + " → replace " + pokemon.moveset[moveIndex].getName()) LoggerTools.logShop(this.scene, this.scene.currentBattle.waveIndex, W.shop + " → learn " + new PokemonMove(this.moveId).getName() + " → replace " + pokemon.moveset[moveIndex].getName())
} else { } else {
LoggerTools.logActions(this.scene, this.scene.currentBattle.waveIndex, LoggerTools.playerPokeName(this.scene, pokemon) + " | Learn " + new PokemonMove(this.moveId).getName() + " → replace " + pokemon.moveset[moveIndex].getName()) var actions = LoggerTools.getActionCount(this.scene, this.scene.currentBattle.waveIndex)
LoggerTools.logActions(this.scene, this.scene.currentBattle.waveIndex, (actions == 0 ? "[MOVEBACK]" : "") + LoggerTools.playerPokeName(this.scene, pokemon) + " | Learn " + new PokemonMove(this.moveId).getName() + " → replace " + pokemon.moveset[moveIndex].getName())
} }
pokemon.setMove(moveIndex, Moves.NONE); pokemon.setMove(moveIndex, Moves.NONE);
this.scene.unshiftPhase(new LearnMovePhase(this.scene, this.partyMemberIndex, this.moveId)); this.scene.unshiftPhase(new LearnMovePhase(this.scene, this.partyMemberIndex, this.moveId));

View File

@ -553,9 +553,9 @@ export default class BattleInfo extends Phaser.GameObjects.Container {
for (var i = 0; i < P.length; i++) { for (var i = 0; i < P.length; i++) {
if (P[i] != undefined) { if (P[i] != undefined) {
states[i] = "ball" states[i] = "ball"
if (!party[i].hp) { if (!P[i].hp) {
states[i] = "faint" states[i] = "faint"
} else if (party[i].status) { } else if (P[i].status) {
states[i] = (this.scene as BattleScene).showTeamSprites ? "ball" : "status" states[i] = (this.scene as BattleScene).showTeamSprites ? "ball" : "status"
} }
if (P[i].isOnField()) { if (P[i].isOnField()) {