This commit is contained in:
Sirz Benjie 2025-08-05 00:57:37 -05:00 committed by GitHub
commit 7d0645f33a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2115,8 +2115,8 @@ export class SlowStartTag extends AbilityBattlerTag {
export class HighestStatBoostTag extends AbilityBattlerTag { export class HighestStatBoostTag extends AbilityBattlerTag {
public declare readonly tagType: HighestStatBoostTagType; public declare readonly tagType: HighestStatBoostTagType;
public stat: Stat; public stat: EffectiveStat = Stat.ATK;
public multiplier: number; public multiplier = 1.3;
constructor(tagType: HighestStatBoostTagType, ability: AbilityId) { constructor(tagType: HighestStatBoostTagType, ability: AbilityId) {
super(tagType, ability, BattlerTagLapseType.CUSTOM, 1); super(tagType, ability, BattlerTagLapseType.CUSTOM, 1);
@ -2128,28 +2128,28 @@ export class HighestStatBoostTag extends AbilityBattlerTag {
*/ */
public override loadTag<T extends this>(source: BaseBattlerTag & Pick<T, "tagType" | "stat" | "multiplier">): void { public override loadTag<T extends this>(source: BaseBattlerTag & Pick<T, "tagType" | "stat" | "multiplier">): void {
super.loadTag(source); super.loadTag(source);
this.stat = source.stat as Stat; this.stat = source.stat;
this.multiplier = source.multiplier; this.multiplier = source.multiplier;
} }
onAdd(pokemon: Pokemon): void { onAdd(pokemon: Pokemon): void {
super.onAdd(pokemon); super.onAdd(pokemon);
let highestStat: EffectiveStat; const highestStat = EFFECTIVE_STATS.reduce(
EFFECTIVE_STATS.map(s => (curr: [EffectiveStat, number], stat: EffectiveStat) => {
pokemon.getEffectiveStat(s, undefined, undefined, undefined, undefined, undefined, undefined, undefined, true), const value = pokemon.getEffectiveStat(stat, undefined, undefined, true, true, true, false, true, true);
).reduce((highestValue: number, value: number, i: number) => { if (value > curr[1]) {
if (value > highestValue) { curr[0] = stat;
highestStat = EFFECTIVE_STATS[i]; curr[1] = value;
return value; }
} return curr;
return highestValue; },
}, 0); [Stat.ATK, 0],
)[0];
highestStat = highestStat!; // tell TS compiler it's defined!
this.stat = highestStat; this.stat = highestStat;
this.multiplier = this.stat === Stat.SPD ? 1.5 : 1.3; this.multiplier = highestStat === Stat.SPD ? 1.5 : 1.3;
globalScene.phaseManager.queueMessage( globalScene.phaseManager.queueMessage(
i18next.t("battlerTags:highestStatBoostOnAdd", { i18next.t("battlerTags:highestStatBoostOnAdd", {
pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), pokemonNameWithAffix: getPokemonNameWithAffix(pokemon),
@ -2614,7 +2614,7 @@ export class IceFaceBlockDamageTag extends FormBlockDamageTag {
*/ */
export class CommandedTag extends SerializableBattlerTag { export class CommandedTag extends SerializableBattlerTag {
public override readonly tagType = BattlerTagType.COMMANDED; public override readonly tagType = BattlerTagType.COMMANDED;
public readonly tatsugiriFormKey: string; public readonly tatsugiriFormKey: string = "curly";
constructor(sourceId: number) { constructor(sourceId: number) {
super(BattlerTagType.COMMANDED, BattlerTagLapseType.CUSTOM, 0, MoveId.NONE, sourceId); super(BattlerTagType.COMMANDED, BattlerTagLapseType.CUSTOM, 0, MoveId.NONE, sourceId);
@ -2668,7 +2668,7 @@ export class StockpilingTag extends SerializableBattlerTag {
super(BattlerTagType.STOCKPILING, BattlerTagLapseType.CUSTOM, 1, sourceMove); super(BattlerTagType.STOCKPILING, BattlerTagLapseType.CUSTOM, 1, sourceMove);
} }
private onStatStagesChanged: StatStageChangeCallback = (_, statsChanged, statChanges) => { private onStatStagesChanged(_: Pokemon | null, statsChanged: BattleStat[], statChanges: number[]) {
const defChange = statChanges[statsChanged.indexOf(Stat.DEF)] ?? 0; const defChange = statChanges[statsChanged.indexOf(Stat.DEF)] ?? 0;
const spDefChange = statChanges[statsChanged.indexOf(Stat.SPDEF)] ?? 0; const spDefChange = statChanges[statsChanged.indexOf(Stat.SPDEF)] ?? 0;
@ -2678,7 +2678,11 @@ export class StockpilingTag extends SerializableBattlerTag {
if (spDefChange) { if (spDefChange) {
this.statChangeCounts[Stat.SPDEF]++; this.statChangeCounts[Stat.SPDEF]++;
} }
};
// Removed during bundling; used to ensure this method's signature retains parity
// with the `StatStageChangeCallback` type.
this.onStatStagesChanged satisfies StatStageChangeCallback;
}
public override loadTag( public override loadTag(
source: BaseBattlerTag & Pick<StockpilingTag, "tagType" | "stockpiledCount" | "statChangeCounts">, source: BaseBattlerTag & Pick<StockpilingTag, "tagType" | "stockpiledCount" | "statChangeCounts">,
@ -2718,7 +2722,7 @@ export class StockpilingTag extends SerializableBattlerTag {
true, true,
false, false,
true, true,
this.onStatStagesChanged, this.onStatStagesChanged.bind(this),
); );
} }
} }