implemented pluck, bug bite
parent
c2136a6df1
commit
c62d4f4a52
|
@ -12,10 +12,10 @@ import * as Utils from "../utils";
|
||||||
import { WeatherType } from "./weather";
|
import { WeatherType } from "./weather";
|
||||||
import { ArenaTagSide, ArenaTrapTag } from "./arena-tag";
|
import { ArenaTagSide, ArenaTrapTag } from "./arena-tag";
|
||||||
import { ArenaTagType } from "./enums/arena-tag-type";
|
import { ArenaTagType } from "./enums/arena-tag-type";
|
||||||
import { UnswappableAbilityAbAttr, UncopiableAbilityAbAttr, UnsuppressableAbilityAbAttr, NoTransformAbilityAbAttr, BlockRecoilDamageAttr, BlockOneHitKOAbAttr, IgnoreContactAbAttr, MaxMultiHitAbAttr, applyAbAttrs, BlockNonDirectDamageAbAttr, applyPreSwitchOutAbAttrs, PreSwitchOutAbAttr, applyPostDefendAbAttrs, PostDefendContactApplyStatusEffectAbAttr, MoveAbilityBypassAbAttr } from "./ability";
|
import { UnswappableAbilityAbAttr, UncopiableAbilityAbAttr, UnsuppressableAbilityAbAttr, NoTransformAbilityAbAttr, BlockRecoilDamageAttr, BlockOneHitKOAbAttr, IgnoreContactAbAttr, MaxMultiHitAbAttr, applyAbAttrs, BlockNonDirectDamageAbAttr, applyPreSwitchOutAbAttrs, PreSwitchOutAbAttr, applyPostDefendAbAttrs, PostDefendContactApplyStatusEffectAbAttr, MoveAbilityBypassAbAttr, PreventBerryUseAbAttr, BlockItemTheftAbAttr } from "./ability";
|
||||||
import { Abilities } from "./enums/abilities";
|
import { Abilities } from "./enums/abilities";
|
||||||
import { allAbilities } from './ability';
|
import { allAbilities } from './ability';
|
||||||
import { PokemonHeldItemModifier } from "../modifier/modifier";
|
import { PokemonHeldItemModifier, BerryModifier } from "../modifier/modifier";
|
||||||
import { BattlerIndex } from "../battle";
|
import { BattlerIndex } from "../battle";
|
||||||
import { Stat } from "./pokemon-stat";
|
import { Stat } from "./pokemon-stat";
|
||||||
import { TerrainType } from "./terrain";
|
import { TerrainType } from "./terrain";
|
||||||
|
@ -25,6 +25,7 @@ import { ModifierPoolType } from "#app/modifier/modifier-type";
|
||||||
import { Command } from "../ui/command-ui-handler";
|
import { Command } from "../ui/command-ui-handler";
|
||||||
import { Biome } from "./enums/biome";
|
import { Biome } from "./enums/biome";
|
||||||
import i18next, { Localizable } from '../plugins/i18n';
|
import i18next, { Localizable } from '../plugins/i18n';
|
||||||
|
import { BerryType, BerryEffectFunc, getBerryEffectFunc } from './berry';
|
||||||
|
|
||||||
export enum MoveCategory {
|
export enum MoveCategory {
|
||||||
PHYSICAL,
|
PHYSICAL,
|
||||||
|
@ -1099,6 +1100,55 @@ export class RemoveHeldItemAttr extends MoveEffectAttr {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class EatBerryAttr extends MoveEffectAttr {
|
||||||
|
protected chosenBerry: BerryModifier;
|
||||||
|
constructor() {
|
||||||
|
super(true, MoveEffectTrigger.HIT);
|
||||||
|
}
|
||||||
|
|
||||||
|
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
||||||
|
if (!super.apply(user, target, move, args))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
getBerryEffectFunc(this.chosenBerry.berryType)(target);
|
||||||
|
|
||||||
|
if (!--this.chosenBerry.stackCount)
|
||||||
|
target.scene.removeModifier(this.chosenBerry);
|
||||||
|
target.scene.updateModifiers(target.isPlayer());
|
||||||
|
|
||||||
|
return 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 StealEatBerryAttr extends EatBerryAttr {
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
||||||
|
const heldBerries = this.getTargetHeldBerries(target).filter(i => i.getTransferrable(false));
|
||||||
|
|
||||||
|
if (heldBerries.length) {
|
||||||
|
this.chosenBerry = heldBerries[user.randSeedInt(heldBerries.length)];
|
||||||
|
|
||||||
|
if (!--this.chosenBerry.stackCount)
|
||||||
|
target.scene.removeModifier(this.chosenBerry);
|
||||||
|
target.scene.updateModifiers(target.isPlayer());
|
||||||
|
|
||||||
|
user.scene.queueMessage(getPokemonMessage(user, ` stole and ate\n${target.name}'s ${this.chosenBerry.type.name}!`));
|
||||||
|
return super.apply(user, user, move, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export class HealStatusEffectAttr extends MoveEffectAttr {
|
export class HealStatusEffectAttr extends MoveEffectAttr {
|
||||||
private effects: StatusEffect[];
|
private effects: StatusEffect[];
|
||||||
|
|
||||||
|
@ -4634,6 +4684,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)
|
||||||
.partial(),
|
.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()
|
||||||
|
@ -4870,6 +4921,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)
|
||||||
.partial(),
|
.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),
|
||||||
|
@ -5656,7 +5708,7 @@ export function initMoves() {
|
||||||
.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)
|
.target(MoveTarget.ALL)
|
||||||
.unimplemented(),
|
.attr(EatBerryAttr),
|
||||||
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(),
|
||||||
|
|
Loading…
Reference in New Issue