implemented teatime

pull/232/head
Luc Dube 2024-04-21 17:36:32 -04:00
parent 3c8dc6c336
commit d716b9b107
1 changed files with 12 additions and 6 deletions

View File

@ -1104,12 +1104,20 @@ export class EatBerryAttr extends MoveEffectAttr {
protected chosenBerry: BerryModifier; protected chosenBerry: BerryModifier;
constructor() { constructor() {
super(true, MoveEffectTrigger.HIT); super(true, MoveEffectTrigger.HIT);
this.chosenBerry = undefined;
} }
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean { apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
if (!super.apply(user, target, move, args)) if (!super.apply(user, target, move, args))
return false; return false;
if(this.chosenBerry === undefined) { // if no berry has been provided, pick a random berry from their inventory
const heldBerries = this.getTargetHeldBerries(target);
if(heldBerries.length <= 0)
return false;
this.chosenBerry = heldBerries[user.randSeedInt(heldBerries.length)];
}
getBerryEffectFunc(this.chosenBerry.berryType)(target); getBerryEffectFunc(this.chosenBerry.berryType)(target);
if (!--this.chosenBerry.stackCount) if (!--this.chosenBerry.stackCount)
@ -4690,8 +4698,7 @@ export function initMoves() {
.makesContact(false) .makesContact(false)
.ignoresProtect(), .ignoresProtect(),
new AttackMove(Moves.PLUCK, Type.FLYING, MoveCategory.PHYSICAL, 60, 100, 20, -1, 0, 4) new AttackMove(Moves.PLUCK, Type.FLYING, MoveCategory.PHYSICAL, 60, 100, 20, -1, 0, 4)
.attr(StealEatBerryAttr) .attr(StealEatBerryAttr),
.partial(),
new StatusMove(Moves.TAILWIND, Type.FLYING, -1, 15, -1, 0, 4) new StatusMove(Moves.TAILWIND, Type.FLYING, -1, 15, -1, 0, 4)
.windMove() .windMove()
.target(MoveTarget.USER_SIDE) .target(MoveTarget.USER_SIDE)
@ -4927,8 +4934,7 @@ export function initMoves() {
new AttackMove(Moves.JUDGMENT, Type.NORMAL, MoveCategory.SPECIAL, 100, 100, 10, -1, 0, 4) new AttackMove(Moves.JUDGMENT, Type.NORMAL, MoveCategory.SPECIAL, 100, 100, 10, -1, 0, 4)
.partial(), .partial(),
new AttackMove(Moves.BUG_BITE, Type.BUG, MoveCategory.PHYSICAL, 60, 100, 20, -1, 0, 4) new AttackMove(Moves.BUG_BITE, Type.BUG, MoveCategory.PHYSICAL, 60, 100, 20, -1, 0, 4)
.attr(StealEatBerryAttr) .attr(StealEatBerryAttr),
.partial(),
new AttackMove(Moves.CHARGE_BEAM, Type.ELECTRIC, MoveCategory.SPECIAL, 50, 90, 10, 70, 0, 4) new AttackMove(Moves.CHARGE_BEAM, Type.ELECTRIC, MoveCategory.SPECIAL, 50, 90, 10, 70, 0, 4)
.attr(StatChangeAttr, BattleStat.SPATK, 1, true), .attr(StatChangeAttr, BattleStat.SPATK, 1, true),
new AttackMove(Moves.WOOD_HAMMER, Type.GRASS, MoveCategory.PHYSICAL, 120, 100, 15, -1, 0, 4) new AttackMove(Moves.WOOD_HAMMER, Type.GRASS, MoveCategory.PHYSICAL, 120, 100, 15, -1, 0, 4)
@ -5713,8 +5719,8 @@ export function initMoves() {
.makesContact(false) .makesContact(false)
.partial(), .partial(),
new StatusMove(Moves.TEATIME, Type.NORMAL, -1, 10, -1, 0, 8) new StatusMove(Moves.TEATIME, Type.NORMAL, -1, 10, -1, 0, 8)
.target(MoveTarget.ALL) .attr(EatBerryAttr)
.attr(EatBerryAttr), .target(MoveTarget.ALL),
new StatusMove(Moves.OCTOLOCK, Type.FIGHTING, 100, 15, -1, 0, 8) new StatusMove(Moves.OCTOLOCK, Type.FIGHTING, 100, 15, -1, 0, 8)
.attr(AddBattlerTagAttr, BattlerTagType.TRAPPED, false, true, 1) .attr(AddBattlerTagAttr, BattlerTagType.TRAPPED, false, true, 1)
.partial(), .partial(),