mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-04 15:32:18 +02:00
implements cursed body
This commit is contained in:
parent
24c2e18ed7
commit
0e84343b15
@ -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(),
|
||||
|
Loading…
Reference in New Issue
Block a user