mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-08 08:29:37 +02:00
Merge branch 'beta' into clean-up-move-info-overlay
This commit is contained in:
commit
dcd1ca3a54
119
src/@types/battler-tags.ts
Normal file
119
src/@types/battler-tags.ts
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
// biome-ignore-start lint/correctness/noUnusedImports: Used in a TSDoc comment
|
||||||
|
import type { AbilityBattlerTag, BattlerTagTypeMap, SerializableBattlerTag, TypeBoostTag } from "#data/battler-tags";
|
||||||
|
import type { AbilityId } from "#enums/ability-id";
|
||||||
|
// biome-ignore-end lint/correctness/noUnusedImports: end
|
||||||
|
import type { BattlerTagType } from "#enums/battler-tag-type";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Subset of {@linkcode BattlerTagType}s that restrict the use of moves.
|
||||||
|
*/
|
||||||
|
export type MoveRestrictionBattlerTagType =
|
||||||
|
| BattlerTagType.THROAT_CHOPPED
|
||||||
|
| BattlerTagType.TORMENT
|
||||||
|
| BattlerTagType.TAUNT
|
||||||
|
| BattlerTagType.IMPRISON
|
||||||
|
| BattlerTagType.HEAL_BLOCK
|
||||||
|
| BattlerTagType.ENCORE
|
||||||
|
| BattlerTagType.DISABLED
|
||||||
|
| BattlerTagType.GORILLA_TACTICS;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Subset of {@linkcode BattlerTagType}s that block damage from moves.
|
||||||
|
*/
|
||||||
|
export type FormBlockDamageBattlerTagType = BattlerTagType.ICE_FACE | BattlerTagType.DISGUISE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Subset of {@linkcode BattlerTagType}s that are related to trapping effects.
|
||||||
|
*/
|
||||||
|
export type TrappingBattlerTagType =
|
||||||
|
| BattlerTagType.BIND
|
||||||
|
| BattlerTagType.WRAP
|
||||||
|
| BattlerTagType.FIRE_SPIN
|
||||||
|
| BattlerTagType.WHIRLPOOL
|
||||||
|
| BattlerTagType.CLAMP
|
||||||
|
| BattlerTagType.SAND_TOMB
|
||||||
|
| BattlerTagType.MAGMA_STORM
|
||||||
|
| BattlerTagType.SNAP_TRAP
|
||||||
|
| BattlerTagType.THUNDER_CAGE
|
||||||
|
| BattlerTagType.INFESTATION
|
||||||
|
| BattlerTagType.INGRAIN
|
||||||
|
| BattlerTagType.OCTOLOCK
|
||||||
|
| BattlerTagType.NO_RETREAT;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Subset of {@linkcode BattlerTagType}s that are related to protection effects.
|
||||||
|
*/
|
||||||
|
export type ProtectionBattlerTagType = BattlerTagType.PROTECTED | BattlerTagType.SPIKY_SHIELD | DamageProtectedTagType;
|
||||||
|
/**
|
||||||
|
* Subset of {@linkcode BattlerTagType}s related to protection effects that block damage but not status moves.
|
||||||
|
*/
|
||||||
|
export type DamageProtectedTagType = ContactSetStatusProtectedTagType | ContactStatStageChangeProtectedTagType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Subset of {@linkcode BattlerTagType}s related to protection effects that set a status effect on the attacker.
|
||||||
|
*/
|
||||||
|
export type ContactSetStatusProtectedTagType = BattlerTagType.BANEFUL_BUNKER | BattlerTagType.BURNING_BULWARK;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Subset of {@linkcode BattlerTagType}s related to protection effects that change stat stages of the attacker.
|
||||||
|
*/
|
||||||
|
export type ContactStatStageChangeProtectedTagType =
|
||||||
|
| BattlerTagType.KINGS_SHIELD
|
||||||
|
| BattlerTagType.SILK_TRAP
|
||||||
|
| BattlerTagType.OBSTRUCT;
|
||||||
|
|
||||||
|
/** Subset of {@linkcode BattlerTagType}s that provide the Endure effect */
|
||||||
|
export type EndureTagType = BattlerTagType.ENDURE_TOKEN | BattlerTagType.ENDURING;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Subset of {@linkcode BattlerTagType}s that are related to semi-invulnerable states.
|
||||||
|
*/
|
||||||
|
export type SemiInvulnerableTagType =
|
||||||
|
| BattlerTagType.FLYING
|
||||||
|
| BattlerTagType.UNDERGROUND
|
||||||
|
| BattlerTagType.UNDERWATER
|
||||||
|
| BattlerTagType.HIDDEN;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Subset of {@linkcode BattlerTagType}s corresponding to {@linkcode AbilityBattlerTag}s
|
||||||
|
*
|
||||||
|
* @remarks
|
||||||
|
* ⚠️ {@linkcode AbilityId.FLASH_FIRE | Flash Fire}'s {@linkcode BattlerTagType.FIRE_BOOST} is not included as it
|
||||||
|
* subclasses {@linkcode TypeBoostTag} and not `AbilityBattlerTag`.
|
||||||
|
*/
|
||||||
|
export type AbilityBattlerTagType =
|
||||||
|
| BattlerTagType.PROTOSYNTHESIS
|
||||||
|
| BattlerTagType.QUARK_DRIVE
|
||||||
|
| BattlerTagType.UNBURDEN
|
||||||
|
| BattlerTagType.SLOW_START
|
||||||
|
| BattlerTagType.TRUANT;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Subset of {@linkcode BattlerTagType}s related to abilities that boost the highest stat.
|
||||||
|
*/
|
||||||
|
export type HighestStatBoostTagType =
|
||||||
|
| BattlerTagType.QUARK_DRIVE // formatting
|
||||||
|
| BattlerTagType.PROTOSYNTHESIS;
|
||||||
|
/**
|
||||||
|
* Subset of {@linkcode BattlerTagType}s that are able to persist between turns and should therefore be serialized
|
||||||
|
*/
|
||||||
|
export type SerializableBattlerTagType = keyof {
|
||||||
|
[K in keyof BattlerTagTypeMap as BattlerTagTypeMap[K] extends SerializableBattlerTag
|
||||||
|
? K
|
||||||
|
: never]: BattlerTagTypeMap[K];
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Subset of {@linkcode BattlerTagType}s that are not able to persist across waves and should therefore not be serialized
|
||||||
|
*/
|
||||||
|
export type NonSerializableBattlerTagType = Exclude<BattlerTagType, SerializableBattlerTagType>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dummy, typescript-only declaration to ensure that
|
||||||
|
* {@linkcode BattlerTagTypeMap} has an entry for all `BattlerTagType`s.
|
||||||
|
*
|
||||||
|
* If a battler tag is missing from the map, Typescript will throw an error on this statement.
|
||||||
|
*
|
||||||
|
* ⚠️ Does not actually exist at runtime, so it must not be used!
|
||||||
|
*/
|
||||||
|
declare const EnsureAllBattlerTagTypesAreMapped: BattlerTagTypeMap[BattlerTagType] & never;
|
File diff suppressed because it is too large
Load Diff
@ -10800,7 +10800,7 @@ export function initMoves() {
|
|||||||
new SelfStatusMove(MoveId.NO_RETREAT, PokemonType.FIGHTING, -1, 5, -1, 0, 8)
|
new SelfStatusMove(MoveId.NO_RETREAT, PokemonType.FIGHTING, -1, 5, -1, 0, 8)
|
||||||
.attr(StatStageChangeAttr, [ Stat.ATK, Stat.DEF, Stat.SPATK, Stat.SPDEF, Stat.SPD ], 1, true)
|
.attr(StatStageChangeAttr, [ Stat.ATK, Stat.DEF, Stat.SPATK, Stat.SPDEF, Stat.SPD ], 1, true)
|
||||||
.attr(AddBattlerTagAttr, BattlerTagType.NO_RETREAT, true, false)
|
.attr(AddBattlerTagAttr, BattlerTagType.NO_RETREAT, true, false)
|
||||||
.condition((user, target, move) => user.getTag(TrappedTag)?.sourceMove !== MoveId.NO_RETREAT), // fails if the user is currently trapped by No Retreat
|
.condition((user, target, move) => user.getTag(TrappedTag)?.tagType !== BattlerTagType.NO_RETREAT), // fails if the user is currently trapped by No Retreat
|
||||||
new StatusMove(MoveId.TAR_SHOT, PokemonType.ROCK, 100, 15, -1, 0, 8)
|
new StatusMove(MoveId.TAR_SHOT, PokemonType.ROCK, 100, 15, -1, 0, 8)
|
||||||
.attr(StatStageChangeAttr, [ Stat.SPD ], -1)
|
.attr(StatStageChangeAttr, [ Stat.SPD ], -1)
|
||||||
.attr(AddBattlerTagAttr, BattlerTagType.TAR_SHOT, false)
|
.attr(AddBattlerTagAttr, BattlerTagType.TAR_SHOT, false)
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { type BattlerTag, loadBattlerTag } from "#data/battler-tags";
|
import type { BattlerTag } from "#data/battler-tags";
|
||||||
|
import { loadBattlerTag, SerializableBattlerTag } from "#data/battler-tags";
|
||||||
import { allSpecies } from "#data/data-lists";
|
import { allSpecies } from "#data/data-lists";
|
||||||
import type { Gender } from "#data/gender";
|
import type { Gender } from "#data/gender";
|
||||||
import { PokemonMove } from "#data/moves/pokemon-move";
|
import { PokemonMove } from "#data/moves/pokemon-move";
|
||||||
@ -187,9 +188,11 @@ export class PokemonSummonData {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (key === "tags") {
|
if (key === "tags" && Array.isArray(value)) {
|
||||||
// load battler tags
|
// load battler tags, discarding any that are not serializable
|
||||||
this.tags = value.map((t: BattlerTag) => loadBattlerTag(t));
|
this.tags = value
|
||||||
|
.map((t: SerializableBattlerTag) => loadBattlerTag(t))
|
||||||
|
.filter((t): t is SerializableBattlerTag => t instanceof SerializableBattlerTag);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
this[key] = value;
|
this[key] = value;
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
export enum BattlerTagType {
|
export enum BattlerTagType {
|
||||||
NONE = "NONE",
|
|
||||||
RECHARGING = "RECHARGING",
|
RECHARGING = "RECHARGING",
|
||||||
FLINCHED = "FLINCHED",
|
FLINCHED = "FLINCHED",
|
||||||
INTERRUPTED = "INTERRUPTED",
|
INTERRUPTED = "INTERRUPTED",
|
||||||
|
Loading…
Reference in New Issue
Block a user