Log switching after fainting

This commit is contained in:
RedstonewolfX 2024-07-12 17:46:57 -04:00
parent 299c00f0a4
commit c7fa2ff8e1
2 changed files with 7 additions and 0 deletions

View File

@ -120,6 +120,7 @@ export const rarities = []
export const rarityslot = [0, ""] export const rarityslot = [0, ""]
export const isPreSwitch: Utils.BooleanHolder = new Utils.BooleanHolder(false); export const isPreSwitch: Utils.BooleanHolder = new Utils.BooleanHolder(false);
export const isFaintSwitch: Utils.BooleanHolder = new Utils.BooleanHolder(false);
export var StoredLog: DRPD = undefined; export var StoredLog: DRPD = undefined;

View File

@ -4341,6 +4341,7 @@ export class FaintPhase extends PokemonPhase {
if (!nonFaintedPartyMemberCount) { if (!nonFaintedPartyMemberCount) {
this.scene.unshiftPhase(new GameOverPhase(this.scene)); this.scene.unshiftPhase(new GameOverPhase(this.scene));
} else if (nonFaintedPartyMemberCount >= this.scene.currentBattle.getBattlerCount() || (this.scene.currentBattle.double && !nonFaintedLegalPartyMembers[0].isActive(true))) { } else if (nonFaintedPartyMemberCount >= this.scene.currentBattle.getBattlerCount() || (this.scene.currentBattle.double && !nonFaintedLegalPartyMembers[0].isActive(true))) {
LoggerTools.isFaintSwitch.value = true;
this.scene.pushPhase(new SwitchPhase(this.scene, this.fieldIndex, true, false)); this.scene.pushPhase(new SwitchPhase(this.scene, this.fieldIndex, true, false));
} }
if (nonFaintedPartyMemberCount === 1 && this.scene.currentBattle.double) { if (nonFaintedPartyMemberCount === 1 && this.scene.currentBattle.double) {
@ -5002,12 +5003,14 @@ export class SwitchPhase extends BattlePhase {
// Skip modal switch if impossible // Skip modal switch if impossible
if (this.isModal && !this.scene.getParty().filter(p => p.isAllowedInBattle() && !p.isActive(true)).length) { if (this.isModal && !this.scene.getParty().filter(p => p.isAllowedInBattle() && !p.isActive(true)).length) {
LoggerTools.isPreSwitch.value = false; LoggerTools.isPreSwitch.value = false;
LoggerTools.isFaintSwitch.value = false;
return super.end(); return super.end();
} }
// Check if there is any space still in field // Check if there is any space still in field
if (this.isModal && this.scene.getPlayerField().filter(p => p.isAllowedInBattle() && p.isActive(true)).length >= this.scene.currentBattle.getBattlerCount()) { if (this.isModal && this.scene.getPlayerField().filter(p => p.isAllowedInBattle() && p.isActive(true)).length >= this.scene.currentBattle.getBattlerCount()) {
LoggerTools.isPreSwitch.value = false; LoggerTools.isPreSwitch.value = false;
LoggerTools.isFaintSwitch.value = false;
return super.end(); return super.end();
} }
@ -5019,6 +5022,9 @@ export class SwitchPhase extends BattlePhase {
if (LoggerTools.isPreSwitch.value) { if (LoggerTools.isPreSwitch.value) {
LoggerTools.logActions(this.scene, this.scene.currentBattle.waveIndex, "Pre-switch " + LoggerTools.playerPokeName(this.scene, fieldIndex) + (option == PartyOption.PASS_BATON ? " → Baton" : "") + " → " + LoggerTools.playerPokeName(this.scene, slotIndex)) LoggerTools.logActions(this.scene, this.scene.currentBattle.waveIndex, "Pre-switch " + LoggerTools.playerPokeName(this.scene, fieldIndex) + (option == PartyOption.PASS_BATON ? " → Baton" : "") + " → " + LoggerTools.playerPokeName(this.scene, slotIndex))
} }
if (LoggerTools.isFaintSwitch.value) {
LoggerTools.logActions(this.scene, this.scene.currentBattle.waveIndex, "Send in " + LoggerTools.playerPokeName(this.scene, slotIndex))
}
this.scene.unshiftPhase(new SwitchSummonPhase(this.scene, fieldIndex, slotIndex, this.doReturn, option === PartyOption.PASS_BATON)); this.scene.unshiftPhase(new SwitchSummonPhase(this.scene, fieldIndex, slotIndex, this.doReturn, option === PartyOption.PASS_BATON));
} }
LoggerTools.isPreSwitch.value = false; LoggerTools.isPreSwitch.value = false;