diff options
| author | historia <[not public]> | 2026-06-10 01:48:28 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-06-10 01:48:28 -0400 |
| commit | a226d72e51eecb768b13600303f73483118d9104 (patch) | |
| tree | 458d15ef049732c15dacc591a830d3beddbedfde /internal/combat/state.go | |
| parent | 6a0f3d7a252de4b1741cfe5e1c561412c602becc (diff) | |
| download | thehouseoficarus-a226d72e51eecb768b13600303f73483118d9104.tar.gz | |
feat: implemented janky object interaction model
Diffstat (limited to 'internal/combat/state.go')
| -rw-r--r-- | internal/combat/state.go | 47 |
1 files changed, 5 insertions, 42 deletions
diff --git a/internal/combat/state.go b/internal/combat/state.go index 0d8de45..43b693b 100644 --- a/internal/combat/state.go +++ b/internal/combat/state.go @@ -3,12 +3,10 @@ package combat import "sync" type State struct { - PlayerName string - MobID string - MobAttacks int // attacks mob has made (3-hit flee rule) - PlayerDamage int // total damage player dealt this combat - Active bool - LockedTicks int // ticks remaining before player can move + PlayerName string + MobID string + Active bool + LockedTicks int } var ( @@ -59,32 +57,6 @@ func GetMobTarget(mobID string) string { return mobTargets[mobID] } -func RecordMobAttack(playerName string) { - mu.Lock() - defer mu.Unlock() - if state, ok := combatants[playerName]; ok { - state.MobAttacks++ - } -} - -func CanFlee(playerName string) bool { - mu.Lock() - defer mu.Unlock() - state, ok := combatants[playerName] - if !ok { - return true - } - return state.MobAttacks >= 3 -} - -func RecordPlayerDamage(playerName string, dmg int) { - mu.Lock() - defer mu.Unlock() - if state, ok := combatants[playerName]; ok { - state.PlayerDamage += dmg - } -} - func TickCombat() { mu.Lock() defer mu.Unlock() @@ -95,13 +67,4 @@ func TickCombat() { } } -func GetTotalDamage(playerName string) int { - mu.Lock() - defer mu.Unlock() - if state, ok := combatants[playerName]; ok { - d := state.PlayerDamage - state.PlayerDamage = 0 - return d - } - return 0 -} + |
