Implemented Anger Point Ability

pull/2/head
xDasone 2023-10-26 21:12:53 -07:00
parent 1b47741ca5
commit 1d8cf50f1b
2 changed files with 27 additions and 3 deletions

View File

@ -320,6 +320,28 @@ export class PostDefendContactApplyTagChanceAbAttr extends PostDefendAbAttr {
} }
} }
export class PostDefendCritStatChangeAbAttr extends PostDefendAbAttr {
private stat: BattleStat;
private levels: integer;
constructor(stat: BattleStat, levels: integer) {
super(true);
this.stat = stat;
this.levels = levels;
}
applyPostDefend(pokemon: Pokemon, attacker: Pokemon, move: PokemonMove, hitResult: HitResult, args: any[]): boolean {
pokemon.scene.unshiftPhase(new StatChangePhase(pokemon.scene, pokemon.getBattlerIndex(), true, [ this.stat ], this.levels));
return true;
}
getCondition(): AbAttrCondition {
return (pokemon: Pokemon) => pokemon.turnData.attacksReceived.length && pokemon.turnData.attacksReceived[pokemon.turnData.attacksReceived.length - 1].critical;
}
}
export class PreAttackAbAttr extends AbAttr { export class PreAttackAbAttr extends AbAttr {
applyPreAttack(pokemon: Pokemon, defender: Pokemon, move: PokemonMove, args: any[]): boolean { applyPreAttack(pokemon: Pokemon, defender: Pokemon, move: PokemonMove, args: any[]): boolean {
return false; return false;
@ -1342,7 +1364,8 @@ export function initAbilities() {
new Ability(Abilities.ADAPTABILITY, "Adaptability", "Powers up moves of the same type.", 4) new Ability(Abilities.ADAPTABILITY, "Adaptability", "Powers up moves of the same type.", 4)
.attr(StabBoostAbAttr), .attr(StabBoostAbAttr),
new Ability(Abilities.AFTERMATH, "Aftermath (N)", "Damages the attacker landing the finishing hit.", 4), new Ability(Abilities.AFTERMATH, "Aftermath (N)", "Damages the attacker landing the finishing hit.", 4),
new Ability(Abilities.ANGER_POINT, "Anger Point (N)", "Maxes Attack after taking a critical hit.", 4), new Ability(Abilities.ANGER_POINT, "Anger Point", "Maxes Attack after taking a critical hit.", 4)
.attr(PostDefendCritStatChangeAbAttr, BattleStat.ATK, 6),
new Ability(Abilities.ANTICIPATION, "Anticipation (N)", "Senses a foe's dangerous moves.", 4), new Ability(Abilities.ANTICIPATION, "Anticipation (N)", "Senses a foe's dangerous moves.", 4),
new Ability(Abilities.BAD_DREAMS, "Bad Dreams (N)", "Reduces a sleeping foe's HP.", 4), new Ability(Abilities.BAD_DREAMS, "Bad Dreams (N)", "Reduces a sleeping foe's HP.", 4),
new Ability(Abilities.DOWNLOAD, "Download (N)", "Adjusts power according to a foe's defenses.", 4), new Ability(Abilities.DOWNLOAD, "Download (N)", "Adjusts power according to a foe's defenses.", 4),

View File

@ -23,7 +23,7 @@ import { WeatherType } from './data/weather';
import { TempBattleStat } from './data/temp-battle-stat'; import { TempBattleStat } from './data/temp-battle-stat';
import { ArenaTagType, WeakenMoveTypeTag } from './data/arena-tag'; import { ArenaTagType, WeakenMoveTypeTag } from './data/arena-tag';
import { Biome } from './data/biome'; import { Biome } from './data/biome';
import { Abilities, Ability, BattleStatMultiplierAbAttr, BlockCritAbAttr, NonSuperEffectiveImmunityAbAttr, PreApplyBattlerTagAbAttr, StabBoostAbAttr, StatusEffectImmunityAbAttr, TypeImmunityAbAttr, VariableMovePowerAbAttr, abilities, applyAbAttrs, applyBattleStatMultiplierAbAttrs, applyPreApplyBattlerTagAbAttrs, applyPreAttackAbAttrs, applyPreDefendAbAttrs, applyPreSetStatusAbAttrs } from './data/ability'; import { Abilities, Ability, BattleStatMultiplierAbAttr, BlockCritAbAttr, NonSuperEffectiveImmunityAbAttr, PreApplyBattlerTagAbAttr, StabBoostAbAttr, StatusEffectImmunityAbAttr, TypeImmunityAbAttr, VariableMovePowerAbAttr, abilities, applyAbAttrs, applyBattleStatMultiplierAbAttrs, applyPostDefendAbAttrs, applyPreApplyBattlerTagAbAttrs, applyPreAttackAbAttrs, applyPreDefendAbAttrs, applyPreSetStatusAbAttrs } from './data/ability';
import PokemonData from './system/pokemon-data'; import PokemonData from './system/pokemon-data';
import { BattlerIndex } from './battle'; import { BattlerIndex } from './battle';
@ -721,7 +721,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
damage = Math.min(damage, this.hp); damage = Math.min(damage, this.hp);
this.damage(damage); this.damage(damage);
source.turnData.damageDealt += damage; source.turnData.damageDealt += damage;
this.turnData.attacksReceived.unshift({ move: move.id, result: result as DamageResult, damage: damage, sourceId: source.id }); this.turnData.attacksReceived.unshift({ move: move.id, result: result as DamageResult, damage: damage, critical: isCritical, sourceId: source.id });
} }
switch (result) { switch (result) {
@ -1363,6 +1363,7 @@ export interface AttackMoveResult {
move: Moves; move: Moves;
result: DamageResult; result: DamageResult;
damage: integer; damage: integer;
critical: boolean;
sourceId: integer; sourceId: integer;
} }