Revert "Apply status tokens in a random order to prevent bias"
This reverts commit 1f8e36575d
.
pull/251/head
parent
1f8e36575d
commit
fa6f05d997
|
@ -1976,27 +1976,9 @@ export default class BattleScene extends SceneBase {
|
||||||
return (player ? this.modifiers : this.enemyModifiers).find(m => (modifierFilter as ModifierPredicate)(m));
|
return (player ? this.modifiers : this.enemyModifiers).find(m => (modifierFilter as ModifierPredicate)(m));
|
||||||
}
|
}
|
||||||
|
|
||||||
applyShuffledModifiers(scene: BattleScene, modifierType: { new(...args: any[]): Modifier }, player: boolean = true, ...args: any[]): PersistentModifier[] {
|
|
||||||
let modifiers = (player ? this.modifiers : this.enemyModifiers).filter(m => m instanceof modifierType && m.shouldApply(args));
|
|
||||||
scene.executeWithSeedOffset(() => {
|
|
||||||
const shuffleModifiers = mods => {
|
|
||||||
if (mods.length === 1)
|
|
||||||
return mods;
|
|
||||||
const rand = Math.floor(Utils.randSeedInt(mods.length));
|
|
||||||
return [mods[rand], ...shuffleModifiers(mods.filter((_, i) => i !== rand))];
|
|
||||||
};
|
|
||||||
modifiers = shuffleModifiers(modifiers);
|
|
||||||
}, scene.currentBattle.turn << 4, scene.waveSeed);
|
|
||||||
return this.applyModifiersInternal(modifiers, player, args);
|
|
||||||
}
|
|
||||||
|
|
||||||
applyModifiers(modifierType: { new(...args: any[]): Modifier }, player: boolean = true, ...args: any[]): PersistentModifier[] {
|
applyModifiers(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));
|
|
||||||
return this.applyModifiersInternal(modifiers, player, args);
|
|
||||||
}
|
|
||||||
|
|
||||||
applyModifiersInternal(modifiers: PersistentModifier[], player: boolean, args: any[]): PersistentModifier[] {
|
|
||||||
const appliedModifiers: PersistentModifier[] = [];
|
const appliedModifiers: PersistentModifier[] = [];
|
||||||
|
const modifiers = (player ? this.modifiers : this.enemyModifiers).filter(m => m instanceof modifierType && m.shouldApply(args));
|
||||||
for (let modifier of modifiers) {
|
for (let modifier of modifiers) {
|
||||||
if (modifier.apply(args)) {
|
if (modifier.apply(args)) {
|
||||||
console.log('Applied', modifier.type.name, !player ? '(enemy)' : '');
|
console.log('Applied', modifier.type.name, !player ? '(enemy)' : '');
|
||||||
|
|
|
@ -2450,7 +2450,7 @@ export class MoveEffectPhase extends PokemonPhase {
|
||||||
user, target, this.move.getMove()).then(() => {
|
user, target, this.move.getMove()).then(() => {
|
||||||
return Utils.executeIf(!target.isFainted() || target.canApplyAbility(), () => applyPostDefendAbAttrs(PostDefendAbAttr, target, user, this.move, hitResult).then(() => {
|
return Utils.executeIf(!target.isFainted() || target.canApplyAbility(), () => applyPostDefendAbAttrs(PostDefendAbAttr, target, user, this.move, hitResult).then(() => {
|
||||||
if (!user.isPlayer() && this.move.getMove() instanceof AttackMove)
|
if (!user.isPlayer() && this.move.getMove() instanceof AttackMove)
|
||||||
user.scene.applyShuffledModifiers(this.scene, EnemyAttackStatusEffectChanceModifier, false, target);
|
user.scene.applyModifiers(EnemyAttackStatusEffectChanceModifier, false, target);
|
||||||
})).then(() => {
|
})).then(() => {
|
||||||
applyPostAttackAbAttrs(PostAttackAbAttr, user, target, this.move, hitResult).then(() => {
|
applyPostAttackAbAttrs(PostAttackAbAttr, user, target, this.move, hitResult).then(() => {
|
||||||
if (this.move.getMove() instanceof AttackMove)
|
if (this.move.getMove() instanceof AttackMove)
|
||||||
|
|
Loading…
Reference in New Issue