Skip to content

Commit 4922f6f

Browse files
committed
Added terastarstorm support for doubles
1 parent 8b5238f commit 4922f6f

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/poke_env/environment/double_battle.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,8 @@ def get_possible_showdown_targets(
294294
PokemonType.GHOST not in pokemon.types
295295
): # fixing target for Curse
296296
return [self.EMPTY_TARGET_POSITION]
297+
elif move.id == "terastarstorm" and pokemon.type_1 == PokemonType.STELLAR:
298+
targets = [self.EMPTY_TARGET_POSITION]
297299
else:
298300
targets = {
299301
Target.from_showdown_message("adjacentAlly"): [ally_position],

unit_tests/environment/test_double_battle.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import pytest
44

5-
from poke_env.environment import DoubleBattle, Pokemon
5+
from poke_env.environment import DoubleBattle, Move, Pokemon
66

77

88
def test_battle_request_parsing(example_doubles_request):
@@ -132,6 +132,13 @@ def test_get_possible_showdown_targets(example_doubles_request):
132132
]
133133
assert battle.get_possible_showdown_targets(slackoff, mr_rime, dynamax=True) == [0]
134134

135+
# Override last request with terastarstorm for Mr. Rime
136+
terastarstorm = Move("terastarstorm", gen=9)
137+
battle._available_moves = [[terastarstorm], []]
138+
assert battle.get_possible_showdown_targets(terastarstorm, mr_rime) == [-2, 1, 2]
139+
mr_rime.terastallize("stellar")
140+
assert battle.get_possible_showdown_targets(terastarstorm, mr_rime) == [0]
141+
135142

136143
def test_to_showdown_target(example_doubles_request):
137144
logger = MagicMock()

0 commit comments

Comments
 (0)