mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-05 07:52:17 +02:00
Minor fixes to stat change aggregation
This commit is contained in:
parent
a5c0e819c0
commit
746da85d62
@ -2765,6 +2765,7 @@ export class StatChangePhase extends PokemonPhase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
aggregateStatChanges(random: boolean = false): void {
|
aggregateStatChanges(random: boolean = false): void {
|
||||||
|
const isAccEva = [ BattleStat.ACC, BattleStat.EVA ].some(s => this.stats.includes(s));
|
||||||
let existingPhase: StatChangePhase;
|
let existingPhase: StatChangePhase;
|
||||||
if (this.stats.length === 1) {
|
if (this.stats.length === 1) {
|
||||||
while ((existingPhase = (this.scene.findPhase(p => p instanceof StatChangePhase && p.battlerIndex === this.battlerIndex && p.stats.length === 1
|
while ((existingPhase = (this.scene.findPhase(p => p instanceof StatChangePhase && p.battlerIndex === this.battlerIndex && p.stats.length === 1
|
||||||
@ -2781,8 +2782,9 @@ export class StatChangePhase extends PokemonPhase {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while ((existingPhase = (this.scene.findPhase(p => p instanceof StatChangePhase && p.battlerIndex === this.battlerIndex && p.selfTarget === this.selfTarget && p.levels === this.levels
|
while ((existingPhase = (this.scene.findPhase(p => p instanceof StatChangePhase && p.battlerIndex === this.battlerIndex && p.selfTarget === this.selfTarget
|
||||||
&& p.showMessage === this.showMessage && p.ignoreAbilities === this.ignoreAbilities) as StatChangePhase))) {
|
&& ([ BattleStat.ACC, BattleStat.EVA ].some(s => p.stats.includes(s)) === isAccEva)
|
||||||
|
&& p.levels === this.levels && p.showMessage === this.showMessage && p.ignoreAbilities === this.ignoreAbilities) as StatChangePhase))) {
|
||||||
this.stats.push(...existingPhase.stats);
|
this.stats.push(...existingPhase.stats);
|
||||||
if (!this.scene.tryRemovePhase(p => p === existingPhase))
|
if (!this.scene.tryRemovePhase(p => p === existingPhase))
|
||||||
break;
|
break;
|
||||||
@ -2804,9 +2806,11 @@ export class StatChangePhase extends PokemonPhase {
|
|||||||
const relLevelStats = stats.filter((_, i) => relLevelStatIndexes[rl].includes(i));
|
const relLevelStats = stats.filter((_, i) => relLevelStatIndexes[rl].includes(i));
|
||||||
let statsFragment = '';
|
let statsFragment = '';
|
||||||
|
|
||||||
if (relLevelStats.length > 1)
|
if (relLevelStats.length > 1) {
|
||||||
statsFragment = `${relLevelStats.slice(0, -1).map(s => getBattleStatName(s)).join(', ')}, and ${getBattleStatName(relLevelStats[relLevelStats.length - 1])}`;
|
statsFragment = relLevelStats.length >= 5
|
||||||
else
|
? 'stats'
|
||||||
|
: `${relLevelStats.slice(0, -1).map(s => getBattleStatName(s)).join(', ')}, and ${getBattleStatName(relLevelStats[relLevelStats.length - 1])}`;
|
||||||
|
} else
|
||||||
statsFragment = getBattleStatName(relLevelStats[0]);
|
statsFragment = getBattleStatName(relLevelStats[0]);
|
||||||
messages.push(getPokemonMessage(this.getPokemon(), `'s ${statsFragment} ${getBattleStatLevelChangeDescription(Math.abs(parseInt(rl)), levels >= 1)}!`));
|
messages.push(getPokemonMessage(this.getPokemon(), `'s ${statsFragment} ${getBattleStatLevelChangeDescription(Math.abs(parseInt(rl)), levels >= 1)}!`));
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user