feat(observation): expose per-pair cover bonus
This commit is contained in:
@@ -1025,6 +1025,21 @@ class CombatEngine:
|
||||
for cell in occupied:
|
||||
for enemy in self.enemies_threatening(state, cell):
|
||||
threatening_enemies.add(enemy.combatant.id)
|
||||
cover_bonus = 0
|
||||
if weapon is not None:
|
||||
others = frozenset(
|
||||
cell
|
||||
for s in self._states
|
||||
if s.active and s is not state and s is not target
|
||||
for cell in s.occupied_cells()
|
||||
)
|
||||
cover_bonus = cover_bonus_cells(
|
||||
self._grid,
|
||||
state.occupied_cells(),
|
||||
target.occupied_cells(),
|
||||
ranged=self._is_ranged_attack(weapon),
|
||||
occupied=others,
|
||||
)
|
||||
return {
|
||||
"target_index": self._states.index(target),
|
||||
"distance_ft": distance_ft,
|
||||
@@ -1039,6 +1054,7 @@ class CombatEngine:
|
||||
"movement_cost_ft": self.movement_cost_ft(state, target),
|
||||
"target_threatens_me": target_threatens_me,
|
||||
"enemies_threatening_me": len(threatening_enemies),
|
||||
"cover_bonus": cover_bonus,
|
||||
}
|
||||
|
||||
def _take_turn(self, state: CombatantState) -> bool:
|
||||
|
||||
Reference in New Issue
Block a user