LovecaSim / engine /tests /cards /batches /test_verification_batch_21.py
trioskosmos's picture
Upload folder using huggingface_hub
bb3fbf9 verified
import pytest
from engine.game.enums import Phase
from engine.game.game_state import initialize_game
class TestVerificationBatch21:
@pytest.fixture
def game_state(self):
gs = initialize_game(use_real_data=True)
if not gs.member_db:
pytest.skip("Card data not loaded")
gs.active_player.tapped_energy.fill(False)
return gs
def get_card_id(self, gs, card_no):
for cid, card in gs.member_db.items():
if card.card_no == card_no:
return cid
for cid, card in gs.live_db.items():
if card.card_no == card_no:
return cid
pytest.fail(f"Card {card_no} not found")
def _test_on_play_look5_filter_tap(self, game_state, card_no):
gs = game_state
card_id = self.get_card_id(gs, card_no)
p1 = gs.players[0]
p2 = gs.players[1]
target_id = self.get_card_id(gs, "LL-bp1-002-R") # Liella! card
target_cost = gs.member_db[target_id].cost
p1.main_deck = [target_id] + [target_id] * 9
p1.hand = [card_id]
valid_opp_id = self.get_card_id(gs, "PL!-sd1-001-SD")
gs.member_db[valid_opp_id].cost = target_cost
gs.member_db[valid_opp_id].blades = 1
invalid_opp_id = self.get_card_id(gs, "PL!-sd1-015-SD")
gs.member_db[invalid_opp_id].cost = target_cost + 5
p2.stage[0] = valid_opp_id
p2.stage[1] = invalid_opp_id
p2.tapped_members[0] = False
p2.tapped_members[1] = False
gs.current_player = 0
gs.phase = Phase.MAIN
gs.step(1, check_legality=False, in_place=True) # Play
# Look 5 Choice
if gs.pending_choices:
choice_type, params = gs.pending_choices[0]
if target_id in params["cards"]:
idx = params["cards"].index(target_id)
gs.step(600 + idx, check_legality=False, in_place=True)
assert bool(p2.tapped_members[0]) == True, "Valid opponent should be tapped"
assert bool(p2.tapped_members[1]) == False, "Invalid opponent should NOT be tapped"
def test_ll_pr_004_pr_smoke(self, game_state):
pass
def test_ll_bp1_001_rplus_smoke(self, game_state):
pass
def test_ll_bp4_001_rplus_smoke(self, game_state):
self._test_on_play_look5_filter_tap(game_state, "LL-bp4-001-R+")
def test_pl_pr_002_pr_smoke(self, game_state):
gs = game_state
card_id = self.get_card_id(gs, "PL!-PR-002-PR")
p1 = gs.players[0]
p1.stage[0] = card_id
fodder_id = self.get_card_id(gs, "PL!-sd1-001-SD")
p1.stage[1] = fodder_id
p1.tapped_members[1] = True
p1.hand = [fodder_id]
gs.current_player = 0
gs.phase = Phase.MAIN
# Play something over to retire it
gs.step(1, check_legality=False, in_place=True)
if gs.pending_choices:
gs.step(561, check_legality=False, in_place=True) # Slot 1
assert bool(p1.tapped_members[1]) == False
def test_pl_pr_003_pr_smoke(self, game_state):
pass
def test_pl_pr_006_pr_smoke(self, game_state):
pass