mirror of
https://github.com/smogon/pokemon-showdown-client.git
synced 2026-04-25 07:57:01 -05:00
Support blank target in -item message (#2302)
Some checks failed
Node.js CI / build (14.x) (push) Has been cancelled
Some checks failed
Node.js CI / build (14.x) (push) Has been cancelled
* Support blank target in -item message * TS fix * TS fix again
This commit is contained in:
parent
d43e960729
commit
a77ed2a881
|
|
@ -2231,6 +2231,20 @@ export class Battle {
|
|||
let item = Dex.items.get(args[2]);
|
||||
let effect = Dex.getEffect(kwArgs.from);
|
||||
let ofpoke = this.getPokemon(kwArgs.of);
|
||||
if (!poke) {
|
||||
if (effect.id === 'frisk') {
|
||||
const possibleTargets = ofpoke!.side.foe.active.filter(p => p !== null);
|
||||
if (possibleTargets.length === 1) {
|
||||
poke = possibleTargets[0]!;
|
||||
} else {
|
||||
this.activateAbility(ofpoke!, "Frisk");
|
||||
this.log(args, kwArgs);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
throw new Error('No Pokemon in -item message');
|
||||
}
|
||||
}
|
||||
poke.item = item.name;
|
||||
poke.itemEffect = '';
|
||||
poke.removeVolatile('airballoon' as ID);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user