Add release option on full party
parent
525cf41b5e
commit
53ab693bad
|
@ -1047,7 +1047,7 @@ export class AttemptCapturePhase extends BattlePhase {
|
||||||
this.scene.sound.play('pb_move');
|
this.scene.sound.play('pb_move');
|
||||||
else {
|
else {
|
||||||
shakeCounter.stop();
|
shakeCounter.stop();
|
||||||
this.release(shakeCount);
|
this.failCatch(shakeCount);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
this.scene.sound.play('pb_lock')
|
this.scene.sound.play('pb_lock')
|
||||||
|
@ -1065,7 +1065,7 @@ export class AttemptCapturePhase extends BattlePhase {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
release(shakeCount: integer) {
|
failCatch(shakeCount: integer) {
|
||||||
const pokemon = this.scene.getEnemyPokemon();
|
const pokemon = this.scene.getEnemyPokemon();
|
||||||
|
|
||||||
this.scene.sound.play('pb_rel');
|
this.scene.sound.play('pb_rel');
|
||||||
|
@ -1091,7 +1091,6 @@ export class AttemptCapturePhase extends BattlePhase {
|
||||||
}
|
}
|
||||||
|
|
||||||
catch() {
|
catch() {
|
||||||
console.log(this, 'catch')
|
|
||||||
const pokemon = this.scene.getEnemyPokemon();
|
const pokemon = this.scene.getEnemyPokemon();
|
||||||
this.scene.unshiftPhase(new VictoryPhase(this.scene));
|
this.scene.unshiftPhase(new VictoryPhase(this.scene));
|
||||||
this.scene.ui.showText(`${pokemon.name} was caught!`, null, () => {
|
this.scene.ui.showText(`${pokemon.name} was caught!`, null, () => {
|
||||||
|
@ -1100,12 +1099,37 @@ export class AttemptCapturePhase extends BattlePhase {
|
||||||
this.removePb();
|
this.removePb();
|
||||||
this.end();
|
this.end();
|
||||||
};
|
};
|
||||||
|
const addToParty = () => {
|
||||||
const newPokemon = pokemon.addToParty();
|
const newPokemon = pokemon.addToParty();
|
||||||
|
pokemon.hp = 0;
|
||||||
this.scene.field.remove(pokemon, true);
|
this.scene.field.remove(pokemon, true);
|
||||||
if (newPokemon)
|
if (newPokemon)
|
||||||
newPokemon.loadAssets().then(end);
|
newPokemon.loadAssets().then(end);
|
||||||
else
|
else
|
||||||
end();
|
end();
|
||||||
|
};
|
||||||
|
if (this.scene.getParty().length === 6) {
|
||||||
|
const promptRelease = () => {
|
||||||
|
this.scene.ui.showText(`Your party is full.\nRelease a POKéMON to make room for ${pokemon.name}?`, null, () => {
|
||||||
|
this.scene.ui.setMode(Mode.CONFIRM, () => {
|
||||||
|
this.scene.ui.setMode(Mode.PARTY, PartyUiMode.RELEASE, (slotIndex: integer) => {
|
||||||
|
this.scene.ui.setMode(Mode.MESSAGE).then(() => {
|
||||||
|
if (slotIndex < 6) {
|
||||||
|
this.scene.getParty().splice(slotIndex, 1);
|
||||||
|
addToParty();
|
||||||
|
} else
|
||||||
|
promptRelease();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}, () => {
|
||||||
|
pokemon.hp = 0;
|
||||||
|
end();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
promptRelease();
|
||||||
|
} else
|
||||||
|
addToParty();
|
||||||
}, 0, true);
|
}, 0, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -792,7 +792,6 @@ export class EnemyPokemon extends Pokemon {
|
||||||
party.push(newPokemon);
|
party.push(newPokemon);
|
||||||
ret = newPokemon;
|
ret = newPokemon;
|
||||||
}
|
}
|
||||||
this.hp = 0;
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import { addTextObject, TextStyle } from "../text";
|
||||||
import { Command } from "./command-ui-handler";
|
import { Command } from "./command-ui-handler";
|
||||||
import MessageUiHandler from "./message-ui-handler";
|
import MessageUiHandler from "./message-ui-handler";
|
||||||
import { Mode } from "./ui";
|
import { Mode } from "./ui";
|
||||||
|
import * as Utils from "../utils";
|
||||||
|
|
||||||
const defaultMessage = 'Choose a Pokémon.';
|
const defaultMessage = 'Choose a Pokémon.';
|
||||||
|
|
||||||
|
@ -12,7 +13,8 @@ export enum PartyUiMode {
|
||||||
SWITCH,
|
SWITCH,
|
||||||
FAINT_SWITCH,
|
FAINT_SWITCH,
|
||||||
POST_BATTLE_SWITCH,
|
POST_BATTLE_SWITCH,
|
||||||
MODIFIER
|
MODIFIER,
|
||||||
|
RELEASE
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum PartyOption {
|
export enum PartyOption {
|
||||||
|
@ -20,6 +22,7 @@ export enum PartyOption {
|
||||||
SEND_OUT,
|
SEND_OUT,
|
||||||
APPLY,
|
APPLY,
|
||||||
SUMMARY,
|
SUMMARY,
|
||||||
|
RELEASE,
|
||||||
CANCEL
|
CANCEL
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,14 +150,23 @@ export default class PartyUiHandler extends MessageUiHandler {
|
||||||
if (this.optionsMode) {
|
if (this.optionsMode) {
|
||||||
if (button === Button.ACTION) {
|
if (button === Button.ACTION) {
|
||||||
const option = this.options[this.optionsCursor];
|
const option = this.options[this.optionsCursor];
|
||||||
if (option === PartyOption.SHIFT || option === PartyOption.SEND_OUT || option === PartyOption.APPLY) {
|
const pokemon = this.scene.getParty()[this.cursor];
|
||||||
let filterResult: string = this.selectFilter(this.scene.getParty()[this.cursor]);
|
if (option === PartyOption.SHIFT || option === PartyOption.SEND_OUT || option === PartyOption.APPLY || option === PartyOption.RELEASE) {
|
||||||
|
let filterResult: string = this.selectFilter(pokemon);
|
||||||
if (filterResult === null) {
|
if (filterResult === null) {
|
||||||
this.clearOptions();
|
this.clearOptions();
|
||||||
if (this.selectCallback) {
|
if (this.selectCallback) {
|
||||||
const selectCallback = this.selectCallback;
|
const selectCallback = this.selectCallback;
|
||||||
|
if (option === PartyOption.RELEASE) {
|
||||||
|
this.partyMessageBox.setTexture('party_message');
|
||||||
|
this.showText(this.getReleaseMessage(pokemon.name), null, () => {
|
||||||
this.selectCallback = null;
|
this.selectCallback = null;
|
||||||
selectCallback(this.cursor);
|
selectCallback(this.cursor);
|
||||||
|
}, null, true);
|
||||||
|
} else {
|
||||||
|
this.selectCallback = null;
|
||||||
|
selectCallback(this.cursor);
|
||||||
|
}
|
||||||
} else if (this.cursor)
|
} else if (this.cursor)
|
||||||
(this.scene.getCurrentPhase() as CommandPhase).handleCommand(Command.POKEMON, this.cursor);
|
(this.scene.getCurrentPhase() as CommandPhase).handleCommand(Command.POKEMON, this.cursor);
|
||||||
if (this.partyUiMode !== PartyUiMode.MODIFIER)
|
if (this.partyUiMode !== PartyUiMode.MODIFIER)
|
||||||
|
@ -172,7 +184,7 @@ export default class PartyUiHandler extends MessageUiHandler {
|
||||||
}
|
}
|
||||||
} else if (option === PartyOption.SUMMARY) {
|
} else if (option === PartyOption.SUMMARY) {
|
||||||
ui.playSelect();
|
ui.playSelect();
|
||||||
ui.setModeWithoutClear(Mode.SUMMARY, this.scene.getParty()[this.cursor]).then(() => this.clearOptions());
|
ui.setModeWithoutClear(Mode.SUMMARY, pokemon).then(() => this.clearOptions());
|
||||||
} else if (option === PartyOption.CANCEL)
|
} else if (option === PartyOption.CANCEL)
|
||||||
this.processInput(Button.CANCEL);
|
this.processInput(Button.CANCEL);
|
||||||
} else if (button === Button.CANCEL) {
|
} else if (button === Button.CANCEL) {
|
||||||
|
@ -314,6 +326,9 @@ export default class PartyUiHandler extends MessageUiHandler {
|
||||||
case PartyUiMode.MODIFIER:
|
case PartyUiMode.MODIFIER:
|
||||||
this.options.push(PartyOption.APPLY);
|
this.options.push(PartyOption.APPLY);
|
||||||
break;
|
break;
|
||||||
|
case PartyUiMode.RELEASE:
|
||||||
|
this.options.push(PartyOption.RELEASE);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.options.push(PartyOption.SUMMARY, PartyOption.CANCEL);
|
this.options.push(PartyOption.SUMMARY, PartyOption.CANCEL);
|
||||||
|
@ -337,6 +352,26 @@ export default class PartyUiHandler extends MessageUiHandler {
|
||||||
this.setCursor(0);
|
this.setCursor(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getReleaseMessage(pokemonName: string): string {
|
||||||
|
const rand = Utils.randInt(128);
|
||||||
|
if (rand < 32)
|
||||||
|
return `Goodbye, ${pokemonName}!`;
|
||||||
|
else if (rand < 64)
|
||||||
|
return `Farewell, ${pokemonName}!`;
|
||||||
|
else if (rand < 96)
|
||||||
|
return `This is where we part, ${pokemonName}!`;
|
||||||
|
else if (rand < 108)
|
||||||
|
return `I'll miss you, ${pokemonName}!`;
|
||||||
|
else if (rand < 116)
|
||||||
|
return `I'll never forget you, ${pokemonName}!`;
|
||||||
|
else if (rand < 124)
|
||||||
|
return `Until we meet again, ${pokemonName}!`;
|
||||||
|
else if (rand < 127)
|
||||||
|
return `Sayonara, ${pokemonName}!`
|
||||||
|
else
|
||||||
|
return `Smell ya later, ${pokemonName}!`;
|
||||||
|
}
|
||||||
|
|
||||||
clearOptions() {
|
clearOptions() {
|
||||||
this.optionsMode = false;
|
this.optionsMode = false;
|
||||||
this.options.splice(0, this.options.length);
|
this.options.splice(0, this.options.length);
|
||||||
|
|
Loading…
Reference in New Issue