Powder basic implementation

This commit is contained in:
innerthunder 2024-08-19 23:49:04 -07:00
parent c846f552bb
commit 55974903ae
3 changed files with 41 additions and 3 deletions

View File

@ -542,6 +542,41 @@ export class SeedTag extends BattlerTag {
}
}
/**
* BattlerTag representing the effects of {@link https://bulbapedia.bulbagarden.net/wiki/Powder_(move) | Powder}.
* When the afflicted Pokemon uses a Fire-type move, the move is cancelled, and the
* Pokemon takes damage equal to 1/4 of it's maximum HP (rounded down).
*/
export class PowderTag extends BattlerTag {
constructor() {
super(BattlerTagType.POWDER, [ BattlerTagLapseType.PRE_MOVE, BattlerTagLapseType.TURN_END ], 1);
}
onAdd(pokemon: Pokemon): void {
super.onAdd(pokemon);
pokemon.scene.queueMessage(i18next.t("battlerTags:powderOnAdd", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon) }));
}
lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean {
if (lapseType === BattlerTagLapseType.PRE_MOVE) {
const movePhase = pokemon.scene.getCurrentPhase();
if (movePhase instanceof MovePhase) {
const move = movePhase.move.getMove();
if (move.type === Type.FIRE) {
movePhase.cancel();
pokemon.damageAndUpdate(Math.floor(pokemon.getMaxHp() / 4), HitResult.OTHER);
pokemon.scene.queueMessage(i18next.t("battlerTags:powderLapse"));
}
}
return true;
} else {
return super.lapse(pokemon, lapseType);
}
}
}
export class NightmareTag extends BattlerTag {
constructor() {
super(BattlerTagType.NIGHTMARE, BattlerTagLapseType.AFTER_MOVE, 1, Moves.NIGHTMARE);
@ -1846,6 +1881,8 @@ export function getBattlerTag(tagType: BattlerTagType, turnCount: number, source
return new InfatuatedTag(sourceMove, sourceId);
case BattlerTagType.SEEDED:
return new SeedTag(sourceId);
case BattlerTagType.POWDER:
return new PowderTag();
case BattlerTagType.NIGHTMARE:
return new NightmareTag();
case BattlerTagType.FRENZY:

View File

@ -7864,8 +7864,8 @@ export function initMoves() {
.attr(StatChangeAttr, [ BattleStat.ATK, BattleStat.SPATK, BattleStat.SPD ], -1, false, (user, target, move) => target.status?.effect === StatusEffect.POISON || target.status?.effect === StatusEffect.TOXIC)
.target(MoveTarget.ALL_NEAR_ENEMIES),
new StatusMove(Moves.POWDER, Type.BUG, 100, 20, -1, 1, 6)
.powderMove()
.unimplemented(),
.attr(AddBattlerTagAttr, BattlerTagType.POWDER, false, true)
.powderMove(),
new SelfStatusMove(Moves.GEOMANCY, Type.FAIRY, -1, 10, -1, 0, 6)
.attr(ChargeAttr, ChargeAnim.GEOMANCY_CHARGING, i18next.t("moveTriggers:isChargingPower", {pokemonName: "{USER}"}))
.attr(StatChangeAttr, [ BattleStat.SPATK, BattleStat.SPDEF, BattleStat.SPD ], 2, true)

View File

@ -69,5 +69,6 @@ export enum BattlerTagType {
GULP_MISSILE_ARROKUDA = "GULP_MISSILE_ARROKUDA",
GULP_MISSILE_PIKACHU = "GULP_MISSILE_PIKACHU",
BEAK_BLAST_CHARGING = "BEAK_BLAST_CHARGING",
SHELL_TRAP = "SHELL_TRAP"
SHELL_TRAP = "SHELL_TRAP",
POWDER = "POWDER"
}