mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-19 13:59:27 +02:00
Compare commits
17 Commits
011aee826d
...
61716ba540
Author | SHA1 | Date | |
---|---|---|---|
|
61716ba540 | ||
|
46c78a0540 | ||
|
98809c28bd | ||
|
e0559e03ff | ||
|
f6b99780fb | ||
|
19af9bdb8b | ||
|
8e61b642a3 | ||
|
ce3fe897c3 | ||
|
605d61cec9 | ||
|
d55cfbcf38 | ||
|
8f9fca50a1 | ||
|
6018e11233 | ||
|
d798ebb545 | ||
|
f771e29b0f | ||
|
d2f8495c1f | ||
|
6fae3cbacd | ||
|
b552779316 |
@ -1 +1 @@
|
||||
Subproject commit ab2716d5440c25f73986664aa3f3131821c3c392
|
||||
Subproject commit 1ea8f865e30d1940caa0fceeabf37ae2e4689471
|
@ -10,6 +10,7 @@ import { allMoves } from "#data/data-lists";
|
||||
import { AbilityId } from "#enums/ability-id";
|
||||
import { ArenaTagSide } from "#enums/arena-tag-side";
|
||||
import { ArenaTagType } from "#enums/arena-tag-type";
|
||||
import type { BattlerIndex } from "#enums/battler-index";
|
||||
import { BattlerTagType } from "#enums/battler-tag-type";
|
||||
import { HitResult } from "#enums/hit-result";
|
||||
import { CommonAnim } from "#enums/move-anims-common";
|
||||
@ -28,7 +29,7 @@ import type {
|
||||
SerializableArenaTagType,
|
||||
} from "#types/arena-tags";
|
||||
import type { Mutable } from "#types/type-helpers";
|
||||
import { BooleanHolder, NumberHolder, toDmgValue } from "#utils/common";
|
||||
import { BooleanHolder, isNullOrUndefined, NumberHolder, toDmgValue } from "#utils/common";
|
||||
import i18next from "i18next";
|
||||
|
||||
/**
|
||||
@ -1583,6 +1584,138 @@ export class SuppressAbilitiesTag extends SerializableArenaTag {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface containing data related to a queued healing effect from
|
||||
* {@link https://bulbapedia.bulbagarden.net/wiki/Healing_Wish_(move) | Healing Wish}
|
||||
* or {@link https://bulbapedia.bulbagarden.net/wiki/Lunar_Dance_(move) | Lunar Dance}.
|
||||
*/
|
||||
interface PendingHealEffect {
|
||||
/** The {@linkcode Pokemon.id | PID} of the {@linkcode Pokemon} that created the effect. */
|
||||
readonly sourceId: number;
|
||||
/** The {@linkcode MoveId} of the move that created the effect. */
|
||||
readonly moveId: MoveId;
|
||||
/** If `true`, also restores the target's PP when the effect activates. */
|
||||
readonly restorePP: boolean;
|
||||
/** The message to display when the effect activates */
|
||||
readonly healMessage: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Arena tag to contain stored healing effects, namely from
|
||||
* {@link https://bulbapedia.bulbagarden.net/wiki/Healing_Wish_(move) | Healing Wish}
|
||||
* and {@link https://bulbapedia.bulbagarden.net/wiki/Lunar_Dance_(move) | Lunar Dance}.
|
||||
* When a damaged Pokemon first enters the effect's {@linkcode BattlerIndex | field position},
|
||||
* their HP is fully restored, and they are cured of any non-volatile status condition.
|
||||
* If the effect is from Lunar Dance, their PP is also restored.
|
||||
*/
|
||||
export class PendingHealTag extends SerializableArenaTag {
|
||||
public readonly tagType = ArenaTagType.PENDING_HEAL;
|
||||
/** All pending healing effects, organized by {@linkcode BattlerIndex} */
|
||||
public readonly pendingHeals: Partial<Record<BattlerIndex, PendingHealEffect[]>> = {};
|
||||
|
||||
constructor() {
|
||||
super(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a pending healing effect to the field. Effects under the same move *and*
|
||||
* target index as an existing effect are ignored.
|
||||
* @param targetIndex - The {@linkcode BattlerIndex} under which the effect applies
|
||||
* @param healEffect - The {@linkcode PendingHealEffect | data} for the pending heal effect
|
||||
*/
|
||||
public queueHeal(targetIndex: BattlerIndex, healEffect: PendingHealEffect): void {
|
||||
const existingHealEffects = this.pendingHeals[targetIndex];
|
||||
if (existingHealEffects) {
|
||||
if (!existingHealEffects.some(he => he.moveId === healEffect.moveId)) {
|
||||
existingHealEffects.push(healEffect);
|
||||
}
|
||||
} else {
|
||||
this.pendingHeals[targetIndex] = [healEffect];
|
||||
}
|
||||
}
|
||||
|
||||
/** Removes default on-remove message */
|
||||
override onRemove(_arena: Arena): void {}
|
||||
|
||||
/** This arena tag is removed at the end of the turn if no pending healing effects are on the field */
|
||||
override lapse(_arena: Arena): boolean {
|
||||
for (const key in this.pendingHeals) {
|
||||
if (this.pendingHeals[key].length > 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies a pending healing effect on the given target index. If an effect is found for
|
||||
* the index, the Pokemon at that index is healed to full HP, is cured of any non-volatile status,
|
||||
* and has its PP fully restored (if the effect is from Lunar Dance).
|
||||
* @param arena - The {@linkcode Arena} containing this tag
|
||||
* @param simulated - If `true`, suppresses changes to game state
|
||||
* @param pokemon - The {@linkcode Pokemon} receiving the healing effect
|
||||
* @returns `true` if the target Pokemon was healed by this effect
|
||||
* @todo This should also be called when a Pokemon moves into a new position via Ally Switch
|
||||
*/
|
||||
override apply(arena: Arena, simulated: boolean, pokemon: Pokemon): boolean {
|
||||
const targetIndex = pokemon.getBattlerIndex();
|
||||
const targetEffects = this.pendingHeals[targetIndex];
|
||||
|
||||
if (simulated) {
|
||||
return !!targetEffects?.length;
|
||||
}
|
||||
|
||||
const healEffect = targetEffects?.find(effect => this.canApply(effect, pokemon));
|
||||
if (targetEffects && healEffect) {
|
||||
const { sourceId, moveId, restorePP, healMessage } = healEffect;
|
||||
const sourcePokemon = globalScene.getPokemonById(sourceId);
|
||||
if (!sourcePokemon) {
|
||||
console.warn(`Source of pending ${allMoves[moveId].name} effect is undefined!`);
|
||||
targetEffects.splice(targetEffects.indexOf(healEffect), 1);
|
||||
// Re-evaluate after the invalid heal effect is removed
|
||||
return this.apply(arena, simulated, pokemon);
|
||||
}
|
||||
|
||||
globalScene.phaseManager.unshiftNew(
|
||||
"PokemonHealPhase",
|
||||
targetIndex,
|
||||
pokemon.getMaxHp(),
|
||||
healMessage,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
restorePP,
|
||||
);
|
||||
|
||||
targetEffects.splice(targetEffects.indexOf(healEffect), 1);
|
||||
}
|
||||
|
||||
return !isNullOrUndefined(healEffect);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if the given {@linkcode PendingHealEffect} can immediately heal
|
||||
* the given target {@linkcode Pokemon}.
|
||||
* @param healEffect - The {@linkcode PendingHealEffect} to evaluate
|
||||
* @param pokemon - The {@linkcode Pokemon} to evaluate against
|
||||
* @returns `true` if the Pokemon can be healed by the effect
|
||||
*/
|
||||
private canApply(healEffect: PendingHealEffect, pokemon: Pokemon): boolean {
|
||||
return (
|
||||
!pokemon.isFullHp() ||
|
||||
!isNullOrUndefined(pokemon.status) ||
|
||||
(healEffect.restorePP && pokemon.getMoveset().some(mv => mv.ppUsed > 0))
|
||||
);
|
||||
}
|
||||
|
||||
override loadTag(source: BaseArenaTag & Pick<PendingHealTag, "tagType" | "pendingHeals">): void {
|
||||
super.loadTag(source);
|
||||
(this as Mutable<this>).pendingHeals = source.pendingHeals;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: swap `sourceMove` and `sourceId` and make `sourceMove` an optional parameter
|
||||
export function getArenaTag(
|
||||
tagType: ArenaTagType,
|
||||
@ -1646,6 +1779,8 @@ export function getArenaTag(
|
||||
return new FairyLockTag(turnCount, sourceId);
|
||||
case ArenaTagType.NEUTRALIZING_GAS:
|
||||
return new SuppressAbilitiesTag(sourceId);
|
||||
case ArenaTagType.PENDING_HEAL:
|
||||
return new PendingHealTag();
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
@ -1694,5 +1829,6 @@ export type ArenaTagTypeMap = {
|
||||
[ArenaTagType.GRASS_WATER_PLEDGE]: GrassWaterPledgeTag;
|
||||
[ArenaTagType.FAIRY_LOCK]: FairyLockTag;
|
||||
[ArenaTagType.NEUTRALIZING_GAS]: SuppressAbilitiesTag;
|
||||
[ArenaTagType.PENDING_HEAL]: PendingHealTag;
|
||||
[ArenaTagType.NONE]: NoneTag;
|
||||
};
|
||||
|
@ -45736,6 +45736,285 @@ export const tmSpecies: TmSpecies = {
|
||||
SpeciesId.HISUI_ARCANINE,
|
||||
SpeciesId.HISUI_AVALUGG,
|
||||
],
|
||||
[MoveId.SHOCK_WAVE]: [
|
||||
SpeciesId.RATTATA,
|
||||
SpeciesId.RATICATE,
|
||||
SpeciesId.PIKACHU,
|
||||
SpeciesId.RAICHU,
|
||||
SpeciesId.NIDORAN_F,
|
||||
SpeciesId.NIDORINA,
|
||||
SpeciesId.NIDOQUEEN,
|
||||
SpeciesId.NIDORAN_M,
|
||||
SpeciesId.NIDORINO,
|
||||
SpeciesId.NIDOKING,
|
||||
SpeciesId.CLEFAIRY,
|
||||
SpeciesId.CLEFABLE,
|
||||
SpeciesId.JIGGLYPUFF,
|
||||
SpeciesId.WIGGLYTUFF,
|
||||
SpeciesId.MEOWTH,
|
||||
SpeciesId.PERSIAN,
|
||||
SpeciesId.ABRA,
|
||||
SpeciesId.KADABRA,
|
||||
SpeciesId.ALAKAZAM,
|
||||
SpeciesId.MAGNEMITE,
|
||||
SpeciesId.MAGNETON,
|
||||
SpeciesId.GRIMER,
|
||||
SpeciesId.MUK,
|
||||
SpeciesId.VOLTORB,
|
||||
SpeciesId.ELECTRODE,
|
||||
SpeciesId.LICKITUNG,
|
||||
SpeciesId.KOFFING,
|
||||
SpeciesId.WEEZING,
|
||||
SpeciesId.RHYHORN,
|
||||
SpeciesId.RHYDON,
|
||||
SpeciesId.CHANSEY,
|
||||
SpeciesId.TANGELA,
|
||||
SpeciesId.KANGASKHAN,
|
||||
SpeciesId.MR_MIME,
|
||||
SpeciesId.ELECTABUZZ,
|
||||
SpeciesId.TAUROS,
|
||||
SpeciesId.LAPRAS,
|
||||
SpeciesId.JOLTEON,
|
||||
SpeciesId.PORYGON,
|
||||
SpeciesId.SNORLAX,
|
||||
SpeciesId.ZAPDOS,
|
||||
SpeciesId.DRATINI,
|
||||
SpeciesId.DRAGONAIR,
|
||||
SpeciesId.DRAGONITE,
|
||||
SpeciesId.MEWTWO,
|
||||
SpeciesId.MEW,
|
||||
SpeciesId.SENTRET,
|
||||
SpeciesId.FURRET,
|
||||
SpeciesId.CHINCHOU,
|
||||
SpeciesId.LANTURN,
|
||||
SpeciesId.PICHU,
|
||||
SpeciesId.CLEFFA,
|
||||
SpeciesId.IGGLYBUFF,
|
||||
SpeciesId.TOGEPI,
|
||||
SpeciesId.TOGETIC,
|
||||
SpeciesId.MAREEP,
|
||||
SpeciesId.FLAAFFY,
|
||||
SpeciesId.AMPHAROS,
|
||||
SpeciesId.AIPOM,
|
||||
SpeciesId.MISDREAVUS,
|
||||
SpeciesId.GIRAFARIG,
|
||||
SpeciesId.DUNSPARCE,
|
||||
SpeciesId.SNUBBULL,
|
||||
SpeciesId.GRANBULL,
|
||||
SpeciesId.QWILFISH,
|
||||
SpeciesId.PORYGON2,
|
||||
SpeciesId.STANTLER,
|
||||
SpeciesId.ELEKID,
|
||||
SpeciesId.MILTANK,
|
||||
SpeciesId.BLISSEY,
|
||||
SpeciesId.RAIKOU,
|
||||
SpeciesId.TYRANITAR,
|
||||
SpeciesId.LUGIA,
|
||||
SpeciesId.HO_OH,
|
||||
SpeciesId.CELEBI,
|
||||
SpeciesId.ZIGZAGOON,
|
||||
SpeciesId.LINOONE,
|
||||
SpeciesId.WINGULL,
|
||||
SpeciesId.PELIPPER,
|
||||
SpeciesId.RALTS,
|
||||
SpeciesId.KIRLIA,
|
||||
SpeciesId.GARDEVOIR,
|
||||
SpeciesId.SLAKOTH,
|
||||
SpeciesId.VIGOROTH,
|
||||
SpeciesId.SLAKING,
|
||||
SpeciesId.WHISMUR,
|
||||
SpeciesId.LOUDRED,
|
||||
SpeciesId.EXPLOUD,
|
||||
SpeciesId.NOSEPASS,
|
||||
SpeciesId.SKITTY,
|
||||
SpeciesId.DELCATTY,
|
||||
SpeciesId.SABLEYE,
|
||||
SpeciesId.ARON,
|
||||
SpeciesId.LAIRON,
|
||||
SpeciesId.AGGRON,
|
||||
SpeciesId.ELECTRIKE,
|
||||
SpeciesId.MANECTRIC,
|
||||
SpeciesId.PLUSLE,
|
||||
SpeciesId.MINUN,
|
||||
SpeciesId.VOLBEAT,
|
||||
SpeciesId.ILLUMISE,
|
||||
SpeciesId.GULPIN,
|
||||
SpeciesId.SWALOT,
|
||||
SpeciesId.SPOINK,
|
||||
SpeciesId.GRUMPIG,
|
||||
SpeciesId.SPINDA,
|
||||
SpeciesId.ZANGOOSE,
|
||||
SpeciesId.CASTFORM,
|
||||
SpeciesId.KECLEON,
|
||||
SpeciesId.SHUPPET,
|
||||
SpeciesId.BANETTE,
|
||||
SpeciesId.CHIMECHO,
|
||||
SpeciesId.ABSOL,
|
||||
SpeciesId.REGIROCK,
|
||||
SpeciesId.REGICE,
|
||||
SpeciesId.REGISTEEL,
|
||||
SpeciesId.LATIAS,
|
||||
SpeciesId.LATIOS,
|
||||
SpeciesId.KYOGRE,
|
||||
SpeciesId.GROUDON,
|
||||
SpeciesId.RAYQUAZA,
|
||||
SpeciesId.JIRACHI,
|
||||
SpeciesId.DEOXYS,
|
||||
SpeciesId.BIDOOF,
|
||||
SpeciesId.BIBAREL,
|
||||
SpeciesId.SHINX,
|
||||
SpeciesId.LUXIO,
|
||||
SpeciesId.LUXRAY,
|
||||
SpeciesId.CRANIDOS,
|
||||
SpeciesId.RAMPARDOS,
|
||||
SpeciesId.SHIELDON,
|
||||
SpeciesId.BASTIODON,
|
||||
SpeciesId.PACHIRISU,
|
||||
SpeciesId.AMBIPOM,
|
||||
SpeciesId.DRIFLOON,
|
||||
SpeciesId.DRIFBLIM,
|
||||
SpeciesId.BUNEARY,
|
||||
SpeciesId.LOPUNNY,
|
||||
SpeciesId.MISMAGIUS,
|
||||
SpeciesId.GLAMEOW,
|
||||
SpeciesId.PURUGLY,
|
||||
SpeciesId.CHINGLING,
|
||||
SpeciesId.MIME_JR,
|
||||
SpeciesId.HAPPINY,
|
||||
SpeciesId.SPIRITOMB,
|
||||
SpeciesId.MUNCHLAX,
|
||||
SpeciesId.MAGNEZONE,
|
||||
SpeciesId.LICKILICKY,
|
||||
SpeciesId.RHYPERIOR,
|
||||
SpeciesId.TANGROWTH,
|
||||
SpeciesId.ELECTIVIRE,
|
||||
SpeciesId.TOGEKISS,
|
||||
SpeciesId.PORYGON_Z,
|
||||
SpeciesId.GALLADE,
|
||||
SpeciesId.PROBOPASS,
|
||||
SpeciesId.FROSLASS,
|
||||
SpeciesId.ROTOM,
|
||||
SpeciesId.UXIE,
|
||||
SpeciesId.MESPRIT,
|
||||
SpeciesId.AZELF,
|
||||
SpeciesId.DIALGA,
|
||||
SpeciesId.PALKIA,
|
||||
SpeciesId.REGIGIGAS,
|
||||
SpeciesId.GIRATINA,
|
||||
SpeciesId.DARKRAI,
|
||||
SpeciesId.ARCEUS,
|
||||
SpeciesId.VICTINI,
|
||||
SpeciesId.PATRAT,
|
||||
SpeciesId.WATCHOG,
|
||||
SpeciesId.LILLIPUP,
|
||||
SpeciesId.HERDIER,
|
||||
SpeciesId.STOUTLAND,
|
||||
SpeciesId.MUNNA,
|
||||
SpeciesId.MUSHARNA,
|
||||
SpeciesId.BLITZLE,
|
||||
SpeciesId.ZEBSTRIKA,
|
||||
SpeciesId.WOOBAT,
|
||||
SpeciesId.SWOOBAT,
|
||||
SpeciesId.SIGILYPH,
|
||||
SpeciesId.YAMASK,
|
||||
SpeciesId.COFAGRIGUS,
|
||||
SpeciesId.MINCCINO,
|
||||
SpeciesId.CINCCINO,
|
||||
SpeciesId.GOTHITA,
|
||||
SpeciesId.GOTHORITA,
|
||||
SpeciesId.GOTHITELLE,
|
||||
SpeciesId.SOLOSIS,
|
||||
SpeciesId.DUOSION,
|
||||
SpeciesId.REUNICLUS,
|
||||
SpeciesId.EMOLGA,
|
||||
SpeciesId.FRILLISH,
|
||||
SpeciesId.JELLICENT,
|
||||
SpeciesId.JOLTIK,
|
||||
SpeciesId.GALVANTULA,
|
||||
SpeciesId.KLINK,
|
||||
SpeciesId.KLANG,
|
||||
SpeciesId.KLINKLANG,
|
||||
SpeciesId.EELEKTRIK,
|
||||
SpeciesId.EELEKTROSS,
|
||||
SpeciesId.ELGYEM,
|
||||
SpeciesId.BEHEEYEM,
|
||||
SpeciesId.LITWICK,
|
||||
SpeciesId.LAMPENT,
|
||||
SpeciesId.CHANDELURE,
|
||||
SpeciesId.AXEW,
|
||||
SpeciesId.FRAXURE,
|
||||
SpeciesId.HAXORUS,
|
||||
SpeciesId.STUNFISK,
|
||||
SpeciesId.DRUDDIGON,
|
||||
SpeciesId.GOLETT,
|
||||
SpeciesId.GOLURK,
|
||||
SpeciesId.DEINO,
|
||||
SpeciesId.ZWEILOUS,
|
||||
SpeciesId.HYDREIGON,
|
||||
SpeciesId.THUNDURUS,
|
||||
SpeciesId.ZEKROM,
|
||||
SpeciesId.MELOETTA,
|
||||
SpeciesId.GENESECT,
|
||||
SpeciesId.BRAIXEN,
|
||||
SpeciesId.DELPHOX,
|
||||
SpeciesId.ESPURR,
|
||||
SpeciesId.MEOWSTIC,
|
||||
SpeciesId.HONEDGE,
|
||||
SpeciesId.DOUBLADE,
|
||||
SpeciesId.AEGISLASH,
|
||||
SpeciesId.SKRELP,
|
||||
SpeciesId.DRAGALGE,
|
||||
SpeciesId.HELIOPTILE,
|
||||
SpeciesId.HELIOLISK,
|
||||
SpeciesId.DEDENNE,
|
||||
SpeciesId.GOOMY,
|
||||
SpeciesId.SLIGGOO,
|
||||
SpeciesId.GOODRA,
|
||||
SpeciesId.ZYGARDE,
|
||||
SpeciesId.HOOPA,
|
||||
SpeciesId.YUNGOOS,
|
||||
SpeciesId.GUMSHOOS,
|
||||
SpeciesId.GRUBBIN,
|
||||
SpeciesId.CHARJABUG,
|
||||
SpeciesId.VIKAVOLT,
|
||||
SpeciesId.PASSIMIAN,
|
||||
SpeciesId.TURTONATOR,
|
||||
SpeciesId.TOGEDEMARU,
|
||||
SpeciesId.DRAMPA,
|
||||
SpeciesId.KOMMO_O,
|
||||
SpeciesId.TAPU_KOKO,
|
||||
SpeciesId.SOLGALEO,
|
||||
SpeciesId.LUNALA,
|
||||
SpeciesId.PHEROMOSA,
|
||||
SpeciesId.XURKITREE,
|
||||
SpeciesId.CELESTEELA,
|
||||
SpeciesId.GUZZLORD,
|
||||
SpeciesId.NECROZMA,
|
||||
SpeciesId.MAGEARNA,
|
||||
SpeciesId.NAGANADEL,
|
||||
SpeciesId.ZERAORA,
|
||||
SpeciesId.TOXTRICITY,
|
||||
SpeciesId.MR_RIME,
|
||||
SpeciesId.REGIELEKI,
|
||||
SpeciesId.WYRDEER,
|
||||
SpeciesId.FARIGIRAF,
|
||||
SpeciesId.DUDUNSPARCE,
|
||||
SpeciesId.MIRAIDON,
|
||||
SpeciesId.RAGING_BOLT,
|
||||
SpeciesId.ALOLA_RATTATA,
|
||||
SpeciesId.ALOLA_RATICATE,
|
||||
SpeciesId.ALOLA_RAICHU,
|
||||
SpeciesId.ALOLA_MEOWTH,
|
||||
SpeciesId.ALOLA_PERSIAN,
|
||||
SpeciesId.ALOLA_GRAVELER,
|
||||
SpeciesId.ALOLA_GOLEM,
|
||||
SpeciesId.ALOLA_GRIMER,
|
||||
SpeciesId.ALOLA_MUK,
|
||||
SpeciesId.GALAR_WEEZING,
|
||||
SpeciesId.GALAR_MR_MIME,
|
||||
SpeciesId.HISUI_SLIGGOO,
|
||||
SpeciesId.HISUI_GOODRA,
|
||||
],
|
||||
[MoveId.WATER_PULSE]: [
|
||||
SpeciesId.SQUIRTLE,
|
||||
SpeciesId.WARTORTLE,
|
||||
@ -68747,6 +69026,7 @@ export const tmPoolTiers: TmPoolTiers = {
|
||||
[MoveId.LEAF_BLADE]: ModifierTier.ULTRA,
|
||||
[MoveId.DRAGON_DANCE]: ModifierTier.GREAT,
|
||||
[MoveId.ROCK_BLAST]: ModifierTier.GREAT,
|
||||
[MoveId.SHOCK_WAVE]: ModifierTier.GREAT,
|
||||
[MoveId.WATER_PULSE]: ModifierTier.GREAT,
|
||||
[MoveId.ROOST]: ModifierTier.GREAT,
|
||||
[MoveId.GRAVITY]: ModifierTier.COMMON,
|
||||
|
@ -6,7 +6,7 @@ import { loggedInUser } from "#app/account";
|
||||
import type { GameMode } from "#app/game-mode";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
import { getPokemonNameWithAffix } from "#app/messages";
|
||||
import type { ArenaTrapTag } from "#data/arena-tag";
|
||||
import type { ArenaTrapTag, PendingHealTag } from "#data/arena-tag";
|
||||
import { WeakenMoveTypeTag } from "#data/arena-tag";
|
||||
import { MoveChargeAnim } from "#data/battle-anims";
|
||||
import {
|
||||
@ -2110,24 +2110,15 @@ export class SacrificialFullRestoreAttr extends SacrificialAttr {
|
||||
return false;
|
||||
}
|
||||
|
||||
// We don't know which party member will be chosen, so pick the highest max HP in the party
|
||||
const party = user.isPlayer() ? globalScene.getPlayerParty() : globalScene.getEnemyParty();
|
||||
const maxPartyMemberHp = party.map(p => p.getMaxHp()).reduce((maxHp: number, hp: number) => Math.max(hp, maxHp), 0);
|
||||
|
||||
const pm = globalScene.phaseManager;
|
||||
|
||||
pm.pushPhase(
|
||||
pm.create("PokemonHealPhase",
|
||||
user.getBattlerIndex(),
|
||||
maxPartyMemberHp,
|
||||
i18next.t(this.moveMessage, { pokemonName: getPokemonNameWithAffix(user) }),
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
this.restorePP),
|
||||
true);
|
||||
// Add a tag to the field if it doesn't already exist, then queue a delayed healing effect in the user's current slot.
|
||||
globalScene.arena.addTag(ArenaTagType.PENDING_HEAL, 0, move.id, user.id); // Arguments after first go completely unused
|
||||
const tag = globalScene.arena.getTag(ArenaTagType.PENDING_HEAL) as PendingHealTag;
|
||||
tag.queueHeal(user.getBattlerIndex(), {
|
||||
sourceId: user.id,
|
||||
moveId: move.id,
|
||||
restorePP: this.restorePP,
|
||||
healMessage: i18next.t(this.moveMessage, { pokemonName: getPokemonNameWithAffix(user) }),
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -99,6 +99,7 @@ export const DarkDealEncounter: MysteryEncounter = MysteryEncounterBuilder.withE
|
||||
MysteryEncounterType.DARK_DEAL,
|
||||
)
|
||||
.withEncounterTier(MysteryEncounterTier.ROGUE)
|
||||
.withDisallowedChallenges(Challenges.HARDCORE)
|
||||
.withIntroSpriteConfigs([
|
||||
{
|
||||
spriteKey: "dark_deal_scientist",
|
||||
|
@ -673,6 +673,8 @@ export async function catchPokemon(
|
||||
globalScene.gameData.updateSpeciesDexIvs(pokemon.species.getRootSpeciesId(true), pokemon.ivs);
|
||||
|
||||
return new Promise(resolve => {
|
||||
const addStatus = new BooleanHolder(true);
|
||||
applyChallenges(ChallengeType.POKEMON_ADD_TO_PARTY, pokemon, addStatus);
|
||||
const doPokemonCatchMenu = () => {
|
||||
const end = () => {
|
||||
// Ensure the pokemon is in the enemy party in all situations
|
||||
@ -708,9 +710,7 @@ export async function catchPokemon(
|
||||
});
|
||||
};
|
||||
Promise.all([pokemon.hideInfo(), globalScene.gameData.setPokemonCaught(pokemon)]).then(() => {
|
||||
const addStatus = new BooleanHolder(true);
|
||||
applyChallenges(ChallengeType.POKEMON_ADD_TO_PARTY, pokemon, addStatus);
|
||||
if (!addStatus.value) {
|
||||
if (!(isObtain || addStatus.value)) {
|
||||
removePokemon();
|
||||
end();
|
||||
return;
|
||||
@ -807,10 +807,16 @@ export async function catchPokemon(
|
||||
};
|
||||
|
||||
if (showCatchObtainMessage) {
|
||||
let catchMessage: string;
|
||||
if (isObtain) {
|
||||
catchMessage = "battle:pokemonObtained";
|
||||
} else if (addStatus.value) {
|
||||
catchMessage = "battle:pokemonCaught";
|
||||
} else {
|
||||
catchMessage = "battle:pokemonCaughtButChallenge";
|
||||
}
|
||||
globalScene.ui.showText(
|
||||
i18next.t(isObtain ? "battle:pokemonObtained" : "battle:pokemonCaught", {
|
||||
pokemonName: pokemon.getNameToRender(),
|
||||
}),
|
||||
i18next.t(catchMessage, { pokemonName: pokemon.getNameToRender() }),
|
||||
null,
|
||||
doPokemonCatchMenu,
|
||||
0,
|
||||
|
@ -36,5 +36,6 @@ export enum ArenaTagType {
|
||||
WATER_FIRE_PLEDGE = "WATER_FIRE_PLEDGE",
|
||||
GRASS_WATER_PLEDGE = "GRASS_WATER_PLEDGE",
|
||||
FAIRY_LOCK = "FAIRY_LOCK",
|
||||
NEUTRALIZING_GAS = "NEUTRALIZING_GAS"
|
||||
NEUTRALIZING_GAS = "NEUTRALIZING_GAS",
|
||||
PENDING_HEAL = "PENDING_HEAL"
|
||||
}
|
||||
|
@ -229,7 +229,6 @@ export class PhaseManager {
|
||||
|
||||
/** overrides default of inserting phases to end of phaseQueuePrepend array. Useful for inserting Phases "out of order" */
|
||||
private phaseQueuePrependSpliceIndex = -1;
|
||||
private nextCommandPhaseQueue: Phase[] = [];
|
||||
|
||||
/** Storage for {@linkcode PhasePriorityQueue}s which hold phases whose order dynamically changes */
|
||||
private dynamicPhaseQueues: PhasePriorityQueue[];
|
||||
@ -285,13 +284,12 @@ export class PhaseManager {
|
||||
/**
|
||||
* Adds a phase to nextCommandPhaseQueue, as long as boolean passed in is false
|
||||
* @param phase {@linkcode Phase} the phase to add
|
||||
* @param defer boolean on which queue to add to, defaults to false, and adds to phaseQueue
|
||||
*/
|
||||
pushPhase(phase: Phase, defer = false): void {
|
||||
pushPhase(phase: Phase): void {
|
||||
if (this.getDynamicPhaseType(phase) !== undefined) {
|
||||
this.pushDynamicPhase(phase);
|
||||
} else {
|
||||
(!defer ? this.phaseQueue : this.nextCommandPhaseQueue).push(phase);
|
||||
this.phaseQueue.push(phase);
|
||||
}
|
||||
}
|
||||
|
||||
@ -318,7 +316,7 @@ export class PhaseManager {
|
||||
* Clears all phase-related stuff, including all phase queues, the current and standby phases, and a splice index
|
||||
*/
|
||||
clearAllPhases(): void {
|
||||
for (const queue of [this.phaseQueue, this.phaseQueuePrepend, this.conditionalQueue, this.nextCommandPhaseQueue]) {
|
||||
for (const queue of [this.phaseQueue, this.phaseQueuePrepend, this.conditionalQueue]) {
|
||||
queue.splice(0, queue.length);
|
||||
}
|
||||
this.dynamicPhaseQueues.forEach(queue => queue.clear());
|
||||
@ -600,10 +598,6 @@ export class PhaseManager {
|
||||
* Moves everything from nextCommandPhaseQueue to phaseQueue (keeping order)
|
||||
*/
|
||||
private populatePhaseQueue(): void {
|
||||
if (this.nextCommandPhaseQueue.length) {
|
||||
this.phaseQueue.push(...this.nextCommandPhaseQueue);
|
||||
this.nextCommandPhaseQueue.splice(0, this.nextCommandPhaseQueue.length);
|
||||
}
|
||||
this.phaseQueue.push(new TurnInitPhase());
|
||||
}
|
||||
|
||||
|
@ -253,8 +253,11 @@ export class AttemptCapturePhase extends PokemonPhase {
|
||||
|
||||
globalScene.gameData.updateSpeciesDexIvs(pokemon.species.getRootSpeciesId(true), pokemon.ivs);
|
||||
|
||||
const addStatus = new BooleanHolder(true);
|
||||
applyChallenges(ChallengeType.POKEMON_ADD_TO_PARTY, pokemon, addStatus);
|
||||
|
||||
globalScene.ui.showText(
|
||||
i18next.t("battle:pokemonCaught", {
|
||||
i18next.t(addStatus.value ? "battle:pokemonCaught" : "battle:pokemonCaughtButChallenge", {
|
||||
pokemonName: getPokemonNameWithAffix(pokemon),
|
||||
}),
|
||||
null,
|
||||
@ -290,8 +293,6 @@ export class AttemptCapturePhase extends PokemonPhase {
|
||||
});
|
||||
};
|
||||
Promise.all([pokemon.hideInfo(), globalScene.gameData.setPokemonCaught(pokemon)]).then(() => {
|
||||
const addStatus = new BooleanHolder(true);
|
||||
applyChallenges(ChallengeType.POKEMON_ADD_TO_PARTY, pokemon, addStatus);
|
||||
if (!addStatus.value) {
|
||||
removePokemon();
|
||||
end();
|
||||
|
@ -63,7 +63,8 @@ export class PokemonHealPhase extends CommonAnimPhase {
|
||||
}
|
||||
|
||||
const hasMessage = !!this.message;
|
||||
const healOrDamage = !pokemon.isFullHp() || this.hpHealed < 0;
|
||||
const canRestorePP = this.fullRestorePP && pokemon.getMoveset().some(mv => mv.ppUsed > 0);
|
||||
const healOrDamage = !pokemon.isFullHp() || this.hpHealed < 0 || canRestorePP;
|
||||
const healBlock = pokemon.getTag(BattlerTagType.HEAL_BLOCK) as HealBlockTag;
|
||||
let lastStatusEffect = StatusEffect.NONE;
|
||||
|
||||
|
@ -2,6 +2,7 @@ import { applyAbAttrs } from "#abilities/apply-ab-attrs";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
import { ArenaTrapTag } from "#data/arena-tag";
|
||||
import { MysteryEncounterPostSummonTag } from "#data/battler-tags";
|
||||
import { ArenaTagType } from "#enums/arena-tag-type";
|
||||
import { BattlerTagType } from "#enums/battler-tag-type";
|
||||
import { StatusEffect } from "#enums/status-effect";
|
||||
import { PokemonPhase } from "#phases/pokemon-phase";
|
||||
@ -16,6 +17,9 @@ export class PostSummonPhase extends PokemonPhase {
|
||||
if (pokemon.status?.effect === StatusEffect.TOXIC) {
|
||||
pokemon.status.toxicTurnCount = 0;
|
||||
}
|
||||
|
||||
globalScene.arena.applyTags(ArenaTagType.PENDING_HEAL, false, pokemon);
|
||||
|
||||
globalScene.arena.applyTags(ArenaTrapTag, false, pokemon);
|
||||
|
||||
// If this is mystery encounter and has post summon phase tag, apply post summon effects
|
||||
|
@ -16,8 +16,10 @@ export class SelectBiomePhase extends BattlePhase {
|
||||
|
||||
globalScene.resetSeed();
|
||||
|
||||
const gameMode = globalScene.gameMode;
|
||||
const currentBiome = globalScene.arena.biomeType;
|
||||
const nextWaveIndex = globalScene.currentBattle.waveIndex + 1;
|
||||
const currentWaveIndex = globalScene.currentBattle.waveIndex;
|
||||
const nextWaveIndex = currentWaveIndex + 1;
|
||||
|
||||
const setNextBiome = (nextBiome: BiomeId) => {
|
||||
if (nextWaveIndex % 10 === 1) {
|
||||
@ -26,6 +28,15 @@ export class SelectBiomePhase extends BattlePhase {
|
||||
applyChallenges(ChallengeType.PARTY_HEAL, healStatus);
|
||||
if (healStatus.value) {
|
||||
globalScene.phaseManager.unshiftNew("PartyHealPhase", false);
|
||||
} else {
|
||||
globalScene.phaseManager.unshiftNew(
|
||||
"SelectModifierPhase",
|
||||
undefined,
|
||||
undefined,
|
||||
gameMode.isFixedBattle(currentWaveIndex)
|
||||
? gameMode.getFixedBattle(currentWaveIndex).customModifierRewardSettings
|
||||
: undefined,
|
||||
);
|
||||
}
|
||||
}
|
||||
globalScene.phaseManager.unshiftNew("SwitchBiomePhase", nextBiome);
|
||||
@ -33,12 +44,12 @@ export class SelectBiomePhase extends BattlePhase {
|
||||
};
|
||||
|
||||
if (
|
||||
(globalScene.gameMode.isClassic && globalScene.gameMode.isWaveFinal(nextWaveIndex + 9)) ||
|
||||
(globalScene.gameMode.isDaily && globalScene.gameMode.isWaveFinal(nextWaveIndex)) ||
|
||||
(globalScene.gameMode.hasShortBiomes && !(nextWaveIndex % 50))
|
||||
(gameMode.isClassic && gameMode.isWaveFinal(nextWaveIndex + 9)) ||
|
||||
(gameMode.isDaily && gameMode.isWaveFinal(nextWaveIndex)) ||
|
||||
(gameMode.hasShortBiomes && !(nextWaveIndex % 50))
|
||||
) {
|
||||
setNextBiome(BiomeId.END);
|
||||
} else if (globalScene.gameMode.hasRandomBiomes) {
|
||||
} else if (gameMode.hasRandomBiomes) {
|
||||
setNextBiome(this.generateNextBiome(nextWaveIndex));
|
||||
} else if (Array.isArray(biomeLinks[currentBiome])) {
|
||||
const biomes: BiomeId[] = (biomeLinks[currentBiome] as (BiomeId | [BiomeId, number])[])
|
||||
@ -73,9 +84,6 @@ export class SelectBiomePhase extends BattlePhase {
|
||||
}
|
||||
|
||||
generateNextBiome(waveIndex: number): BiomeId {
|
||||
if (!(waveIndex % 50)) {
|
||||
return BiomeId.END;
|
||||
}
|
||||
return globalScene.generateRandomBiome(waveIndex);
|
||||
return waveIndex % 50 === 0 ? BiomeId.END : globalScene.generateRandomBiome(waveIndex);
|
||||
}
|
||||
}
|
||||
|
@ -3,13 +3,9 @@ import { globalScene } from "#app/global-scene";
|
||||
import { modifierTypes } from "#data/data-lists";
|
||||
import { BattleType } from "#enums/battle-type";
|
||||
import type { BattlerIndex } from "#enums/battler-index";
|
||||
import { ChallengeType } from "#enums/challenge-type";
|
||||
import { ClassicFixedBossWaves } from "#enums/fixed-boss-waves";
|
||||
import type { CustomModifierSettings } from "#modifiers/modifier-type";
|
||||
import { handleMysteryEncounterVictory } from "#mystery-encounters/encounter-phase-utils";
|
||||
import { PokemonPhase } from "#phases/pokemon-phase";
|
||||
import { applyChallenges } from "#utils/challenge-utils";
|
||||
import { BooleanHolder } from "#utils/common";
|
||||
|
||||
export class VictoryPhase extends PokemonPhase {
|
||||
public readonly phaseName = "VictoryPhase";
|
||||
@ -49,15 +45,19 @@ export class VictoryPhase extends PokemonPhase {
|
||||
if (globalScene.currentBattle.battleType === BattleType.TRAINER) {
|
||||
globalScene.phaseManager.pushNew("TrainerVictoryPhase");
|
||||
}
|
||||
if (globalScene.gameMode.isEndless || !globalScene.gameMode.isWaveFinal(globalScene.currentBattle.waveIndex)) {
|
||||
|
||||
const gameMode = globalScene.gameMode;
|
||||
const currentWaveIndex = globalScene.currentBattle.waveIndex;
|
||||
|
||||
if (gameMode.isEndless || !gameMode.isWaveFinal(currentWaveIndex)) {
|
||||
globalScene.phaseManager.pushNew("EggLapsePhase");
|
||||
if (globalScene.gameMode.isClassic) {
|
||||
switch (globalScene.currentBattle.waveIndex) {
|
||||
if (gameMode.isClassic) {
|
||||
switch (currentWaveIndex) {
|
||||
case ClassicFixedBossWaves.RIVAL_1:
|
||||
case ClassicFixedBossWaves.RIVAL_2:
|
||||
// Get event modifiers for this wave
|
||||
timedEventManager
|
||||
.getFixedBattleEventRewards(globalScene.currentBattle.waveIndex)
|
||||
.getFixedBattleEventRewards(currentWaveIndex)
|
||||
.map(r => globalScene.phaseManager.pushNew("ModifierRewardPhase", modifierTypes[r]));
|
||||
break;
|
||||
case ClassicFixedBossWaves.EVIL_BOSS_2:
|
||||
@ -66,59 +66,53 @@ export class VictoryPhase extends PokemonPhase {
|
||||
break;
|
||||
}
|
||||
}
|
||||
const healStatus = new BooleanHolder(globalScene.currentBattle.waveIndex % 10 === 0);
|
||||
applyChallenges(ChallengeType.PARTY_HEAL, healStatus);
|
||||
if (!healStatus.value) {
|
||||
if (currentWaveIndex % 10) {
|
||||
globalScene.phaseManager.pushNew(
|
||||
"SelectModifierPhase",
|
||||
undefined,
|
||||
undefined,
|
||||
this.getFixedBattleCustomModifiers(),
|
||||
gameMode.isFixedBattle(currentWaveIndex)
|
||||
? gameMode.getFixedBattle(currentWaveIndex).customModifierRewardSettings
|
||||
: undefined,
|
||||
);
|
||||
} else if (globalScene.gameMode.isDaily) {
|
||||
} else if (gameMode.isDaily) {
|
||||
globalScene.phaseManager.pushNew("ModifierRewardPhase", modifierTypes.EXP_CHARM);
|
||||
if (
|
||||
globalScene.currentBattle.waveIndex > 10 &&
|
||||
!globalScene.gameMode.isWaveFinal(globalScene.currentBattle.waveIndex)
|
||||
) {
|
||||
if (currentWaveIndex > 10 && !gameMode.isWaveFinal(currentWaveIndex)) {
|
||||
globalScene.phaseManager.pushNew("ModifierRewardPhase", modifierTypes.GOLDEN_POKEBALL);
|
||||
}
|
||||
} else {
|
||||
const superExpWave = !globalScene.gameMode.isEndless ? (globalScene.offsetGym ? 0 : 20) : 10;
|
||||
if (globalScene.gameMode.isEndless && globalScene.currentBattle.waveIndex === 10) {
|
||||
const superExpWave = !gameMode.isEndless ? (globalScene.offsetGym ? 0 : 20) : 10;
|
||||
if (gameMode.isEndless && currentWaveIndex === 10) {
|
||||
globalScene.phaseManager.pushNew("ModifierRewardPhase", modifierTypes.EXP_SHARE);
|
||||
}
|
||||
if (
|
||||
globalScene.currentBattle.waveIndex <= 750 &&
|
||||
(globalScene.currentBattle.waveIndex <= 500 || globalScene.currentBattle.waveIndex % 30 === superExpWave)
|
||||
) {
|
||||
if (currentWaveIndex <= 750 && (currentWaveIndex <= 500 || currentWaveIndex % 30 === superExpWave)) {
|
||||
globalScene.phaseManager.pushNew(
|
||||
"ModifierRewardPhase",
|
||||
globalScene.currentBattle.waveIndex % 30 !== superExpWave || globalScene.currentBattle.waveIndex > 250
|
||||
currentWaveIndex % 30 !== superExpWave || currentWaveIndex > 250
|
||||
? modifierTypes.EXP_CHARM
|
||||
: modifierTypes.SUPER_EXP_CHARM,
|
||||
);
|
||||
}
|
||||
if (globalScene.currentBattle.waveIndex <= 150 && !(globalScene.currentBattle.waveIndex % 50)) {
|
||||
if (currentWaveIndex <= 150 && !(currentWaveIndex % 50)) {
|
||||
globalScene.phaseManager.pushNew("ModifierRewardPhase", modifierTypes.GOLDEN_POKEBALL);
|
||||
}
|
||||
if (globalScene.gameMode.isEndless && !(globalScene.currentBattle.waveIndex % 50)) {
|
||||
if (gameMode.isEndless && !(currentWaveIndex % 50)) {
|
||||
globalScene.phaseManager.pushNew(
|
||||
"ModifierRewardPhase",
|
||||
!(globalScene.currentBattle.waveIndex % 250) ? modifierTypes.VOUCHER_PREMIUM : modifierTypes.VOUCHER_PLUS,
|
||||
!(currentWaveIndex % 250) ? modifierTypes.VOUCHER_PREMIUM : modifierTypes.VOUCHER_PLUS,
|
||||
);
|
||||
globalScene.phaseManager.pushNew("AddEnemyBuffModifierPhase");
|
||||
}
|
||||
}
|
||||
|
||||
if (globalScene.gameMode.hasRandomBiomes || globalScene.isNewBiome()) {
|
||||
if (gameMode.hasRandomBiomes || globalScene.isNewBiome()) {
|
||||
globalScene.phaseManager.pushNew("SelectBiomePhase");
|
||||
}
|
||||
|
||||
globalScene.phaseManager.pushNew("NewBattlePhase");
|
||||
} else {
|
||||
globalScene.currentBattle.battleType = BattleType.CLEAR;
|
||||
globalScene.score += globalScene.gameMode.getClearScoreBonus();
|
||||
globalScene.score += gameMode.getClearScoreBonus();
|
||||
globalScene.updateScoreText();
|
||||
globalScene.phaseManager.pushNew("GameOverPhase", true);
|
||||
}
|
||||
@ -126,18 +120,4 @@ export class VictoryPhase extends PokemonPhase {
|
||||
|
||||
this.end();
|
||||
}
|
||||
|
||||
/**
|
||||
* If this wave is a fixed battle with special custom modifier rewards,
|
||||
* will pass those settings to the upcoming {@linkcode SelectModifierPhase}`.
|
||||
*/
|
||||
getFixedBattleCustomModifiers(): CustomModifierSettings | undefined {
|
||||
const gameMode = globalScene.gameMode;
|
||||
const waveIndex = globalScene.currentBattle.waveIndex;
|
||||
if (gameMode.isFixedBattle(waveIndex)) {
|
||||
return gameMode.getFixedBattle(waveIndex).customModifierRewardSettings;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
@ -448,6 +448,8 @@ export function getAchievementDescription(localizationKey: string): string {
|
||||
return i18next.t("achv:FLIP_STATS.description", { context: genderStr });
|
||||
case "FLIP_INVERSE":
|
||||
return i18next.t("achv:FLIP_INVERSE.description", { context: genderStr });
|
||||
case "NUZLOCKE":
|
||||
return i18next.t("achv:NUZLOCKE.description", { context: genderStr });
|
||||
case "BREEDERS_IN_SPACE":
|
||||
return i18next.t("achv:BREEDERS_IN_SPACE.description", {
|
||||
context: genderStr,
|
||||
|
@ -287,6 +287,12 @@ export class ArenaFlyout extends Phaser.GameObjects.Container {
|
||||
switch (arenaEffectChangedEvent.constructor) {
|
||||
case TagAddedEvent: {
|
||||
const tagAddedEvent = arenaEffectChangedEvent as TagAddedEvent;
|
||||
|
||||
const excludedTags = [ArenaTagType.PENDING_HEAL];
|
||||
if (excludedTags.includes(tagAddedEvent.arenaTagType)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const isArenaTrapTag = globalScene.arena.getTag(tagAddedEvent.arenaTagType) instanceof ArenaTrapTag;
|
||||
let arenaEffectType: ArenaEffectType;
|
||||
|
||||
|
@ -208,6 +208,26 @@ export class PokedexMonContainer extends Phaser.GameObjects.Container {
|
||||
);
|
||||
this.checkIconId(defaultProps.female, defaultProps.formIndex, defaultProps.shiny, defaultProps.variant);
|
||||
this.add(this.icon);
|
||||
|
||||
[
|
||||
this.hiddenAbilityIcon,
|
||||
this.favoriteIcon,
|
||||
this.classicWinIcon,
|
||||
this.candyUpgradeIcon,
|
||||
this.candyUpgradeOverlayIcon,
|
||||
this.eggMove1Icon,
|
||||
this.tmMove1Icon,
|
||||
this.eggMove2Icon,
|
||||
this.tmMove2Icon,
|
||||
this.passive1Icon,
|
||||
this.passive2Icon,
|
||||
this.passive1OverlayIcon,
|
||||
this.passive2OverlayIcon,
|
||||
].forEach(icon => {
|
||||
if (icon) {
|
||||
this.bringToTop(icon);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
checkIconId(female, formIndex, shiny, variant) {
|
||||
|
@ -410,6 +410,11 @@ export class PokedexUiHandler extends MessageUiHandler {
|
||||
new DropDownLabel(i18next.t("filterBar:hasHiddenAbility"), undefined, DropDownState.ON),
|
||||
new DropDownLabel(i18next.t("filterBar:noHiddenAbility"), undefined, DropDownState.EXCLUDE),
|
||||
];
|
||||
const seenSpeciesLabels = [
|
||||
new DropDownLabel(i18next.t("filterBar:seenSpecies"), undefined, DropDownState.OFF),
|
||||
new DropDownLabel(i18next.t("filterBar:isSeen"), undefined, DropDownState.ON),
|
||||
new DropDownLabel(i18next.t("filterBar:isUnseen"), undefined, DropDownState.EXCLUDE),
|
||||
];
|
||||
const eggLabels = [
|
||||
new DropDownLabel(i18next.t("filterBar:egg"), undefined, DropDownState.OFF),
|
||||
new DropDownLabel(i18next.t("filterBar:eggPurchasable"), undefined, DropDownState.ON),
|
||||
@ -423,6 +428,7 @@ export class PokedexUiHandler extends MessageUiHandler {
|
||||
new DropDownOption("FAVORITE", favoriteLabels),
|
||||
new DropDownOption("WIN", winLabels),
|
||||
new DropDownOption("HIDDEN_ABILITY", hiddenAbilityLabels),
|
||||
new DropDownOption("SEEN_SPECIES", seenSpeciesLabels),
|
||||
new DropDownOption("EGG", eggLabels),
|
||||
new DropDownOption("POKERUS", pokerusLabels),
|
||||
];
|
||||
@ -792,13 +798,15 @@ export class PokedexUiHandler extends MessageUiHandler {
|
||||
this.starterSelectMessageBoxContainer.setVisible(!!text?.length);
|
||||
}
|
||||
|
||||
isSeen(species: PokemonSpecies, dexEntry: DexEntry): boolean {
|
||||
isSeen(species: PokemonSpecies, dexEntry: DexEntry, seenFilter?: boolean): boolean {
|
||||
if (dexEntry?.seenAttr) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const starterDexEntry = globalScene.gameData.dexData[this.getStarterSpeciesId(species.speciesId)];
|
||||
return !!starterDexEntry?.caughtAttr;
|
||||
if (!seenFilter) {
|
||||
const starterDexEntry = globalScene.gameData.dexData[this.getStarterSpeciesId(species.speciesId)];
|
||||
return !!starterDexEntry?.caughtAttr;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1617,6 +1625,21 @@ export class PokedexUiHandler extends MessageUiHandler {
|
||||
}
|
||||
});
|
||||
|
||||
// Seen Filter
|
||||
const dexEntry = globalScene.gameData.dexData[species.speciesId];
|
||||
const isItSeen = this.isSeen(species, dexEntry, true);
|
||||
const fitsSeen = this.filterBar.getVals(DropDownColumn.MISC).some(misc => {
|
||||
if (misc.val === "SEEN_SPECIES" && misc.state === DropDownState.ON) {
|
||||
return isItSeen;
|
||||
}
|
||||
if (misc.val === "SEEN_SPECIES" && misc.state === DropDownState.EXCLUDE) {
|
||||
return !isItSeen;
|
||||
}
|
||||
if (misc.val === "SEEN_SPECIES" && misc.state === DropDownState.OFF) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
// Egg Purchasable Filter
|
||||
const isEggPurchasable = this.isSameSpeciesEggAvailable(species.speciesId);
|
||||
const fitsEgg = this.filterBar.getVals(DropDownColumn.MISC).some(misc => {
|
||||
@ -1658,6 +1681,7 @@ export class PokedexUiHandler extends MessageUiHandler {
|
||||
fitsFavorite &&
|
||||
fitsWin &&
|
||||
fitsHA &&
|
||||
fitsSeen &&
|
||||
fitsEgg &&
|
||||
fitsPokerus
|
||||
) {
|
||||
|
@ -210,7 +210,8 @@ export class RunInfoUiHandler extends UiHandler {
|
||||
this.runContainer.add(headerText);
|
||||
const runName = addTextObject(0, 0, this.runInfo.name, TextStyle.WINDOW);
|
||||
runName.setOrigin(0, 0);
|
||||
runName.setPositionRelative(headerBg, 60, 4);
|
||||
const runNameX = headerText.width / 6 + headerText.x + 4;
|
||||
runName.setPositionRelative(headerBg, runNameX, 4);
|
||||
this.runContainer.add(runName);
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,10 @@
|
||||
import { AbilityId } from "#enums/ability-id";
|
||||
import { Challenges } from "#enums/challenges";
|
||||
import { MoveId } from "#enums/move-id";
|
||||
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
||||
import { PokeballType } from "#enums/pokeball";
|
||||
import { SpeciesId } from "#enums/species-id";
|
||||
import { runMysteryEncounterToEnd } from "#test/mystery-encounter/encounter-test-utils";
|
||||
import { GameManager } from "#test/test-utils/game-manager";
|
||||
import Phaser from "phaser";
|
||||
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
||||
@ -52,4 +54,18 @@ describe("Challenges - Limited Catch", () => {
|
||||
|
||||
expect(game.scene.getPlayerParty()).toHaveLength(1);
|
||||
});
|
||||
|
||||
it("should allow gift Pokémon from Mystery Encounters to be added to party", async () => {
|
||||
game.override
|
||||
.mysteryEncounterChance(100)
|
||||
.mysteryEncounter(MysteryEncounterType.THE_POKEMON_SALESMAN)
|
||||
.startingWave(12);
|
||||
game.scene.money = 20000;
|
||||
|
||||
await game.challengeMode.runToSummon([SpeciesId.NUZLEAF]);
|
||||
|
||||
await runMysteryEncounterToEnd(game, 1);
|
||||
|
||||
expect(game.scene.getPlayerParty()).toHaveLength(2);
|
||||
});
|
||||
});
|
||||
|
@ -3,6 +3,7 @@ import { Challenges } from "#enums/challenges";
|
||||
import { MoveId } from "#enums/move-id";
|
||||
import { SpeciesId } from "#enums/species-id";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import { ExpBoosterModifier } from "#modifiers/modifier";
|
||||
import { GameManager } from "#test/test-utils/game-manager";
|
||||
import { ModifierSelectUiHandler } from "#ui/modifier-select-ui-handler";
|
||||
import Phaser from "phaser";
|
||||
@ -75,6 +76,7 @@ describe("Challenges - Limited Support", () => {
|
||||
await game.doKillOpponents();
|
||||
await game.toNextWave();
|
||||
|
||||
expect(game.scene.getModifiers(ExpBoosterModifier)).toHaveLength(1);
|
||||
expect(playerPokemon).not.toHaveFullHp();
|
||||
|
||||
game.move.use(MoveId.SPLASH);
|
||||
|
245
test/moves/healing-wish-lunar-dance.test.ts
Normal file
245
test/moves/healing-wish-lunar-dance.test.ts
Normal file
@ -0,0 +1,245 @@
|
||||
import { AbilityId } from "#enums/ability-id";
|
||||
import { ArenaTagType } from "#enums/arena-tag-type";
|
||||
import { Challenges } from "#enums/challenges";
|
||||
import { MoveId } from "#enums/move-id";
|
||||
import { MoveResult } from "#enums/move-result";
|
||||
import { PokemonType } from "#enums/pokemon-type";
|
||||
import { SpeciesId } from "#enums/species-id";
|
||||
import { StatusEffect } from "#enums/status-effect";
|
||||
import { GameManager } from "#test/test-utils/game-manager";
|
||||
import Phaser from "phaser";
|
||||
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
||||
|
||||
describe("Moves - Lunar Dance and Healing Wish", () => {
|
||||
let phaserGame: Phaser.Game;
|
||||
let game: GameManager;
|
||||
|
||||
beforeAll(() => {
|
||||
phaserGame = new Phaser.Game({
|
||||
type: Phaser.HEADLESS,
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
game.phaseInterceptor.restoreOg();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
game = new GameManager(phaserGame);
|
||||
game.override.battleStyle("double").enemyAbility(AbilityId.BALL_FETCH).enemyMoveset(MoveId.SPLASH);
|
||||
});
|
||||
|
||||
describe.each([
|
||||
{ moveName: "Healing Wish", moveId: MoveId.HEALING_WISH },
|
||||
{ moveName: "Lunar Dance", moveId: MoveId.LUNAR_DANCE },
|
||||
])("$moveName", ({ moveId }) => {
|
||||
it("should sacrifice the user to restore the switched in Pokemon's HP", async () => {
|
||||
await game.classicMode.startBattle([SpeciesId.BULBASAUR, SpeciesId.CHARMANDER, SpeciesId.SQUIRTLE]);
|
||||
|
||||
const [bulbasaur, charmander, squirtle] = game.scene.getPlayerParty();
|
||||
squirtle.hp = 1;
|
||||
|
||||
game.move.use(MoveId.SPLASH, 0);
|
||||
game.move.use(moveId, 1);
|
||||
game.doSelectPartyPokemon(2);
|
||||
|
||||
await game.toNextTurn();
|
||||
|
||||
expect(bulbasaur.isFullHp()).toBe(true);
|
||||
expect(charmander.isFainted()).toBe(true);
|
||||
expect(squirtle.isFullHp()).toBe(true);
|
||||
});
|
||||
|
||||
it("should sacrifice the user to cure the switched in Pokemon's status", async () => {
|
||||
game.override.statusEffect(StatusEffect.BURN);
|
||||
|
||||
await game.classicMode.startBattle([SpeciesId.BULBASAUR, SpeciesId.CHARMANDER, SpeciesId.SQUIRTLE]);
|
||||
const [bulbasaur, charmander, squirtle] = game.scene.getPlayerParty();
|
||||
|
||||
game.move.use(MoveId.SPLASH, 0);
|
||||
game.move.use(moveId, 1);
|
||||
game.doSelectPartyPokemon(2);
|
||||
|
||||
await game.toNextTurn();
|
||||
|
||||
expect(bulbasaur.status?.effect).toBe(StatusEffect.BURN);
|
||||
expect(charmander.isFainted()).toBe(true);
|
||||
expect(squirtle.status?.effect).toBeUndefined();
|
||||
});
|
||||
|
||||
it("should fail if the user has no non-fainted allies in their party", async () => {
|
||||
game.override.battleStyle("single");
|
||||
|
||||
await game.classicMode.startBattle([SpeciesId.BULBASAUR, SpeciesId.CHARMANDER]);
|
||||
const [bulbasaur, charmander] = game.scene.getPlayerParty();
|
||||
|
||||
game.move.use(MoveId.MEMENTO);
|
||||
game.doSelectPartyPokemon(1);
|
||||
|
||||
await game.toNextTurn();
|
||||
|
||||
expect(bulbasaur.isFainted()).toBe(true);
|
||||
expect(charmander.isActive(true)).toBe(true);
|
||||
|
||||
game.move.use(moveId);
|
||||
|
||||
await game.toEndOfTurn();
|
||||
|
||||
expect(charmander.isFullHp());
|
||||
expect(charmander.getLastXMoves()[0].result).toBe(MoveResult.FAIL);
|
||||
});
|
||||
|
||||
it("should fail if the user has no challenge-eligible allies", async () => {
|
||||
game.override.battleStyle("single");
|
||||
// Mono normal challenge
|
||||
game.challengeMode.addChallenge(Challenges.SINGLE_TYPE, PokemonType.NORMAL + 1, 0);
|
||||
await game.challengeMode.startBattle([SpeciesId.RATICATE, SpeciesId.ODDISH]);
|
||||
|
||||
const raticate = game.field.getPlayerPokemon();
|
||||
|
||||
game.move.use(moveId);
|
||||
await game.toNextTurn();
|
||||
|
||||
expect(raticate.isFullHp()).toBe(true);
|
||||
expect(raticate.getLastXMoves()[0].result).toEqual(MoveResult.FAIL);
|
||||
});
|
||||
|
||||
it("should store its effect if the switched-in Pokemon would be unaffected", async () => {
|
||||
game.override.battleStyle("single");
|
||||
|
||||
await game.classicMode.startBattle([SpeciesId.BULBASAUR, SpeciesId.CHARMANDER, SpeciesId.SQUIRTLE]);
|
||||
|
||||
const [bulbasaur, charmander, squirtle] = game.scene.getPlayerParty();
|
||||
squirtle.hp = 1;
|
||||
|
||||
game.move.use(moveId);
|
||||
game.doSelectPartyPokemon(1);
|
||||
|
||||
await game.toNextTurn();
|
||||
|
||||
// Bulbasaur fainted and stored a healing effect
|
||||
expect(bulbasaur.isFainted()).toBe(true);
|
||||
expect(charmander.isFullHp()).toBe(true);
|
||||
expect(game.phaseInterceptor.log).not.toContain("PokemonHealPhase");
|
||||
expect(game.scene.arena.getTag(ArenaTagType.PENDING_HEAL)).toBeDefined();
|
||||
|
||||
await game.toNextTurn();
|
||||
|
||||
// Switch to damaged Squirtle. HW/LD's effect should activate
|
||||
|
||||
await game.toEndOfTurn();
|
||||
expect(squirtle.isFullHp()).toBe(true);
|
||||
expect(game.scene.arena.getTag(ArenaTagType.PENDING_HEAL)).toBeUndefined();
|
||||
|
||||
// Set Charmander's HP to 1, then switch back to Charmander.
|
||||
// HW/LD shouldn't activate again
|
||||
charmander.hp = 1;
|
||||
game.doSwitchPokemon(2);
|
||||
|
||||
await game.toEndOfTurn();
|
||||
expect(charmander.hp).toBe(1);
|
||||
});
|
||||
|
||||
it("should only store one charge of the effect at a time", async () => {
|
||||
game.override.battleStyle("single");
|
||||
|
||||
await game.classicMode.startBattle([
|
||||
SpeciesId.BULBASAUR,
|
||||
SpeciesId.CHARMANDER,
|
||||
SpeciesId.SQUIRTLE,
|
||||
SpeciesId.PIKACHU,
|
||||
]);
|
||||
|
||||
const [bulbasaur, charmander, squirtle, pikachu] = game.scene.getPlayerParty();
|
||||
[squirtle, pikachu].forEach(p => (p.hp = 1));
|
||||
|
||||
// Use HW/LD and send in Charmander. HW/LD's effect should be stored
|
||||
game.move.use(moveId);
|
||||
game.doSelectPartyPokemon(1);
|
||||
|
||||
await game.toNextTurn();
|
||||
expect(bulbasaur.isFainted()).toBe(true);
|
||||
expect(charmander.isFullHp()).toBe(true);
|
||||
expect(charmander.isFullHp());
|
||||
expect(game.phaseInterceptor.log).not.toContain("PokemonHealPhase");
|
||||
expect(game.scene.arena.getTag(ArenaTagType.PENDING_HEAL)).toBeDefined();
|
||||
|
||||
// Use HW/LD again, sending in Squirtle. HW/LD should activate and heal Squirtle
|
||||
game.move.use(moveId);
|
||||
game.doSelectPartyPokemon(2);
|
||||
|
||||
expect(charmander.isFainted()).toBe(true);
|
||||
expect(squirtle.isFullHp()).toBe(true);
|
||||
expect(squirtle.isFullHp());
|
||||
|
||||
// Switch again to Pikachu. HW/LD's effect shouldn't be present
|
||||
game.doSwitchPokemon(3);
|
||||
|
||||
expect(pikachu.isFullHp()).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
it("Lunar Dance should sacrifice the user to restore the switched in Pokemon's PP", async () => {
|
||||
game.override.battleStyle("single");
|
||||
|
||||
await game.classicMode.startBattle([SpeciesId.BULBASAUR, SpeciesId.CHARMANDER]);
|
||||
|
||||
const [bulbasaur, charmander] = game.scene.getPlayerParty();
|
||||
|
||||
game.move.use(MoveId.SPLASH);
|
||||
await game.toNextTurn();
|
||||
|
||||
game.doSwitchPokemon(1);
|
||||
await game.toNextTurn();
|
||||
|
||||
game.move.use(MoveId.LUNAR_DANCE);
|
||||
game.doSelectPartyPokemon(1);
|
||||
|
||||
await game.toNextTurn();
|
||||
expect(charmander.isFainted()).toBeTruthy();
|
||||
bulbasaur.getMoveset().forEach(mv => expect(mv.ppUsed).toBe(0));
|
||||
});
|
||||
|
||||
it("should stack with each other", async () => {
|
||||
game.override.battleStyle("single");
|
||||
|
||||
await game.classicMode.startBattle([
|
||||
SpeciesId.BULBASAUR,
|
||||
SpeciesId.CHARMANDER,
|
||||
SpeciesId.SQUIRTLE,
|
||||
SpeciesId.PIKACHU,
|
||||
]);
|
||||
|
||||
const [bulbasaur, charmander, squirtle, pikachu] = game.scene.getPlayerParty();
|
||||
[squirtle, pikachu].forEach(p => {
|
||||
p.hp = 1;
|
||||
p.getMoveset().forEach(mv => (mv.ppUsed = 1));
|
||||
});
|
||||
|
||||
game.move.use(MoveId.LUNAR_DANCE);
|
||||
game.doSelectPartyPokemon(1);
|
||||
|
||||
await game.toNextTurn();
|
||||
expect(bulbasaur.isFainted()).toBe(true);
|
||||
expect(charmander.isFullHp()).toBe(true);
|
||||
expect(game.phaseInterceptor.log).not.toContain("PokemonHealPhase");
|
||||
expect(game.scene.arena.getTag(ArenaTagType.PENDING_HEAL)).toBeDefined();
|
||||
|
||||
game.move.use(MoveId.HEALING_WISH);
|
||||
game.doSelectPartyPokemon(2);
|
||||
|
||||
// Lunar Dance should apply first since it was used first, restoring Squirtle's HP and PP
|
||||
await game.toNextTurn();
|
||||
expect(squirtle.isFullHp()).toBe(true);
|
||||
squirtle.getMoveset().forEach(mv => expect(mv.ppUsed).toBe(0));
|
||||
expect(game.scene.arena.getTag(ArenaTagType.PENDING_HEAL)).toBeDefined();
|
||||
|
||||
game.doSwitchPokemon(3);
|
||||
|
||||
// Healing Wish should apply on the next switch, restoring Pikachu's HP
|
||||
await game.toEndOfTurn();
|
||||
expect(pikachu.isFullHp()).toBe(true);
|
||||
pikachu.getMoveset().forEach(mv => expect(mv.ppUsed).toBe(1));
|
||||
expect(game.scene.arena.getTag(ArenaTagType.PENDING_HEAL)).toBeUndefined();
|
||||
});
|
||||
});
|
@ -1,73 +0,0 @@
|
||||
import { AbilityId } from "#enums/ability-id";
|
||||
import { MoveId } from "#enums/move-id";
|
||||
import { SpeciesId } from "#enums/species-id";
|
||||
import { StatusEffect } from "#enums/status-effect";
|
||||
import { GameManager } from "#test/test-utils/game-manager";
|
||||
import Phaser from "phaser";
|
||||
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
||||
|
||||
describe("Moves - Lunar Dance", () => {
|
||||
let phaserGame: Phaser.Game;
|
||||
let game: GameManager;
|
||||
|
||||
beforeAll(() => {
|
||||
phaserGame = new Phaser.Game({
|
||||
type: Phaser.HEADLESS,
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
game.phaseInterceptor.restoreOg();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
game = new GameManager(phaserGame);
|
||||
game.override
|
||||
.statusEffect(StatusEffect.BURN)
|
||||
.battleStyle("double")
|
||||
.enemyAbility(AbilityId.BALL_FETCH)
|
||||
.enemyMoveset(MoveId.SPLASH);
|
||||
});
|
||||
|
||||
it("should full restore HP, PP and status of switched in pokemon, then fail second use because no remaining backup pokemon in party", async () => {
|
||||
await game.classicMode.startBattle([SpeciesId.BULBASAUR, SpeciesId.ODDISH, SpeciesId.RATTATA]);
|
||||
|
||||
const [bulbasaur, oddish, rattata] = game.scene.getPlayerParty();
|
||||
game.move.changeMoveset(bulbasaur, [MoveId.LUNAR_DANCE, MoveId.SPLASH]);
|
||||
game.move.changeMoveset(oddish, [MoveId.LUNAR_DANCE, MoveId.SPLASH]);
|
||||
game.move.changeMoveset(rattata, [MoveId.LUNAR_DANCE, MoveId.SPLASH]);
|
||||
|
||||
game.move.select(MoveId.SPLASH, 0);
|
||||
game.move.select(MoveId.SPLASH, 1);
|
||||
await game.toNextTurn();
|
||||
|
||||
// Bulbasaur should still be burned and have used a PP for splash and not at max hp
|
||||
expect(bulbasaur.status?.effect).toBe(StatusEffect.BURN);
|
||||
expect(bulbasaur.moveset[1]?.ppUsed).toBe(1);
|
||||
expect(bulbasaur.hp).toBeLessThan(bulbasaur.getMaxHp());
|
||||
|
||||
// Switch out Bulbasaur for Rattata so we can swtich bulbasaur back in with lunar dance
|
||||
game.doSwitchPokemon(2);
|
||||
game.move.select(MoveId.SPLASH, 1);
|
||||
await game.toNextTurn();
|
||||
|
||||
game.move.select(MoveId.SPLASH, 0);
|
||||
game.move.select(MoveId.LUNAR_DANCE);
|
||||
game.doSelectPartyPokemon(2);
|
||||
await game.phaseInterceptor.to("SwitchPhase", false);
|
||||
await game.toNextTurn();
|
||||
|
||||
// Bulbasaur should NOT have any status and have full PP for splash and be at max hp
|
||||
expect(bulbasaur.status?.effect).toBeUndefined();
|
||||
expect(bulbasaur.moveset[1]?.ppUsed).toBe(0);
|
||||
expect(bulbasaur.isFullHp()).toBe(true);
|
||||
|
||||
game.move.select(MoveId.SPLASH, 0);
|
||||
game.move.select(MoveId.LUNAR_DANCE);
|
||||
await game.toNextTurn();
|
||||
|
||||
// Using Lunar dance again should fail because nothing in party and rattata should be alive
|
||||
expect(rattata.status?.effect).toBe(StatusEffect.BURN);
|
||||
expect(rattata.hp).toBeLessThan(rattata.getMaxHp());
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue
Block a user