Commit cac28f5fe4be62af5bb93679dd011bc7c7fd65d9

Authored by zhouhaihai
1 parent 8b25d183

魔力改变

Showing 1 changed file with 6 additions and 5 deletions   Show diff stats
src/adv/AdvPlayer.lua
... ... @@ -610,14 +610,15 @@ end
610 610 function Player:changeSp(value, cType)
611 611 local oldSp = self.sp
612 612 cType = cType or 0
  613 + local change = 0
613 614 if cType == 0 then
614   - self.sp = self.sp + value
  615 + change = value
615 616 elseif cType == 1 then
616   - self.sp = self.sp + self.sp * value / 100
  617 + change = self.sp * value / 100
617 618 end
618   - self.sp = math.floor(math.min(self.spMax, math.max(0, self.sp)))
619   - if self.sp - oldSp ~= 0 then
620   - self.battle.adv:pushBackEvent(AdvBackEventType.SpChange, {change = self.sp - oldSp})
  619 + self.sp = math.floor(math.min(self.spMax, math.max(0, self.sp + change)))
  620 + if change ~= 0 then
  621 + self.battle.adv:pushBackEvent(AdvBackEventType.SpChange, {change = math.floor(change)})
621 622 end
622 623 end
623 624  
... ...