mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-09 08:59:29 +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 {
|
export class CritBoostTag extends SerializableBattlerTag {
|
||||||
public declare readonly tagType: CritStageBoostTagType;
|
public declare readonly tagType: CritStageBoostTagType;
|
||||||
/** The number of stages boosted by this tag */
|
/** The number of stages boosted by this tag */
|
||||||
#critStages: number;
|
public readonly critStages: number;
|
||||||
/** The number of stages boosted by this tag */
|
|
||||||
public get critStages(): number {
|
constructor(tagType: CritStageBoostTagType, sourceMove: MoveId) {
|
||||||
return this.#critStages;
|
|
||||||
}
|
|
||||||
constructor(tagType: CritStageBoostTagType, sourceMove: MoveId, stages = 1) {
|
|
||||||
super(tagType, BattlerTagLapseType.TURN_END, 1, sourceMove, undefined, true);
|
super(tagType, BattlerTagLapseType.TURN_END, 1, sourceMove, undefined, true);
|
||||||
this.#critStages = stages;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onAdd(pokemon: Pokemon): void {
|
onAdd(pokemon: Pokemon): void {
|
||||||
super.onAdd(pokemon);
|
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(
|
globalScene.phaseManager.queueMessage(
|
||||||
i18next.t("battlerTags:critBoostOnAdd", {
|
i18next.t("battlerTags:critBoostOnAdd", {
|
||||||
pokemonNameWithAffix: getPokemonNameWithAffix(pokemon),
|
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 {
|
export class SaltCuredTag extends SerializableBattlerTag {
|
||||||
@ -3734,9 +3744,8 @@ export function getBattlerTag(
|
|||||||
case BattlerTagType.FIRE_BOOST:
|
case BattlerTagType.FIRE_BOOST:
|
||||||
return new TypeBoostTag(tagType, sourceMove, PokemonType.FIRE, 1.5, false);
|
return new TypeBoostTag(tagType, sourceMove, PokemonType.FIRE, 1.5, false);
|
||||||
case BattlerTagType.CRIT_BOOST:
|
case BattlerTagType.CRIT_BOOST:
|
||||||
return new CritBoostTag(tagType, sourceMove);
|
|
||||||
case BattlerTagType.DRAGON_CHEER:
|
case BattlerTagType.DRAGON_CHEER:
|
||||||
return new CritBoostTag(tagType, sourceMove, 2);
|
return new CritBoostTag(tagType, sourceMove);
|
||||||
case BattlerTagType.ALWAYS_CRIT:
|
case BattlerTagType.ALWAYS_CRIT:
|
||||||
case BattlerTagType.IGNORE_ACCURACY:
|
case BattlerTagType.IGNORE_ACCURACY:
|
||||||
return new SerializableBattlerTag(tagType, BattlerTagLapseType.TURN_END, 2, sourceMove);
|
return new SerializableBattlerTag(tagType, BattlerTagLapseType.TURN_END, 2, sourceMove);
|
||||||
|
@ -25,7 +25,6 @@ import {
|
|||||||
AutotomizedTag,
|
AutotomizedTag,
|
||||||
BattlerTag,
|
BattlerTag,
|
||||||
CritBoostTag,
|
CritBoostTag,
|
||||||
DragonCheerTag,
|
|
||||||
EncoreTag,
|
EncoreTag,
|
||||||
ExposedTag,
|
ExposedTag,
|
||||||
GroundedTag,
|
GroundedTag,
|
||||||
@ -1390,8 +1389,7 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
const critBoostTag = source.getTag(CritBoostTag);
|
const critBoostTag = source.getTag(CritBoostTag);
|
||||||
if (critBoostTag) {
|
if (critBoostTag) {
|
||||||
// Dragon cheer only gives +1 crit stage to non-dragon types
|
// Dragon cheer only gives +1 crit stage to non-dragon types
|
||||||
critStage.value +=
|
critStage.value += critBoostTag.critStages;
|
||||||
critBoostTag instanceof DragonCheerTag && !critBoostTag.typesOnAdd.includes(PokemonType.DRAGON) ? 1 : 2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(`crit stage: +${critStage.value}`);
|
console.log(`crit stage: +${critStage.value}`);
|
||||||
|
Loading…
Reference in New Issue
Block a user