mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-07 07:59:26 +02:00
Merge a40087e2fc
into 375587213e
This commit is contained in:
commit
c1b34184e8
@ -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 highestValue;
|
return curr;
|
||||||
}, 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),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user