From 0e84343b15872081880e2c31149a051a9412ed38 Mon Sep 17 00:00:00 2001 From: shayebeadlingkl Date: Sun, 21 Apr 2024 14:37:58 -0400 Subject: [PATCH 1/3] implements cursed body --- src/data/ability.ts | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/src/data/ability.ts b/src/data/ability.ts index 16eb729e1db..f876f7f525d 100644 --- a/src/data/ability.ts +++ b/src/data/ability.ts @@ -745,6 +745,36 @@ export class PostDefendAbilityGiveAbAttr extends PostDefendAbAttr { } } +export class PostDefendMoveDisableAbAttr extends PostDefendAbAttr { + private chance: integer; + private attacker: Pokemon; + private move: PokemonMove; + + constructor(chance: integer) { + super(); + + this.chance = chance; + } + + applyPostDefend(pokemon: Pokemon, passive: boolean, attacker: Pokemon, move: PokemonMove, hitResult: HitResult, args: any[]): boolean { + if (!attacker.summonData.disabledMove) { + if (move.getMove().checkFlag(MoveFlags.MAKES_CONTACT, attacker, pokemon) && (this.chance === -1 || pokemon.randSeedInt(100) < this.chance)) { + this.attacker = attacker; + this.move = move; + + attacker.summonData.disabledMove = move.moveId; + attacker.summonData.disabledTurns = 4; + return true; + } + } + return false; + } + + getTriggerMessage(pokemon: Pokemon, abilityName: string, ...args: any[]): string { + return getPokemonMessage(this.attacker, `'s ${this.move.getName()}\nwas disabled!`); + } +} + export class PostStatChangeStatChangeAbAttr extends PostStatChangeAbAttr { private condition: PokemonStatChangeCondition; private statsToChange: BattleStat[]; @@ -2651,7 +2681,8 @@ export function initAbilities() { .attr(BattleStatMultiplierAbAttr, BattleStat.ATK, 0.5) .attr(BattleStatMultiplierAbAttr, BattleStat.SPATK, 0.5) .condition((pokemon) => pokemon.getHpRatio() <= 0.5), - new Ability(Abilities.CURSED_BODY, "Cursed Body (N)", "May disable a move used on the Pokémon.", 5), + new Ability(Abilities.CURSED_BODY, "Cursed Body", "May disable a move used on the Pokémon.", 5) + .attr(PostDefendMoveDisableAbAttr, 100), new Ability(Abilities.HEALER, "Healer (N)", "Sometimes heals an ally's status condition.", 5), new Ability(Abilities.FRIEND_GUARD, "Friend Guard (N)", "Reduces damage done to allies.", 5) .ignorable(), From ad7c7deb274f8df62e760b3b7cf4c56c769fa9e4 Mon Sep 17 00:00:00 2001 From: shayebeadlingkl Date: Sun, 21 Apr 2024 14:38:47 -0400 Subject: [PATCH 2/3] 30 percent chance to proc --- src/data/ability.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/data/ability.ts b/src/data/ability.ts index f876f7f525d..4ccff675386 100644 --- a/src/data/ability.ts +++ b/src/data/ability.ts @@ -2682,7 +2682,7 @@ export function initAbilities() { .attr(BattleStatMultiplierAbAttr, BattleStat.SPATK, 0.5) .condition((pokemon) => pokemon.getHpRatio() <= 0.5), new Ability(Abilities.CURSED_BODY, "Cursed Body", "May disable a move used on the Pokémon.", 5) - .attr(PostDefendMoveDisableAbAttr, 100), + .attr(PostDefendMoveDisableAbAttr, 30), new Ability(Abilities.HEALER, "Healer (N)", "Sometimes heals an ally's status condition.", 5), new Ability(Abilities.FRIEND_GUARD, "Friend Guard (N)", "Reduces damage done to allies.", 5) .ignorable(), From e18f5f972b879035556089758989e5dcd4918a87 Mon Sep 17 00:00:00 2001 From: shayebeadlingkl Date: Fri, 26 Apr 2024 09:14:36 -0400 Subject: [PATCH 3/3] check if max --- src/data/ability.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/data/ability.ts b/src/data/ability.ts index e02765ec143..590f45fd735 100644 --- a/src/data/ability.ts +++ b/src/data/ability.ts @@ -817,7 +817,7 @@ export class PostDefendMoveDisableAbAttr extends PostDefendAbAttr { applyPostDefend(pokemon: Pokemon, passive: boolean, attacker: Pokemon, move: PokemonMove, hitResult: HitResult, args: any[]): boolean { if (!attacker.summonData.disabledMove) { - if (move.getMove().checkFlag(MoveFlags.MAKES_CONTACT, attacker, pokemon) && (this.chance === -1 || pokemon.randSeedInt(100) < this.chance)) { + if (move.getMove().checkFlag(MoveFlags.MAKES_CONTACT, attacker, pokemon) && (this.chance === -1 || pokemon.randSeedInt(100) < this.chance) && !attacker.isMax()) { this.attacker = attacker; this.move = move;