Merge branch 'pr/168'

This commit is contained in:
Chacolay 2024-04-29 10:56:23 -04:00
commit af32b54764

View File

@ -16,6 +16,7 @@ import { UnswappableAbilityAbAttr, UncopiableAbilityAbAttr, UnsuppressableAbilit
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 } from "../modifier/modifier";
import { modifierTypes } from '../modifier/modifier-type';
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";
@ -1871,6 +1872,42 @@ export class TurnDamagedDoublePowerAttr extends VariablePowerAttr {
} }
} }
export class NoHeldItemDoublePowerAttr extends VariablePowerAttr {
heldItemModifierTypes: (keyof typeof modifierTypes)[] = [
'REVIVER_SEED',
'BERRY',
'SOOTHE_BELL',
'GRIP_CLAW',
'FOCUS_BAND',
'KINGS_ROCK',
'LEFTOVERS',
'SHELL_BELL',
'BATON',
'LUCKY_EGG',
'GOLDEN_EGG',
];
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
const heldItems = this.getUserHeldItems(user);
if (!heldItems.length) {
(args[0] as Utils.NumberHolder).value *= 2;
return true;
}
return false;
}
countsAsHeldItem(item: PokemonHeldItemModifier) {
return this.heldItemModifierTypes.includes(item.type.id as keyof typeof modifierTypes);
}
getUserHeldItems(user: Pokemon) {
return user.scene.findModifiers(m => m instanceof PokemonHeldItemModifier
&& (m as PokemonHeldItemModifier).pokemonId === user.id && this.countsAsHeldItem(m), user.isPlayer()) as PokemonHeldItemModifier[];
}
}
const magnitudeMessageFunc = (user: Pokemon, target: Pokemon, move: Move) => { const magnitudeMessageFunc = (user: Pokemon, target: Pokemon, move: Move) => {
let message: string; let message: string;
user.scene.executeWithSeedOffset(() => { user.scene.executeWithSeedOffset(() => {
@ -5143,7 +5180,7 @@ export function initMoves() {
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)
.partial(), .attr(NoHeldItemDoublePowerAttr),
new StatusMove(Moves.REFLECT_TYPE, Type.NORMAL, -1, 15, -1, 0, 5) new StatusMove(Moves.REFLECT_TYPE, Type.NORMAL, -1, 15, -1, 0, 5)
.attr(CopyTypeAttr), .attr(CopyTypeAttr),
new AttackMove(Moves.RETALIATE, Type.NORMAL, MoveCategory.PHYSICAL, 70, 100, 5, -1, 0, 5) new AttackMove(Moves.RETALIATE, Type.NORMAL, MoveCategory.PHYSICAL, 70, 100, 5, -1, 0, 5)