From a226d72e51eecb768b13600303f73483118d9104 Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Wed, 10 Jun 2026 01:48:28 -0400 Subject: feat: implemented janky object interaction model --- internal/combat/state.go | 47 +++++------------------------------------------ 1 file changed, 5 insertions(+), 42 deletions(-) (limited to 'internal/combat') 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 -} + -- cgit v1.2.3