Berries activate simultaneously

This commit is contained in:
Flashfyre 2024-03-25 00:21:00 -04:00
parent be88f4783e
commit 93a7af853b
2 changed files with 17 additions and 10 deletions

View File

@ -1862,14 +1862,19 @@ export default class BattleScene extends Phaser.Scene {
return (player ? this.modifiers : this.enemyModifiers).find(m => (modifierFilter as ModifierPredicate)(m));
}
applyModifiers(modifierType: { new(...args: any[]): Modifier }, player: boolean = true, ...args: any[]): void {
applyModifiers(modifierType: { new(...args: any[]): Modifier }, player: boolean = true, ...args: any[]): PersistentModifier[] {
const appliedModifiers: PersistentModifier[] = [];
const modifiers = (player ? this.modifiers : this.enemyModifiers).filter(m => m instanceof modifierType && m.shouldApply(args));
for (let modifier of modifiers) {
if (modifier.apply(args))
if (modifier.apply(args)) {
console.log('Applied', modifier.type.name, !player ? '(enemy)' : '');
appliedModifiers.push(modifier);
}
}
return appliedModifiers;
}
applyModifier(modifierType: { new(...args: any[]): Modifier }, player: boolean = true, ...args: any[]): PersistentModifier {
const modifiers = (player ? this.modifiers : this.enemyModifiers).filter(m => m instanceof modifierType && m.shouldApply(args));
for (let modifier of modifiers) {

View File

@ -3455,9 +3455,10 @@ export class BerryPhase extends CommonAnimPhase {
}
start() {
let berryModifier: BerryModifier;
let berryModifiers: BerryModifier[];
if ((berryModifier = this.scene.applyModifier(BerryModifier, this.player, this.getPokemon()) as BerryModifier)) {
if ((berryModifiers = this.scene.applyModifiers(BerryModifier, this.player, this.getPokemon()) as BerryModifier[])) {
for (let berryModifier of berryModifiers) {
if (berryModifier.consumed) {
if (!--berryModifier.stackCount)
this.scene.removeModifier(berryModifier);
@ -3465,6 +3466,7 @@ export class BerryPhase extends CommonAnimPhase {
berryModifier.consumed = false;
this.scene.updateModifiers(this.player);
}
}
return super.start();
}