Fix some bugs related to double battles
parent
1ac9f239b7
commit
75904470d3
|
@ -528,7 +528,7 @@ export class SwitchBiomePhase extends BattlePhase {
|
||||||
return this.end();
|
return this.end();
|
||||||
|
|
||||||
this.scene.tweens.add({
|
this.scene.tweens.add({
|
||||||
targets: this.scene.arenaEnemy,
|
targets: [ this.scene.arenaEnemy, this.scene.lastEnemyTrainer ],
|
||||||
x: '+=300',
|
x: '+=300',
|
||||||
duration: 2000,
|
duration: 2000,
|
||||||
onComplete: () => {
|
onComplete: () => {
|
||||||
|
@ -548,7 +548,7 @@ export class SwitchBiomePhase extends BattlePhase {
|
||||||
this.scene.time.delayedCall(1000, () => this.scene.playBgm());
|
this.scene.time.delayedCall(1000, () => this.scene.playBgm());
|
||||||
|
|
||||||
this.scene.tweens.add({
|
this.scene.tweens.add({
|
||||||
targets: [ this.scene.arenaPlayer, this.scene.arenaBgTransition, this.scene.arenaPlayerTransition, this.scene.lastEnemyTrainer ],
|
targets: [ this.scene.arenaPlayer, this.scene.arenaBgTransition, this.scene.arenaPlayerTransition ],
|
||||||
duration: 1000,
|
duration: 1000,
|
||||||
delay: 1000,
|
delay: 1000,
|
||||||
ease: 'Sine.easeInOut',
|
ease: 'Sine.easeInOut',
|
||||||
|
@ -723,6 +723,9 @@ export class SwitchSummonPhase extends SummonPhase {
|
||||||
}
|
}
|
||||||
|
|
||||||
preSummon(): void {
|
preSummon(): void {
|
||||||
|
if (!this.player && this.slotIndex === -1)
|
||||||
|
this.slotIndex = this.scene.currentBattle.trainer.getNextSummonIndex();
|
||||||
|
|
||||||
if (!this.doReturn || (this.slotIndex !== -1 && !this.scene.getParty()[this.slotIndex])) {
|
if (!this.doReturn || (this.slotIndex !== -1 && !this.scene.getParty()[this.slotIndex])) {
|
||||||
this.switchAndSummon();
|
this.switchAndSummon();
|
||||||
return;
|
return;
|
||||||
|
@ -1797,6 +1800,9 @@ export class StatChangePhase extends PokemonPhase {
|
||||||
start() {
|
start() {
|
||||||
const pokemon = this.getPokemon();
|
const pokemon = this.getPokemon();
|
||||||
|
|
||||||
|
if (pokemon.isFainted())
|
||||||
|
return this.end();
|
||||||
|
|
||||||
const filteredStats = this.stats.filter(stat => {
|
const filteredStats = this.stats.filter(stat => {
|
||||||
const cancelled = new Utils.BooleanHolder(false);
|
const cancelled = new Utils.BooleanHolder(false);
|
||||||
|
|
||||||
|
@ -2116,7 +2122,7 @@ export class FaintPhase extends PokemonPhase {
|
||||||
if (this.scene.currentBattle.battleType === BattleType.TRAINER) {
|
if (this.scene.currentBattle.battleType === BattleType.TRAINER) {
|
||||||
const hasReservePartyMember = !!this.scene.getEnemyParty().filter(p => p.isActive() && !p.isOnField()).length;
|
const hasReservePartyMember = !!this.scene.getEnemyParty().filter(p => p.isActive() && !p.isOnField()).length;
|
||||||
if (hasReservePartyMember)
|
if (hasReservePartyMember)
|
||||||
this.scene.pushPhase(new SwitchSummonPhase(this.scene, this.fieldIndex, this.scene.currentBattle.trainer.getNextSummonIndex(), false, false, false));
|
this.scene.pushPhase(new SwitchSummonPhase(this.scene, this.fieldIndex, -1, false, false, false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1020,6 +1020,9 @@ export class RecoilAttr extends MoveEffectAttr {
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const recoilDamage = Math.max(Math.floor((!this.useHp ? user.turnData.damageDealt : user.getMaxHp()) / 4), 1);
|
const recoilDamage = Math.max(Math.floor((!this.useHp ? user.turnData.damageDealt : user.getMaxHp()) / 4), 1);
|
||||||
|
if (!recoilDamage)
|
||||||
|
return false;
|
||||||
|
|
||||||
user.scene.unshiftPhase(new DamagePhase(user.scene, user.getBattlerIndex(), HitResult.OTHER));
|
user.scene.unshiftPhase(new DamagePhase(user.scene, user.getBattlerIndex(), HitResult.OTHER));
|
||||||
user.scene.queueMessage(getPokemonMessage(user, ' is hit\nwith recoil!'));
|
user.scene.queueMessage(getPokemonMessage(user, ' is hit\nwith recoil!'));
|
||||||
user.damage(recoilDamage);
|
user.damage(recoilDamage);
|
||||||
|
|
Loading…
Reference in New Issue