Revert "Fix stuff"

This reverts commit 8882d7bb12.
This commit is contained in:
RedstonewolfX 2024-07-20 16:01:39 -04:00
parent 07593945ee
commit 80750aab15
2 changed files with 71 additions and 86 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,27 +2678,29 @@ export class TurnInitPhase extends FieldPhase {
}); });
var Pt = this.scene.getEnemyParty() var Pt = this.scene.getEnemyParty()
var Pt1 = [this.scene.getEnemyParty()[0], this.scene.getEnemyParty()[2], this.scene.getEnemyParty()[4]] var Pt2 = Pt.slice()
var Pt2 = [this.scene.getEnemyParty()[1], this.scene.getEnemyParty()[3], this.scene.getEnemyParty()[5]] if (Pt2.length > 1) {
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()) { // Switch this to cycle between
// Switch this to cycle between // - hiding the top mon's team bar
// - hiding the top mon's team bar // - showing the bottom mon's team bar with its active slots reversed
// - showing the bottom mon's team bar with its active slots reversed if (false) {
if (false) { pokemon.getBattleInfo().displayParty(Pt)
pokemon.getBattleInfo().displayParty(Pt) Pt[0].getBattleInfo().switchIconVisibility(false); // Make the top mon's team bar go away
Pt[0].getBattleInfo().switchIconVisibility(false); // Make the top mon's team bar go away Pt[0].getBattleInfo().iconsActive = false; // Prevent the top mon from re-opening its bar
Pt[0].getBattleInfo().iconsActive = false; // Prevent the top mon from re-opening its bar
} else {
pokemon.getBattleInfo().displayParty(Pt2)
}
} else { } else {
pokemon.getBattleInfo().displayParty((this.scene.currentBattle.double ? Pt1 : Pt)) pokemon.getBattleInfo().displayParty(Pt2)
} }
} else {
pokemon.getBattleInfo().displayParty(Pt)
} }
}
}) })
this.scene.pushPhase(new TurnStartPhase(this.scene)); this.scene.pushPhase(new TurnStartPhase(this.scene));
@ -2770,7 +2772,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, isContinuing: true }); this.handleCommand(Command.FIGHT, moveIndex, queuedMove.ignorePP, { targets: queuedMove.targets, multiple: queuedMove.targets.length > 1 });
} else { } else {
this.scene.ui.setMode(Mode.COMMAND, this.fieldIndex); this.scene.ui.setMode(Mode.COMMAND, this.fieldIndex);
} }
@ -3161,12 +3163,7 @@ 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"
@ -3247,11 +3244,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 = ["Self", "Self", "Ally", "L", "R"] var targIDs = ["Counter", "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 = ["Self", "", "", "", ""] var targIDs = ["Counter", "", "", "", ""]
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
@ -3267,36 +3264,32 @@ export class TurnStartPhase extends FieldPhase {
console.log(mv.getName(), targets) console.log(mv.getName(), targets)
} }
} else { } else {
console.log("turncommand = ", turnCommand, " -- running BOTTOM block") console.log("turncommand = ", turnCommand, " -- running BOTTO< 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) { LoggerTools.Actions[pokemon.getBattlerIndex()] = mv.getName()
console.log(mv.getName(), targets) if (this.scene.currentBattle.double) {
var targIDs = ["Counter", "Self", "Ally", "L", "R"]
if (pokemon.getBattlerIndex() == 1) targIDs = ["Counter", "Ally", "Self", "L", "R"]
LoggerTools.Actions[pokemon.getBattlerIndex()] += " → " + targets.map(v => targIDs[v+1])
} else { } else {
LoggerTools.Actions[pokemon.getBattlerIndex()] = mv.getName() var targIDs = ["Counter", "", "", "", ""]
if (this.scene.currentBattle.double) { var myField = this.scene.getField()
var targIDs = ["Self", "Self", "Ally", "L", "R"] if (myField[0])
if (pokemon.getBattlerIndex() == 1) targIDs = ["Counter", "Ally", "Self", "L", "R"] targIDs[1] = myField[0].name
LoggerTools.Actions[pokemon.getBattlerIndex()] += " → " + targets.map(v => targIDs[v+1]) if (myField[1])
} else { targIDs[2] = myField[1].name
var targIDs = ["Self", "", "", "", ""] var eField = this.scene.getEnemyField()
var myField = this.scene.getField() if (eField[0])
if (myField[0]) targIDs[3] = eField[0].name
targIDs[1] = myField[0].name if (eField[1])
if (myField[1]) targIDs[4] = eField[1].name
targIDs[2] = myField[1].name //LoggerTools.Actions[pokemon.getBattlerIndex()] += " → " + targets.map(v => targIDs[v+1])
var eField = this.scene.getEnemyField()
if (eField[0])
targIDs[3] = eField[0].name
if (eField[1])
targIDs[4] = eField[1].name
//LoggerTools.Actions[pokemon.getBattlerIndex()] += " → " + targets.map(v => targIDs[v+1])
}
console.log(mv.getName(), targets)
} }
console.log(mv.getName(), targets)
} }
this.scene.pushPhase(playerPhase); this.scene.pushPhase(playerPhase);
} }
@ -3484,6 +3477,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++;
@ -3525,36 +3542,6 @@ 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());
} }
} }
@ -5884,8 +5871,7 @@ 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 {
var actions = LoggerTools.getActionCount(this.scene, this.scene.currentBattle.waveIndex) LoggerTools.logActions(this.scene, this.scene.currentBattle.waveIndex, LoggerTools.playerPokeName(this.scene, pokemon) + " | Skip " + move.name)
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);
}, () => { }, () => {
@ -5912,8 +5898,7 @@ 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 {
var actions = LoggerTools.getActionCount(this.scene, this.scene.currentBattle.waveIndex) LoggerTools.logActions(this.scene, this.scene.currentBattle.waveIndex, LoggerTools.playerPokeName(this.scene, pokemon) + " | Learn " + new PokemonMove(this.moveId).getName() + " → replace " + pokemon.moveset[moveIndex].getName())
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 (!P[i].hp) { if (!party[i].hp) {
states[i] = "faint" states[i] = "faint"
} else if (P[i].status) { } else if (party[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()) {