From cec6bdd312d042ff4ac8dc40484b8a2ca6216560 Mon Sep 17 00:00:00 2001 From: magralo Date: Fri, 9 Feb 2024 18:59:06 -0500 Subject: [PATCH 1/3] ensure random --- sim/battle-actions.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/sim/battle-actions.ts b/sim/battle-actions.ts index 0930ae04cbf98..a8ebdc40976d8 100644 --- a/sim/battle-actions.ts +++ b/sim/battle-actions.ts @@ -1,6 +1,6 @@ import {Dex, toID} from './dex'; -const CHOOSABLE_TARGETS = new Set(['normal', 'any', 'adjacentAlly', 'adjacentAllyOrSelf', 'adjacentFoe']); +const CHOOSABLE_TARGETS = new Set(['normal', 'any', 'adjacentAlly', 'adjacentAllyOrSelf', 'adjacentFoe','randomNormal']); export class BattleActions { battle: Battle; @@ -225,7 +225,10 @@ export class BattleActions { ) { pokemon.activeMoveActions++; let target = this.battle.getTarget(pokemon, maxMove || zMove || moveOrMoveName, targetLoc, originalTarget); + + let baseMove = this.dex.getActiveMove(moveOrMoveName); + const pranksterBoosted = baseMove.pranksterBoosted; if (baseMove.id !== 'struggle' && !zMove && !maxMove && !externalMove) { const changedMove = this.battle.runEvent('OverrideAction', pokemon, target, baseMove); @@ -241,6 +244,13 @@ export class BattleActions { } else if (maxMove) { move = this.getActiveMaxMove(baseMove, pokemon); } + //console.log(move) + let target_aux + if (move.target === 'randomNormal'){ + target = this.battle.getRandomTarget(pokemon, move); + } + + move.isExternal = externalMove; From 575163aedea5c6192fe3a78df91db105440a81e8 Mon Sep 17 00:00:00 2001 From: magralo Date: Fri, 9 Feb 2024 19:01:27 -0500 Subject: [PATCH 2/3] delete empty lines --- sim/battle-actions.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/sim/battle-actions.ts b/sim/battle-actions.ts index a8ebdc40976d8..34c41e54219c9 100644 --- a/sim/battle-actions.ts +++ b/sim/battle-actions.ts @@ -224,11 +224,8 @@ export class BattleActions { zMove?: string, externalMove?: boolean, maxMove?: string, originalTarget?: Pokemon ) { pokemon.activeMoveActions++; - let target = this.battle.getTarget(pokemon, maxMove || zMove || moveOrMoveName, targetLoc, originalTarget); - - + let target = this.battle.getTarget(pokemon, maxMove || zMove || moveOrMoveName, targetLoc, originalTarget); let baseMove = this.dex.getActiveMove(moveOrMoveName); - const pranksterBoosted = baseMove.pranksterBoosted; if (baseMove.id !== 'struggle' && !zMove && !maxMove && !externalMove) { const changedMove = this.battle.runEvent('OverrideAction', pokemon, target, baseMove); @@ -244,8 +241,7 @@ export class BattleActions { } else if (maxMove) { move = this.getActiveMaxMove(baseMove, pokemon); } - //console.log(move) - let target_aux + if (move.target === 'randomNormal'){ target = this.battle.getRandomTarget(pokemon, move); } From 355288e87fb4b0548427d704c3f7396f0c649fe5 Mon Sep 17 00:00:00 2001 From: magralo Date: Fri, 9 Feb 2024 19:02:17 -0500 Subject: [PATCH 3/3] remove empty lines --- sim/battle-actions.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sim/battle-actions.ts b/sim/battle-actions.ts index 34c41e54219c9..7740c60b9db04 100644 --- a/sim/battle-actions.ts +++ b/sim/battle-actions.ts @@ -245,9 +245,7 @@ export class BattleActions { if (move.target === 'randomNormal'){ target = this.battle.getRandomTarget(pokemon, move); } - - - + move.isExternal = externalMove; this.battle.setActiveMove(move, pokemon, target);