Commit e90b4d203a4d9da793a8cba61e8814371c28670c

Authored by zhouhaihai
1 parent 058a0cbb

战斗buff

src/adv/AdvBattle.lua
@@ -160,6 +160,7 @@ function Battle:battleBegin(roomId, blockId, params) @@ -160,6 +160,7 @@ function Battle:battleBegin(roomId, blockId, params)
160 -- 玩家没死就是怪死了 160 -- 玩家没死就是怪死了
161 if player.hp > 0 then 161 if player.hp > 0 then
162 enemy:hurt(enemy.hp, self.player, {hurtType = 5}) 162 enemy:hurt(enemy.hp, self.player, {hurtType = 5})
  163 + self.player:effectBattleBuff()
163 end 164 end
164 self.player:hurt(math.max(0, math.ceil(self.player.hp - player.hp)), enemy, {hurtType = 5}) --战斗血量只会变少 165 self.player:hurt(math.max(0, math.ceil(self.player.hp - player.hp)), enemy, {hurtType = 5}) --战斗血量只会变少
165 self.player:changeSp(math.min(0, math.floor(player.sp - self.player.sp)) , 0) --战斗魔力只会变少 166 self.player:changeSp(math.min(0, math.floor(player.sp - self.player.sp)) , 0) --战斗魔力只会变少
src/adv/AdvBuff.lua
@@ -17,6 +17,7 @@ Buff.CANT_SKILL = 13 -- 禁止技能 @@ -17,6 +17,7 @@ Buff.CANT_SKILL = 13 -- 禁止技能
17 Buff.OPEN_BLOCK = 14 -- 翻开格子(每回合) 17 Buff.OPEN_BLOCK = 14 -- 翻开格子(每回合)
18 Buff.SP_CHANGE = 15 -- sp变化(每回合) 18 Buff.SP_CHANGE = 15 -- sp变化(每回合)
19 Buff.HP_CHANGE_NOW = 16 -- 生命变化(每回合生效,立刻生效) 19 Buff.HP_CHANGE_NOW = 16 -- 生命变化(每回合生效,立刻生效)
  20 +Buff.BATTLE_BUFF = 17 -- 切换为战斗中的buff
20 21
21 --角色一些属性的变化 22 --角色一些属性的变化
22 local function commonAttr(_Buff, attrName) 23 local function commonAttr(_Buff, attrName)
@@ -224,9 +225,7 @@ function Buff:ctor(owner, id) @@ -224,9 +225,7 @@ function Buff:ctor(owner, id)
224 self.buffData = csvdb["adv_map_buffCsv"][self.id] 225 self.buffData = csvdb["adv_map_buffCsv"][self.id]
225 self.isDel = false 226 self.isDel = false
226 self.roundSpace = 0 --生效间隔 227 self.roundSpace = 0 --生效间隔
227 - self.turnSpace = 0 --生效间隔  
228 self.round = 0 --剩余的回合 228 self.round = 0 --剩余的回合
229 - self.turn = 0 --剩余战斗内回合  
230 self.count = -1 -- 可生效的次数 -1 无次数限制 229 self.count = -1 -- 可生效的次数 -1 无次数限制
231 230
232 if BuffFactory[self.buffData.type] then 231 if BuffFactory[self.buffData.type] then
@@ -249,7 +248,6 @@ end @@ -249,7 +248,6 @@ end
249 function Buff:initNew(release, data) 248 function Buff:initNew(release, data)
250 self.release = release or self.owner 249 self.release = release or self.owner
251 self.round = self.buffData.round 250 self.round = self.buffData.round
252 - self.turn = self.buffData.turn  
253 if self.buffData.effectTime > 0 then 251 if self.buffData.effectTime > 0 then
254 self.count = self.buffData.effectTime 252 self.count = self.buffData.effectTime
255 end 253 end
@@ -277,11 +275,6 @@ function Buff:initByDB(data) @@ -277,11 +275,6 @@ function Buff:initByDB(data)
277 end 275 end
278 end 276 end
279 277
280 -function Buff:battleEnd()  
281 - if self.buffData.turn ~= 0 then  
282 - self.isDel = true -- turn类型buff战斗结束后移除  
283 - end  
284 -end  
285 278
286 function Buff:afterRound() 279 function Buff:afterRound()
287 if self.isDel or self.owner.isDead or self.buffData.round == 0 then return end 280 if self.isDel or self.owner.isDead or self.buffData.round == 0 then return end
src/adv/AdvPlayer.lua
@@ -444,6 +444,14 @@ function Player:changeSp(value, cType) @@ -444,6 +444,14 @@ function Player:changeSp(value, cType)
444 self.battle.adv:pushBackEvent(AdvBackEventType.SpChange) 444 self.battle.adv:pushBackEvent(AdvBackEventType.SpChange)
445 end 445 end
446 446
  447 +--战斗结束了扣战斗buff次数
  448 +function Player:effectBattleBuff()
  449 + for _, buff in ipairs(self.buffs) do
  450 + if not buff.isDel and buff:getType() == Buff.BATTLE_BUFF then
  451 + buff:effect()
  452 + end
  453 + end
  454 +end
447 455
448 function Player:getDB() 456 function Player:getDB()
449 local db = Player.super.getDB(self) 457 local db = Player.super.getDB(self)