c8ade4f6
 
  suhongyang
 
被动筛选逻辑
 | 
1
2
3 
 | 
  local Filter = class("Filter")
  
  Filter.HP_UP_WITH_EQUAL = 1 -- 血量>=value%
 
 | 
1cb78a24
 
  suhongyang
 
passive的筛选
 | 
4
5
6
7
8 
 | 
  Filter.HP_UP = 2 -- 血量>value%
  Filter.HP_LOW_WITH_EQUAL = 3 -- 血量<=value%
  Filter.HP_LOW = 4 -- 血量<value%
  Filter.BUFF_BY_TYPE = 5 -- 指定类型buff
  Filter.BUFF_BY_ID = 6 -- 指定id的buff
 
 | 
bf73a8e5
 
  zhouhaihai
 
阵营
 | 
9 
 | 
  Filter.CAMP = 7 -- 玩家是指定阵营
 
 | 
6826fdf6
 
  zhouhaihai
 
被动触发
 | 
10
11 
 | 
  Filter.RANGE = 8 -- 筛选范围 (触发是地块)
  Filter.CLASSIFY = 9 -- 标签
 
 | 
58450dab
 
  zhouhaihai
 
被动条件增加
 | 
12 
 | 
  Filter.NO_BUFF_BY_ID = 10 -- 没有指定id的buff
 
 | 
c8ade4f6
 
  suhongyang
 
被动筛选逻辑
 | 
13
14
15
16
17
18
19 
 | 
  
  local FilterFactory = {}
  FilterFactory[Filter.HP_UP_WITH_EQUAL] = function (_Filter)
  	_Filter._execute = function (self, target)
  		return target.hp >= self.value * target.hpMax / 100
  	end
  end
 
 | 
1cb78a24
 
  suhongyang
 
passive的筛选
 | 
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44 
 | 
  FilterFactory[Filter.HP_UP] = function (_Filter)
  	_Filter._execute = function (self, target)
  		return target.hp > self.value * target.hpMax / 100
  	end
  end
  FilterFactory[Filter.HP_LOW_WITH_EQUAL] = function (_Filter)
  	_Filter._execute = function (self, target)
  		return target.hp <= self.value * target.hpMax / 100
  	end
  end
  FilterFactory[Filter.HP_LOW] = function (_Filter)
  	_Filter._execute = function (self, target)
  		return target.hp < self.value * target.hpMax / 100
  	end
  end
  FilterFactory[Filter.BUFF_BY_TYPE] = function (_Filter)
  	_Filter._execute = function (self, target)
  		return target:hadBuff(self.value)
  	end
  end
  FilterFactory[Filter.BUFF_BY_ID] = function (_Filter)
  	_Filter._execute = function (self, target)
  		return target:hadBuffById(self.value)
  	end
  end
 
 | 
bf73a8e5
 
  zhouhaihai
 
阵营
 | 
45
46
47
48
49
50 
 | 
  FilterFactory[Filter.CAMP] = function (_Filter)
  	_Filter._execute = function (self, target)
  		local role = self.owner.battle.adv.owner
  		return role:getHerosCamp(role:getProperty("advTeam").heros) == self.value
  	end
  end
 
 | 
6826fdf6
 
  zhouhaihai
 
被动触发
 | 
51
52 
 | 
  FilterFactory[Filter.RANGE] = function (_Filter)
  	_Filter._execute = function (self, target, params)
 
 | 
e587a3aa
 
  zhouhaihai
 
passive 距离生效bug
 | 
53 
 | 
  		if params and self.owner.blockId and self.owner.roomId  and params.blockId and params.roomId then
 
 | 
6826fdf6
 
  zhouhaihai
 
被动触发
 | 
54
55
56
57
58
59 
 | 
  			local distance = self.owner.battle.adv:getCurMap():getDistance(self.owner.roomId, self.owner.blockId, params.roomId, params.blockId)
  			return distance ~= -1 and distance <= self.value
  		end
  		return false
  	end
  end
 
 | 
6826fdf6
 
  zhouhaihai
 
被动触发
 | 
60
61 
 | 
  FilterFactory[Filter.CLASSIFY] = function (_Filter)
  	_Filter._execute = function (self, target)
 
 | 
1e789624
 
  zhouhaihai
 
新的 buff 效果
 | 
62 
 | 
  		return target.isClassify and target:isClassify(self.value)
 
 | 
6826fdf6
 
  zhouhaihai
 
被动触发
 | 
63
64 
 | 
  	end
  end
 
 | 
c8ade4f6
 
  suhongyang
 
被动筛选逻辑
 | 
65 
 | 
  
 
 | 
58450dab
 
  zhouhaihai
 
被动条件增加
 | 
66
67
68
69
70
71 
 | 
  FilterFactory[Filter.NO_BUFF_BY_ID] = function (_Filter)
  	_Filter._execute = function (self, target)
  		return not target:hadBuffById(self.value)
  	end
  end
  
 
 | 
c8ade4f6
 
  suhongyang
 
被动筛选逻辑
 | 
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94 
 | 
  function Filter:ctor(params)
  	self.owner = params.owner
  	self.skill = params.skill
  	self.fType = params.fType -- 筛选类型
  	self.oType = params.oType -- 主体类型 0:owner 1:trigger 2:releaser
  	self.value = params.value -- 筛选值
  	
  	if FilterFactory[self.fType] then
  		FilterFactory[self.fType](self)
  	end
  end
  
  function Filter:getTarget(params)
  	local target
  	if self.oType == 0 then
  		target = self.owner
  	end
  	if self.oType == 1 and params.trigger then
  		target = params.trigger
  	end
  	if self.oType == 2 and params.releaser then
  		target = params.releaser
  	end
 
 | 
58450dab
 
  zhouhaihai
 
被动条件增加
 | 
95
96
97 
 | 
  	if self.oType == 3 then
  		target = self.owner.battle.player
  	end
 
 | 
c8ade4f6
 
  suhongyang
 
被动筛选逻辑
 | 
98
99
100
101
102
103
104
105 
 | 
  	return target
  end
  
  function Filter:execute(params)
  	local target = self:getTarget(params)
  	if not target then
  		return
  	end
 
 | 
e587a3aa
 
  zhouhaihai
 
passive 距离生效bug
 | 
106
107 
 | 
  
  	return self:_execute(target, params)
 
 | 
c8ade4f6
 
  suhongyang
 
被动筛选逻辑
 | 
108
109
110 
 | 
  end
  
  -->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
111
112
113
114
115 
 | 
  local Passive = class("Passive")
  
  -- 每回合触发的使用 afterRound
  -- 其他触发的使用 triggerPassive 
  
 
 | 
02c4de8d
 
  zhouahaihai
 
增加 固有技
 | 
116
117 
 | 
  Passive.BORN_ONCE = 1 -- 自身出生(翻开所在格子)触发
  Passive.ROOM_SHOW = 2 --自身所在房间被展示时,触发1次 
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
118
119
120
121
122
123 
 | 
  Passive.HURT_PERCENT_SELF = 3 --自身,每损失N%生命值,触发1次
  Passive.HURT_PERCENT_TEAM = 4 --队友,每损失N%生命值,触发1次
  Passive.HP_LOW_SELF = 5 --自身生命值<N%时,每回合触发
  Passive.HP_LOW_TEAM = 6 --敌人生命值<N%时,每回合触发
  Passive.HP_UP_SELF = 7 --自身生命值>N%时,每回合触发
  Passive.HP_UP_TEAM = 8 --敌人生命值>N%时,每回合触发
 
 | 
d3da3368
 
  zhouhaihai
 
冒险地图被动技, buff  神器
 | 
124
125
126
127 
 | 
  Passive.SELF_ATK = 9 --自身攻击N次后,触发1次 < discard >
  Passive.SELF_HURT = 10 --自身受击buff后,触发1次
  Passive.TEAM_ATK = 11 --队友攻击N次后,触发1次 < discard >
  Passive.TEAM_HURT = 12 --队友受击buff后,触发1次 
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
128
129
130
131
132
133 
 | 
  Passive.MONSTER_COUNT_UP = 13  --场上存在N个以上怪物,每回合触发
  Passive.MONSTER_COUNT_LOW = 14  --场上存在N个以下怪物,每回合触发
  Passive.SELF_DEAD = 15 --自身死亡后,触发1次
  Passive.TEAM_DEAD = 16 --队友死亡后,触发1次
  Passive.TARGET_SKILL = 17 --目标每使用N次技能,触发1次
  Passive.TEAM_SKILL = 18 --队友每使用N次技能,触发1次
 
 | 
02c4de8d
 
  zhouahaihai
 
增加 固有技
 | 
134 
 | 
  
 
 | 
d3da3368
 
  zhouhaihai
 
冒险地图被动技, buff  神器
 | 
135
136
137
138
139
140
141
142
143
144
145 
 | 
  Passive.HAVE_MONSTER = 20 --场上拥有指定怪时 回合触发
  Passive.SKILL_KILL = 21 --技能击杀怪物时 触发1次
  Passive.CLICK_TRAP = 22 --触发陷阱时 触发1次
  Passive.DOWN_LAYER = 23 --下层时 触发1次
  Passive.ADV_OVER = 24 --结算时 触发1次
  Passive.BATTLE_WIN = 25 --战斗胜利x次时
  Passive.CLICK_DROP = 26 --拾取drop x次时
  Passive.AFTER_ROUND = 27 --经过 x回合时
  Passive.GET_BUFF = 28 --获得指定buff
  Passive.OPEN_BLOCK = 29 --翻开格子
  Passive.OPEN_MONSTER = 30 --翻开怪物
 
 | 
95065b5b
 
  zhouhaihai
 
被动技新
 | 
146 
 | 
  Passive.PLAYER_BUFF = 31 --玩家获得buff
 
 | 
6826fdf6
 
  zhouhaihai
 
被动触发
 | 
147 
 | 
  
 
 | 
04b84e1e
 
  zhouhaihai
 
被动
 | 
148 
 | 
  Passive.PLAYER_BUFF_CLASSIFY = 35 -- 获得指定标签的buff
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
149
150 
 | 
  
  -- 不同的开启条件
 
 | 
02c4de8d
 
  zhouahaihai
 
增加 固有技
 | 
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170 
 | 
  local PassiveCondFactory = {}
  PassiveCondFactory[Passive.HURT_PERCENT_SELF] = function(_Passive)
  	_Passive._trigger = function(self, params)
  		local value = params.value or 1
  		self.rv = math.floor(self.rv + value)
  		if self.rv >= self.passiveData.value then
  			self.rv = self.rv % self.passiveData.value  -- 取余
  			return true
  		end
  	end
  	_Passive._initDB = function(self, data)
  		self.rv = data.rv or 0
  	end
  	_Passive._getDB = function(self)
  		return {rv = self.rv}
  	end
  end
  
  PassiveCondFactory[Passive.HURT_PERCENT_TEAM] = PassiveCondFactory[Passive.HURT_PERCENT_SELF]  --逻辑相同
  PassiveCondFactory[Passive.SELF_ATK] = PassiveCondFactory[Passive.HURT_PERCENT_SELF]  --逻辑相同
 
 | 
02c4de8d
 
  zhouahaihai
 
增加 固有技
 | 
171 
 | 
  PassiveCondFactory[Passive.TEAM_ATK] = PassiveCondFactory[Passive.HURT_PERCENT_SELF]  --逻辑相同
 
 | 
02c4de8d
 
  zhouahaihai
 
增加 固有技
 | 
172
173 
 | 
  PassiveCondFactory[Passive.TARGET_SKILL] = PassiveCondFactory[Passive.HURT_PERCENT_SELF]  --逻辑相同
  PassiveCondFactory[Passive.TEAM_SKILL] = PassiveCondFactory[Passive.HURT_PERCENT_SELF]  --逻辑相同
 
 | 
d3da3368
 
  zhouhaihai
 
冒险地图被动技, buff  神器
 | 
174
175
176
177
178
179
180
181 
 | 
  PassiveCondFactory[Passive.BATTLE_WIN] = PassiveCondFactory[Passive.HURT_PERCENT_SELF]  --逻辑相同
  PassiveCondFactory[Passive.CLICK_DROP] = PassiveCondFactory[Passive.HURT_PERCENT_SELF]  --逻辑相同
  PassiveCondFactory[Passive.AFTER_ROUND] = PassiveCondFactory[Passive.HURT_PERCENT_SELF]  --逻辑相同
  PassiveCondFactory[Passive.OPEN_BLOCK] = PassiveCondFactory[Passive.HURT_PERCENT_SELF]  --逻辑相同
  
  PassiveCondFactory[Passive.SELF_HURT] = function(_Passive)
  	_Passive._trigger = function(self, params)
  		local buffId = params.buffId
 
 | 
f5e38251
 
  zhouhaihai
 
数据保护
 | 
182 
 | 
  		if not buffId then return end
 
 | 
d3da3368
 
  zhouhaihai
 
冒险地图被动技, buff  神器
 | 
183 
 | 
  		local data = csvdb["adv_map_buffCsv"][buffId]
 
 | 
f5e38251
 
  zhouhaihai
 
数据保护
 | 
184 
 | 
  		if not data then return end
 
 | 
1e6f6a8a
 
  zhouhaihai
 
免疫 清除buff  增加新效果
 | 
185 
 | 
  		if data.classify:sismember(self.passiveData.value, " ") then
 
 | 
d3da3368
 
  zhouhaihai
 
冒险地图被动技, buff  神器
 | 
186
187
188
189
190
191 
 | 
  			return true
  		end
  	end
  end
  PassiveCondFactory[Passive.TEAM_HURT] = PassiveCondFactory[Passive.SELF_HURT]  --逻辑相同
  
 
 | 
02c4de8d
 
  zhouahaihai
 
增加 固有技
 | 
192
193
194
195 
 | 
  
  PassiveCondFactory[Passive.ROOM_SHOW] = function(_Passive)
  	_Passive._trigger = function(self, params)
  		local roomId = params.roomId
 
 | 
d3da3368
 
  zhouhaihai
 
冒险地图被动技, buff  神器
 | 
196 
 | 
  		if self.owner.roomId == roomId then
 
 | 
02c4de8d
 
  zhouahaihai
 
增加 固有技
 | 
197
198
199
200
201 
 | 
  			return true
  		end
  	end
  end
  
 
 | 
d3da3368
 
  zhouhaihai
 
冒险地图被动技, buff  神器
 | 
202
203
204
205
206
207
208 
 | 
  PassiveCondFactory[Passive.GET_BUFF] = function(_Passive)
  	_Passive._trigger = function(self, params)
  		if self.passiveData.value == params.buffId then
  			return true
  		end
  	end
  end
 
 | 
95065b5b
 
  zhouhaihai
 
被动技新
 | 
209 
 | 
  PassiveCondFactory[Passive.PLAYER_BUFF] = PassiveCondFactory[Passive.GET_BUFF]
 
 | 
d3da3368
 
  zhouhaihai
 
冒险地图被动技, buff  神器
 | 
210 
 | 
  
 
 | 
04b84e1e
 
  zhouhaihai
 
被动
 | 
211
212 
 | 
  PassiveCondFactory[Passive.PLAYER_BUFF_CLASSIFY] = function(_Passive)
  	_Passive._trigger = function(self, params)
 
 | 
1556be8b
 
  zhouhaihai
 
判断错误
 | 
213 
 | 
  		if params.classify:sismember(self.passiveData.value, " ") then
 
 | 
04b84e1e
 
  zhouhaihai
 
被动
 | 
214
215
216
217
218 
 | 
  			return true
  		end
  	end
  end
  
 
 | 
d3da3368
 
  zhouhaihai
 
冒险地图被动技, buff  神器
 | 
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238 
 | 
  
  PassiveCondFactory[Passive.BORN_ONCE] = function(_Passive)
  	_Passive._afterRound = function(self)
  		if not self.owner.lock then
  			self:trigger(Passive.BORN_ONCE)
  		end
  	end
  end
  
  PassiveCondFactory[Passive.HAVE_MONSTER] = function(_Passive)
  	_Passive._afterRound = function(self)
  		for _, player in ipairs(self.owner.battle.player:getTeam(2)) do
  			if player.monsterId == self.passiveData.value then
  				self:trigger(Passive.HAVE_MONSTER)
  				break
  			end
  		end
  	end
  end
  
 
 | 
02c4de8d
 
  zhouahaihai
 
增加 固有技
 | 
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292 
 | 
  PassiveCondFactory[Passive.HP_LOW_SELF] = function(_Passive)
  	_Passive._afterRound = function(self)
  		if self.owner.hp / self.owner.hpMax * 100 < self.passiveData.value then
  			self:trigger(Passive.HP_LOW_SELF)
  		end
  	end
  end
  
  PassiveCondFactory[Passive.HP_LOW_TEAM] = function(_Passive)
  	_Passive._afterRound = function(self)
  		for _, player in ipairs(self.owner:getTeam(2)) do
  			if player.hp / player.hpMax * 100 < self.passiveData.value then
  				self:trigger(Passive.HP_LOW_TEAM, {trigger = player})
  			end
  		end
  	end
  end
  
  PassiveCondFactory[Passive.HP_UP_SELF] = function(_Passive)
  	_Passive._afterRound = function(self)
  		if self.owner.hp / self.owner.hpMax * 100 > self.passiveData.value then
  			self:trigger(Passive.HP_UP_SELF)
  		end
  	end
  end
  
  PassiveCondFactory[Passive.HP_UP_TEAM] = function(_Passive)
  	_Passive._afterRound = function(self)
  		for _, player in ipairs(self.owner:getTeam(2)) do
  			if player.hp / player.hpMax * 100 > self.passiveData.value then
  				self:trigger(Passive.HP_UP_TEAM, {trigger = player})
  			end
  		end
  	end
  end
  
  PassiveCondFactory[Passive.MONSTER_COUNT_UP] = function(_Passive)
  	_Passive._afterRound = function(self)
  		local monsters = self.owner.battle.player:getTeam(2)
  		if #monsters > self.passiveData.value then
  			self:trigger(Passive.MONSTER_COUNT_UP)
  		end
  	end
  end
  
  PassiveCondFactory[Passive.MONSTER_COUNT_LOW] = function(_Passive)
  	_Passive._afterRound = function(self)
  		local monsters = self.owner.battle.player:getTeam(2)
  		if #monsters < self.passiveData.value then
  			self:trigger(Passive.MONSTER_COUNT_LOW)
  		end
  	end
  end
  
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
293
294
295
296
297 
 | 
  
  function Passive:ctor(owner, data)
  	self.owner = owner
  	self.id = data.id
  	self.level = data.level or 1
 
 | 
3b0526d2
 
  zhouhaihai
 
冒险demo
 | 
298 
 | 
  	self.passiveData = csvdb["adv_map_passiveCsv"][self.id][self.level]
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
299
300 
 | 
  	self.isDel = false
  	self.round = data.round or 0	--触发剩余回合数
 
 | 
65de8cf1
 
  suhongyang
 
被动逻辑进一步修缮
 | 
301
302 
 | 
  	self.count = data.count or self.passiveData.count	--触发剩余次数
  	self.delay = data.delay or self.passiveData.delayRound    --触发延迟回合数
 
 | 
9c8e9482
 
  zhouhaihai
 
buff  被动 限定地图
 | 
303
304
305 
 | 
  	if self.passiveData.mapLock == 1 and not self.mapId then
  		self.mapId = self.owner.battle.adv:getCurMap().mapId
  	end
 
 | 
1b0d767f
 
  suhongyang
 
一個被動支持多種effect
 | 
306
307 
 | 
  
  	self.effects = self.passiveData.effect:toTableArray(true)
 
 | 
c8ade4f6
 
  suhongyang
 
被动筛选逻辑
 | 
308 
 | 
  	self.filters = {}
 
 | 
821f2b60
 
  suhongyang
 
冒险战斗完善,增加battlebe...
 | 
309
310
311
312 
 | 
  
  	if self.passiveData.count < 0 then -- count < 0 无限次触发
  		self.count = 999
  	end
 
 | 
1b0d767f
 
  suhongyang
 
一個被動支持多種effect
 | 
313 
 | 
  	
 
 | 
02c4de8d
 
  zhouahaihai
 
增加 固有技
 | 
314
315
316 
 | 
  	if PassiveCondFactory[self.passiveData.condition] then
  		PassiveCondFactory[self.passiveData.condition](self)
  	end
 
 | 
c8ade4f6
 
  suhongyang
 
被动筛选逻辑
 | 
317 
 | 
  	self:initFilter()
 
 | 
02c4de8d
 
  zhouahaihai
 
增加 固有技
 | 
318
319 
 | 
  	if self._initDB then
  		self:_initDB(data)
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
320
321
322 
 | 
  	end
  end
  
 
 | 
c8ade4f6
 
  suhongyang
 
被动筛选逻辑
 | 
323
324
325
326
327
328
329
330 
 | 
  function Passive:initFilter()
  	local filterList = self.passiveData.filter:toTableArray(true)
  	for _, fParams in ipairs(filterList) do
  		local filter = Filter.new({owner = self.owner, skill = self, oType = fParams[1], fType = fParams[2], value = fParams[3] })
  		table.insert(self.filters, filter)
  	end
  end
  
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
331
332
333
334 
 | 
  function Passive:getCondType()
  	return self.passiveData.condition, self.passiveData.value
  end
  
 
 | 
c8ade4f6
 
  suhongyang
 
被动筛选逻辑
 | 
335 
 | 
  -- effect 生效篩選
 
 | 
1b0d767f
 
  suhongyang
 
一個被動支持多種effect
 | 
336
337
338
339 
 | 
  function Passive:canEffect(effType, effValue)
  	if self.owner.lock and effType ~= 3 then -- 锁定的只能触发翻开自己格子的固有技
  		return
  	end
 
 | 
4f0a5fae
 
  zhouhaihai
 
营养剂
 | 
340 
 | 
  	--禁用被动技
 
 | 
aa74d6ef
 
  zhouhaihai
 
掉落反馈
 | 
341 
 | 
  	local count = self.owner:getDisablePassiveCount()
 
 | 
871b3da3
 
  zhouhaihai
 
被动 取消
 | 
342
343 
 | 
  	local idx = self.owner:getPassiveIdx(self)
  	if count and idx and (count == 0 or idx <= count) then
 
 | 
4f0a5fae
 
  zhouhaihai
 
营养剂
 | 
344
345 
 | 
  		return
  	end
 
 | 
1b0d767f
 
  suhongyang
 
一個被動支持多種effect
 | 
346
347
348 
 | 
  	return true
  end
  
 
 | 
d3da3368
 
  zhouhaihai
 
冒险地图被动技, buff  神器
 | 
349 
 | 
  function Passive:effect(triggerPms)
 
 | 
cf584618
 
  zhouhaihai
 
效果发给客户端
 | 
350 
 | 
  	local hadEffect = false
 
 | 
6a323693
 
  zhouhaihai
 
有序的
 | 
351 
 | 
  	for _, effect in ipairs(self.effects) do
 
 | 
1b0d767f
 
  suhongyang
 
一個被動支持多種effect
 | 
352
353 
 | 
  		local effType = effect[1]
  		local effValue = effect[2]
 
 | 
d3da3368
 
  zhouhaihai
 
冒险地图被动技, buff  神器
 | 
354
355
356
357 
 | 
  		local otherPms = {}
  		for i = 3, #effect do
  			table.insert(otherPms, effect[i])
  		end
 
 | 
1b0d767f
 
  suhongyang
 
一個被動支持多種effect
 | 
358 
 | 
  		if self:canEffect(effType, effValue) then
 
 | 
cf584618
 
  zhouhaihai
 
效果发给客户端
 | 
359 
 | 
  			hadEffect = true
 
 | 
d3da3368
 
  zhouhaihai
 
冒险地图被动技, buff  神器
 | 
360 
 | 
  			self["effect" .. effType](self, effValue, triggerPms, table.unpack(otherPms))
 
 | 
1b0d767f
 
  suhongyang
 
一個被動支持多種effect
 | 
361
362 
 | 
  		end
  	end
 
 | 
cf584618
 
  zhouhaihai
 
效果发给客户端
 | 
363
364 
 | 
  	if hadEffect then
  		self.owner.battle.adv:pushBackEvent(AdvBackEventType.PassiveEffect, {id = self.id, level = self.level, roomId = self.owner.roomId, blockId = self.owner.blockId})
 
 | 
e6dc06cc
 
  zhouhaihai
 
拾荒bug  增加bug log
 | 
365 
 | 
  		buglog("Passive", "who: %s effect id: %s", self.owner.monsterId, self.id)
 
 | 
cf584618
 
  zhouhaihai
 
效果发给客户端
 | 
366 
 | 
  	end
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
367 
 | 
  	if self.count > 0 then
 
 | 
821f2b60
 
  suhongyang
 
冒险战斗完善,增加battlebe...
 | 
368 
 | 
  		self.count = self.count < 999 and self.count - 1 or self.count
 
 | 
65de8cf1
 
  suhongyang
 
被动逻辑进一步修缮
 | 
369
370 
 | 
  		self.round = self.passiveData.round
  	end
 
 | 
058a0cbb
 
  zhouhaihai
 
抽卡
 | 
371 
 | 
  	
 
 | 
7b2dc17c
 
  zhouhaihai
 
地图 层 buff passive
 | 
372 
 | 
  	if self.count <= 0 then  -- 次数 <= 0 并且一次冒险内不刷新,被动可以直接移除
 
 | 
058a0cbb
 
  zhouhaihai
 
抽卡
 | 
373
374 
 | 
  		self.isDel = true
  	end
 
 | 
65de8cf1
 
  suhongyang
 
被动逻辑进一步修缮
 | 
375
376 
 | 
  end
  
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
377 
 | 
  function Passive:afterRound()
 
 | 
e0c0365a
 
  zhouhaihai
 
反的判断
 | 
378 
 | 
  	if self.isDel or self.owner.isDead or self.owner.lock or self:isHide() then return end
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
379
380 
 | 
  	if self.round > 0 then  --回合触发的
  		self.round = self.round - 1
 
 | 
65de8cf1
 
  suhongyang
 
被动逻辑进一步修缮
 | 
381
382
383 
 | 
  	end
  	if self.delay > 0 then
  		self.delay = self.delay - 1
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
384 
 | 
  	end
 
 | 
cfeb432d
 
  zhouhaihai
 
冒险被动技 调整
 | 
385
386
387 
 | 
  	if self._afterRound then
  		self:_afterRound()  --有的触发自己检测在这里检查
  	end
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
388
389 
 | 
  end
  
 
 | 
7b2dc17c
 
  zhouhaihai
 
地图 层 buff passive
 | 
390
391
392
393
394
395 
 | 
  function Passive:afterLayer()
  	if self.passiveData.mapLock == 1 or self.passiveData.floorType == 1 then
  		self.isDel = true
  	end
  end
  
 
 | 
9c8e9482
 
  zhouhaihai
 
buff  被动 限定地图
 | 
396
397
398 
 | 
  -- 在当前阶段不可用 小透明 < 不会回合遍历  不会查找遍历  可以删除遍历  可以下层遍历 >
  function Passive:isHide()
  	if self.isDel then
 
 | 
e0c0365a
 
  zhouhaihai
 
反的判断
 | 
399 
 | 
  		return true
 
 | 
9c8e9482
 
  zhouhaihai
 
buff  被动 限定地图
 | 
400
401 
 | 
  	end
  	if self.passiveData.mapLock == 1 and self.mapId and self.owner.battle.adv:getCurMap().mapId ~= self.mapId  then
 
 | 
e0c0365a
 
  zhouhaihai
 
反的判断
 | 
402 
 | 
  		return true
 
 | 
9c8e9482
 
  zhouhaihai
 
buff  被动 限定地图
 | 
403 
 | 
  	end
 
 | 
e0c0365a
 
  zhouhaihai
 
反的判断
 | 
404 
 | 
  	return false
 
 | 
9c8e9482
 
  zhouhaihai
 
buff  被动 限定地图
 | 
405
406 
 | 
  end
  
 
 | 
65de8cf1
 
  suhongyang
 
被动逻辑进一步修缮
 | 
407
408 
 | 
  -- 可以触发
  function  Passive:canTrigger( )
 
 | 
9c8e9482
 
  zhouhaihai
 
buff  被动 限定地图
 | 
409 
 | 
  	return self.count > 0 and self.delay <= 0 and not self:isHide()
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
410
411
412 
 | 
  end
  
  function Passive:trigger(condType, params) --触发检查
 
 | 
02c4de8d
 
  zhouahaihai
 
增加 固有技
 | 
413
414 
 | 
  	params = params or {}
  	if self.isDel or self.owner.isDead then return end
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
415 
 | 
  	if self:getCondType() ~= condType then return end
 
 | 
e6dc06cc
 
  zhouhaihai
 
拾荒bug  增加bug log
 | 
416
417 
 | 
  
  	buglog("Passive", "who: %s trigger id: %s", self.owner.monsterId, self.id)
 
 | 
65de8cf1
 
  suhongyang
 
被动逻辑进一步修缮
 | 
418 
 | 
  	if not self:canTrigger() then return end
 
 | 
36c30c5c
 
  zhouahaihai
 
冒险
 | 
419 
 | 
  	if self._trigger then
 
 | 
02c4de8d
 
  zhouahaihai
 
增加 固有技
 | 
420 
 | 
  		if not self:_trigger(params) then return end  --检查
 
 | 
36c30c5c
 
  zhouahaihai
 
冒险
 | 
421 
 | 
  	end
 
 | 
c8ade4f6
 
  suhongyang
 
被动筛选逻辑
 | 
422
423
424
425
426
427 
 | 
  	if not self:filter(params) then
  		return
  	end
  	if math.randomInt(1, 100) > self.passiveData.chance then
  		return
  	end
 
 | 
76dc6fb7
 
  zhouhaihai
 
bug
 | 
428 
 | 
  	if self.round and self.round > 0 then  -- cd
 
 | 
65de8cf1
 
  suhongyang
 
被动逻辑进一步修缮
 | 
429 
 | 
  		return
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
430 
 | 
  	end
 
 | 
d3da3368
 
  zhouhaihai
 
冒险地图被动技, buff  神器
 | 
431 
 | 
  	self:effect(params)
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
432
433 
 | 
  end
  
 
 | 
c8ade4f6
 
  suhongyang
 
被动筛选逻辑
 | 
434
435
436
437
438
439
440
441
442 
 | 
  function Passive:filter(params)
  	for _, filter in ipairs(self.filters) do
  		if not filter:execute(params) then
  			return
  		end
  	end
  	return true
  end
  
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
443
444
445
446
447
448
449
450
451 
 | 
  function Passive:getDB()
  	local db = {}
  	if self._getDB then
  		db = self:_getDB()
  	end
  	db.id = self.id
  	db.level = self.level
  	db.round = self.round
  	db.count = self.count
 
 | 
65de8cf1
 
  suhongyang
 
被动逻辑进一步修缮
 | 
452 
 | 
  	db.delay = self.delay
 
 | 
9c8e9482
 
  zhouhaihai
 
buff  被动 限定地图
 | 
453
454
455 
 | 
  	if self.mapId then
  		db.mapId = self.mapId
  	end
 
 | 
36c30c5c
 
  zhouahaihai
 
冒险
 | 
456 
 | 
  	return db
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
457 
 | 
  end
 
 | 
02c4de8d
 
  zhouahaihai
 
增加 固有技
 | 
458
459 
 | 
  
  --默认=0=使用技能,
 
 | 
1b0d767f
 
  suhongyang
 
一個被動支持多種effect
 | 
460
461 
 | 
  function Passive:effect0(value)
  	self.owner:releaseSkill(value)
 
 | 
02c4de8d
 
  zhouahaihai
 
增加 固有技
 | 
462
463 
 | 
  end
  --1=自身获得buff
 
 | 
1b0d767f
 
  suhongyang
 
一個被動支持多種effect
 | 
464 
 | 
  function Passive:effect1(value)
 
 | 
0d405dc3
 
  suhongyang
 
Buff生命周期调整,被动加buf...
 | 
465 
 | 
  	self.owner:addBuff(value, self.owner)
 
 | 
02c4de8d
 
  zhouahaihai
 
增加 固有技
 | 
466
467 
 | 
  end
  --2=触发目标获得buff
 
 | 
d3da3368
 
  zhouhaihai
 
冒险地图被动技, buff  神器
 | 
468 
 | 
  function Passive:effect2(value, triggerPms)
 
 | 
26e6dd8b
 
  zhouhaihai
 
修改被动效果2
 | 
469
470
471 
 | 
  	local aim = triggerPms.trigger or self.owner.battle.player
  	if aim then
  		aim:addBuff(value, self.owner)
 
 | 
02c4de8d
 
  zhouahaihai
 
增加 固有技
 | 
472
473 
 | 
  	end
  end
 
 | 
26e6dd8b
 
  zhouhaihai
 
修改被动效果2
 | 
474 
 | 
  
 
 | 
1a04c06c
 
  zhouhaihai
 
冒险 被动调整
 | 
475 
 | 
  --3=翻开自己所在格子
 
 | 
d3da3368
 
  zhouhaihai
 
冒险地图被动技, buff  神器
 | 
476 
 | 
  function Passive:effect3(value)
 
 | 
6826fdf6
 
  zhouhaihai
 
被动触发
 | 
477 
 | 
  	if not self.owner.roomId or not self.owner.blockId then return end
 
 | 
d3da3368
 
  zhouhaihai
 
冒险地图被动技, buff  神器
 | 
478
479 
 | 
  	if value == 0 then
  		self.owner.battle.adv:getCurMap():openBlock(self.owner.roomId, self.owner.blockId)
 
 | 
1a04c06c
 
  zhouhaihai
 
冒险 被动调整
 | 
480
481
482
483
484
485 
 | 
  	elseif value > 0 then
  		self.owner.battle.adv:getCurMap():openBlocksBySize(self.owner.roomId, self.owner.blockId, value)
  	elseif value == -1 then -- 当前房间
  		self.owner.battle.adv:getCurMap():openBlocksByRoom(self.owner.roomId)
  	elseif value == -2 then  -- 当前层
  		self.owner.battle.adv:getCurMap():openAllBlocks(not self.owner.monsterId)
 
 | 
d3da3368
 
  zhouhaihai
 
冒险地图被动技, buff  神器
 | 
486 
 | 
  	end
 
 | 
02c4de8d
 
  zhouahaihai
 
增加 固有技
 | 
487
488
489 
 | 
  end
  --4=逃跑
  function Passive:effect4()
 
 | 
7828ffd0
 
  zhouhaihai
 
冒险 连续选择点 和 地图因子
 | 
490 
 | 
  	self.owner.isDead = 1 --跑了
 
 | 
02c4de8d
 
  zhouahaihai
 
增加 固有技
 | 
491 
 | 
  end
 
 | 
d3da3368
 
  zhouhaihai
 
冒险地图被动技, buff  神器
 | 
492
493
494 
 | 
  
  --5=召唤怪物
  function Passive:effect5(monsterId)
 
 | 
810c6151
 
  zhouhaihai
 
增加buff 效果31 地图被动刷...
 | 
495
496
497
498
499
500
501
502 
 | 
  	for _, buff in ipairs(self.owner.battle.player.buffs) do
  		if not buff.isDel and buff:getType() == buff.Buff_NO_PASSIVE_MONSTER then
  			local effect = buff:effect()
  			if effect == 0 or effect == monsterId then
  				return
  			end
  		end
  	end
 
 | 
d3da3368
 
  zhouhaihai
 
冒险地图被动技, buff  神器
 | 
503 
 | 
  	self.owner.battle.adv:getCurMap():addNewMonsterRand(monsterId)
 
 | 
d232676a
 
  zhouhaihai
 
功能解锁  冒险返回
 | 
504
505 
 | 
  	self.owner.battle.adv:pushBackEvent(AdvBackEventType.Monster, {id = monsterId})
  
 
 | 
d3da3368
 
  zhouhaihai
 
冒险地图被动技, buff  神器
 | 
506
507 
 | 
  end
  
 
 | 
fc93b122
 
  zhouhaihai
 
指定怪增加buff
 | 
508
509 
 | 
  --6=给所有场上怪物增加buff 《 限定 怪 id》
  function Passive:effect6(value, triggerPms, enemyId)
 
 | 
d95bc647
 
  zhouhaihai
 
冒险被动技
 | 
510
511 
 | 
  	local aims = self.owner.battle.player:getTeam(2)
  	for k , aim in pairs(aims) do
 
 | 
fc93b122
 
  zhouhaihai
 
指定怪增加buff
 | 
512
513
514 
 | 
  		if not enemyId or enemyId == 0 or aim.monsterId == enemyId then
  			aim:addBuff(value, self.owner)
  		end
 
 | 
7828ffd0
 
  zhouhaihai
 
冒险 连续选择点 和 地图因子
 | 
515
516 
 | 
  	end
  end
 
 | 
02c4de8d
 
  zhouahaihai
 
增加 固有技
 | 
517 
 | 
  
 
 | 
1a04c06c
 
  zhouhaihai
 
冒险 被动调整
 | 
518
519
520
521
522 
 | 
  --7=给自己加一個被動技能  --废弃
  -- function Passive:effect7(value)
  -- 	self.owner:addPassive({id = value})
  -- end
  
 
 | 
d3da3368
 
  zhouhaihai
 
冒险地图被动技, buff  神器
 | 
523
524 
 | 
  --8=获得drop,直接进入背包
  function Passive:effect8(dropId)
 
 | 
9284512a
 
  zhouhaihai
 
输出异常
 | 
525
526
527
528
529 
 | 
  	local dropData = csvdb["event_dropCsv"][dropId]
  	if not dropData then
  		skynet.error(string.format("CSVDATA Error  adv_map_passive %s effect 8 not id %s in event_drop", self.id, dropId))
  	end
  	local item = dropData["range"]:randWeight(true)
 
 | 
4b34fee8
 
  zhouhaihai
 
增加~= 0 判定
 | 
530
531
532 
 | 
  	if item[1] ~= 0 then
  		self.owner.battle.adv:award({[item[1]] = item[2]}, {log = {desc = "passive", int1 = self.id}}, {roomId = self.owner.roomId, blockId = self.owner.blockId})
  	end
 
 | 
d3da3368
 
  zhouhaihai
 
冒险地图被动技, buff  神器
 | 
533
534
535 
 | 
  end
  
  --9=直接获得item(可在结算触发时使用)
 
 | 
73d683e6
 
  zhouhaihai
 
新增倍数
 | 
536 
 | 
  function Passive:effect9(itemId, triggerPms, ratio, ratio2, max)
 
 | 
d3da3368
 
  zhouhaihai
 
冒险地图被动技, buff  神器
 | 
537
538
539
540
541
542
543
544
545 
 | 
  	local cond = nil
  	if self.passiveData.value == 0 then
  		cond = triggerPms.score
  	elseif self.passiveData.value == 1 then
  		cond = triggerPms.level
  	else
  		return
  	end
  	if not cond then return end
 
 | 
73d683e6
 
  zhouhaihai
 
新增倍数
 | 
546 
 | 
  	self.owner.battle.adv:award({[itemId] = math.floor(math.max(0, math.min(max, cond / ratio * ratio2)))}, {log = {desc = "passive", int1 = self.id}}, {roomId = self.owner.roomId, blockId = self.owner.blockId})
 
 | 
d3da3368
 
  zhouhaihai
 
冒险地图被动技, buff  神器
 | 
547
548
549 
 | 
  end
  
  --10=战斗额外掉落次数
 
 | 
debdc4f7
 
  zhouhaihai
 
bug
 | 
550 
 | 
  function Passive:effect10(count, triggerPms)
 
 | 
9104a922
 
  zhouhaihai
 
多重掉落
 | 
551
552
553
554 
 | 
  	if triggerPms.drops then
  		for _, drop in pairs(triggerPms.drops) do
  			drop[2] = drop[2] + math.floor(drop[2] * count)
  		end
 
 | 
d3da3368
 
  zhouhaihai
 
冒险地图被动技, buff  神器
 | 
555
556
557 
 | 
  	end
  end
  
 
 | 
2d87caee
 
  zhouhaihai
 
地块替换优化  新的效果类型
 | 
558
559
560
561
562
563
564
565
566
567 
 | 
  -- 将地图上的A事件替换成B事件					
  function Passive:effect11(eventTypeF, triggerPms, eventIdF, eventTypeT, eventIdT, count)
  	local change = self.owner.battle.adv:getCurMap():eventChangeToOther(eventTypeF, eventIdF, eventTypeT, eventIdT, count)
  	for _, one in ipairs(change) do
  		self.owner.battle.adv:backBlockChange(one[1].roomId, one[2].blockId)
  	end
  end
  
  -- 在指定地点召唤event项目							
  function Passive:effect12(eventType, triggerPms, eventId, count, stage)
 
 | 
d4ef50f0
 
  zhouhaihai
 
召唤怪物 指定地点 玩家buff 屏蔽
 | 
568
569
570
571
572
573
574
575
576
577 
 | 
  	if eventType == AdvEventType.Monster then
  		for _, buff in ipairs(self.owner.battle.player.buffs) do
  			if not buff.isDel and buff:getType() == buff.Buff_NO_PASSIVE_MONSTER then
  				local effect = buff:effect()
  				if effect == 0 or effect == eventId then
  					return
  				end
  			end
  		end
  	end
 
 | 
2d87caee
 
  zhouhaihai
 
地块替换优化  新的效果类型
 | 
578
579
580
581
582
583
584
585 
 | 
  	local change = self.owner.battle.adv:getCurMap():layEventToStage(eventType, eventId, count, stage)
  	for _, one in ipairs(change) do
  		self.owner.battle.adv:backBlockChange(one[1].roomId, one[2].blockId)
  	end
  end
  
  -- 移除指定项目					
  function Passive:effect13(eventType, triggerPms, eventId, count)
 
 | 
e1b26027
 
  zhouhaihai
 
增加移除项目排除功能
 | 
586
587
588
589
590 
 | 
  	local exclude = {}
  	if self.owner:is("Enemy") then
  		exclude[self.owner.roomId] = {[self.owner.blockId] = 1}
  	end
  	local change = self.owner.battle.adv:getCurMap():clearEventById(eventType, eventId, count, exclude)
 
 | 
2d87caee
 
  zhouhaihai
 
地块替换优化  新的效果类型
 | 
591
592
593
594
595 
 | 
  	for _, one in ipairs(change) do
  		self.owner.battle.adv:backBlockChange(one[1].roomId, one[2].blockId)
  	end
  end
  
 
 | 
05ab09a2
 
  zhouhaihai
 
新的被动效果
 | 
596
597
598
599
600
601
602
603
604
605
606
607 
 | 
  --14=给所有场上怪物增加buff 《 限定 怪 id》 除了自己
  function Passive:effect14(value, triggerPms, enemyId)
  	local aims = self.owner.battle.player:getTeam(2)
  	for k , aim in pairs(aims) do
  		if aim ~= self.owner then
  			if not enemyId or enemyId == 0 or aim.monsterId == enemyId then
  				aim:addBuff(value, self.owner)
  			end
  		end
  	end
  end
  
 
 | 
6826fdf6
 
  zhouhaihai
 
被动触发
 | 
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624 
 | 
  --15=翻开房间内的count 个怪 并且增加一个buff
  function Passive:effect15(count, triggerPms, buffId)
  	local roomId = self.owner.roomId
  	if not roomId then return end
  	local enemys = self.owner.battle.adv:getCurMap():openBlocksIsMonsterByRoom(roomId, count)
  	for _, e in ipairs(enemys) do
  		e:addBuff(buffId)
  	end
  end
  
  --16=转变 value 范围内的掉落物 为 id count
  function Passive:effect16(value, triggerPms, changeType)
  	if not self.owner.roomId or not self.owner.blockId then return end
  	local blocks = self.owner.battle.adv:getCurMap():getBlocksBySize(self.owner.roomId, self.owner.blockId, value)
  	self.owner.battle.adv:blockDropChange(changeType, blocks)
  end
  
 
 | 
e6dc06cc
 
  zhouhaihai
 
拾荒bug  增加bug log
 | 
625
626
627
628 
 | 
  --17=玩家获得buff
  function Passive:effect17(value, triggerPms)
  	self.owner.battle.player:addBuff(value, self.owner)
  end
 
 | 
2d87caee
 
  zhouhaihai
 
地块替换优化  新的效果类型
 | 
629 
 | 
  
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
630 
 | 
  return Passive
 
 |