refactor: tighten useAbility and Scenario archetype lookup
Final-review-driven changes (Tasks 6/M1, I1 from the ledger): - Drop the redundant abilities-list check in CombatEngine::useAbility. By construction (Scenario::__construct enforces the allowlist), any ability the unit 'knows' is also archetype-allowed; the second check alone is sufficient and removes a dead code path. - Update testUseAbilityRejectsAnAbilityTheArchetypeForbids to assert the 'Unit archetype forbids that ability.' message it actually exercises. - Compute $template once in Scenario::__construct's per-unit loop and drop the redundant catalog lookup on the next line.
This commit is contained in:
@@ -971,7 +971,7 @@ final class CombatEngineTest extends TestCase
|
||||
);
|
||||
|
||||
$this->expectException(CombatException::class);
|
||||
$this->expectExceptionMessage('Unit does not know that ability.');
|
||||
$this->expectExceptionMessage('Unit archetype forbids that ability.');
|
||||
|
||||
(new CombatEngine())->useAbility($match, 'scout-1', 'heal', new Position(0, 1));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user