diff --git a/src/adv/AdvPlayer.lua b/src/adv/AdvPlayer.lua index 0695282..39f7756 100644 --- a/src/adv/AdvPlayer.lua +++ b/src/adv/AdvPlayer.lua @@ -610,14 +610,15 @@ end function Player:changeSp(value, cType) local oldSp = self.sp cType = cType or 0 + local change = 0 if cType == 0 then - self.sp = self.sp + value + change = value elseif cType == 1 then - self.sp = self.sp + self.sp * value / 100 + change = self.sp * value / 100 end - self.sp = math.floor(math.min(self.spMax, math.max(0, self.sp))) - if self.sp - oldSp ~= 0 then - self.battle.adv:pushBackEvent(AdvBackEventType.SpChange, {change = self.sp - oldSp}) + self.sp = math.floor(math.min(self.spMax, math.max(0, self.sp + change))) + if change ~= 0 then + self.battle.adv:pushBackEvent(AdvBackEventType.SpChange, {change = math.floor(change)}) end end -- libgit2 0.21.2