LovecaSim / engine /tests /test_fix_verification.py
trioskosmos's picture
Upload folder using huggingface_hub
bb3fbf9 verified
import pytest
from engine.game.game_state import initialize_game
def get_card_id(gs, card_no):
for cid, card in gs.member_db.items():
if card.card_no == card_no:
return cid
pytest.fail(f"Card {card_no} not found")
def test_plhs_bp2_017_n_ability():
gs = initialize_game(use_real_data=True)
gs.verbose = True
player = gs.players[gs.current_player]
# 1. Test without 10 cards in discard
card_id = get_card_id(gs, "PL!HS-bp2-017-N")
player.hand = [card_id]
player.discard = [1, 2, 3, 4, 5, 6, 7, 8, 9] # 9 cards
initial_hand_size = len(player.hand)
# Place card on stage (triggers TOUJYOU)
# Action 1: hand[0] to area 0
gs._execute_action(1)
# Hand size should be 0 (no draw)
assert len(player.hand) == 0
assert len(gs.triggered_abilities) == 0
# 2. Test with 10 cards in discard
gs = initialize_game(use_real_data=True)
player = gs.players[gs.current_player]
card_id = get_card_id(gs, "PL!HS-bp2-017-N")
player.hand = [card_id]
player.discard = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] # 10 cards
# Action 1: hand[0] to area 1
gs._execute_action(2)
# Hand size should be 1 (drew a card)
# Note: apply_action processes triggers automatically if they don't require choice
# DRAW(1) doesn't require choice, so it should happen immediately.
assert len(player.hand) == 1
print("Verification successful!")
if __name__ == "__main__":
test_plhs_bp2_017_n_ability()