properly handle targets on mutli moves. also checks which pokemon did the bouncing.
parent
1e28f95453
commit
4b1f979af2
|
|
@ -2410,19 +2410,24 @@ export class MoveEffectPhase extends PokemonPhase {
|
||||||
|
|
||||||
let isBounced: BattlerTag | boolean = false;
|
let isBounced: BattlerTag | boolean = false;
|
||||||
for (let opponent of targets) {
|
for (let opponent of targets) {
|
||||||
isBounced = this.move.getMove().hasFlag(MoveFlags.MAGIC_COAT_MOVE) && (targets[0].findTags(t => t instanceof BounceTag).find(t => targets[0].lapseTag(t.tagType)) || opponent.hasAbilityWithAttr(MagicBounceAbAttr));
|
isBounced = this.move.getMove().hasFlag(MoveFlags.MAGIC_COAT_MOVE) && (opponent.findTags(t => t instanceof BounceTag).find(t => opponent.lapseTag(t.tagType)) || opponent.hasAbilityWithAttr(MagicBounceAbAttr));
|
||||||
if (isBounced) {
|
if (isBounced) {
|
||||||
this.scene.queueMessage(getPokemonMessage(targets[0], '\nbounced the move back!'));
|
this.scene.queueMessage(getPokemonMessage(opponent, '\nbounced the move back!'));
|
||||||
const tempTargets = targets;
|
const tempTargets = targets;
|
||||||
this.targets = getMoveTargets(tempTargets[0], this.move.moveId).targets;
|
if (this.move.getMove().isMultiTarget()){
|
||||||
targets = [];
|
this.targets = getMoveTargets(tempTargets[0], this.move.moveId).targets;
|
||||||
for (let index of this.targets){
|
targets = [];
|
||||||
const target = this.scene.getField()[index];
|
for (let index of this.targets){
|
||||||
if (target)
|
const target = this.scene.getField()[index];
|
||||||
targets.push(target);
|
if (target)
|
||||||
|
targets.push(target);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.targets = [user.getBattlerIndex()];
|
||||||
|
targets = [user];
|
||||||
}
|
}
|
||||||
user = tempTargets[0];
|
user = tempTargets[0];
|
||||||
if (!this.move.getMove().applyConditions(user, targets[0], this.move.getMove())) {
|
if (!this.move.getMove().applyConditions(user, opponent, this.move.getMove())) {
|
||||||
this.scene.queueMessage(i18next.t('menu:attackFailed'));
|
this.scene.queueMessage(i18next.t('menu:attackFailed'));
|
||||||
return this.end();
|
return this.end();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue