Commit 821f2b60820248d1006e8c5b30aebedc9ff15b4e

Authored by suhongyang
1 parent 65de8cf1

冒险战斗完善,增加battlebegin阶段

src/adv/AdvBattle.lua
... ... @@ -97,8 +97,8 @@ end
97 97 function Battle:playerAtk(roomId, blockId)
98 98 local enemy = self:getEnemy(roomId, blockId)
99 99 if enemy then
100   - self.player:battleBgein()
101   - enemy:battleBgein()
  100 + self.player:battleBegin()
  101 + enemy:battleBegin()
102 102 while not enemy.isDead and not self.player.isDead do
103 103 -- 玩家先出手
104 104 self.adv:backAtk(nil, enemy.id)
... ...
src/adv/AdvBuff.lua
... ... @@ -201,7 +201,7 @@ function Buff:ctor(owner, id)
201 201 self.id = id
202 202 self.buffData = csvdb["adv_buffCsv"][self.id]
203 203 self.isDel = false
204   - self.duration = 0 --剩余的回合
  204 + self.round = 0 --剩余的回合
205 205 self.count = -1 -- 可生效的次数 -1 无次数限制
206 206  
207 207 if BuffFactory[self.buffData.type] then
... ... @@ -217,7 +217,7 @@ function Buff:initByDB(data)
217 217 self.release = self.owner.battle:getEnemyById(data.rele)
218 218 end
219 219 end
220   - self.duration = data.dur
  220 + self.round = data.round
221 221 if data.count then
222 222 self.count = data.count
223 223 end
... ... @@ -229,7 +229,7 @@ end
229 229  
230 230 function Buff:initNew(release, data)
231 231 self.release = release
232   - self.duration = self.buffData.duration
  232 + self.round = self.buffData.round
233 233 if self._init then
234 234 self:_init(data)
235 235 end
... ... @@ -241,9 +241,9 @@ function Buff:afterRound()
241 241 self:_afterRount()
242 242 end
243 243  
244   - if self.buffData.duration ~= 0 then
245   - self.duration = self.duration - 1
246   - if self.duration <= 0 then
  244 + if self.buffData.round ~= 0 then
  245 + self.round = self.round - 1
  246 + if self.round <= 0 then
247 247 self.isDel = true
248 248 end
249 249 end
... ... @@ -286,8 +286,8 @@ function Buff:getDB()
286 286 if self.release and not self.release.isDead then
287 287 db.rele = self.release.id or 0 --释放者的id (0 为玩家) (不存在 则释放者不存在或者已经死亡)
288 288 end
289   - if self.buffData.duration ~= 0 then
290   - db.dur = self.duration
  289 + if self.buffData.round ~= 0 then
  290 + db.round = self.round
291 291 end
292 292 if self.count ~= -1 then
293 293 db.count = self.count
... ...
src/adv/AdvPassive.lua
... ... @@ -206,6 +206,10 @@ function Passive:ctor(owner, data)
206 206  
207 207 self.effects = self.passiveData.effect:toTableArray(true)
208 208 self.filters = {}
  209 +
  210 + if self.passiveData.count < 0 then -- count < 0 无限次触发
  211 + self.count = 999
  212 + end
209 213  
210 214 if PassiveCondFactory[self.passiveData.condition] then
211 215 PassiveCondFactory[self.passiveData.condition](self)
... ... @@ -244,12 +248,8 @@ function Passive:effect(trigger)
244 248 self["effect" .. effType](self, effValue, trigger)
245 249 end
246 250 end
247   - --次数为 -1 一局只能触发一次,触发过后删掉就可以
248   - if self.count == -1 then
249   - self.isDel = true
250   - end
251 251 if self.count > 0 then
252   - self.count = self.count - 1
  252 + self.count = self.count < 999 and self.count - 1 or self.count
253 253 self.round = self.passiveData.round
254 254 end
255 255 end
... ...
src/adv/AdvPlayer.lua
... ... @@ -78,9 +78,9 @@ function BaseObject:clear()
78 78 self.passives = {}
79 79 end
80 80  
81   -function BaseObject:battleBgein()
  81 +function BaseObject:battleBegin()
82 82 for _, passive in ipairs(self.passives) do
83   - passive:battleBgein()
  83 + passive:battleBegin()
84 84 end
85 85 -- for _, buff in ipairs(self.buffs) do
86 86 -- buff:afterRound(self)
... ...