mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-01 05:52:17 +02:00
Split up trySetStatus
fully; fixed rest turn order display to match mainline
This commit is contained in:
parent
c76739f629
commit
8a10cc2037
@ -1549,7 +1549,7 @@ export class PostDefendContactApplyStatusEffectAbAttr extends PostDefendAbAttr {
|
|||||||
): void {
|
): void {
|
||||||
const effect =
|
const effect =
|
||||||
this.effects.length === 1 ? this.effects[0] : this.effects[pokemon.randBattleSeedInt(this.effects.length)];
|
this.effects.length === 1 ? this.effects[0] : this.effects[pokemon.randBattleSeedInt(this.effects.length)];
|
||||||
attacker.trySetStatus(effect, true, pokemon);
|
attacker.trySetStatus(effect, pokemon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2885,7 +2885,7 @@ export class PostAttackApplyStatusEffectAbAttr extends PostAttackAbAttr {
|
|||||||
): void {
|
): void {
|
||||||
const effect =
|
const effect =
|
||||||
this.effects.length === 1 ? this.effects[0] : this.effects[pokemon.randBattleSeedInt(this.effects.length)];
|
this.effects.length === 1 ? this.effects[0] : this.effects[pokemon.randBattleSeedInt(this.effects.length)];
|
||||||
attacker.trySetStatus(effect, true, pokemon);
|
attacker.trySetStatus(effect, pokemon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3092,7 +3092,7 @@ export class SynchronizeStatusAbAttr extends PostSetStatusAbAttr {
|
|||||||
_args: any[],
|
_args: any[],
|
||||||
): void {
|
): void {
|
||||||
if (!simulated && sourcePokemon) {
|
if (!simulated && sourcePokemon) {
|
||||||
sourcePokemon.trySetStatus(effect, true, pokemon);
|
sourcePokemon.trySetStatus(effect, pokemon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -8931,7 +8931,7 @@ export function initAbilities() {
|
|||||||
new Ability(AbilityId.ORICHALCUM_PULSE, 9)
|
new Ability(AbilityId.ORICHALCUM_PULSE, 9)
|
||||||
.attr(PostSummonWeatherChangeAbAttr, WeatherType.SUNNY)
|
.attr(PostSummonWeatherChangeAbAttr, WeatherType.SUNNY)
|
||||||
.attr(PostBiomeChangeWeatherChangeAbAttr, WeatherType.SUNNY)
|
.attr(PostBiomeChangeWeatherChangeAbAttr, WeatherType.SUNNY)
|
||||||
.conditionalAttr(getWeatherCondition(WeatherType.SUNNY, WeatherType.HARSH_SUN), StatMultiplierAbAttr, Stat.ATK, 4 / 3), // No game freak rounding jank
|
.conditionalAttr(getWeatherCondition(WeatherType.SUNNY, WeatherType.HARSH_SUN), StatMultiplierAbAttr, Stat.ATK, 4 / 3),
|
||||||
new Ability(AbilityId.HADRON_ENGINE, 9)
|
new Ability(AbilityId.HADRON_ENGINE, 9)
|
||||||
.attr(PostSummonTerrainChangeAbAttr, TerrainType.ELECTRIC)
|
.attr(PostSummonTerrainChangeAbAttr, TerrainType.ELECTRIC)
|
||||||
.attr(PostBiomeChangeTerrainChangeAbAttr, TerrainType.ELECTRIC)
|
.attr(PostBiomeChangeTerrainChangeAbAttr, TerrainType.ELECTRIC)
|
||||||
|
@ -552,7 +552,7 @@ class WishTag extends ArenaTag {
|
|||||||
const target = globalScene.getField()[this.battlerIndex];
|
const target = globalScene.getField()[this.battlerIndex];
|
||||||
if (target?.isActive(true)) {
|
if (target?.isActive(true)) {
|
||||||
globalScene.phaseManager.queueMessage(this.triggerMessage);
|
globalScene.phaseManager.queueMessage(this.triggerMessage);
|
||||||
globalScene.phaseManager.unshiftNew("PokemonHealPhase", target.getBattlerIndex(), this.healHp, null, true, false);
|
globalScene.phaseManager.unshiftNew("PokemonHealPhase", target.getBattlerIndex(), this.healHp, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -839,7 +839,6 @@ class ToxicSpikesTag extends ArenaTrapTag {
|
|||||||
|
|
||||||
return pokemon.trySetStatus(
|
return pokemon.trySetStatus(
|
||||||
this.layers === 1 ? StatusEffect.POISON : StatusEffect.TOXIC,
|
this.layers === 1 ? StatusEffect.POISON : StatusEffect.TOXIC,
|
||||||
true,
|
|
||||||
null,
|
null,
|
||||||
0,
|
0,
|
||||||
this.getMoveName(),
|
this.getMoveName(),
|
||||||
|
@ -487,7 +487,7 @@ export class BeakBlastChargingTag extends BattlerTag {
|
|||||||
target: pokemon,
|
target: pokemon,
|
||||||
})
|
})
|
||||||
) {
|
) {
|
||||||
phaseData.attacker.trySetStatus(StatusEffect.BURN, true, pokemon);
|
phaseData.attacker.trySetStatus(StatusEffect.BURN, pokemon);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1377,7 +1377,7 @@ export class DrowsyTag extends BattlerTag {
|
|||||||
|
|
||||||
lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean {
|
lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean {
|
||||||
if (!super.lapse(pokemon, lapseType)) {
|
if (!super.lapse(pokemon, lapseType)) {
|
||||||
pokemon.trySetStatus(StatusEffect.SLEEP, true);
|
pokemon.trySetStatus(StatusEffect.SLEEP);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1706,7 +1706,7 @@ export class ContactSetStatusProtectedTag extends DamageProtectedTag {
|
|||||||
* @param user - The pokemon that is being attacked and has the tag
|
* @param user - The pokemon that is being attacked and has the tag
|
||||||
*/
|
*/
|
||||||
override onContact(attacker: Pokemon, user: Pokemon): void {
|
override onContact(attacker: Pokemon, user: Pokemon): void {
|
||||||
attacker.trySetStatus(this.statusEffect, true, user);
|
attacker.trySetStatus(this.statusEffect, user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2668,7 +2668,7 @@ export class GulpMissileTag extends BattlerTag {
|
|||||||
if (this.tagType === BattlerTagType.GULP_MISSILE_ARROKUDA) {
|
if (this.tagType === BattlerTagType.GULP_MISSILE_ARROKUDA) {
|
||||||
globalScene.phaseManager.unshiftNew("StatStageChangePhase", attacker.getBattlerIndex(), false, [Stat.DEF], -1);
|
globalScene.phaseManager.unshiftNew("StatStageChangePhase", attacker.getBattlerIndex(), false, [Stat.DEF], -1);
|
||||||
} else {
|
} else {
|
||||||
attacker.trySetStatus(StatusEffect.PARALYSIS, true, pokemon);
|
attacker.trySetStatus(StatusEffect.PARALYSIS, pokemon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -27,7 +27,7 @@ import {
|
|||||||
} from "../status-effect";
|
} from "../status-effect";
|
||||||
import { getTypeDamageMultiplier } from "../type";
|
import { getTypeDamageMultiplier } from "../type";
|
||||||
import { PokemonType } from "#enums/pokemon-type";
|
import { PokemonType } from "#enums/pokemon-type";
|
||||||
import { BooleanHolder, NumberHolder, isNullOrUndefined, toDmgValue, randSeedItem, randSeedInt, getEnumValues, toReadableString, type Constructor, randSeedFloat } from "#app/utils/common";
|
import { BooleanHolder, NumberHolder, isNullOrUndefined, toDmgValue, randSeedItem, randSeedInt, getEnumValues, toReadableString, type Constructor, randSeedFloat, coerceArray } from "#app/utils/common";
|
||||||
import { WeatherType } from "#enums/weather-type";
|
import { WeatherType } from "#enums/weather-type";
|
||||||
import type { ArenaTrapTag } from "../arena-tag";
|
import type { ArenaTrapTag } from "../arena-tag";
|
||||||
import { WeakenMoveTypeTag } from "../arena-tag";
|
import { WeakenMoveTypeTag } from "../arena-tag";
|
||||||
@ -70,13 +70,9 @@ import {
|
|||||||
getStatKey,
|
getStatKey,
|
||||||
Stat,
|
Stat,
|
||||||
} from "#app/enums/stat";
|
} from "#app/enums/stat";
|
||||||
import { BattleEndPhase } from "#app/phases/battle-end-phase";
|
|
||||||
import { MoveEndPhase } from "#app/phases/move-end-phase";
|
import { MoveEndPhase } from "#app/phases/move-end-phase";
|
||||||
import { MovePhase } from "#app/phases/move-phase";
|
import { MovePhase } from "#app/phases/move-phase";
|
||||||
import { NewBattlePhase } from "#app/phases/new-battle-phase";
|
|
||||||
import { PokemonHealPhase } from "#app/phases/pokemon-heal-phase";
|
import { PokemonHealPhase } from "#app/phases/pokemon-heal-phase";
|
||||||
import { StatStageChangePhase } from "#app/phases/stat-stage-change-phase";
|
|
||||||
import { SwitchPhase } from "#app/phases/switch-phase";
|
|
||||||
import { SwitchSummonPhase } from "#app/phases/switch-summon-phase";
|
import { SwitchSummonPhase } from "#app/phases/switch-summon-phase";
|
||||||
import { SpeciesFormChangeRevertWeatherFormTrigger } from "../pokemon-forms/form-change-triggers";
|
import { SpeciesFormChangeRevertWeatherFormTrigger } from "../pokemon-forms/form-change-triggers";
|
||||||
import type { GameMode } from "#app/game-mode";
|
import type { GameMode } from "#app/game-mode";
|
||||||
@ -1916,19 +1912,16 @@ export class AddSubstituteAttr extends MoveEffectAttr {
|
|||||||
* @see {@linkcode apply}
|
* @see {@linkcode apply}
|
||||||
*/
|
*/
|
||||||
export class HealAttr extends MoveEffectAttr {
|
export class HealAttr extends MoveEffectAttr {
|
||||||
/** The percentage of {@linkcode Stat.HP} to heal */
|
constructor(
|
||||||
private healRatio: number;
|
/** The percentage of {@linkcode Stat.HP} to heal. */
|
||||||
/** Should an animation be shown? */
|
private healRatio: number,
|
||||||
private showAnim: boolean;
|
/** Whether to display a healing animation when healing the target; default `false` */
|
||||||
|
private showAnim = false,
|
||||||
constructor(healRatio = 1, showAnim = false, selfTarget = true) {
|
selfTarget = true) {
|
||||||
super(selfTarget);
|
super(selfTarget);
|
||||||
|
|
||||||
this.healRatio = healRatio;
|
|
||||||
this.showAnim = showAnim;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
override apply(user: Pokemon, target: Pokemon, _move: Move, _args: any[]): boolean {
|
||||||
this.addHealPhase(this.selfTarget ? user : target, this.healRatio);
|
this.addHealPhase(this.selfTarget ? user : target, this.healRatio);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1937,15 +1930,97 @@ export class HealAttr extends MoveEffectAttr {
|
|||||||
* Creates a new {@linkcode PokemonHealPhase}.
|
* Creates a new {@linkcode PokemonHealPhase}.
|
||||||
* This heals the target and shows the appropriate message.
|
* This heals the target and shows the appropriate message.
|
||||||
*/
|
*/
|
||||||
addHealPhase(target: Pokemon, healRatio: number) {
|
protected addHealPhase(target: Pokemon, healRatio: number) {
|
||||||
globalScene.phaseManager.unshiftNew("PokemonHealPhase", target.getBattlerIndex(),
|
globalScene.phaseManager.unshiftNew("PokemonHealPhase", target.getBattlerIndex(),
|
||||||
toDmgValue(target.getMaxHp() * healRatio), i18next.t("moveTriggers:healHp", { pokemonName: getPokemonNameWithAffix(target) }), true, !this.showAnim);
|
toDmgValue(target.getMaxHp() * healRatio), i18next.t("moveTriggers:healHp", { pokemonName: getPokemonNameWithAffix(target) }), true, !this.showAnim);
|
||||||
}
|
}
|
||||||
|
|
||||||
getTargetBenefitScore(user: Pokemon, target: Pokemon, move: Move): number {
|
override getTargetBenefitScore(user: Pokemon, target: Pokemon, move: Move): number {
|
||||||
const score = ((1 - (this.selfTarget ? user : target).getHpRatio()) * 20) - this.healRatio * 10;
|
const score = ((1 - (this.selfTarget ? user : target).getHpRatio()) * 20) - this.healRatio * 10;
|
||||||
return Math.round(score / (1 - this.healRatio / 2));
|
return Math.round(score / (1 - this.healRatio / 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override canApply(_user: Pokemon, target: Pokemon, _move: Move, _args?: any[]): boolean {
|
||||||
|
if (target.isFullHp()) {
|
||||||
|
globalScene.phaseManager.queueMessage(i18next.t("battle:hpIsFull", {
|
||||||
|
pokemonName: getPokemonNameWithAffix(target),
|
||||||
|
}))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attribute for moves with variable healing amounts.
|
||||||
|
* Heals the target by an amount depending on the return value of {@linkcode healFunc}.
|
||||||
|
*
|
||||||
|
* Used for {@linkcode MoveId.MOONLIGHT}, {@linkcode MoveId.SHORE_UP}, {@linkcode MoveId.JUNGLE_HEALING}, {@linkcode MoveId.SWALLOW}
|
||||||
|
*/
|
||||||
|
export class VariableHealAttr extends HealAttr {
|
||||||
|
constructor(
|
||||||
|
/** A function yielding the amount of HP to heal. */
|
||||||
|
private healFunc: (user: Pokemon, target: Pokemon, _move: Move) => number,
|
||||||
|
showAnim = false,
|
||||||
|
selfTarget = true,
|
||||||
|
) {
|
||||||
|
super(1, showAnim, selfTarget);
|
||||||
|
this.healFunc = healFunc;
|
||||||
|
}
|
||||||
|
|
||||||
|
apply(user: Pokemon, target: Pokemon, move: Move, _args: any[]): boolean {
|
||||||
|
const healRatio = this.healFunc(user, target, move)
|
||||||
|
this.addHealPhase(target, healRatio);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Heals the target only if it is an ally.
|
||||||
|
* Used for {@linkcode MoveId.POLLEN_PUFF}.
|
||||||
|
*/
|
||||||
|
export class HealOnAllyAttr extends HealAttr {
|
||||||
|
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
||||||
|
if (user.getAlly() === target) {
|
||||||
|
super.apply(user, target, move, args);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
override canApply(user: Pokemon, target: Pokemon, _move: Move, _args?: any[]): boolean {
|
||||||
|
return user.getAlly() !== target || super.canApply(user, target, _move, _args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attribute to put the user to sleep for a fixed duration, fully heal them and cure their status.
|
||||||
|
* Used for {@linkcode MoveId.REST}.
|
||||||
|
*/
|
||||||
|
export class RestAttr extends HealAttr {
|
||||||
|
private duration: number;
|
||||||
|
|
||||||
|
constructor(duration: number) {
|
||||||
|
super(1);
|
||||||
|
this.duration = duration;
|
||||||
|
}
|
||||||
|
|
||||||
|
override apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
||||||
|
user.trySetStatus(StatusEffect.SLEEP, user, this.duration, null, true, true);
|
||||||
|
globalScene.phaseManager.queueMessage(i18next.t("moveTriggers:restBecameHealthy", {
|
||||||
|
pokemonName: getPokemonNameWithAffix(user),
|
||||||
|
}))
|
||||||
|
return super.apply(user, target, move, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
override addHealPhase(user: Pokemon, healRatio: number): void {
|
||||||
|
globalScene.phaseManager.unshiftNew("PokemonHealPhase", user.getBattlerIndex(), healRatio, "")
|
||||||
|
}
|
||||||
|
|
||||||
|
canApply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
||||||
|
return super.canApply(user, target, move, args) && user.canSetStatus(StatusEffect.SLEEP, true, true, user)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2128,111 +2203,6 @@ export class IgnoreWeatherTypeDebuffAttr extends MoveAttr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export abstract class WeatherHealAttr extends HealAttr {
|
|
||||||
constructor() {
|
|
||||||
super(0.5);
|
|
||||||
}
|
|
||||||
|
|
||||||
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
|
||||||
let healRatio = 0.5;
|
|
||||||
if (!globalScene.arena.weather?.isEffectSuppressed()) {
|
|
||||||
const weatherType = globalScene.arena.weather?.weatherType || WeatherType.NONE;
|
|
||||||
healRatio = this.getWeatherHealRatio(weatherType);
|
|
||||||
}
|
|
||||||
this.addHealPhase(user, healRatio);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract getWeatherHealRatio(weatherType: WeatherType): number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class PlantHealAttr extends WeatherHealAttr {
|
|
||||||
getWeatherHealRatio(weatherType: WeatherType): number {
|
|
||||||
switch (weatherType) {
|
|
||||||
case WeatherType.SUNNY:
|
|
||||||
case WeatherType.HARSH_SUN:
|
|
||||||
return 2 / 3;
|
|
||||||
case WeatherType.RAIN:
|
|
||||||
case WeatherType.SANDSTORM:
|
|
||||||
case WeatherType.HAIL:
|
|
||||||
case WeatherType.SNOW:
|
|
||||||
case WeatherType.HEAVY_RAIN:
|
|
||||||
return 0.25;
|
|
||||||
default:
|
|
||||||
return 0.5;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class SandHealAttr extends WeatherHealAttr {
|
|
||||||
getWeatherHealRatio(weatherType: WeatherType): number {
|
|
||||||
switch (weatherType) {
|
|
||||||
case WeatherType.SANDSTORM:
|
|
||||||
return 2 / 3;
|
|
||||||
default:
|
|
||||||
return 0.5;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Heals the target or the user by either {@linkcode normalHealRatio} or {@linkcode boostedHealRatio}
|
|
||||||
* depending on the evaluation of {@linkcode condition}
|
|
||||||
* @extends HealAttr
|
|
||||||
* @see {@linkcode apply}
|
|
||||||
*/
|
|
||||||
export class BoostHealAttr extends HealAttr {
|
|
||||||
/** Healing received when {@linkcode condition} is false */
|
|
||||||
private normalHealRatio: number;
|
|
||||||
/** Healing received when {@linkcode condition} is true */
|
|
||||||
private boostedHealRatio: number;
|
|
||||||
/** The lambda expression to check against when boosting the healing value */
|
|
||||||
private condition?: MoveConditionFunc;
|
|
||||||
|
|
||||||
constructor(normalHealRatio: number = 0.5, boostedHealRatio: number = 2 / 3, showAnim?: boolean, selfTarget?: boolean, condition?: MoveConditionFunc) {
|
|
||||||
super(normalHealRatio, showAnim, selfTarget);
|
|
||||||
this.normalHealRatio = normalHealRatio;
|
|
||||||
this.boostedHealRatio = boostedHealRatio;
|
|
||||||
this.condition = condition;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param user {@linkcode Pokemon} using the move
|
|
||||||
* @param target {@linkcode Pokemon} target of the move
|
|
||||||
* @param move {@linkcode Move} with this attribute
|
|
||||||
* @param args N/A
|
|
||||||
* @returns true if the move was successful
|
|
||||||
*/
|
|
||||||
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
|
||||||
const healRatio: number = (this.condition ? this.condition(user, target, move) : false) ? this.boostedHealRatio : this.normalHealRatio;
|
|
||||||
this.addHealPhase(target, healRatio);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Heals the target only if it is the ally
|
|
||||||
* @extends HealAttr
|
|
||||||
* @see {@linkcode apply}
|
|
||||||
*/
|
|
||||||
export class HealOnAllyAttr extends HealAttr {
|
|
||||||
/**
|
|
||||||
* @param user {@linkcode Pokemon} using the move
|
|
||||||
* @param target {@linkcode Pokemon} target of the move
|
|
||||||
* @param move {@linkcode Move} with this attribute
|
|
||||||
* @param args N/A
|
|
||||||
* @returns true if the function succeeds
|
|
||||||
*/
|
|
||||||
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
|
||||||
if (user.getAlly() === target) {
|
|
||||||
super.apply(user, target, move, args);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Heals user as a side effect of a move that hits a target.
|
* Heals user as a side effect of a move that hits a target.
|
||||||
* Healing is based on {@linkcode healRatio} * the amount of damage dealt or a stat of the target.
|
* Healing is based on {@linkcode healRatio} * the amount of damage dealt or a stat of the target.
|
||||||
@ -2240,6 +2210,7 @@ export class HealOnAllyAttr extends HealAttr {
|
|||||||
* @see {@linkcode apply}
|
* @see {@linkcode apply}
|
||||||
* @see {@linkcode getUserBenefitScore}
|
* @see {@linkcode getUserBenefitScore}
|
||||||
*/
|
*/
|
||||||
|
// TODO: Make Strength Sap its own attribute that extends off of this one
|
||||||
export class HitHealAttr extends MoveEffectAttr {
|
export class HitHealAttr extends MoveEffectAttr {
|
||||||
private healRatio: number;
|
private healRatio: number;
|
||||||
private healStat: EffectiveStat | null;
|
private healStat: EffectiveStat | null;
|
||||||
@ -2508,7 +2479,7 @@ export class StatusEffectAttr extends MoveEffectAttr {
|
|||||||
const quiet = move.category !== MoveCategory.STATUS;
|
const quiet = move.category !== MoveCategory.STATUS;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
target.trySetStatus(this.effect, true, user, undefined, null, false, quiet)
|
target.trySetStatus(this.effect, user, undefined, null, false, quiet)
|
||||||
) {
|
) {
|
||||||
applyPostAttackAbAttrs("ConfusionOnStatusEffectAbAttr", user, target, move, null, false, this.effect);
|
applyPostAttackAbAttrs("ConfusionOnStatusEffectAbAttr", user, target, move, null, false, this.effect);
|
||||||
return true;
|
return true;
|
||||||
@ -2516,7 +2487,6 @@ export class StatusEffectAttr extends MoveEffectAttr {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
getTargetBenefitScore(user: Pokemon, target: Pokemon, move: Move): number {
|
getTargetBenefitScore(user: Pokemon, target: Pokemon, move: Move): number {
|
||||||
const moveChance = this.getMoveChance(user, target, move, this.selfTarget, false);
|
const moveChance = this.getMoveChance(user, target, move, this.selfTarget, false);
|
||||||
const score = moveChance < 0 ? -10 : Math.floor(moveChance * -0.1);
|
const score = moveChance < 0 ? -10 : Math.floor(moveChance * -0.1);
|
||||||
@ -2526,25 +2496,6 @@ export class StatusEffectAttr extends MoveEffectAttr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Attribute to put the target to sleep for a fixed duration and cure its status.
|
|
||||||
* Used for {@linkcode Moves.REST}.
|
|
||||||
*/
|
|
||||||
export class RestAttr extends StatusEffectAttr {
|
|
||||||
private duration: number;
|
|
||||||
|
|
||||||
constructor(duration: number) {
|
|
||||||
// Sleep is the only duration-based status ATM
|
|
||||||
super(StatusEffect.SLEEP, true);
|
|
||||||
this.duration = duration;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: Add custom text for rest and make `HealAttr` no longer show the message
|
|
||||||
protected override doSetStatus(pokemon: Pokemon, user: Pokemon, quiet: boolean): boolean {
|
|
||||||
return pokemon.trySetStatus(this.effect, true, user, this.duration, null, true, quiet)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attribute to randomly apply one of several statuses to the target.
|
* Attribute to randomly apply one of several statuses to the target.
|
||||||
* Used for {@linkcode Moves.TRI_ATTACK} and {@linkcode Moves.DIRE_CLAW}.
|
* Used for {@linkcode Moves.TRI_ATTACK} and {@linkcode Moves.DIRE_CLAW}.
|
||||||
@ -2587,13 +2538,13 @@ export class PsychoShiftEffectAttr extends MoveEffectAttr {
|
|||||||
(user.hasAbility(AbilityId.COMATOSE) ? StatusEffect.SLEEP : undefined);
|
(user.hasAbility(AbilityId.COMATOSE) ? StatusEffect.SLEEP : undefined);
|
||||||
|
|
||||||
// Bang is justified as condition func returns early if no status is found
|
// Bang is justified as condition func returns early if no status is found
|
||||||
if (!target.trySetStatus(statusToApply!, true, user)) {
|
if (!target.trySetStatus(statusToApply!, user)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (user.status) {
|
if (user.status) {
|
||||||
// Add tag to user to heal its status effect after the move ends (unless we have comatose);
|
// Add tag to user to heal its status effect after the move ends (unless we have comatose);
|
||||||
// Occurs after move use to ensure correct Synchronize timing
|
// occurs after move use to ensure correct Synchronize timing
|
||||||
user.addTag(BattlerTagType.PSYCHO_SHIFT)
|
user.addTag(BattlerTagType.PSYCHO_SHIFT)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2677,7 +2628,7 @@ export class StealHeldItemChanceAttr extends MoveEffectAttr {
|
|||||||
* Used for Incinerate and Knock Off.
|
* Used for Incinerate and Knock Off.
|
||||||
* Not Implemented Cases: (Same applies for Thief)
|
* Not Implemented Cases: (Same applies for Thief)
|
||||||
* "If the user faints due to the target's Ability (Rough Skin or Iron Barbs) or held Rocky Helmet, it cannot remove the target's held item."
|
* "If the user faints due to the target's Ability (Rough Skin or Iron Barbs) or held Rocky Helmet, it cannot remove the target's held item."
|
||||||
* "If the Pokémon is knocked out by the attack, Sticky Hold does not protect the held item.""
|
* "If the Pokémon is knocked out by the attack, Sticky Hold does not protect the held item."
|
||||||
*/
|
*/
|
||||||
export class RemoveHeldItemAttr extends MoveEffectAttr {
|
export class RemoveHeldItemAttr extends MoveEffectAttr {
|
||||||
|
|
||||||
@ -2887,10 +2838,7 @@ export class HealStatusEffectAttr extends MoveEffectAttr {
|
|||||||
*/
|
*/
|
||||||
constructor(selfTarget: boolean, effects: StatusEffect | StatusEffect[]) {
|
constructor(selfTarget: boolean, effects: StatusEffect | StatusEffect[]) {
|
||||||
super(selfTarget, { lastHitOnly: true });
|
super(selfTarget, { lastHitOnly: true });
|
||||||
if (!Array.isArray(effects)) {
|
this.effects = coerceArray(effects)
|
||||||
effects = [ effects ]
|
|
||||||
}
|
|
||||||
this.effects = effects
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -4363,36 +4311,6 @@ export class SpitUpPowerAttr extends VariablePowerAttr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Attribute used to apply Swallow's healing, which scales with Stockpile stacks.
|
|
||||||
* Does NOT remove stockpiled stacks.
|
|
||||||
*/
|
|
||||||
export class SwallowHealAttr extends HealAttr {
|
|
||||||
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
|
||||||
const stockpilingTag = user.getTag(StockpilingTag);
|
|
||||||
|
|
||||||
if (stockpilingTag && stockpilingTag.stockpiledCount > 0) {
|
|
||||||
const stockpiled = stockpilingTag.stockpiledCount;
|
|
||||||
let healRatio: number;
|
|
||||||
|
|
||||||
if (stockpiled === 1) {
|
|
||||||
healRatio = 0.25;
|
|
||||||
} else if (stockpiled === 2) {
|
|
||||||
healRatio = 0.50;
|
|
||||||
} else { // stockpiled >= 3
|
|
||||||
healRatio = 1.00;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (healRatio) {
|
|
||||||
this.addHealPhase(user, healRatio);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const hasStockpileStacksCondition: MoveConditionFunc = (user) => {
|
const hasStockpileStacksCondition: MoveConditionFunc = (user) => {
|
||||||
const hasStockpilingTag = user.getTag(StockpilingTag);
|
const hasStockpilingTag = user.getTag(StockpilingTag);
|
||||||
return !!hasStockpilingTag && hasStockpilingTag.stockpiledCount > 0;
|
return !!hasStockpilingTag && hasStockpilingTag.stockpiledCount > 0;
|
||||||
@ -7862,7 +7780,7 @@ export class StatusIfBoostedAttr extends MoveEffectAttr {
|
|||||||
*/
|
*/
|
||||||
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
||||||
if (target.turnData.statStagesIncreased) {
|
if (target.turnData.statStagesIncreased) {
|
||||||
target.trySetStatus(this.effect, true, user);
|
target.trySetStatus(this.effect, user);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -8028,6 +7946,53 @@ const attackedByItemMessageFunc = (user: Pokemon, target: Pokemon, move: Move) =
|
|||||||
return message;
|
return message;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const sunnyHealRatioFunc = (): number => {
|
||||||
|
if (globalScene.arena.weather?.isEffectSuppressed()) {
|
||||||
|
return 1 / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (globalScene.arena.getWeatherType()) {
|
||||||
|
case WeatherType.SUNNY:
|
||||||
|
case WeatherType.HARSH_SUN:
|
||||||
|
return 2 / 3;
|
||||||
|
case WeatherType.RAIN:
|
||||||
|
case WeatherType.SANDSTORM:
|
||||||
|
case WeatherType.HAIL:
|
||||||
|
case WeatherType.SNOW:
|
||||||
|
case WeatherType.HEAVY_RAIN:
|
||||||
|
case WeatherType.FOG:
|
||||||
|
return 1 / 4;
|
||||||
|
case WeatherType.STRONG_WINDS:
|
||||||
|
default:
|
||||||
|
return 1 / 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const shoreUpHealRatioFunc = (): number => {
|
||||||
|
if (globalScene.arena.weather?.isEffectSuppressed()) {
|
||||||
|
return 1 / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
return globalScene.arena.getWeatherType() === WeatherType.SANDSTORM ? 2 / 3 : 1 / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
const swallowHealFunc = (user: Pokemon): number => {
|
||||||
|
const tag = user.getTag(StockpilingTag);
|
||||||
|
if (!tag || tag.stockpiledCount <= 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (tag.stockpiledCount) {
|
||||||
|
case 1:
|
||||||
|
return 0.25
|
||||||
|
case 2:
|
||||||
|
return 0.5
|
||||||
|
case 3:
|
||||||
|
default: // in case we ever get more stacks
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export class MoveCondition {
|
export class MoveCondition {
|
||||||
protected func: MoveConditionFunc;
|
protected func: MoveConditionFunc;
|
||||||
|
|
||||||
@ -8238,15 +8203,12 @@ const MoveAttrs = Object.freeze({
|
|||||||
SacrificialAttrOnHit,
|
SacrificialAttrOnHit,
|
||||||
HalfSacrificialAttr,
|
HalfSacrificialAttr,
|
||||||
AddSubstituteAttr,
|
AddSubstituteAttr,
|
||||||
HealAttr,
|
|
||||||
PartyStatusCureAttr,
|
PartyStatusCureAttr,
|
||||||
FlameBurstAttr,
|
FlameBurstAttr,
|
||||||
SacrificialFullRestoreAttr,
|
SacrificialFullRestoreAttr,
|
||||||
IgnoreWeatherTypeDebuffAttr,
|
IgnoreWeatherTypeDebuffAttr,
|
||||||
WeatherHealAttr,
|
HealAttr,
|
||||||
PlantHealAttr,
|
VariableHealAttr,
|
||||||
SandHealAttr,
|
|
||||||
BoostHealAttr,
|
|
||||||
HealOnAllyAttr,
|
HealOnAllyAttr,
|
||||||
HitHealAttr,
|
HitHealAttr,
|
||||||
IncrementMovePriorityAttr,
|
IncrementMovePriorityAttr,
|
||||||
@ -8311,7 +8273,6 @@ const MoveAttrs = Object.freeze({
|
|||||||
PresentPowerAttr,
|
PresentPowerAttr,
|
||||||
WaterShurikenPowerAttr,
|
WaterShurikenPowerAttr,
|
||||||
SpitUpPowerAttr,
|
SpitUpPowerAttr,
|
||||||
SwallowHealAttr,
|
|
||||||
MultiHitPowerIncrementAttr,
|
MultiHitPowerIncrementAttr,
|
||||||
LastMoveDoublePowerAttr,
|
LastMoveDoublePowerAttr,
|
||||||
CombinedPledgePowerAttr,
|
CombinedPledgePowerAttr,
|
||||||
@ -8888,7 +8849,6 @@ export function initMoves() {
|
|||||||
.attr(MultiHitAttr, MultiHitType._2)
|
.attr(MultiHitAttr, MultiHitType._2)
|
||||||
.makesContact(false),
|
.makesContact(false),
|
||||||
new SelfStatusMove(MoveId.REST, PokemonType.PSYCHIC, -1, 5, -1, 0, 1)
|
new SelfStatusMove(MoveId.REST, PokemonType.PSYCHIC, -1, 5, -1, 0, 1)
|
||||||
.attr(HealAttr, 1, true)
|
|
||||||
.attr(RestAttr, 3)
|
.attr(RestAttr, 3)
|
||||||
.triageMove(),
|
.triageMove(),
|
||||||
new AttackMove(MoveId.ROCK_SLIDE, PokemonType.ROCK, MoveCategory.PHYSICAL, 75, 90, 10, 30, 0, 1)
|
new AttackMove(MoveId.ROCK_SLIDE, PokemonType.ROCK, MoveCategory.PHYSICAL, 75, 90, 10, 30, 0, 1)
|
||||||
@ -9158,13 +9118,13 @@ export function initMoves() {
|
|||||||
.attr(StatStageChangeAttr, [ Stat.ATK ], 1, true),
|
.attr(StatStageChangeAttr, [ Stat.ATK ], 1, true),
|
||||||
new AttackMove(MoveId.VITAL_THROW, PokemonType.FIGHTING, MoveCategory.PHYSICAL, 70, -1, 10, -1, -1, 2),
|
new AttackMove(MoveId.VITAL_THROW, PokemonType.FIGHTING, MoveCategory.PHYSICAL, 70, -1, 10, -1, -1, 2),
|
||||||
new SelfStatusMove(MoveId.MORNING_SUN, PokemonType.NORMAL, -1, 5, -1, 0, 2)
|
new SelfStatusMove(MoveId.MORNING_SUN, PokemonType.NORMAL, -1, 5, -1, 0, 2)
|
||||||
.attr(PlantHealAttr)
|
.attr(VariableHealAttr, sunnyHealRatioFunc)
|
||||||
.triageMove(),
|
.triageMove(),
|
||||||
new SelfStatusMove(MoveId.SYNTHESIS, PokemonType.GRASS, -1, 5, -1, 0, 2)
|
new SelfStatusMove(MoveId.SYNTHESIS, PokemonType.GRASS, -1, 5, -1, 0, 2)
|
||||||
.attr(PlantHealAttr)
|
.attr(VariableHealAttr, sunnyHealRatioFunc)
|
||||||
.triageMove(),
|
.triageMove(),
|
||||||
new SelfStatusMove(MoveId.MOONLIGHT, PokemonType.FAIRY, -1, 5, -1, 0, 2)
|
new SelfStatusMove(MoveId.MOONLIGHT, PokemonType.FAIRY, -1, 5, -1, 0, 2)
|
||||||
.attr(PlantHealAttr)
|
.attr(VariableHealAttr, sunnyHealRatioFunc)
|
||||||
.triageMove(),
|
.triageMove(),
|
||||||
new AttackMove(MoveId.HIDDEN_POWER, PokemonType.NORMAL, MoveCategory.SPECIAL, 60, 100, 15, -1, 0, 2)
|
new AttackMove(MoveId.HIDDEN_POWER, PokemonType.NORMAL, MoveCategory.SPECIAL, 60, 100, 15, -1, 0, 2)
|
||||||
.attr(HiddenPowerTypeAttr),
|
.attr(HiddenPowerTypeAttr),
|
||||||
@ -9221,12 +9181,12 @@ export function initMoves() {
|
|||||||
.condition(user => (user.getTag(StockpilingTag)?.stockpiledCount ?? 0) < 3)
|
.condition(user => (user.getTag(StockpilingTag)?.stockpiledCount ?? 0) < 3)
|
||||||
.attr(AddBattlerTagAttr, BattlerTagType.STOCKPILING, true),
|
.attr(AddBattlerTagAttr, BattlerTagType.STOCKPILING, true),
|
||||||
new AttackMove(MoveId.SPIT_UP, PokemonType.NORMAL, MoveCategory.SPECIAL, -1, -1, 10, -1, 0, 3)
|
new AttackMove(MoveId.SPIT_UP, PokemonType.NORMAL, MoveCategory.SPECIAL, -1, -1, 10, -1, 0, 3)
|
||||||
.condition(hasStockpileStacksCondition)
|
|
||||||
.attr(SpitUpPowerAttr, 100)
|
.attr(SpitUpPowerAttr, 100)
|
||||||
|
.condition(hasStockpileStacksCondition)
|
||||||
.attr(RemoveBattlerTagAttr, [ BattlerTagType.STOCKPILING ], true),
|
.attr(RemoveBattlerTagAttr, [ BattlerTagType.STOCKPILING ], true),
|
||||||
new SelfStatusMove(MoveId.SWALLOW, PokemonType.NORMAL, -1, 10, -1, 0, 3)
|
new SelfStatusMove(MoveId.SWALLOW, PokemonType.NORMAL, -1, 10, -1, 0, 3)
|
||||||
|
.attr(VariableHealAttr, swallowHealFunc)
|
||||||
.condition(hasStockpileStacksCondition)
|
.condition(hasStockpileStacksCondition)
|
||||||
.attr(SwallowHealAttr)
|
|
||||||
.attr(RemoveBattlerTagAttr, [ BattlerTagType.STOCKPILING ], true)
|
.attr(RemoveBattlerTagAttr, [ BattlerTagType.STOCKPILING ], true)
|
||||||
.triageMove(),
|
.triageMove(),
|
||||||
new AttackMove(MoveId.HEAT_WAVE, PokemonType.FIRE, MoveCategory.SPECIAL, 95, 90, 10, 10, 0, 3)
|
new AttackMove(MoveId.HEAT_WAVE, PokemonType.FIRE, MoveCategory.SPECIAL, 95, 90, 10, 10, 0, 3)
|
||||||
@ -9610,15 +9570,16 @@ export function initMoves() {
|
|||||||
.unimplemented(),
|
.unimplemented(),
|
||||||
new StatusMove(MoveId.PSYCHO_SHIFT, PokemonType.PSYCHIC, 100, 10, -1, 0, 4)
|
new StatusMove(MoveId.PSYCHO_SHIFT, PokemonType.PSYCHIC, 100, 10, -1, 0, 4)
|
||||||
.attr(PsychoShiftEffectAttr)
|
.attr(PsychoShiftEffectAttr)
|
||||||
.edgeCase(),
|
|
||||||
// TODO: Verify status applied if a statused pokemon obtains Comatose (via Transform) and uses Psycho Shift
|
// TODO: Verify status applied if a statused pokemon obtains Comatose (via Transform) and uses Psycho Shift
|
||||||
|
.edgeCase(),
|
||||||
new AttackMove(MoveId.TRUMP_CARD, PokemonType.NORMAL, MoveCategory.SPECIAL, -1, -1, 5, -1, 0, 4)
|
new AttackMove(MoveId.TRUMP_CARD, PokemonType.NORMAL, MoveCategory.SPECIAL, -1, -1, 5, -1, 0, 4)
|
||||||
.makesContact()
|
.makesContact()
|
||||||
.attr(LessPPMorePowerAttr),
|
.attr(LessPPMorePowerAttr),
|
||||||
new StatusMove(MoveId.HEAL_BLOCK, PokemonType.PSYCHIC, 100, 15, -1, 0, 4)
|
new StatusMove(MoveId.HEAL_BLOCK, PokemonType.PSYCHIC, 100, 15, -1, 0, 4)
|
||||||
.attr(AddBattlerTagAttr, BattlerTagType.HEAL_BLOCK, false, true, 5)
|
.attr(AddBattlerTagAttr, BattlerTagType.HEAL_BLOCK, false, true, 5)
|
||||||
.target(MoveTarget.ALL_NEAR_ENEMIES)
|
.target(MoveTarget.ALL_NEAR_ENEMIES)
|
||||||
.reflectable(),
|
.reflectable()
|
||||||
|
.edgeCase(),
|
||||||
new AttackMove(MoveId.WRING_OUT, PokemonType.NORMAL, MoveCategory.SPECIAL, -1, 100, 5, -1, 0, 4)
|
new AttackMove(MoveId.WRING_OUT, PokemonType.NORMAL, MoveCategory.SPECIAL, -1, 100, 5, -1, 0, 4)
|
||||||
.attr(OpponentHighHpPowerAttr, 120)
|
.attr(OpponentHighHpPowerAttr, 120)
|
||||||
.makesContact(),
|
.makesContact(),
|
||||||
@ -10471,7 +10432,7 @@ export function initMoves() {
|
|||||||
.unimplemented(),
|
.unimplemented(),
|
||||||
/* End Unused */
|
/* End Unused */
|
||||||
new SelfStatusMove(MoveId.SHORE_UP, PokemonType.GROUND, -1, 5, -1, 0, 7)
|
new SelfStatusMove(MoveId.SHORE_UP, PokemonType.GROUND, -1, 5, -1, 0, 7)
|
||||||
.attr(SandHealAttr)
|
.attr(VariableHealAttr, shoreUpHealRatioFunc)
|
||||||
.triageMove(),
|
.triageMove(),
|
||||||
new AttackMove(MoveId.FIRST_IMPRESSION, PokemonType.BUG, MoveCategory.PHYSICAL, 90, 100, 10, -1, 2, 7)
|
new AttackMove(MoveId.FIRST_IMPRESSION, PokemonType.BUG, MoveCategory.PHYSICAL, 90, 100, 10, -1, 2, 7)
|
||||||
.condition(new FirstMoveCondition()),
|
.condition(new FirstMoveCondition()),
|
||||||
@ -10491,7 +10452,7 @@ export function initMoves() {
|
|||||||
.attr(StatStageChangeAttr, [ Stat.SPD ], -1, true)
|
.attr(StatStageChangeAttr, [ Stat.SPD ], -1, true)
|
||||||
.punchingMove(),
|
.punchingMove(),
|
||||||
new StatusMove(MoveId.FLORAL_HEALING, PokemonType.FAIRY, -1, 10, -1, 0, 7)
|
new StatusMove(MoveId.FLORAL_HEALING, PokemonType.FAIRY, -1, 10, -1, 0, 7)
|
||||||
.attr(BoostHealAttr, 0.5, 2 / 3, true, false, (user, target, move) => globalScene.arena.terrain?.terrainType === TerrainType.GRASSY)
|
.attr(VariableHealAttr, () => globalScene.arena.terrain?.terrainType === TerrainType.GRASSY ? 2 / 3 : 1 / 2, true, false)
|
||||||
.triageMove()
|
.triageMove()
|
||||||
.reflectable(),
|
.reflectable(),
|
||||||
new AttackMove(MoveId.HIGH_HORSEPOWER, PokemonType.GROUND, MoveCategory.PHYSICAL, 95, 95, 10, -1, 0, 7),
|
new AttackMove(MoveId.HIGH_HORSEPOWER, PokemonType.GROUND, MoveCategory.PHYSICAL, 95, 95, 10, -1, 0, 7),
|
||||||
|
@ -243,8 +243,9 @@ export const FieryFalloutEncounter: MysteryEncounter = MysteryEncounterBuilder.w
|
|||||||
if (burnable?.length > 0) {
|
if (burnable?.length > 0) {
|
||||||
const roll = randSeedInt(burnable.length);
|
const roll = randSeedInt(burnable.length);
|
||||||
const chosenPokemon = burnable[roll];
|
const chosenPokemon = burnable[roll];
|
||||||
if (chosenPokemon.trySetStatus(StatusEffect.BURN)) {
|
if (chosenPokemon.canSetStatus(StatusEffect.BURN, true)) {
|
||||||
// Burn applied
|
// Burn applied
|
||||||
|
chosenPokemon.doSetStatus(StatusEffect.BURN);
|
||||||
encounter.setDialogueToken("burnedPokemon", chosenPokemon.getNameToRender());
|
encounter.setDialogueToken("burnedPokemon", chosenPokemon.getNameToRender());
|
||||||
encounter.setDialogueToken("abilityName", allAbilities[AbilityId.HEATPROOF].name);
|
encounter.setDialogueToken("abilityName", allAbilities[AbilityId.HEATPROOF].name);
|
||||||
queueEncounterMessage(`${namespace}:option.2.target_burned`);
|
queueEncounterMessage(`${namespace}:option.2.target_burned`);
|
||||||
|
@ -304,7 +304,7 @@ export function getRandomSpeciesByStarterCost(
|
|||||||
*/
|
*/
|
||||||
export function koPlayerPokemon(pokemon: PlayerPokemon) {
|
export function koPlayerPokemon(pokemon: PlayerPokemon) {
|
||||||
pokemon.hp = 0;
|
pokemon.hp = 0;
|
||||||
pokemon.trySetStatus(StatusEffect.FAINT);
|
pokemon.doSetStatus(StatusEffect.FAINT);
|
||||||
pokemon.updateInfo();
|
pokemon.updateInfo();
|
||||||
queueEncounterMessage(
|
queueEncounterMessage(
|
||||||
i18next.t("battle:fainted", {
|
i18next.t("battle:fainted", {
|
||||||
|
@ -154,7 +154,6 @@ export function getRandomStatus(statusA: Status | null, statusB: Status | null):
|
|||||||
return randIntRange(0, 2) ? statusA : statusB;
|
return randIntRange(0, 2) ? statusA : statusB;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Make this a type and remove these
|
|
||||||
/**
|
/**
|
||||||
* Gets all non volatile status effects
|
* Gets all non volatile status effects
|
||||||
* @returns A list containing all non volatile status effects
|
* @returns A list containing all non volatile status effects
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/** Enum representing all non-volatile status effects. */
|
/** Enum representing all non-volatile status effects. */
|
||||||
// TODO: Add a type that excludes `NONE` and `FAINT`
|
// TODO: Remove StatusEffect.FAINT
|
||||||
export enum StatusEffect {
|
export enum StatusEffect {
|
||||||
NONE,
|
NONE,
|
||||||
POISON,
|
POISON,
|
||||||
|
@ -3190,6 +3190,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
while (rand > movePool[index][1]) {
|
while (rand > movePool[index][1]) {
|
||||||
rand -= movePool[index++][1];
|
rand -= movePool[index++][1];
|
||||||
}
|
}
|
||||||
|
this.moveset.push(new PokemonMove(movePool[index][0], 0, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Trigger FormChange, except for enemy Pokemon during Mystery Encounters, to avoid crashes
|
// Trigger FormChange, except for enemy Pokemon during Mystery Encounters, to avoid crashes
|
||||||
@ -4560,14 +4561,13 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Add messages for misty/electric terrain
|
queueImmuneMessage(quiet: boolean, effect?: StatusEffect): void {
|
||||||
private queueImmuneMessage(quiet: boolean, effect: StatusEffect): void {
|
|
||||||
if (!effect || quiet) {
|
if (!effect || quiet) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const message =
|
const message =
|
||||||
effect && this.status?.effect === effect
|
effect && this.status?.effect === effect
|
||||||
? getStatusEffectOverlapText(effect, getPokemonNameWithAffix(this))
|
? getStatusEffectOverlapText(effect ?? StatusEffect.NONE, getPokemonNameWithAffix(this))
|
||||||
: i18next.t("abilityTriggers:moveImmunity", {
|
: i18next.t("abilityTriggers:moveImmunity", {
|
||||||
pokemonNameWithAffix: getPokemonNameWithAffix(this),
|
pokemonNameWithAffix: getPokemonNameWithAffix(this),
|
||||||
});
|
});
|
||||||
@ -4587,6 +4587,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
* @returns Whether {@linkcode effect} can be applied to this Pokemon.
|
* @returns Whether {@linkcode effect} can be applied to this Pokemon.
|
||||||
*/
|
*/
|
||||||
// TODO: Review and verify the message order precedence in mainline if multiple status-blocking effects are present at once
|
// TODO: Review and verify the message order precedence in mainline if multiple status-blocking effects are present at once
|
||||||
|
// TODO: Make argument order consistent with `trySetStatus`
|
||||||
canSetStatus(
|
canSetStatus(
|
||||||
effect: StatusEffect,
|
effect: StatusEffect,
|
||||||
quiet = false,
|
quiet = false,
|
||||||
@ -4595,7 +4596,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
ignoreField = false,
|
ignoreField = false,
|
||||||
): boolean {
|
): boolean {
|
||||||
if (effect !== StatusEffect.FAINT) {
|
if (effect !== StatusEffect.FAINT) {
|
||||||
// Status-overriding moves (ie Rest) fail if their respective status already exists;
|
// Status-overriding moves (i.e. Rest) fail if their respective status already exists;
|
||||||
// all other moves fail if the target already has _any_ status
|
// all other moves fail if the target already has _any_ status
|
||||||
if (overrideStatus ? this.status?.effect === effect : this.status) {
|
if (overrideStatus ? this.status?.effect === effect : this.status) {
|
||||||
this.queueImmuneMessage(quiet, effect);
|
this.queueImmuneMessage(quiet, effect);
|
||||||
@ -4690,29 +4691,27 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Attempt to set this Pokemon's status to the specified condition.
|
* Attempt to set this Pokemon's status to the specified condition.
|
||||||
|
* Enqueues a new `ObtainStatusEffectPhase` to trigger animations, etc.
|
||||||
* @param effect - The {@linkcode StatusEffect} to set.
|
* @param effect - The {@linkcode StatusEffect} to set.
|
||||||
* @param asPhase - Whether to set the status in a new {@linkcode ObtainStatusEffectPhase} or immediately; default `false`.
|
|
||||||
* If `false`, will not display most messages associated with status setting.
|
|
||||||
* @param sourcePokemon - The {@linkcode Pokemon} applying the status effect to the target,
|
* @param sourcePokemon - The {@linkcode Pokemon} applying the status effect to the target,
|
||||||
* or `null` if the status is applied from a non-Pokemon source (hazards, etc.); default `null`.
|
* or `null` if the status is applied from a non-Pokemon source (hazards, etc.); default `null`.
|
||||||
* @param sleepTurnsRemaining - The number of turns to set {@linkcode StatusEffect.SLEEP} for;
|
* @param sleepTurnsRemaining - The number of turns to set {@linkcode StatusEffect.SLEEP} for;
|
||||||
* defaults to a random number between 2 and 4 and is unused for non-Sleep statuses.
|
* defaults to a random number between 2 and 4 and is unused for non-Sleep statuses.
|
||||||
* @param sourceText - The text to show for the source of the status effect, if any;
|
* @param sourceText - The text to show for the source of the status effect, if any; default `null`.
|
||||||
* defaults to `null` and is unused if `asPhase=false`.
|
|
||||||
* @param overrideStatus - Whether to allow overriding the Pokemon's current status with a different one; default `false`.
|
* @param overrideStatus - Whether to allow overriding the Pokemon's current status with a different one; default `false`.
|
||||||
* @param quiet - Whether to suppress in-battle messages for status checks; default `false`.
|
* @param quiet - Whether to suppress in-battle messages for status checks; default `true`.
|
||||||
* @returns Whether the status effect was successfully applied (or a phase for it)
|
* @returns Whether the status effect phase was successfully created.
|
||||||
|
* @see {@linkcode doSetStatus} - alternate function that sets status immediately (albeit without condition checks).
|
||||||
*/
|
*/
|
||||||
trySetStatus(
|
trySetStatus(
|
||||||
effect: StatusEffect,
|
effect: StatusEffect,
|
||||||
asPhase = false,
|
|
||||||
sourcePokemon: Pokemon | null = null,
|
sourcePokemon: Pokemon | null = null,
|
||||||
sleepTurnsRemaining?: number,
|
sleepTurnsRemaining?: number,
|
||||||
sourceText: string | null = null,
|
sourceText: string | null = null,
|
||||||
overrideStatus?: boolean,
|
overrideStatus?: boolean,
|
||||||
quiet = true,
|
quiet = true,
|
||||||
): boolean {
|
): boolean {
|
||||||
// TODO: Remove uses of `asPhase=false` in favor of checking status directly
|
// TODO: This needs to propagate failure status for non-status moves
|
||||||
if (!this.canSetStatus(effect, quiet, overrideStatus, sourcePokemon)) {
|
if (!this.canSetStatus(effect, quiet, overrideStatus, sourcePokemon)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -4736,46 +4735,42 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
this.resetStatus(false);
|
this.resetStatus(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: This needs to propagate failure status for non-status moves
|
globalScene.phaseManager.unshiftNew(
|
||||||
if (asPhase) {
|
"ObtainStatusEffectPhase",
|
||||||
globalScene.phaseManager.unshiftNew(
|
this.getBattlerIndex(),
|
||||||
"ObtainStatusEffectPhase", this.getBattlerIndex(), effect, sleepTurnsRemaining, sourceText, sourcePokemon
|
effect,
|
||||||
)
|
sleepTurnsRemaining,
|
||||||
} else {
|
sourceText,
|
||||||
this.doSetStatus(effect, sleepTurnsRemaining);
|
sourcePokemon,
|
||||||
}
|
);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attempt to give the specified Pokemon the given status effect.
|
* Set this Pokemon's {@linkcode status | status condition} to the specified effect.
|
||||||
* Does **NOT** perform any feasibility checks whatsoever, and should thus never be called directly
|
* Does **NOT** perform any feasibility checks whatsoever; must be checked by the caller.
|
||||||
* unless conditions are known to be met.
|
|
||||||
* @param effect - The {@linkcode StatusEffect} to set
|
* @param effect - The {@linkcode StatusEffect} to set
|
||||||
*/
|
*/
|
||||||
doSetStatus(effect: Exclude<StatusEffect, StatusEffect.SLEEP>): void;
|
doSetStatus(effect: Exclude<StatusEffect, StatusEffect.SLEEP>): void;
|
||||||
/**
|
/**
|
||||||
* Attempt to give the specified Pokemon the given status effect.
|
* Set this Pokemon's {@linkcode status | status condition} to the specified effect.
|
||||||
* Does **NOT** perform any feasibility checks whatsoever, and should thus never be called directly
|
* Does **NOT** perform any feasibility checks whatsoever; must be checked by the caller.
|
||||||
* unless conditions are known to be met.
|
|
||||||
* @param effect - {@linkcode StatusEffect.SLEEP}
|
* @param effect - {@linkcode StatusEffect.SLEEP}
|
||||||
* @param sleepTurnsRemaining - The number of turns to inflict sleep for; defaults to a random number between 2 and 4.
|
* @param sleepTurnsRemaining - The number of turns to inflict sleep for; defaults to a random number between 2 and 4.
|
||||||
*/
|
*/
|
||||||
doSetStatus(effect: StatusEffect.SLEEP, sleepTurnsRemaining?: number): void;
|
doSetStatus(effect: StatusEffect.SLEEP, sleepTurnsRemaining?: number): void;
|
||||||
/**
|
/**
|
||||||
* Attempt to give the specified Pokemon the given status effect.
|
* Set this Pokemon's {@linkcode status | status condition} to the specified effect.
|
||||||
* Does **NOT** perform any feasibility checks whatsoever, and should thus never be called directly
|
* Does **NOT** perform any feasibility checks whatsoever; must be checked by the caller.
|
||||||
* unless conditions are known to be met.
|
|
||||||
* @param effect - The {@linkcode StatusEffect} to set
|
* @param effect - The {@linkcode StatusEffect} to set
|
||||||
* @param sleepTurnsRemaining - The number of turns to inflict sleep for; defaults to a random number between 2 and 4
|
* @param sleepTurnsRemaining - The number of turns to inflict sleep for; defaults to a random number between 2 and 4
|
||||||
* and is unused for all non-sleep Statuses.
|
* and is unused for all non-sleep Statuses.
|
||||||
*/
|
*/
|
||||||
doSetStatus(effect: StatusEffect, sleepTurnsRemaining?: number): void;
|
doSetStatus(effect: StatusEffect, sleepTurnsRemaining?: number): void;
|
||||||
/**
|
/**
|
||||||
* Attempt to give the specified Pokemon the given status effect.
|
* Set this Pokemon's {@linkcode status | status condition} to the specified effect.
|
||||||
* Does **NOT** perform any feasibility checks whatsoever, and should thus never be called directly
|
* Does **NOT** perform any feasibility checks whatsoever; must be checked by the caller.
|
||||||
* unless conditions are known to be met.
|
|
||||||
* @param effect - The {@linkcode StatusEffect} to set
|
* @param effect - The {@linkcode StatusEffect} to set
|
||||||
* @param sleepTurnsRemaining - The number of turns to inflict sleep for; defaults to a random number between 2 and 4
|
* @param sleepTurnsRemaining - The number of turns to inflict sleep for; defaults to a random number between 2 and 4
|
||||||
* and is unused for all non-sleep Statuses.
|
* and is unused for all non-sleep Statuses.
|
||||||
@ -4789,7 +4784,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
|
|
||||||
// If the user is semi-invulnerable when put asleep (such as due to Yawm),
|
// If the user is semi-invulnerable when put asleep (such as due to Yawm),
|
||||||
// remove their invulnerability and cancel the upcoming move from the queue
|
// remove their invulnerability and cancel the upcoming move from the queue
|
||||||
const invulnTag = this.getTag(SemiInvulnerableTag)
|
const invulnTag = this.getTag(SemiInvulnerableTag);
|
||||||
if (invulnTag) {
|
if (invulnTag) {
|
||||||
this.removeTag(invulnTag.tagType);
|
this.removeTag(invulnTag.tagType);
|
||||||
this.getMoveQueue().shift();
|
this.getMoveQueue().shift();
|
||||||
|
@ -1766,7 +1766,7 @@ export class TurnStatusEffectModifier extends PokemonHeldItemModifier {
|
|||||||
* @returns `true` if the status effect was applied successfully
|
* @returns `true` if the status effect was applied successfully
|
||||||
*/
|
*/
|
||||||
override apply(pokemon: Pokemon): boolean {
|
override apply(pokemon: Pokemon): boolean {
|
||||||
return pokemon.trySetStatus(this.effect, true, pokemon, undefined, this.type.name);
|
return pokemon.trySetStatus(this.effect, pokemon, undefined, this.type.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
getMaxHeldItemCount(_pokemon: Pokemon): number {
|
getMaxHeldItemCount(_pokemon: Pokemon): number {
|
||||||
@ -3639,7 +3639,7 @@ export class EnemyAttackStatusEffectChanceModifier extends EnemyPersistentModifi
|
|||||||
*/
|
*/
|
||||||
override apply(enemyPokemon: Pokemon): boolean {
|
override apply(enemyPokemon: Pokemon): boolean {
|
||||||
if (randSeedFloat() <= this.chance * this.getStackCount()) {
|
if (randSeedFloat() <= this.chance * this.getStackCount()) {
|
||||||
return enemyPokemon.trySetStatus(this.effect, true);
|
return enemyPokemon.trySetStatus(this.effect);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -264,7 +264,7 @@ export class AttemptCapturePhase extends PokemonPhase {
|
|||||||
const removePokemon = () => {
|
const removePokemon = () => {
|
||||||
globalScene.addFaintedEnemyScore(pokemon);
|
globalScene.addFaintedEnemyScore(pokemon);
|
||||||
pokemon.hp = 0;
|
pokemon.hp = 0;
|
||||||
pokemon.trySetStatus(StatusEffect.FAINT);
|
pokemon.doSetStatus(StatusEffect.FAINT);
|
||||||
globalScene.clearEnemyHeldItemModifiers();
|
globalScene.clearEnemyHeldItemModifiers();
|
||||||
pokemon.leaveField(true, true, true);
|
pokemon.leaveField(true, true, true);
|
||||||
};
|
};
|
||||||
|
@ -49,7 +49,7 @@ export class AttemptRunPhase extends PokemonPhase {
|
|||||||
enemyField.forEach(enemyPokemon => {
|
enemyField.forEach(enemyPokemon => {
|
||||||
enemyPokemon.hideInfo().then(() => enemyPokemon.destroy());
|
enemyPokemon.hideInfo().then(() => enemyPokemon.destroy());
|
||||||
enemyPokemon.hp = 0;
|
enemyPokemon.hp = 0;
|
||||||
enemyPokemon.trySetStatus(StatusEffect.FAINT);
|
enemyPokemon.doSetStatus(StatusEffect.FAINT);
|
||||||
});
|
});
|
||||||
|
|
||||||
globalScene.phaseManager.pushNew("BattleEndPhase", false);
|
globalScene.phaseManager.pushNew("BattleEndPhase", false);
|
||||||
|
@ -209,7 +209,7 @@ export class FaintPhase extends PokemonPhase {
|
|||||||
pokemon.lapseTags(BattlerTagLapseType.FAINT);
|
pokemon.lapseTags(BattlerTagLapseType.FAINT);
|
||||||
|
|
||||||
pokemon.y -= 150;
|
pokemon.y -= 150;
|
||||||
pokemon.trySetStatus(StatusEffect.FAINT);
|
pokemon.doSetStatus(StatusEffect.FAINT);
|
||||||
if (pokemon.isPlayer()) {
|
if (pokemon.isPlayer()) {
|
||||||
globalScene.currentBattle.removeFaintedParticipant(pokemon as PlayerPokemon);
|
globalScene.currentBattle.removeFaintedParticipant(pokemon as PlayerPokemon);
|
||||||
} else {
|
} else {
|
||||||
|
@ -2,14 +2,13 @@ import { globalScene } from "#app/global-scene";
|
|||||||
import type { BattlerIndex } from "#enums/battler-index";
|
import type { BattlerIndex } from "#enums/battler-index";
|
||||||
import { CommonBattleAnim } from "#app/data/battle-anims";
|
import { CommonBattleAnim } from "#app/data/battle-anims";
|
||||||
import { CommonAnim } from "#enums/move-anims-common";
|
import { CommonAnim } from "#enums/move-anims-common";
|
||||||
import { getStatusEffectObtainText, getStatusEffectOverlapText } from "#app/data/status-effect";
|
import { getStatusEffectObtainText } from "#app/data/status-effect";
|
||||||
import { StatusEffect } from "#app/enums/status-effect";
|
import { StatusEffect } from "#app/enums/status-effect";
|
||||||
import type Pokemon from "#app/field/pokemon";
|
import type Pokemon from "#app/field/pokemon";
|
||||||
import { getPokemonNameWithAffix } from "#app/messages";
|
import { getPokemonNameWithAffix } from "#app/messages";
|
||||||
import { PokemonPhase } from "./pokemon-phase";
|
import { PokemonPhase } from "./pokemon-phase";
|
||||||
import { SpeciesFormChangeStatusEffectTrigger } from "#app/data/pokemon-forms/form-change-triggers";
|
import { SpeciesFormChangeStatusEffectTrigger } from "#app/data/pokemon-forms/form-change-triggers";
|
||||||
import { applyPostSetStatusAbAttrs } from "#app/data/abilities/apply-ab-attrs";
|
import { applyPostSetStatusAbAttrs } from "#app/data/abilities/apply-ab-attrs";
|
||||||
import { isNullOrUndefined } from "#app/utils/common";
|
|
||||||
|
|
||||||
/** The phase where pokemon obtain status effects. */
|
/** The phase where pokemon obtain status effects. */
|
||||||
export class ObtainStatusEffectPhase extends PokemonPhase {
|
export class ObtainStatusEffectPhase extends PokemonPhase {
|
||||||
@ -49,7 +48,7 @@ export class ObtainStatusEffectPhase extends PokemonPhase {
|
|||||||
pokemon.doSetStatus(this.statusEffect, this.sleepTurnsRemaining);
|
pokemon.doSetStatus(this.statusEffect, this.sleepTurnsRemaining);
|
||||||
pokemon.updateInfo(true);
|
pokemon.updateInfo(true);
|
||||||
|
|
||||||
new CommonBattleAnim(CommonAnim.POISON + (this.statusEffect! - 1), pokemon).play(false, () => {
|
new CommonBattleAnim(CommonAnim.POISON + (this.statusEffect - 1), pokemon).play(false, () => {
|
||||||
globalScene.phaseManager.queueMessage(
|
globalScene.phaseManager.queueMessage(
|
||||||
getStatusEffectObtainText(this.statusEffect, getPokemonNameWithAffix(pokemon), this.sourceText ?? undefined),
|
getStatusEffectObtainText(this.statusEffect, getPokemonNameWithAffix(pokemon), this.sourceText ?? undefined),
|
||||||
);
|
);
|
||||||
|
@ -13,6 +13,7 @@ import { CommonAnimPhase } from "./common-anim-phase";
|
|||||||
import { BattlerTagType } from "#app/enums/battler-tag-type";
|
import { BattlerTagType } from "#app/enums/battler-tag-type";
|
||||||
import type { HealBlockTag } from "#app/data/battler-tags";
|
import type { HealBlockTag } from "#app/data/battler-tags";
|
||||||
|
|
||||||
|
// TODO: Refactor this - it has far too many arguments
|
||||||
export class PokemonHealPhase extends CommonAnimPhase {
|
export class PokemonHealPhase extends CommonAnimPhase {
|
||||||
public readonly phaseName = "PokemonHealPhase";
|
public readonly phaseName = "PokemonHealPhase";
|
||||||
private hpHealed: number;
|
private hpHealed: number;
|
||||||
@ -28,7 +29,7 @@ export class PokemonHealPhase extends CommonAnimPhase {
|
|||||||
battlerIndex: BattlerIndex,
|
battlerIndex: BattlerIndex,
|
||||||
hpHealed: number,
|
hpHealed: number,
|
||||||
message: string | null,
|
message: string | null,
|
||||||
showFullHpMessage: boolean,
|
showFullHpMessage = true,
|
||||||
skipAnim = false,
|
skipAnim = false,
|
||||||
revive = false,
|
revive = false,
|
||||||
healStatus = false,
|
healStatus = false,
|
||||||
@ -69,9 +70,10 @@ export class PokemonHealPhase extends CommonAnimPhase {
|
|||||||
|
|
||||||
if (healBlock && this.hpHealed > 0) {
|
if (healBlock && this.hpHealed > 0) {
|
||||||
globalScene.phaseManager.queueMessage(healBlock.onActivation(pokemon));
|
globalScene.phaseManager.queueMessage(healBlock.onActivation(pokemon));
|
||||||
this.message = null;
|
super.end();
|
||||||
return super.end();
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (healOrDamage) {
|
if (healOrDamage) {
|
||||||
const hpRestoreMultiplier = new NumberHolder(1);
|
const hpRestoreMultiplier = new NumberHolder(1);
|
||||||
if (!this.revive) {
|
if (!this.revive) {
|
||||||
|
@ -64,7 +64,7 @@ describe("Abilities - Corrosion", () => {
|
|||||||
expect(enemyPokemon.status?.effect).toBeUndefined();
|
expect(enemyPokemon.status?.effect).toBeUndefined();
|
||||||
|
|
||||||
game.move.select(MoveId.TOXIC);
|
game.move.select(MoveId.TOXIC);
|
||||||
await game.toEndOfTurn()
|
await game.toEndOfTurn();
|
||||||
|
|
||||||
expect(playerPokemon.status?.effect).toBe(StatusEffect.TOXIC);
|
expect(playerPokemon.status?.effect).toBe(StatusEffect.TOXIC);
|
||||||
expect(enemyPokemon.status?.effect).toBeUndefined();
|
expect(enemyPokemon.status?.effect).toBeUndefined();
|
||||||
|
@ -47,9 +47,11 @@ describe("Abilities - Healer", () => {
|
|||||||
it("should not queue a message phase for healing if the ally has fainted", async () => {
|
it("should not queue a message phase for healing if the ally has fainted", async () => {
|
||||||
game.override.moveset([MoveId.SPLASH, MoveId.LUNAR_DANCE]);
|
game.override.moveset([MoveId.SPLASH, MoveId.LUNAR_DANCE]);
|
||||||
await game.classicMode.startBattle([SpeciesId.MAGIKARP, SpeciesId.MAGIKARP]);
|
await game.classicMode.startBattle([SpeciesId.MAGIKARP, SpeciesId.MAGIKARP]);
|
||||||
|
|
||||||
const user = game.scene.getPlayerPokemon()!;
|
const user = game.scene.getPlayerPokemon()!;
|
||||||
// Only want one magikarp to have the ability.
|
// Only want one magikarp to have the ability.
|
||||||
vi.spyOn(user, "getAbility").mockReturnValue(allAbilities[AbilityId.HEALER]);
|
vi.spyOn(user, "getAbility").mockReturnValue(allAbilities[AbilityId.HEALER]);
|
||||||
|
|
||||||
game.move.select(MoveId.SPLASH);
|
game.move.select(MoveId.SPLASH);
|
||||||
// faint the ally
|
// faint the ally
|
||||||
game.move.select(MoveId.LUNAR_DANCE, 1);
|
game.move.select(MoveId.LUNAR_DANCE, 1);
|
||||||
@ -67,9 +69,10 @@ describe("Abilities - Healer", () => {
|
|||||||
it("should heal the status of an ally if the ally has a status", async () => {
|
it("should heal the status of an ally if the ally has a status", async () => {
|
||||||
await game.classicMode.startBattle([SpeciesId.MAGIKARP, SpeciesId.MAGIKARP]);
|
await game.classicMode.startBattle([SpeciesId.MAGIKARP, SpeciesId.MAGIKARP]);
|
||||||
const [user, ally] = game.scene.getPlayerField();
|
const [user, ally] = game.scene.getPlayerField();
|
||||||
|
|
||||||
// Only want one magikarp to have the ability.
|
// Only want one magikarp to have the ability.
|
||||||
vi.spyOn(user, "getAbility").mockReturnValue(allAbilities[AbilityId.HEALER]);
|
vi.spyOn(user, "getAbility").mockReturnValue(allAbilities[AbilityId.HEALER]);
|
||||||
expect(ally.trySetStatus(StatusEffect.BURN)).toBe(true);
|
ally.doSetStatus(StatusEffect.BURN);
|
||||||
game.move.select(MoveId.SPLASH);
|
game.move.select(MoveId.SPLASH);
|
||||||
game.move.select(MoveId.SPLASH, 1);
|
game.move.select(MoveId.SPLASH, 1);
|
||||||
|
|
||||||
@ -85,7 +88,7 @@ describe("Abilities - Healer", () => {
|
|||||||
const [user, ally] = game.scene.getPlayerField();
|
const [user, ally] = game.scene.getPlayerField();
|
||||||
// Only want one magikarp to have the ability.
|
// Only want one magikarp to have the ability.
|
||||||
vi.spyOn(user, "getAbility").mockReturnValue(allAbilities[AbilityId.HEALER]);
|
vi.spyOn(user, "getAbility").mockReturnValue(allAbilities[AbilityId.HEALER]);
|
||||||
expect(ally.trySetStatus(StatusEffect.BURN)).toBe(true);
|
ally.doSetStatus(StatusEffect.BURN);
|
||||||
game.move.select(MoveId.SPLASH);
|
game.move.select(MoveId.SPLASH);
|
||||||
game.move.select(MoveId.SPLASH, 1);
|
game.move.select(MoveId.SPLASH, 1);
|
||||||
await game.phaseInterceptor.to("TurnEndPhase");
|
await game.phaseInterceptor.to("TurnEndPhase");
|
||||||
|
@ -44,7 +44,7 @@ describe("Moves - Fusion Flare", () => {
|
|||||||
await game.phaseInterceptor.to(TurnStartPhase, false);
|
await game.phaseInterceptor.to(TurnStartPhase, false);
|
||||||
|
|
||||||
// Inflict freeze quietly and check if it was properly inflicted
|
// Inflict freeze quietly and check if it was properly inflicted
|
||||||
partyMember.trySetStatus(StatusEffect.FREEZE, false);
|
partyMember.doSetStatus(StatusEffect.FREEZE);
|
||||||
expect(partyMember.status!.effect).toBe(StatusEffect.FREEZE);
|
expect(partyMember.status!.effect).toBe(StatusEffect.FREEZE);
|
||||||
|
|
||||||
await game.toNextTurn();
|
await game.toNextTurn();
|
||||||
|
@ -5,6 +5,9 @@ import { SpeciesId } from "#enums/species-id";
|
|||||||
import GameManager from "#test/testUtils/gameManager";
|
import GameManager from "#test/testUtils/gameManager";
|
||||||
import Phaser from "phaser";
|
import Phaser from "phaser";
|
||||||
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
||||||
|
import { MoveResult } from "#enums/move-result";
|
||||||
|
import { getPokemonNameWithAffix } from "#app/messages";
|
||||||
|
import i18next from "i18next";
|
||||||
|
|
||||||
describe("Moves - Pollen Puff", () => {
|
describe("Moves - Pollen Puff", () => {
|
||||||
let phaserGame: Phaser.Game;
|
let phaserGame: Phaser.Game;
|
||||||
@ -23,42 +26,77 @@ describe("Moves - Pollen Puff", () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
game = new GameManager(phaserGame);
|
game = new GameManager(phaserGame);
|
||||||
game.override
|
game.override
|
||||||
.moveset([MoveId.POLLEN_PUFF])
|
|
||||||
.ability(AbilityId.BALL_FETCH)
|
.ability(AbilityId.BALL_FETCH)
|
||||||
.battleStyle("single")
|
.battleStyle("single")
|
||||||
.disableCrits()
|
.disableCrits()
|
||||||
|
.enemyLevel(100)
|
||||||
.enemySpecies(SpeciesId.MAGIKARP)
|
.enemySpecies(SpeciesId.MAGIKARP)
|
||||||
.enemyAbility(AbilityId.BALL_FETCH)
|
.enemyAbility(AbilityId.BALL_FETCH)
|
||||||
.enemyMoveset(MoveId.SPLASH);
|
.enemyMoveset(MoveId.SPLASH);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should not heal more than once when the user has a source of multi-hit", async () => {
|
it("should damage an enemy when used, or heal an ally for 50% max HP", async () => {
|
||||||
game.override.battleStyle("double").moveset([MoveId.POLLEN_PUFF, MoveId.ENDURE]).ability(AbilityId.PARENTAL_BOND);
|
game.override.battleStyle("double").ability(AbilityId.PARENTAL_BOND);
|
||||||
await game.classicMode.startBattle([SpeciesId.BULBASAUR, SpeciesId.OMANYTE]);
|
await game.classicMode.startBattle([SpeciesId.BULBASAUR, SpeciesId.OMANYTE]);
|
||||||
|
|
||||||
const [_, rightPokemon] = game.scene.getPlayerField();
|
const [_, omantye, karp1] = game.scene.getField();
|
||||||
|
omantye.hp = 1;
|
||||||
|
|
||||||
rightPokemon.damageAndUpdate(rightPokemon.hp - 1);
|
game.move.use(MoveId.POLLEN_PUFF, BattlerIndex.PLAYER, BattlerIndex.PLAYER_2);
|
||||||
|
game.move.use(MoveId.POLLEN_PUFF, BattlerIndex.PLAYER_2, BattlerIndex.ENEMY);
|
||||||
|
await game.toEndOfTurn();
|
||||||
|
|
||||||
game.move.select(MoveId.POLLEN_PUFF, 0, BattlerIndex.PLAYER_2);
|
expect(karp1.hp).toBeLessThan(karp1.getMaxHp());
|
||||||
game.move.select(MoveId.ENDURE, 1);
|
expect(omantye.hp).toBeCloseTo(0.5 * omantye.getMaxHp() + 1, 1);
|
||||||
|
expect(game.phaseInterceptor.log).toContain("PokemonHealPhase");
|
||||||
|
});
|
||||||
|
|
||||||
await game.phaseInterceptor.to("BerryPhase");
|
it("should display message & count as failed when hitting a full HP ally", async () => {
|
||||||
|
game.override.battleStyle("double").ability(AbilityId.PARENTAL_BOND);
|
||||||
|
await game.classicMode.startBattle([SpeciesId.BULBASAUR, SpeciesId.OMANYTE]);
|
||||||
|
|
||||||
// Pollen Puff heals with a ratio of 0.5, as long as Pollen Puff triggers only once the pokemon will always be <= (0.5 * Max HP) + 1
|
const [bulbasaur, omantye] = game.scene.getPlayerField();
|
||||||
expect(rightPokemon.hp).toBeLessThanOrEqual(0.5 * rightPokemon.getMaxHp() + 1);
|
|
||||||
|
game.move.use(MoveId.POLLEN_PUFF, BattlerIndex.PLAYER, BattlerIndex.PLAYER_2);
|
||||||
|
game.move.use(MoveId.SPLASH, BattlerIndex.PLAYER_2);
|
||||||
|
await game.toEndOfTurn();
|
||||||
|
|
||||||
|
// move failed without unshifting a phase
|
||||||
|
expect(omantye.hp).toBe(omantye.getMaxHp());
|
||||||
|
expect(bulbasaur.getLastXMoves()[0].result).toBe(MoveResult.FAIL);
|
||||||
|
expect(game.textInterceptor.logs).toContain(
|
||||||
|
i18next.t("battle:hpIsFull", {
|
||||||
|
pokemonName: getPokemonNameWithAffix(omantye),
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
expect(game.phaseInterceptor.log).not.toContain("PokemonHealPhase");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should not heal more than once if the user has a source of multi-hit", async () => {
|
||||||
|
game.override.battleStyle("double").ability(AbilityId.PARENTAL_BOND);
|
||||||
|
await game.classicMode.startBattle([SpeciesId.BULBASAUR, SpeciesId.OMANYTE]);
|
||||||
|
|
||||||
|
const [bulbasaur, omantye] = game.scene.getPlayerField();
|
||||||
|
|
||||||
|
omantye.hp = 1;
|
||||||
|
|
||||||
|
game.move.use(MoveId.POLLEN_PUFF, BattlerIndex.PLAYER, BattlerIndex.PLAYER_2);
|
||||||
|
game.move.use(MoveId.SPLASH, BattlerIndex.PLAYER_2);
|
||||||
|
await game.toEndOfTurn();
|
||||||
|
|
||||||
|
expect(bulbasaur.turnData.hitCount).toBe(1);
|
||||||
|
expect(omantye.hp).toBeLessThanOrEqual(0.5 * omantye.getMaxHp() + 1);
|
||||||
|
expect(game.phaseInterceptor.log.filter(l => l === "PokemonHealPhase")).toHaveLength(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should damage an enemy multiple times when the user has a source of multi-hit", async () => {
|
it("should damage an enemy multiple times when the user has a source of multi-hit", async () => {
|
||||||
game.override.moveset([MoveId.POLLEN_PUFF]).ability(AbilityId.PARENTAL_BOND).enemyLevel(100);
|
game.override.ability(AbilityId.PARENTAL_BOND);
|
||||||
await game.classicMode.startBattle([SpeciesId.MAGIKARP]);
|
await game.classicMode.startBattle([SpeciesId.MAGIKARP]);
|
||||||
|
|
||||||
|
game.move.use(MoveId.POLLEN_PUFF);
|
||||||
|
await game.toEndOfTurn();
|
||||||
|
|
||||||
const target = game.scene.getEnemyPokemon()!;
|
const target = game.scene.getEnemyPokemon()!;
|
||||||
|
|
||||||
game.move.select(MoveId.POLLEN_PUFF);
|
|
||||||
|
|
||||||
await game.phaseInterceptor.to("BerryPhase");
|
|
||||||
|
|
||||||
expect(target.battleData.hitCount).toBe(2);
|
expect(target.battleData.hitCount).toBe(2);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
175
test/moves/recovery-moves.test.ts
Normal file
175
test/moves/recovery-moves.test.ts
Normal file
@ -0,0 +1,175 @@
|
|||||||
|
import { getPokemonNameWithAffix } from "#app/messages";
|
||||||
|
import { getEnumValues, toReadableString } from "#app/utils/common";
|
||||||
|
import { AbilityId } from "#enums/ability-id";
|
||||||
|
import { MoveId } from "#enums/move-id";
|
||||||
|
import { SpeciesId } from "#enums/species-id";
|
||||||
|
import { WeatherType } from "#enums/weather-type";
|
||||||
|
import GameManager from "#test/testUtils/gameManager";
|
||||||
|
import i18next from "i18next";
|
||||||
|
import Phaser from "phaser";
|
||||||
|
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
||||||
|
|
||||||
|
describe("Moves - Recovery Moves", () => {
|
||||||
|
let phaserGame: Phaser.Game;
|
||||||
|
let game: GameManager;
|
||||||
|
|
||||||
|
beforeAll(() => {
|
||||||
|
phaserGame = new Phaser.Game({
|
||||||
|
type: Phaser.HEADLESS,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe.each<{ name: string; move: MoveId }>([
|
||||||
|
{ name: "Recover", move: MoveId.RECOVER },
|
||||||
|
{ name: "Soft-Boiled", move: MoveId.SOFT_BOILED },
|
||||||
|
{ name: "Milk Drink", move: MoveId.MILK_DRINK },
|
||||||
|
{ name: "Slack Off", move: MoveId.SLACK_OFF },
|
||||||
|
{ name: "Roost", move: MoveId.ROOST },
|
||||||
|
])("Normal Recovery Moves - $name", ({ move }) => {
|
||||||
|
afterEach(() => {
|
||||||
|
game.phaseInterceptor.restoreOg();
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
game = new GameManager(phaserGame);
|
||||||
|
game.override
|
||||||
|
.ability(AbilityId.BALL_FETCH)
|
||||||
|
.battleStyle("single")
|
||||||
|
.disableCrits()
|
||||||
|
.enemySpecies(SpeciesId.MAGIKARP)
|
||||||
|
.enemyAbility(AbilityId.BALL_FETCH)
|
||||||
|
.enemyMoveset(MoveId.SPLASH)
|
||||||
|
.startingLevel(100)
|
||||||
|
.enemyLevel(100);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should heal 50% of the user's maximum HP", async () => {
|
||||||
|
await game.classicMode.startBattle([SpeciesId.BLISSEY]);
|
||||||
|
|
||||||
|
const blissey = game.field.getPlayerPokemon();
|
||||||
|
blissey.hp = 1;
|
||||||
|
|
||||||
|
game.move.use(move);
|
||||||
|
await game.toEndOfTurn();
|
||||||
|
|
||||||
|
expect(blissey.getHpRatio()).toBeCloseTo(0.5, 1);
|
||||||
|
expect(game.phaseInterceptor.log).toContain("PokemonHealPhase");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should display message and fail if used at full HP", async () => {
|
||||||
|
await game.classicMode.startBattle([SpeciesId.BLISSEY]);
|
||||||
|
|
||||||
|
game.move.use(move);
|
||||||
|
await game.toEndOfTurn();
|
||||||
|
|
||||||
|
const blissey = game.field.getPlayerPokemon();
|
||||||
|
expect(blissey.hp).toBe(blissey.getMaxHp());
|
||||||
|
expect(game.textInterceptor.logs).toContain(
|
||||||
|
i18next.t("battle:hpIsFull", {
|
||||||
|
pokemonName: getPokemonNameWithAffix(blissey),
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
expect(game.phaseInterceptor.log).not.toContain("PokemonHealPhase");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("Weather-based Healing moves", () => {
|
||||||
|
afterEach(() => {
|
||||||
|
game.phaseInterceptor.restoreOg();
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
game = new GameManager(phaserGame);
|
||||||
|
game.override
|
||||||
|
.ability(AbilityId.BALL_FETCH)
|
||||||
|
.battleStyle("single")
|
||||||
|
.disableCrits()
|
||||||
|
.enemySpecies(SpeciesId.MAGIKARP)
|
||||||
|
.enemyAbility(AbilityId.BALL_FETCH)
|
||||||
|
.enemyMoveset(MoveId.SPLASH)
|
||||||
|
.startingLevel(100)
|
||||||
|
.enemyLevel(100);
|
||||||
|
});
|
||||||
|
|
||||||
|
it.each([
|
||||||
|
{ name: "Harsh Sunlight", ability: AbilityId.DROUGHT },
|
||||||
|
{ name: "Extremely Harsh Sunlight", ability: AbilityId.DESOLATE_LAND },
|
||||||
|
])("should heal 66% of the user's maximum HP under $name", async ({ ability }) => {
|
||||||
|
game.override.passiveAbility(ability);
|
||||||
|
await game.classicMode.startBattle([SpeciesId.BLISSEY]);
|
||||||
|
|
||||||
|
const blissey = game.field.getPlayerPokemon();
|
||||||
|
blissey.hp = 1;
|
||||||
|
|
||||||
|
game.move.use(MoveId.MOONLIGHT);
|
||||||
|
await game.toEndOfTurn();
|
||||||
|
|
||||||
|
expect(blissey.getHpRatio()).toBeCloseTo(0.67, 1);
|
||||||
|
});
|
||||||
|
|
||||||
|
const nonSunWTs = getEnumValues(WeatherType)
|
||||||
|
.filter(wt => ![WeatherType.NONE, WeatherType.STRONG_WINDS].includes(wt))
|
||||||
|
.map(wt => ({
|
||||||
|
name: toReadableString(WeatherType[wt]),
|
||||||
|
weather: wt,
|
||||||
|
}));
|
||||||
|
|
||||||
|
it.each(nonSunWTs)("should heal 25% of the user's maximum HP under $name", async ({ weather }) => {
|
||||||
|
game.override.weather(weather);
|
||||||
|
await game.classicMode.startBattle([SpeciesId.BLISSEY]);
|
||||||
|
|
||||||
|
const blissey = game.field.getPlayerPokemon();
|
||||||
|
blissey.hp = 1;
|
||||||
|
|
||||||
|
game.move.use(MoveId.MOONLIGHT);
|
||||||
|
await game.toEndOfTurn();
|
||||||
|
|
||||||
|
expect(blissey.getHpRatio()).toBeCloseTo(0.25, 1);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should heal 50% of the user's maximum HP under strong winds", async () => {
|
||||||
|
game.override.ability(AbilityId.DELTA_STREAM);
|
||||||
|
await game.classicMode.startBattle([SpeciesId.BLISSEY]);
|
||||||
|
|
||||||
|
const blissey = game.field.getPlayerPokemon();
|
||||||
|
blissey.hp = 1;
|
||||||
|
|
||||||
|
game.move.use(MoveId.MOONLIGHT);
|
||||||
|
await game.toEndOfTurn();
|
||||||
|
|
||||||
|
expect(blissey.getHpRatio()).toBeCloseTo(0.5, 1);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("Shore Up", () => {
|
||||||
|
afterEach(() => {
|
||||||
|
game.phaseInterceptor.restoreOg();
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
game = new GameManager(phaserGame);
|
||||||
|
game.override
|
||||||
|
.ability(AbilityId.BALL_FETCH)
|
||||||
|
.battleStyle("single")
|
||||||
|
.disableCrits()
|
||||||
|
.enemySpecies(SpeciesId.MAGIKARP)
|
||||||
|
.enemyAbility(AbilityId.BALL_FETCH)
|
||||||
|
.enemyMoveset(MoveId.SPLASH)
|
||||||
|
.startingLevel(100)
|
||||||
|
.enemyLevel(100);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should heal 66% of the user's maximum HP under sandstorm", async () => {
|
||||||
|
game.override.ability(AbilityId.SAND_STREAM);
|
||||||
|
await game.classicMode.startBattle([SpeciesId.BLISSEY]);
|
||||||
|
|
||||||
|
const blissey = game.field.getPlayerPokemon();
|
||||||
|
blissey.hp = 1;
|
||||||
|
|
||||||
|
game.move.use(MoveId.SHORE_UP);
|
||||||
|
await game.toEndOfTurn();
|
||||||
|
|
||||||
|
expect(blissey.getHpRatio()).toBeCloseTo(0.66, 1);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
@ -1,4 +1,4 @@
|
|||||||
import { MoveResult } from "#app/field/pokemon";
|
import { MoveResult } from "#enums/move-result";
|
||||||
import { AbilityId } from "#enums/ability-id";
|
import { AbilityId } from "#enums/ability-id";
|
||||||
import { BattlerTagType } from "#enums/battler-tag-type";
|
import { BattlerTagType } from "#enums/battler-tag-type";
|
||||||
import { MoveId } from "#enums/move-id";
|
import { MoveId } from "#enums/move-id";
|
||||||
@ -26,7 +26,6 @@ describe("MoveId - Rest", () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
game = new GameManager(phaserGame);
|
game = new GameManager(phaserGame);
|
||||||
game.override
|
game.override
|
||||||
.moveset([MoveId.REST, MoveId.SWORDS_DANCE])
|
|
||||||
.ability(AbilityId.BALL_FETCH)
|
.ability(AbilityId.BALL_FETCH)
|
||||||
.battleStyle("single")
|
.battleStyle("single")
|
||||||
.disableCrits()
|
.disableCrits()
|
||||||
@ -39,11 +38,11 @@ describe("MoveId - Rest", () => {
|
|||||||
game.override.statusEffect(StatusEffect.POISON);
|
game.override.statusEffect(StatusEffect.POISON);
|
||||||
await game.classicMode.startBattle([SpeciesId.SNORLAX]);
|
await game.classicMode.startBattle([SpeciesId.SNORLAX]);
|
||||||
|
|
||||||
const snorlax = game.scene.getPlayerPokemon()!;
|
const snorlax = game.field.getPlayerPokemon();
|
||||||
snorlax.hp = 1;
|
snorlax.hp = 1;
|
||||||
expect(snorlax.status?.effect).toBe(StatusEffect.POISON);
|
expect(snorlax.status?.effect).toBe(StatusEffect.POISON);
|
||||||
|
|
||||||
game.move.select(MoveId.REST);
|
game.move.use(MoveId.REST);
|
||||||
await game.toEndOfTurn();
|
await game.toEndOfTurn();
|
||||||
|
|
||||||
expect(snorlax.isFullHp()).toBe(true);
|
expect(snorlax.isFullHp()).toBe(true);
|
||||||
@ -53,26 +52,26 @@ describe("MoveId - Rest", () => {
|
|||||||
it("should always last 3 turns", async () => {
|
it("should always last 3 turns", async () => {
|
||||||
await game.classicMode.startBattle([SpeciesId.SNORLAX]);
|
await game.classicMode.startBattle([SpeciesId.SNORLAX]);
|
||||||
|
|
||||||
const snorlax = game.scene.getPlayerPokemon()!;
|
const snorlax = game.field.getPlayerPokemon();
|
||||||
snorlax.hp = 1;
|
snorlax.hp = 1;
|
||||||
|
|
||||||
// Cf https://bulbapedia.bulbagarden.net/wiki/Rest_(move):
|
// Cf https://bulbapedia.bulbagarden.net/wiki/Rest_(move):
|
||||||
// > The user is unable to use MoveId while asleep for 2 turns after the turn when Rest is used.
|
// > The user is unable to use MoveId while asleep for 2 turns after the turn when Rest is used.
|
||||||
game.move.select(MoveId.REST);
|
game.move.use(MoveId.REST);
|
||||||
await game.toNextTurn();
|
await game.toNextTurn();
|
||||||
|
|
||||||
expect(snorlax.status?.effect).toBe(StatusEffect.SLEEP);
|
expect(snorlax.status?.effect).toBe(StatusEffect.SLEEP);
|
||||||
expect(snorlax.status?.sleepTurnsRemaining).toBe(3);
|
expect(snorlax.status?.sleepTurnsRemaining).toBe(3);
|
||||||
|
|
||||||
game.move.select(MoveId.SWORDS_DANCE);
|
game.move.use(MoveId.SWORDS_DANCE);
|
||||||
await game.toNextTurn();
|
await game.toNextTurn();
|
||||||
expect(snorlax.status?.sleepTurnsRemaining).toBe(2);
|
expect(snorlax.status?.sleepTurnsRemaining).toBe(2);
|
||||||
|
|
||||||
game.move.select(MoveId.SWORDS_DANCE);
|
game.move.use(MoveId.SWORDS_DANCE);
|
||||||
await game.toNextTurn();
|
await game.toNextTurn();
|
||||||
expect(snorlax.status?.sleepTurnsRemaining).toBe(1);
|
expect(snorlax.status?.sleepTurnsRemaining).toBe(1);
|
||||||
|
|
||||||
game.move.select(MoveId.SWORDS_DANCE);
|
game.move.use(MoveId.SWORDS_DANCE);
|
||||||
await game.toNextTurn();
|
await game.toNextTurn();
|
||||||
expect(snorlax.status?.effect).toBeUndefined();
|
expect(snorlax.status?.effect).toBeUndefined();
|
||||||
expect(snorlax.getStatStage(Stat.ATK)).toBe(2);
|
expect(snorlax.getStatStage(Stat.ATK)).toBe(2);
|
||||||
@ -81,11 +80,11 @@ describe("MoveId - Rest", () => {
|
|||||||
it("should preserve non-volatile status conditions", async () => {
|
it("should preserve non-volatile status conditions", async () => {
|
||||||
await game.classicMode.startBattle([SpeciesId.SNORLAX]);
|
await game.classicMode.startBattle([SpeciesId.SNORLAX]);
|
||||||
|
|
||||||
const snorlax = game.scene.getPlayerPokemon()!;
|
const snorlax = game.field.getPlayerPokemon();
|
||||||
snorlax.hp = 1;
|
snorlax.hp = 1;
|
||||||
snorlax.addTag(BattlerTagType.CONFUSED, 999);
|
snorlax.addTag(BattlerTagType.CONFUSED, 999);
|
||||||
|
|
||||||
game.move.select(MoveId.REST);
|
game.move.use(MoveId.REST);
|
||||||
await game.toEndOfTurn();
|
await game.toEndOfTurn();
|
||||||
|
|
||||||
expect(snorlax.getTag(BattlerTagType.CONFUSED)).toBeDefined();
|
expect(snorlax.getTag(BattlerTagType.CONFUSED)).toBeDefined();
|
||||||
@ -100,11 +99,11 @@ describe("MoveId - Rest", () => {
|
|||||||
game.override.ability(ability).statusEffect(status);
|
game.override.ability(ability).statusEffect(status);
|
||||||
await game.classicMode.startBattle([SpeciesId.SNORLAX]);
|
await game.classicMode.startBattle([SpeciesId.SNORLAX]);
|
||||||
|
|
||||||
const snorlax = game.scene.getPlayerPokemon()!;
|
const snorlax = game.field.getPlayerPokemon();
|
||||||
|
|
||||||
snorlax.hp = snorlax.getMaxHp() - dmg;
|
snorlax.hp = snorlax.getMaxHp() - dmg;
|
||||||
|
|
||||||
game.move.select(MoveId.REST);
|
game.move.use(MoveId.REST);
|
||||||
await game.toEndOfTurn();
|
await game.toEndOfTurn();
|
||||||
|
|
||||||
expect(snorlax.getLastXMoves()[0].result).toBe(MoveResult.FAIL);
|
expect(snorlax.getLastXMoves()[0].result).toBe(MoveResult.FAIL);
|
||||||
@ -114,7 +113,7 @@ describe("MoveId - Rest", () => {
|
|||||||
game.override.statusEffect(StatusEffect.SLEEP).moveset([MoveId.REST, MoveId.SLEEP_TALK]);
|
game.override.statusEffect(StatusEffect.SLEEP).moveset([MoveId.REST, MoveId.SLEEP_TALK]);
|
||||||
await game.classicMode.startBattle([SpeciesId.SNORLAX]);
|
await game.classicMode.startBattle([SpeciesId.SNORLAX]);
|
||||||
|
|
||||||
const snorlax = game.scene.getPlayerPokemon()!;
|
const snorlax = game.field.getPlayerPokemon();
|
||||||
snorlax.hp = 1;
|
snorlax.hp = 1;
|
||||||
|
|
||||||
// Need to use sleep talk here since you normally can't move while asleep
|
// Need to use sleep talk here since you normally can't move while asleep
|
||||||
@ -126,22 +125,22 @@ describe("MoveId - Rest", () => {
|
|||||||
expect(snorlax.getLastXMoves(-1).map(tm => tm.result)).toEqual([MoveResult.FAIL, MoveResult.SUCCESS]);
|
expect(snorlax.getLastXMoves(-1).map(tm => tm.result)).toEqual([MoveResult.FAIL, MoveResult.SUCCESS]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should succeed if called the turn after waking up", async () => {
|
it("should succeed if called the same turn as the user wakes", async () => {
|
||||||
game.override.statusEffect(StatusEffect.SLEEP);
|
game.override.statusEffect(StatusEffect.SLEEP);
|
||||||
await game.classicMode.startBattle([SpeciesId.SNORLAX]);
|
await game.classicMode.startBattle([SpeciesId.SNORLAX]);
|
||||||
|
|
||||||
const snorlax = game.scene.getPlayerPokemon()!;
|
const snorlax = game.field.getPlayerPokemon();
|
||||||
snorlax.hp = 1;
|
snorlax.hp = 1;
|
||||||
|
|
||||||
expect(snorlax.status?.effect).toBe(StatusEffect.SLEEP);
|
expect(snorlax.status?.effect).toBe(StatusEffect.SLEEP);
|
||||||
snorlax.status!.sleepTurnsRemaining = 1;
|
snorlax.status!.sleepTurnsRemaining = 1;
|
||||||
|
|
||||||
game.move.select(MoveId.REST);
|
game.move.use(MoveId.REST);
|
||||||
await game.toNextTurn();
|
await game.toNextTurn();
|
||||||
|
|
||||||
expect(snorlax.status?.effect).toBe(StatusEffect.SLEEP);
|
expect(snorlax.status!.effect).toBe(StatusEffect.SLEEP);
|
||||||
expect(snorlax.isFullHp()).toBe(true);
|
expect(snorlax.isFullHp()).toBe(true);
|
||||||
expect(snorlax.getLastXMoves()[0].result).toBe(MoveResult.SUCCESS);
|
expect(snorlax.getLastXMoves()[0].result).toBe(MoveResult.SUCCESS);
|
||||||
expect(snorlax.status?.sleepTurnsRemaining).toBeGreaterThan(1);
|
expect(snorlax.status!.sleepTurnsRemaining).toBeGreaterThan(1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -46,17 +46,17 @@ describe("Moves - Sleep Talk", () => {
|
|||||||
const feebas = game.field.getPlayerPokemon();
|
const feebas = game.field.getPlayerPokemon();
|
||||||
expect(feebas.getStatStage(Stat.ATK)).toBe(2);
|
expect(feebas.getStatStage(Stat.ATK)).toBe(2);
|
||||||
expect(feebas.getLastXMoves(2)).toEqual([
|
expect(feebas.getLastXMoves(2)).toEqual([
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
move: MoveId.SWORDS_DANCE,
|
move: MoveId.SWORDS_DANCE,
|
||||||
result: MoveResult.SUCCESS,
|
result: MoveResult.SUCCESS,
|
||||||
virtual: true,
|
virtual: true,
|
||||||
}),
|
}),
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
move: MoveId.SLEEP_TALK,
|
move: MoveId.SLEEP_TALK,
|
||||||
result: MoveResult.SUCCESS,
|
result: MoveResult.SUCCESS,
|
||||||
virtual: false,
|
virtual: false,
|
||||||
})
|
}),
|
||||||
])
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should fail if the user is not asleep", async () => {
|
it("should fail if the user is not asleep", async () => {
|
||||||
@ -96,7 +96,7 @@ describe("Moves - Sleep Talk", () => {
|
|||||||
game.move.select(MoveId.SLEEP_TALK);
|
game.move.select(MoveId.SLEEP_TALK);
|
||||||
await game.toNextTurn();
|
await game.toNextTurn();
|
||||||
|
|
||||||
const feebas = game.field.getPlayerPokemon()
|
const feebas = game.field.getPlayerPokemon();
|
||||||
expect(feebas.getStatStage(Stat.SPD)).toBe(1);
|
expect(feebas.getStatStage(Stat.SPD)).toBe(1);
|
||||||
expect(feebas.getStatStage(Stat.DEF)).toBe(-1);
|
expect(feebas.getStatStage(Stat.DEF)).toBe(-1);
|
||||||
});
|
});
|
||||||
|
@ -3,14 +3,12 @@ import { StockpilingTag } from "#app/data/battler-tags";
|
|||||||
import { BattlerTagType } from "#app/enums/battler-tag-type";
|
import { BattlerTagType } from "#app/enums/battler-tag-type";
|
||||||
import type { TurnMove } from "#app/field/pokemon";
|
import type { TurnMove } from "#app/field/pokemon";
|
||||||
import { MoveResult } from "#enums/move-result";
|
import { MoveResult } from "#enums/move-result";
|
||||||
import { MovePhase } from "#app/phases/move-phase";
|
|
||||||
import { TurnInitPhase } from "#app/phases/turn-init-phase";
|
|
||||||
import { AbilityId } from "#enums/ability-id";
|
import { AbilityId } from "#enums/ability-id";
|
||||||
import { MoveId } from "#enums/move-id";
|
import { MoveId } from "#enums/move-id";
|
||||||
import { SpeciesId } from "#enums/species-id";
|
import { SpeciesId } from "#enums/species-id";
|
||||||
import GameManager from "#test/testUtils/gameManager";
|
import GameManager from "#test/testUtils/gameManager";
|
||||||
import Phaser from "phaser";
|
import Phaser from "phaser";
|
||||||
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
||||||
|
|
||||||
describe("Moves - Swallow", () => {
|
describe("Moves - Swallow", () => {
|
||||||
let phaserGame: Phaser.Game;
|
let phaserGame: Phaser.Game;
|
||||||
@ -31,99 +29,41 @@ describe("Moves - Swallow", () => {
|
|||||||
.battleStyle("single")
|
.battleStyle("single")
|
||||||
.enemySpecies(SpeciesId.RATTATA)
|
.enemySpecies(SpeciesId.RATTATA)
|
||||||
.enemyMoveset(MoveId.SPLASH)
|
.enemyMoveset(MoveId.SPLASH)
|
||||||
.enemyAbility(AbilityId.NONE)
|
.enemyAbility(AbilityId.BALL_FETCH)
|
||||||
.enemyLevel(2000)
|
.enemyLevel(1000)
|
||||||
.moveset(MoveId.SWALLOW)
|
.startingLevel(1000)
|
||||||
.ability(AbilityId.NONE);
|
.ability(AbilityId.BALL_FETCH);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("consumes all stockpile stacks to heal (scaling with stacks)", () => {
|
it.each<{ stackCount: number; healPercent: number }>([
|
||||||
it("1 stack -> 25% heal", async () => {
|
{ stackCount: 1, healPercent: 25 },
|
||||||
const stacksToSetup = 1;
|
{ stackCount: 2, healPercent: 50 },
|
||||||
const expectedHeal = 25;
|
{ stackCount: 3, healPercent: 100 },
|
||||||
|
])(
|
||||||
|
"should heal the user by $healPercent% when consuming $count stockpile stacks",
|
||||||
|
async ({ stackCount, healPercent }) => {
|
||||||
|
await game.classicMode.startBattle([SpeciesId.SWALOT]);
|
||||||
|
|
||||||
await game.classicMode.startBattle([SpeciesId.ABOMASNOW]);
|
const swalot = game.field.getPlayerPokemon();
|
||||||
|
swalot.hp = 1;
|
||||||
|
|
||||||
const pokemon = game.scene.getPlayerPokemon()!;
|
for (let i = 0; i < stackCount; i++) {
|
||||||
vi.spyOn(pokemon, "getMaxHp").mockReturnValue(100);
|
swalot.addTag(BattlerTagType.STOCKPILING);
|
||||||
pokemon["hp"] = 1;
|
}
|
||||||
|
|
||||||
pokemon.addTag(BattlerTagType.STOCKPILING);
|
const stockpilingTag = swalot.getTag(StockpilingTag)!;
|
||||||
|
|
||||||
const stockpilingTag = pokemon.getTag(StockpilingTag)!;
|
|
||||||
expect(stockpilingTag).toBeDefined();
|
expect(stockpilingTag).toBeDefined();
|
||||||
expect(stockpilingTag.stockpiledCount).toBe(stacksToSetup);
|
expect(stockpilingTag.stockpiledCount).toBe(stackCount);
|
||||||
|
|
||||||
vi.spyOn(pokemon, "heal");
|
game.move.use(MoveId.SWALLOW);
|
||||||
|
await game.toEndOfTurn();
|
||||||
|
|
||||||
game.move.select(MoveId.SWALLOW);
|
expect(swalot.getHpRatio()).toBeCloseTo(healPercent / 100, 1);
|
||||||
await game.phaseInterceptor.to(TurnInitPhase);
|
expect(swalot.getTag(StockpilingTag)).toBeUndefined();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
expect(pokemon.heal).toHaveBeenCalledOnce();
|
it("should fail without stacks", async () => {
|
||||||
expect(pokemon.heal).toHaveReturnedWith(expectedHeal);
|
|
||||||
|
|
||||||
expect(pokemon.getTag(StockpilingTag)).toBeUndefined();
|
|
||||||
});
|
|
||||||
|
|
||||||
it("2 stacks -> 50% heal", async () => {
|
|
||||||
const stacksToSetup = 2;
|
|
||||||
const expectedHeal = 50;
|
|
||||||
|
|
||||||
await game.classicMode.startBattle([SpeciesId.ABOMASNOW]);
|
|
||||||
|
|
||||||
const pokemon = game.scene.getPlayerPokemon()!;
|
|
||||||
vi.spyOn(pokemon, "getMaxHp").mockReturnValue(100);
|
|
||||||
pokemon["hp"] = 1;
|
|
||||||
|
|
||||||
pokemon.addTag(BattlerTagType.STOCKPILING);
|
|
||||||
pokemon.addTag(BattlerTagType.STOCKPILING);
|
|
||||||
|
|
||||||
const stockpilingTag = pokemon.getTag(StockpilingTag)!;
|
|
||||||
expect(stockpilingTag).toBeDefined();
|
|
||||||
expect(stockpilingTag.stockpiledCount).toBe(stacksToSetup);
|
|
||||||
|
|
||||||
vi.spyOn(pokemon, "heal");
|
|
||||||
|
|
||||||
game.move.select(MoveId.SWALLOW);
|
|
||||||
await game.phaseInterceptor.to(TurnInitPhase);
|
|
||||||
|
|
||||||
expect(pokemon.heal).toHaveBeenCalledOnce();
|
|
||||||
expect(pokemon.heal).toHaveReturnedWith(expectedHeal);
|
|
||||||
|
|
||||||
expect(pokemon.getTag(StockpilingTag)).toBeUndefined();
|
|
||||||
});
|
|
||||||
|
|
||||||
it("3 stacks -> 100% heal", async () => {
|
|
||||||
const stacksToSetup = 3;
|
|
||||||
const expectedHeal = 100;
|
|
||||||
|
|
||||||
await game.classicMode.startBattle([SpeciesId.ABOMASNOW]);
|
|
||||||
|
|
||||||
const pokemon = game.scene.getPlayerPokemon()!;
|
|
||||||
vi.spyOn(pokemon, "getMaxHp").mockReturnValue(100);
|
|
||||||
pokemon["hp"] = 0.0001;
|
|
||||||
|
|
||||||
pokemon.addTag(BattlerTagType.STOCKPILING);
|
|
||||||
pokemon.addTag(BattlerTagType.STOCKPILING);
|
|
||||||
pokemon.addTag(BattlerTagType.STOCKPILING);
|
|
||||||
|
|
||||||
const stockpilingTag = pokemon.getTag(StockpilingTag)!;
|
|
||||||
expect(stockpilingTag).toBeDefined();
|
|
||||||
expect(stockpilingTag.stockpiledCount).toBe(stacksToSetup);
|
|
||||||
|
|
||||||
vi.spyOn(pokemon, "heal");
|
|
||||||
|
|
||||||
game.move.select(MoveId.SWALLOW);
|
|
||||||
await game.phaseInterceptor.to(TurnInitPhase);
|
|
||||||
|
|
||||||
expect(pokemon.heal).toHaveBeenCalledOnce();
|
|
||||||
expect(pokemon.heal).toHaveReturnedWith(expect.closeTo(expectedHeal));
|
|
||||||
|
|
||||||
expect(pokemon.getTag(StockpilingTag)).toBeUndefined();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it("fails without stacks", async () => {
|
|
||||||
await game.classicMode.startBattle([SpeciesId.ABOMASNOW]);
|
await game.classicMode.startBattle([SpeciesId.ABOMASNOW]);
|
||||||
|
|
||||||
const pokemon = game.scene.getPlayerPokemon()!;
|
const pokemon = game.scene.getPlayerPokemon()!;
|
||||||
@ -131,17 +71,17 @@ describe("Moves - Swallow", () => {
|
|||||||
const stockpilingTag = pokemon.getTag(StockpilingTag)!;
|
const stockpilingTag = pokemon.getTag(StockpilingTag)!;
|
||||||
expect(stockpilingTag).toBeUndefined();
|
expect(stockpilingTag).toBeUndefined();
|
||||||
|
|
||||||
game.move.select(MoveId.SWALLOW);
|
game.move.use(MoveId.SWALLOW);
|
||||||
await game.phaseInterceptor.to(TurnInitPhase);
|
await game.toEndOfTurn();
|
||||||
|
|
||||||
expect(pokemon.getMoveHistory().at(-1)).toMatchObject<TurnMove>({
|
expect(pokemon.getLastXMoves()[0]).toMatchObject({
|
||||||
move: MoveId.SWALLOW,
|
move: MoveId.SWALLOW,
|
||||||
result: MoveResult.FAIL,
|
result: MoveResult.FAIL,
|
||||||
targets: [pokemon.getBattlerIndex()],
|
targets: [pokemon.getBattlerIndex()],
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("restores stat stage boosts granted by stacks", () => {
|
describe("should reset stat stage boosts granted by stacks", () => {
|
||||||
it("decreases stats based on stored values (both boosts equal)", async () => {
|
it("decreases stats based on stored values (both boosts equal)", async () => {
|
||||||
await game.classicMode.startBattle([SpeciesId.ABOMASNOW]);
|
await game.classicMode.startBattle([SpeciesId.ABOMASNOW]);
|
||||||
|
|
||||||
@ -150,16 +90,13 @@ describe("Moves - Swallow", () => {
|
|||||||
|
|
||||||
const stockpilingTag = pokemon.getTag(StockpilingTag)!;
|
const stockpilingTag = pokemon.getTag(StockpilingTag)!;
|
||||||
expect(stockpilingTag).toBeDefined();
|
expect(stockpilingTag).toBeDefined();
|
||||||
|
|
||||||
game.move.select(MoveId.SWALLOW);
|
|
||||||
await game.phaseInterceptor.to(MovePhase);
|
|
||||||
|
|
||||||
expect(pokemon.getStatStage(Stat.DEF)).toBe(1);
|
expect(pokemon.getStatStage(Stat.DEF)).toBe(1);
|
||||||
expect(pokemon.getStatStage(Stat.SPDEF)).toBe(1);
|
expect(pokemon.getStatStage(Stat.SPDEF)).toBe(1);
|
||||||
|
|
||||||
await game.phaseInterceptor.to(TurnInitPhase);
|
game.move.use(MoveId.SWALLOW);
|
||||||
|
await game.toEndOfTurn();
|
||||||
|
|
||||||
expect(pokemon.getMoveHistory().at(-1)).toMatchObject<TurnMove>({
|
expect(pokemon.getLastXMoves()[0]).toMatchObject({
|
||||||
move: MoveId.SWALLOW,
|
move: MoveId.SWALLOW,
|
||||||
result: MoveResult.SUCCESS,
|
result: MoveResult.SUCCESS,
|
||||||
targets: [pokemon.getBattlerIndex()],
|
targets: [pokemon.getBattlerIndex()],
|
||||||
@ -167,8 +104,6 @@ describe("Moves - Swallow", () => {
|
|||||||
|
|
||||||
expect(pokemon.getStatStage(Stat.DEF)).toBe(0);
|
expect(pokemon.getStatStage(Stat.DEF)).toBe(0);
|
||||||
expect(pokemon.getStatStage(Stat.SPDEF)).toBe(0);
|
expect(pokemon.getStatStage(Stat.SPDEF)).toBe(0);
|
||||||
|
|
||||||
expect(pokemon.getTag(StockpilingTag)).toBeUndefined();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("lower stat stages based on stored values (different boosts)", async () => {
|
it("lower stat stages based on stored values (different boosts)", async () => {
|
||||||
@ -179,7 +114,6 @@ describe("Moves - Swallow", () => {
|
|||||||
|
|
||||||
const stockpilingTag = pokemon.getTag(StockpilingTag)!;
|
const stockpilingTag = pokemon.getTag(StockpilingTag)!;
|
||||||
expect(stockpilingTag).toBeDefined();
|
expect(stockpilingTag).toBeDefined();
|
||||||
|
|
||||||
// for the sake of simplicity (and because other tests cover the setup), set boost amounts directly
|
// for the sake of simplicity (and because other tests cover the setup), set boost amounts directly
|
||||||
stockpilingTag.statChangeCounts = {
|
stockpilingTag.statChangeCounts = {
|
||||||
[Stat.DEF]: -1,
|
[Stat.DEF]: -1,
|
||||||
@ -187,10 +121,9 @@ describe("Moves - Swallow", () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
game.move.select(MoveId.SWALLOW);
|
game.move.select(MoveId.SWALLOW);
|
||||||
|
await game.toEndOfTurn();
|
||||||
|
|
||||||
await game.phaseInterceptor.to(TurnInitPhase);
|
expect(pokemon.getLastXMoves()[0]).toMatchObject<TurnMove>({
|
||||||
|
|
||||||
expect(pokemon.getMoveHistory().at(-1)).toMatchObject<TurnMove>({
|
|
||||||
move: MoveId.SWALLOW,
|
move: MoveId.SWALLOW,
|
||||||
result: MoveResult.SUCCESS,
|
result: MoveResult.SUCCESS,
|
||||||
targets: [pokemon.getBattlerIndex()],
|
targets: [pokemon.getBattlerIndex()],
|
||||||
@ -198,8 +131,6 @@ describe("Moves - Swallow", () => {
|
|||||||
|
|
||||||
expect(pokemon.getStatStage(Stat.DEF)).toBe(1);
|
expect(pokemon.getStatStage(Stat.DEF)).toBe(1);
|
||||||
expect(pokemon.getStatStage(Stat.SPDEF)).toBe(-2);
|
expect(pokemon.getStatStage(Stat.SPDEF)).toBe(-2);
|
||||||
|
|
||||||
expect(pokemon.getTag(StockpilingTag)).toBeUndefined();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user