diff options
| author | Anhgelus Morhtuuzh <anhgelus.morhtuuzh@proton.me> | 2024-04-15 19:40:42 +0200 |
|---|---|---|
| committer | Anhgelus Morhtuuzh <anhgelus.morhtuuzh@proton.me> | 2024-04-15 19:40:42 +0200 |
| commit | 76745af0e841518835a73e6e3590a1b85e579163 (patch) | |
| tree | b869110f74ac8bf9f022cbce232f2c8407e87ff3 | |
| parent | e78c8d8c422bf470924109c186cff9f987b095fd (diff) | |
fix(xp): strange comportment with -=
| -rw-r--r-- | xp/level.go | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/xp/level.go b/xp/level.go index b179cdb..aeb7d91 100644 --- a/xp/level.go +++ b/xp/level.go @@ -51,7 +51,7 @@ func LastEventUpdate(c *Copaing) { utils.SendWarn("lose - xp already removed is negative", "lose", l, "xp", xp) c.XP = 0 } else { - c.XP -= l - c.XPAlreadyRemoved() + c.XP = c.XP - l + c.XPAlreadyRemoved() } c.Save() c.SetLastEvent() @@ -63,10 +63,9 @@ func XPUpdate(c *Copaing) { xp := c.XPAlreadyRemoved() if l-xp < 0 { utils.SendWarn("lose - xp already removed is negative", "lose", l, "xp", xp) - c.XP = 0 c.AddXPAlreadyRemoved(0) } else { - c.XP -= l - c.XPAlreadyRemoved() + c.XP = c.XP - l + xp c.AddXPAlreadyRemoved(l - xp) } c.Save() |
