Combat: implement stateful monster ability effects

Slice 3 of the bestiary SRD upgrade: the monster abilities that need
per-fight state (evade, block, advantage, retaliate, regenerate,
survive_at_1, stat_drain, debuff, max_hp_drain). applyAbility arms
combatState flags that the shared resolution primitives read, so both
the auto-resolve and turn-based engines honor them; the turn-based
engine round-trips them through CombatStatuses so a suspended fight
resumes from exact mid-state. New branches are guarded by zero-valued
state so the auto-resolve characterization golden is untouched.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
prosolis
2026-05-14 08:32:13 -07:00
parent f1aa9981f8
commit e629f8fd4d
6 changed files with 468 additions and 18 deletions

View File

@@ -96,6 +96,20 @@ type CombatStatuses struct {
AssassinateReroll bool `json:"assassinate_reroll_used,omitempty"`
AssassinateBonus bool `json:"assassinate_bonus_used,omitempty"`
// Slice-3 stateful monster-ability effects — armed by applyAbility, read by
// the shared resolution primitives, round-tripped through combatState so a
// suspended/resumed fight (or a reaper auto-play) keeps the same effect
// state. EnemyEvadeNext is a one-shot; the rest persist for the fight.
EnemyEvadeNext bool `json:"enemy_evade_next,omitempty"`
EnemyBlockUp bool `json:"enemy_block_up,omitempty"`
EnemyAdvantage bool `json:"enemy_advantage,omitempty"`
EnemyRetaliateFrac float64 `json:"enemy_retaliate_frac,omitempty"`
EnemyRegen int `json:"enemy_regen,omitempty"`
EnemySurviveArmed bool `json:"enemy_survive_armed,omitempty"`
PlayerAtkDrain int `json:"player_atk_drain,omitempty"`
PlayerACDebuff int `json:"player_ac_debuff,omitempty"`
MaxHPDrain int `json:"max_hp_drain,omitempty"`
// Persistent stat buffs from mid-fight !cast / !consume, accumulated as
// deltas against the freshly-rebuilt combatant. applySessionBuffs folds
// these back onto the player every round; diffTurnBuff produces them.