Implement Incinerate

pull/341/head
Frank 2024-04-29 17:11:56 +02:00
parent b173000008
commit 377f8da2e0
1 changed files with 33 additions and 1 deletions

View File

@ -1085,6 +1085,38 @@ export class StealHeldItemChanceAttr extends MoveEffectAttr {
} }
} }
export class RemoveHeldBerryAttr extends MoveEffectAttr {
constructor() {
super(false, MoveEffectTrigger.HIT);
}
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean | Promise<boolean> {
return new Promise<boolean>(resolve => {
const heldBerries = this.getTargetHeldBerries(target).filter(b => b.getTransferrable(false))
if (!heldBerries.length) {
return resolve(false);
}
const removedBerry = heldBerries[user.randSeedInt(heldBerries.length)];
const couldRemoveBerry = target.scene.removeModifier(removedBerry, true);
if (!couldRemoveBerry) {
return resolve(false);
}
target.scene.updateModifiers(target.isPlayer(), false)
user.scene.queueMessage(getPokemonMessage(user, ` burned\n${target.name}'s ${getBerryName(removedBerry.berryType)}!`));
resolve(true);
});
}
getTargetHeldBerries(target: Pokemon): BerryModifier[] {
return target.scene.findModifiers(m => m instanceof BerryModifier
&& (m as BerryModifier).pokemonId === target.id, target.isPlayer()) as BerryModifier[];
}
}
export class RemoveHeldItemAttr extends MoveEffectAttr { export class RemoveHeldItemAttr extends MoveEffectAttr {
private chance: number; private chance: number;
@ -5118,7 +5150,7 @@ export function initMoves() {
.attr(ForceSwitchOutAttr), .attr(ForceSwitchOutAttr),
new AttackMove(Moves.INCINERATE, Type.FIRE, MoveCategory.SPECIAL, 60, 100, 15, -1, 0, 5) new AttackMove(Moves.INCINERATE, Type.FIRE, MoveCategory.SPECIAL, 60, 100, 15, -1, 0, 5)
.target(MoveTarget.ALL_NEAR_ENEMIES) .target(MoveTarget.ALL_NEAR_ENEMIES)
.partial(), .attr(RemoveHeldBerryAttr),
new StatusMove(Moves.QUASH, Type.DARK, 100, 15, -1, 0, 5) new StatusMove(Moves.QUASH, Type.DARK, 100, 15, -1, 0, 5)
.unimplemented(), .unimplemented(),
new AttackMove(Moves.ACROBATICS, Type.FLYING, MoveCategory.PHYSICAL, 55, 100, 15, -1, 0, 5) new AttackMove(Moves.ACROBATICS, Type.FLYING, MoveCategory.PHYSICAL, 55, 100, 15, -1, 0, 5)