Implement Purify (#1291)

* Implement purify

* Code review fixes

* Remove vitest import

* Update status-effect.ts

* Update status-effect.ts

---------

Co-authored-by: Benjamin Odom <bennybroseph@gmail.com>
This commit is contained in:
ReneGV 2024-05-25 05:01:23 -06:00 committed by GitHub
parent 79f69ddfe0
commit 5c327e347a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 30 additions and 3 deletions

View File

@ -6,7 +6,7 @@ import { EncoreTag } from "./battler-tags";
import { BattlerTagType } from "./enums/battler-tag-type";
import { getPokemonMessage } from "../messages";
import Pokemon, { AttackMoveResult, EnemyPokemon, HitResult, MoveResult, PlayerPokemon, PokemonMove, TurnMove } from "../field/pokemon";
import { StatusEffect, getStatusEffectHealText } from "./status-effect";
import { StatusEffect, getStatusEffectHealText, isNonVolatileStatusEffect, getNonVolatileStatusEffects} from "./status-effect";
import { Type } from "./type";
import * as Utils from "../utils";
import { WeatherType } from "./weather";
@ -6813,8 +6813,11 @@ export function initMoves() {
.unimplemented(),
new AttackMove(Moves.SMART_STRIKE, Type.STEEL, MoveCategory.PHYSICAL, 70, -1, 10, -1, 0, 7),
new StatusMove(Moves.PURIFY, Type.POISON, -1, 20, -1, 0, 7)
.triageMove()
.unimplemented(),
.condition(
(user: Pokemon, target: Pokemon, move: Move) => isNonVolatileStatusEffect(user.status?.effect))
.attr(HealAttr, 0.5)
.attr(HealStatusEffectAttr, true, ...getNonVolatileStatusEffects())
.triageMove(),
new AttackMove(Moves.REVELATION_DANCE, Type.NORMAL, MoveCategory.SPECIAL, 90, 100, 15, -1, 0, 7)
.danceMove()
.attr(MatchUserTypeAttr),

View File

@ -175,3 +175,27 @@ export function getRandomStatus(statusA: Status, statusB: Status): Status {
return Utils.randIntRange(0, 2) ? statusA : statusB;
}
/**
* Gets all non volatile status effects
* @returns A list containing all non volatile status effects
*/
export function getNonVolatileStatusEffects():Array<StatusEffect> {
return [
StatusEffect.POISON,
StatusEffect.TOXIC,
StatusEffect.PARALYSIS,
StatusEffect.SLEEP,
StatusEffect.FREEZE,
StatusEffect.BURN
];
}
/**
* Returns whether a statuss effect is non volatile.
* Non-volatile status condition is a status that remains after being switched out.
* @param status The status to check
*/
export function isNonVolatileStatusEffect(status: StatusEffect): boolean {
return getNonVolatileStatusEffects().includes(status);
}