Fix issues with targeting
This commit is contained in:
parent
47fd9985c8
commit
ac9814e665
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue