aboutsummaryrefslogtreecommitdiff
path: root/internal/combat
diff options
context:
space:
mode:
Diffstat (limited to 'internal/combat')
-rw-r--r--internal/combat/state.go47
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
-}
+