Skip to main content

✅ Is in range short circuits for cancer

CategoryAbility
StatusPassing
Testtests/test_abilities_complex.py::TestCancerIgnoresRange::test_is_in_range_short_circuits_for_cancer

Tests interaction between Cancer, Duban.

Preconditions

  • Lane 0: P1's Cancer (#116), READIED, range=Local

  • Lane 2: P2's Duban (#001) — two lanes away

Action

  • is_in_range(cancer, duban, Range.LOCAL) — Cancer's natural range
from engine.constants import Range
from engine.targeting import is_in_range

cancer = make_demon("116", lane=0, owner=Side.PLAYER_1)
duban = make_demon("001", lane=2, owner=Side.PLAYER_2)
state, placed = _make_state_with_demons(cancer, duban)

Expected Postconditions

  • Returns True (Cancer's passive bypasses the same-lane requirement)

  • Also True for Range.IN_RANGE (range resolves to Local for Cancer

  • but the ignores_range short-circuit fires first)

Assertions

assert is_in_range(placed[0], placed[1], Range.LOCAL) is True, (
"Cancer ignores Local range restriction — should reach Duban 2 lanes away."
)
assert is_in_range(placed[0], placed[1], Range.IN_RANGE) is True, (
"Cancer IN_RANGE resolution should also short-circuit via ignores_range."
)