Add run logic and forest background
parent
fda8e6055a
commit
40e69789c8
Binary file not shown.
Before Width: | Height: | Size: 651 B After Width: | Height: | Size: 1.5 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 2.7 KiB |
Binary file not shown.
Before Width: | Height: | Size: 633 B After Width: | Height: | Size: 642 B |
|
@ -206,6 +206,7 @@ export class NextEncounterPhase extends EncounterPhase {
|
||||||
duration: 2000,
|
duration: 2000,
|
||||||
onComplete: () => {
|
onComplete: () => {
|
||||||
this.scene.arenaEnemy.setX(this.scene.arenaNextEnemy.x);
|
this.scene.arenaEnemy.setX(this.scene.arenaNextEnemy.x);
|
||||||
|
this.scene.arenaEnemy.setAlpha(1);
|
||||||
this.scene.arenaNextEnemy.setX(this.scene.arenaNextEnemy.x - 300);
|
this.scene.arenaNextEnemy.setX(this.scene.arenaNextEnemy.x - 300);
|
||||||
enemyPokemon.untint(100, 'Sine.easeOut');
|
enemyPokemon.untint(100, 'Sine.easeOut');
|
||||||
enemyPokemon.cry();
|
enemyPokemon.cry();
|
||||||
|
@ -326,6 +327,7 @@ export class SwitchBiomePhase extends BattlePhase {
|
||||||
this.scene.arenaPlayer.setTexture(playerTexture);
|
this.scene.arenaPlayer.setTexture(playerTexture);
|
||||||
this.scene.arenaPlayer.setAlpha(1);
|
this.scene.arenaPlayer.setAlpha(1);
|
||||||
this.scene.arenaEnemy.setTexture(enemyTexture);
|
this.scene.arenaEnemy.setTexture(enemyTexture);
|
||||||
|
this.scene.arenaEnemy.setAlpha(1);
|
||||||
this.scene.arenaNextEnemy.setTexture(enemyTexture);
|
this.scene.arenaNextEnemy.setTexture(enemyTexture);
|
||||||
this.scene.arenaBgTransition.setVisible(false);
|
this.scene.arenaBgTransition.setVisible(false);
|
||||||
this.scene.arenaPlayerTransition.setVisible(false);
|
this.scene.arenaPlayerTransition.setVisible(false);
|
||||||
|
@ -632,9 +634,8 @@ export class CommandPhase extends FieldPhase {
|
||||||
break;
|
break;
|
||||||
case Command.BALL:
|
case Command.BALL:
|
||||||
case Command.POKEMON:
|
case Command.POKEMON:
|
||||||
return false;
|
|
||||||
case Command.RUN:
|
case Command.RUN:
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.isPlayerDelayed();
|
return this.isPlayerDelayed();
|
||||||
|
@ -695,6 +696,8 @@ export class CommandPhase extends FieldPhase {
|
||||||
}, null, true);
|
}, null, true);
|
||||||
break;
|
break;
|
||||||
case Command.RUN:
|
case Command.RUN:
|
||||||
|
this.scene.unshiftPhase(new AttemptRunPhase(this.scene));
|
||||||
|
success = true;
|
||||||
//this.scene.unshiftPhase(new MoveAnimTestPhase(this.scene));
|
//this.scene.unshiftPhase(new MoveAnimTestPhase(this.scene));
|
||||||
//success = true;
|
//success = true;
|
||||||
break;
|
break;
|
||||||
|
@ -1420,19 +1423,21 @@ export class MessagePhase extends BattlePhase {
|
||||||
private text: string;
|
private text: string;
|
||||||
private callbackDelay: integer;
|
private callbackDelay: integer;
|
||||||
private prompt: boolean;
|
private prompt: boolean;
|
||||||
|
private promptDelay: integer;
|
||||||
|
|
||||||
constructor(scene: BattleScene, text: string, callbackDelay?: integer, prompt?: boolean) {
|
constructor(scene: BattleScene, text: string, callbackDelay?: integer, prompt?: boolean, promptDelay?: integer) {
|
||||||
super(scene);
|
super(scene);
|
||||||
|
|
||||||
this.text = text;
|
this.text = text;
|
||||||
this.callbackDelay = callbackDelay;
|
this.callbackDelay = callbackDelay;
|
||||||
this.prompt = prompt;
|
this.prompt = prompt;
|
||||||
|
this.promptDelay = promptDelay;
|
||||||
}
|
}
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
super.start();
|
super.start();
|
||||||
|
|
||||||
this.scene.ui.showText(this.text, null, () => this.end(), this.callbackDelay || (this.prompt ? 0 : 1500), this.prompt);
|
this.scene.ui.showText(this.text, null, () => this.end(), this.callbackDelay || (this.prompt ? 0 : 1500), this.prompt, this.promptDelay);
|
||||||
}
|
}
|
||||||
|
|
||||||
end() {
|
end() {
|
||||||
|
@ -2102,6 +2107,41 @@ export class AttemptCapturePhase extends BattlePhase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class AttemptRunPhase extends BattlePhase {
|
||||||
|
constructor(scene: BattleScene) {
|
||||||
|
super(scene);
|
||||||
|
}
|
||||||
|
|
||||||
|
start() {
|
||||||
|
super.start();
|
||||||
|
|
||||||
|
const playerPokemon = this.scene.getPlayerPokemon();
|
||||||
|
const enemyPokemon = this.scene.getEnemyPokemon();
|
||||||
|
|
||||||
|
const escapeChance = (((playerPokemon.stats[Stat.SPD] * 128) / enemyPokemon.stats[Stat.SPD]) + (30 * this.scene.currentBattle.escapeAttempts++)) % 256;
|
||||||
|
|
||||||
|
if (Utils.randInt(256) < escapeChance) {
|
||||||
|
this.scene.sound.play('flee');
|
||||||
|
this.scene.queueMessage('You got away safely!', null, true, 500);
|
||||||
|
|
||||||
|
this.scene.tweens.add({
|
||||||
|
targets: [ this.scene.arenaEnemy, enemyPokemon ],
|
||||||
|
alpha: 0,
|
||||||
|
duration: 250,
|
||||||
|
ease: 'Sine.easeIn'
|
||||||
|
});
|
||||||
|
|
||||||
|
enemyPokemon.hp = 0;
|
||||||
|
|
||||||
|
this.scene.pushPhase(new BattleEndPhase(this.scene));
|
||||||
|
this.scene.newBattle();
|
||||||
|
} else
|
||||||
|
this.scene.queueMessage('You can\'t escape!', null, true);
|
||||||
|
|
||||||
|
this.end();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export class SelectModifierPhase extends BattlePhase {
|
export class SelectModifierPhase extends BattlePhase {
|
||||||
constructor(scene: BattleScene) {
|
constructor(scene: BattleScene) {
|
||||||
super(scene);
|
super(scene);
|
||||||
|
|
|
@ -689,8 +689,8 @@ export default class BattleScene extends Phaser.Scene {
|
||||||
this.currentPhase.start();
|
this.currentPhase.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
queueMessage(message: string, callbackDelay?: integer, prompt?: boolean) {
|
queueMessage(message: string, callbackDelay?: integer, prompt?: boolean, promptDelay?: integer) {
|
||||||
this.unshiftPhase(new MessagePhase(this, message, callbackDelay, prompt));
|
this.unshiftPhase(new MessagePhase(this, message, callbackDelay, prompt, promptDelay));
|
||||||
}
|
}
|
||||||
|
|
||||||
populatePhaseQueue(): void {
|
populatePhaseQueue(): void {
|
||||||
|
|
|
@ -7,6 +7,7 @@ export class Battle {
|
||||||
public enemyPokemon: EnemyPokemon;
|
public enemyPokemon: EnemyPokemon;
|
||||||
public turn: integer;
|
public turn: integer;
|
||||||
public playerParticipantIds: Set<integer> = new Set<integer>();
|
public playerParticipantIds: Set<integer> = new Set<integer>();
|
||||||
|
public escapeAttempts: integer = 0;
|
||||||
|
|
||||||
constructor(waveIndex: integer) {
|
constructor(waveIndex: integer) {
|
||||||
this.waveIndex = waveIndex;
|
this.waveIndex = waveIndex;
|
||||||
|
|
Loading…
Reference in New Issue