Commit 821f2b60820248d1006e8c5b30aebedc9ff15b4e

Authored by suhongyang
1 parent 65de8cf1

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

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