diff --git a/src/battle-phases.ts b/src/battle-phases.ts index 9eb61b06d..ba0f103ca 100644 --- a/src/battle-phases.ts +++ b/src/battle-phases.ts @@ -570,7 +570,7 @@ export class SwitchSummonPhase extends SummonPhase { } preSummon(): void { - if (!this.doReturn || !this.scene.getParty()[this.slotIndex]) { + if (!this.doReturn || (this.slotIndex !== -1 && !this.scene.getParty()[this.slotIndex])) { this.switchAndSummon(); return; } diff --git a/src/data/move.ts b/src/data/move.ts index dc67c19c6..ab502749b 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -1012,13 +1012,13 @@ export class HealAttr extends MoveEffectAttr { } apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean { - this.addHealPhase(user, this.healRatio); + this.addHealPhase(this.selfTarget ? user : target, this.healRatio); return true; } - addHealPhase(user: Pokemon, healRatio: number) { - user.scene.unshiftPhase(new PokemonHealPhase(user.scene, user.getBattlerIndex(), - Math.max(Math.floor(user.getMaxHp() * healRatio), 1), getPokemonMessage(user, ' regained\nhealth!'), true, !this.showAnim)); + addHealPhase(target: Pokemon, healRatio: number) { + target.scene.unshiftPhase(new PokemonHealPhase(target.scene, target.getBattlerIndex(), + Math.max(Math.floor(target.getMaxHp() * healRatio), 1), getPokemonMessage(target, ' regained\nhealth!'), true, !this.showAnim)); } getTargetBenefitScore(user: Pokemon, target: Pokemon, move: Move): integer { diff --git a/src/ui/target-select-ui-handler.ts b/src/ui/target-select-ui-handler.ts index 6195f7990..680b8585d 100644 --- a/src/ui/target-select-ui-handler.ts +++ b/src/ui/target-select-ui-handler.ts @@ -52,19 +52,19 @@ export default class TargetSelectUiHandler extends UiHandler { } else { switch (button) { case Button.UP: - if (this.cursor < BattlerIndex.ENEMY && this.targets.find(t => t >= BattlerIndex.ENEMY)) + if (this.cursor < BattlerIndex.ENEMY && this.targets.findIndex(t => t >= BattlerIndex.ENEMY) > -1) success = this.setCursor(this.targets.find(t => t >= BattlerIndex.ENEMY)); break; case Button.DOWN: - if (this.cursor >= BattlerIndex.ENEMY && this.targets.find(t => t < BattlerIndex.ENEMY)) + if (this.cursor >= BattlerIndex.ENEMY && this.targets.findIndex(t => t < BattlerIndex.ENEMY) > -1) success = this.setCursor(this.targets.find(t => t < BattlerIndex.ENEMY)); break; case Button.LEFT: - if (this.cursor % 2 && this.targets.find(t => t === this.cursor - 1)) + if (this.cursor % 2 && this.targets.findIndex(t => t === this.cursor - 1) > -1) success = this.setCursor(this.cursor - 1); break; case Button.RIGHT: - if (!(this.cursor % 2) && this.targets.find(t => t === this.cursor + 1)) + if (!(this.cursor % 2) && this.targets.findIndex(t => t === this.cursor + 1) > -1) success = this.setCursor(this.cursor + 1); break; }