last line of code for this feature. will revert everything after.

This commit is contained in:
Greenlamp 2024-05-06 21:18:49 +02:00
parent ff562af446
commit a6d4beb02a
2 changed files with 23 additions and 6 deletions

View File

@ -1788,7 +1788,7 @@ export class CommandPhase extends FieldPhase {
if (!batonPass)
enemyField.forEach(enemyPokemon => applyCheckTrappedAbAttrs(CheckTrappedAbAttr, enemyPokemon, trapped));
if (batonPass || (!trapTag && !trapped.value)) {
this.scene.currentBattle.turnCommands[this.fieldIndex] = isSwitch
this.scene.currentBattle.turnCommands[args[1]] = isSwitch
? { command: Command.POKEMON, cursor: cursor, args: args }
: { command: Command.RUN };
success = true;
@ -1955,11 +1955,15 @@ export class TurnStartPhase extends FieldPhase {
start() {
super.start();
const field = this.scene.getField();
const order = this.getOrder();
const moveOrder = order.slice(0);
console.log('field', field);
console.log('moveOrder', moveOrder);
// if (this.scene.currentBattle.turn === 1 && field.)
moveOrder.sort((a, b) => {
const aCommand = this.scene.currentBattle.turnCommands[a];
const bCommand = this.scene.currentBattle.turnCommands[b];

View File

@ -95,6 +95,7 @@ export default class PartyUiHandler extends MessageUiHandler {
private moveSelectFilter: PokemonMoveSelectFilter;
private tmMoveId: Moves;
private showMovePp: boolean;
private slots: Map<number, number> = new Map();
private iconAnimHandler: PokemonIconAnimHandler;
@ -291,8 +292,11 @@ export default class PartyUiHandler extends MessageUiHandler {
this.scene.triggerPokemonFormChange(pokemon, SpeciesFormChangeItemTrigger, false, true);
break;
}
} else if (this.cursor)
(this.scene.getCurrentPhase() as CommandPhase).handleCommand(Command.POKEMON, this.cursor, option === PartyOption.PASS_BATON);
} else if (this.cursor) {
this.doSwitch(this.cursor, option);
// (this.scene.getCurrentPhase() as CommandPhase).handleCommand(Command.POKEMON, this.cursor, option === PartyOption.PASS_BATON, option);
}
}
if (this.partyUiMode !== PartyUiMode.MODIFIER && this.partyUiMode !== PartyUiMode.TM_MODIFIER && this.partyUiMode !== PartyUiMode.MOVE_MODIFIER)
ui.playSelect();
@ -370,7 +374,11 @@ export default class PartyUiHandler extends MessageUiHandler {
} else if (this.partyUiMode === PartyUiMode.FAINT_SWITCH)
ui.playError();
else if (this.cursor === 6) {
console.log('DONE');
console.log('done');
if (this.slots[PartyOption.SEND_OUT_1])
(this.scene.getCurrentPhase() as CommandPhase).handleCommand(Command.POKEMON, this.slots[PartyOption.SEND_OUT_1], false, PartyOption.SEND_OUT_1);
if (this.slots[PartyOption.SEND_OUT_2])
(this.scene.getCurrentPhase() as CommandPhase).handleCommand(Command.POKEMON, this.slots[PartyOption.SEND_OUT_2], false, PartyOption.SEND_OUT_2);
} else
return this.processInput(Button.CANCEL);
return true;
@ -533,7 +541,7 @@ export default class PartyUiHandler extends MessageUiHandler {
}
showOptions() {
if (this.cursor === 6)
if (this.cursor === 6 || this.cursor === 7)
return;
this.optionsMode = true;
@ -752,6 +760,11 @@ export default class PartyUiHandler extends MessageUiHandler {
this.partySlots[this.transferCursor].setTransfer(false);
}
doSwitch(slotIndex: integer, target: integer): void {
if (target !== PartyOption.SEND_OUT_1 && target !== PartyOption.SEND_OUT_2) return;
this.slots[target] = slotIndex;
}
doRelease(slotIndex: integer): void {
this.showText(this.getReleaseMessage(this.scene.getParty()[slotIndex].name), null, () => {
this.clearPartySlots();