mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-12-15 22:35:20 +01:00
* Add abilityAttr.is methods * [WIP] move modifier stuff around * Untangle circular deps from modifiers * Move unlockables to own file * Untangle all circular deps outside of MEs * Move constants in MEs to their own files * Re-add missing import to battle.ts * Add necessary overload for getTag * Add missing type import in weather.ts * Init modifier types and pools in loading-scene * Remove stray commented code * Apply kev's suggestions from code review Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> --------- Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
40 lines
1.2 KiB
TypeScript
40 lines
1.2 KiB
TypeScript
import { ModifierTier } from "#enums/modifier-tier";
|
|
import {
|
|
regenerateModifierPoolThresholds,
|
|
getEnemyBuffModifierForWave,
|
|
} from "#app/modifier/modifier-type";
|
|
import { ModifierPoolType } from "#enums/modifier-pool-type";
|
|
import { EnemyPersistentModifier } from "#app/modifier/modifier";
|
|
import { Phase } from "#app/phase";
|
|
import { globalScene } from "#app/global-scene";
|
|
|
|
export class AddEnemyBuffModifierPhase extends Phase {
|
|
public readonly phaseName = "AddEnemyBuffModifierPhase";
|
|
start() {
|
|
super.start();
|
|
|
|
const waveIndex = globalScene.currentBattle.waveIndex;
|
|
const tier = !(waveIndex % 1000)
|
|
? ModifierTier.ULTRA
|
|
: !(waveIndex % 250)
|
|
? ModifierTier.GREAT
|
|
: ModifierTier.COMMON;
|
|
|
|
regenerateModifierPoolThresholds(globalScene.getEnemyParty(), ModifierPoolType.ENEMY_BUFF);
|
|
|
|
const count = Math.ceil(waveIndex / 250);
|
|
for (let i = 0; i < count; i++) {
|
|
globalScene.addEnemyModifier(
|
|
getEnemyBuffModifierForWave(
|
|
tier,
|
|
globalScene.findModifiers(m => m instanceof EnemyPersistentModifier, false),
|
|
),
|
|
true,
|
|
true,
|
|
);
|
|
}
|
|
globalScene.updateModifiers(false, true);
|
|
this.end();
|
|
}
|
|
}
|