Implement Anger Shell and Berserk (#421)
* abilities: implement anger shell and berserk * abilities: fix small typo causing berserk to raise speed instead of spatk * abilities: condense battlestats into an array instead of multiple attrspull/434/head
parent
313fdc0e42
commit
d48f0aa97d
|
@ -580,6 +580,35 @@ export class PostDefendStatChangeAbAttr extends PostDefendAbAttr {
|
|||
}
|
||||
}
|
||||
|
||||
export class PostDefendHpGatedStatChangeAbAttr extends PostDefendAbAttr {
|
||||
private condition: PokemonDefendCondition;
|
||||
private hpGate: number;
|
||||
private stats: BattleStat[];
|
||||
private levels: integer;
|
||||
private selfTarget: boolean;
|
||||
|
||||
constructor(condition: PokemonDefendCondition, hpGate: number, stats: BattleStat[], levels: integer, selfTarget: boolean = true) {
|
||||
super(true);
|
||||
|
||||
this.condition = condition;
|
||||
this.hpGate = hpGate;
|
||||
this.stats = stats;
|
||||
this.levels = levels;
|
||||
this.selfTarget = selfTarget;
|
||||
}
|
||||
|
||||
applyPostDefend(pokemon: Pokemon, passive: boolean, attacker: Pokemon, move: PokemonMove, hitResult: HitResult, args: any[]): boolean {
|
||||
const hpGateFlat: integer = Math.ceil(pokemon.getMaxHp() * this.hpGate)
|
||||
const lastAttackReceived = pokemon.turnData.attacksReceived[pokemon.turnData.attacksReceived.length - 1]
|
||||
if (this.condition(pokemon, attacker, move.getMove()) && (pokemon.hp <= hpGateFlat && (pokemon.hp + lastAttackReceived.damage) > hpGateFlat)) {
|
||||
pokemon.scene.unshiftPhase(new StatChangePhase(pokemon.scene, (this.selfTarget ? pokemon : attacker).getBattlerIndex(), true, this.stats, this.levels));
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export class PostDefendApplyArenaTrapTagAbAttr extends PostDefendAbAttr {
|
||||
private condition: PokemonDefendCondition;
|
||||
private tagType: ArenaTagType;
|
||||
|
@ -3091,7 +3120,7 @@ export function initAbilities() {
|
|||
new Ability(Abilities.STEELWORKER, 7)
|
||||
.attr(MoveTypePowerBoostAbAttr, Type.STEEL),
|
||||
new Ability(Abilities.BERSERK, 7)
|
||||
.unimplemented(),
|
||||
.attr(PostDefendHpGatedStatChangeAbAttr, (target, user, move) => move.category !== MoveCategory.STATUS, 0.5, [BattleStat.SPATK], 1),
|
||||
new Ability(Abilities.SLUSH_RUSH, 7)
|
||||
.attr(BattleStatMultiplierAbAttr, BattleStat.SPD, 2)
|
||||
.condition(getWeatherCondition(WeatherType.HAIL, WeatherType.SNOW)),
|
||||
|
@ -3327,7 +3356,8 @@ export function initAbilities() {
|
|||
.attr(StatusEffectImmunityAbAttr, StatusEffect.BURN)
|
||||
.ignorable(),
|
||||
new Ability(Abilities.ANGER_SHELL, 9)
|
||||
.unimplemented(),
|
||||
.attr(PostDefendHpGatedStatChangeAbAttr, (target, user, move) => move.category !== MoveCategory.STATUS, 0.5, [ BattleStat.ATK, BattleStat.SPATK, BattleStat.SPD ], 1)
|
||||
.attr(PostDefendHpGatedStatChangeAbAttr, (target, user, move) => move.category !== MoveCategory.STATUS, 0.5, [ BattleStat.DEF, BattleStat.SPDEF ], -1),
|
||||
new Ability(Abilities.PURIFYING_SALT, 9)
|
||||
.attr(StatusEffectImmunityAbAttr)
|
||||
.attr(ReceivedTypeDamageMultiplierAbAttr, Type.GHOST, 0.5)
|
||||
|
|
Loading…
Reference in New Issue