✅ Get effective ap cost basic vs custom action
| Category | Ability |
| Status | Passing |
| Test | tests/test_operations.py::test_get_effective_ap_cost_basic_vs_custom_action |
Tests interaction between Forneus.
Preconditions
-
Lane 0: P1's Forneus (#097) — READIED
-
Forneus has passive idx=2: +1 AP Cost on basic actions
-
ACTION 1: Query get_effective_ap_cost(state, forneus, 2, is_basic_action=True)
-
ACTION 2: Query get_effective_ap_cost(state, forneus, 2, is_basic_action=False)
Action
See code below.
# Earlier tests in the suite (e.g. TestVapula) call clear_registries();
# reload abilities_passive to ensure Forneus's passive is registered.
import importlib
import engine.abilities_passive
from engine.abilities import clear_registries
clear_registries()
importlib.reload(engine.abilities_passive)
from engine.operations import get_effective_ap_cost
state = make_game_state()
forneus = make_demon("097", lane=0, owner=Side.PLAYER_1)
state = place_demon(state, forneus)
placed = state.demons[0]
basic_cost = get_effective_ap_cost(state, placed, 2, is_basic_action=True)
custom_cost = get_effective_ap_cost(state, placed, 2, is_basic_action=False)
Expected Postconditions
-
Basic call: 3 (2 base + 1 from Forneus basic_ap_cost passive)
-
Custom call: 2 (2 base — Forneus's passive does not apply to custom abilities)
Assertions
assert basic_cost == 3, (
f"Forneus's +1 AP Cost applies to basic actions. Got {basic_cost}."
)
assert custom_cost == 2, (
f"Forneus's basic_ap_cost must NOT apply to custom abilities. Got {custom_cost}."
)