mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-09 00:49:27 +02:00
Fix issues with dragon cheer
This commit is contained in:
parent
69430d3536
commit
3b917f954b
@ -2320,19 +2320,22 @@ export class TypeBoostTag extends SerializableBattlerTag {
|
||||
export class CritBoostTag extends SerializableBattlerTag {
|
||||
public declare readonly tagType: CritStageBoostTagType;
|
||||
/** The number of stages boosted by this tag */
|
||||
#critStages: number;
|
||||
/** The number of stages boosted by this tag */
|
||||
public get critStages(): number {
|
||||
return this.#critStages;
|
||||
}
|
||||
constructor(tagType: CritStageBoostTagType, sourceMove: MoveId, stages = 1) {
|
||||
public readonly critStages: number;
|
||||
|
||||
constructor(tagType: CritStageBoostTagType, sourceMove: MoveId) {
|
||||
super(tagType, BattlerTagLapseType.TURN_END, 1, sourceMove, undefined, true);
|
||||
this.#critStages = stages;
|
||||
}
|
||||
|
||||
onAdd(pokemon: Pokemon): void {
|
||||
super.onAdd(pokemon);
|
||||
|
||||
// Dragon cheer adds +2 crit stages if the pokemon is a Dragon type when the tag is added
|
||||
if (this.tagType === BattlerTagType.DRAGON_CHEER && pokemon.getTypes(true).includes(PokemonType.DRAGON)) {
|
||||
(this as Mutable<this>).critStages = 2;
|
||||
} else {
|
||||
(this as Mutable<this>).critStages = 1;
|
||||
}
|
||||
|
||||
globalScene.phaseManager.queueMessage(
|
||||
i18next.t("battlerTags:critBoostOnAdd", {
|
||||
pokemonNameWithAffix: getPokemonNameWithAffix(pokemon),
|
||||
@ -2353,6 +2356,13 @@ export class CritBoostTag extends SerializableBattlerTag {
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
public override loadTag(source: BaseBattlerTag & Pick<CritBoostTag, "tagType" | "critStages">): void {
|
||||
super.loadTag(source);
|
||||
// TODO: Remove the nullish coalescing once Zod Schemas come in
|
||||
// For now, this is kept for backwards compatibility with older save files
|
||||
(this as Mutable<this>).critStages = source.critStages ?? 1;
|
||||
}
|
||||
}
|
||||
|
||||
export class SaltCuredTag extends SerializableBattlerTag {
|
||||
@ -3734,9 +3744,8 @@ export function getBattlerTag(
|
||||
case BattlerTagType.FIRE_BOOST:
|
||||
return new TypeBoostTag(tagType, sourceMove, PokemonType.FIRE, 1.5, false);
|
||||
case BattlerTagType.CRIT_BOOST:
|
||||
return new CritBoostTag(tagType, sourceMove);
|
||||
case BattlerTagType.DRAGON_CHEER:
|
||||
return new CritBoostTag(tagType, sourceMove, 2);
|
||||
return new CritBoostTag(tagType, sourceMove);
|
||||
case BattlerTagType.ALWAYS_CRIT:
|
||||
case BattlerTagType.IGNORE_ACCURACY:
|
||||
return new SerializableBattlerTag(tagType, BattlerTagLapseType.TURN_END, 2, sourceMove);
|
||||
|
@ -25,7 +25,6 @@ import {
|
||||
AutotomizedTag,
|
||||
BattlerTag,
|
||||
CritBoostTag,
|
||||
DragonCheerTag,
|
||||
EncoreTag,
|
||||
ExposedTag,
|
||||
GroundedTag,
|
||||
@ -1390,8 +1389,7 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
const critBoostTag = source.getTag(CritBoostTag);
|
||||
if (critBoostTag) {
|
||||
// Dragon cheer only gives +1 crit stage to non-dragon types
|
||||
critStage.value +=
|
||||
critBoostTag instanceof DragonCheerTag && !critBoostTag.typesOnAdd.includes(PokemonType.DRAGON) ? 1 : 2;
|
||||
critStage.value += critBoostTag.critStages;
|
||||
}
|
||||
|
||||
console.log(`crit stage: +${critStage.value}`);
|
||||
|
Loading…
Reference in New Issue
Block a user