Skip to main content

✅ Question challenge with lie no damage to allies

CategoryAbility
StatusPassing
Testtests/test_abilities_familiars.py::test_question_challenge_with_lie_no_damage_to_allies

A demon Challenges a Question familiar that has Lie underneath.

Preconditions

  • Lane 1: P1's Question (120_3) with hidden_card="120_2" (Lie).

  • Lane 1: P2's Duban (001) — READIED (will be the challenger).

  • No other demons in lane 1.

  • P1's familiar_deck = [] (Question and Lie are in play).

Action

  • Execute Challenge ability (action[1] of Question, 120_3) with Duban as performer,
from engine.abilities import execute_ability

state = make_game_state()
state.players[Side.PLAYER_1].cp = 0
state.players[Side.PLAYER_2].cp = 0
state.players[Side.PLAYER_1].familiar_deck = []
state.players[Side.PLAYER_2].familiar_deck = []

# Place Question with Lie hidden underneath
question = make_familiar_demon("120_3", lane=1, owner=Side.PLAYER_1,
current_hp=1) # null hp → use 1 for testing
question.abilities_used_this_turn = {"hidden_card": "120_2"} # Lie underneath
state = place_demon(state, question)
question = state.demons[-1]

# Place Duban (challenger) in the same lane
duban = make_demon("001", lane=1, owner=Side.PLAYER_2)
state = place_demon(state, duban)
duban = state.demons[-1]

# Execute Challenge: Duban challenges the Question
from engine.abilities_familiars import _question_challenge_handler
new_state = _question_challenge_handler(state, duban, [question], {}, None)

# Question removed from field
question_on_field = [d for d in new_state.demons if d.unit_id == "120_3"]

Expected Postconditions

  • Question is removed from field (not added to any pile — not dead).

  • No damage dealt to Duban or its allies (Lie doesn't trigger damage).

  • P1 CP = 0 (Question and Lie are not considered dead).

  • P2 CP = 0.

Assertions

assert len(question_on_field) == 0, (
"Question should be removed from field after Challenge resolves."
)

# No damage to Duban (Lie → no ally damage)
duban_after = next((d for d in new_state.demons if d.unit_id == "001"), None)
assert duban_after is not None, "Duban should still be on field."
assert duban_after.damage == 0, (
f"Duban's allies take no damage when Lie is revealed. "
f"Got damage={duban_after.damage}."
)

# No CP change (Question/Lie are not dead)
assert new_state.players[Side.PLAYER_1].cp == 0, (
"P1 should NOT gain CP when Question is revealed — it's not considered dead."
)
assert new_state.players[Side.PLAYER_2].cp == 0, "P2 CP should be 0."