Commit a5f7fb800f9fea1016837b72d73e2a3250162561

Authored by DarkGod
2 parents c889e811 772000e1

Merge branch 'the-cure-cure' into 'master'

FOR1.8: Update Disintegration. Change proc tracking from callbackOnActBase to a turn_pro…

…c, fix call to removeEffectsFilter, restore tracking The Cure achievement.

See merge request !736
... ... @@ -273,52 +273,31 @@ newTalent{
273 273 doStrip = function(self, t, target, type)
274 274 local what = type == "PHYSICAL" and "physical" or "magical"
275 275 local p = self:isTalentActive(self.T_DISINTEGRATION)
276   -
277   - if what == "physical" and p.physical[target] then return end
278   - if what == "magical" and p.magical[target] then return end
  276 + self.turn_procs.disintegration_physical = self.turn_procs.disintegration_physical or {}
  277 + self.turn_procs.disintegration_magical = self.turn_procs.disintegration_magical or {}
  278 + if what == "physical" and self.turn_procs.disintegration_physical[target] then return end
  279 + if what == "magical" and self.turn_procs.disintegration_magical[target] then return end
279 280
280 281 if rng.percent(t.getChance(self, t)) then
281   - local effs = {}
282   - -- Go through all spell effects
283   - for eff_id, p in pairs(target.tmp) do
284   - local e = target.tempeffect_def[eff_id]
285   - if e.type == what and e.status == "beneficial" then
286   - effs[#effs+1] = {"effect", eff_id}
287   - end
288   - end
289   -
290   - if #effs > 0 then
291   - local eff = rng.tableRemove(effs)
292   - if eff[1] == "effect" then
293   - if target:removeEffect(eff[2], self) then
294   - game.logSeen(self, "#CRIMSON#%s's beneficial effect was stripped!#LAST#", target:getName():capitalize())
295   - if what == "physical" then p.physical[target] = true end
296   - if what == "magical" then p.magical[target] = true end
297   -
298   - -- The Cure achievement
299   - local acheive = self.player and not target.training_dummy and target ~= self
300   - if acheive then
301   - world:gainAchievement("THE_CURE", self)
302   - end
303   - end
  282 + -- effect filter
  283 + local filter = {type = what, status = "beneficial"}
  284 + if target:removeEffectsFilter(self, filter, 1) > 0 then
  285 + game.logSeen(self, "#CRIMSON#%s's beneficial effect was stripped!#LAST#", target:getName():capitalize())
  286 + if what == "physical" then self.turn_procs.disintegration_physical[target] = true end
  287 + if what == "magical" then self.turn_procs.disintegration_magical[target] = true end
  288 +
  289 + -- The Cure achievement
  290 + local acheive = self.player and not target.training_dummy and target ~= self
  291 + if acheive then
  292 + world:gainAchievement("THE_CURE", self)
304 293 end
305 294 end
306 295 end
307 296 end,
308   - callbackOnActBase = function(self, t)
309   - -- reset our targets
310   - local p = self:isTalentActive(self.T_DISINTEGRATION)
311   - if p then
312   - p.physical = {}
313   - p.magical = {}
314   - end
315   - end,
316 297 activate = function(self, t)
317 298 game:playSoundNear(self, "talents/earth")
318 299
319   - local ret = {
320   - physical = {}, magical ={}
321   - }
  300 + local ret = { }
322 301 if core.shader.active(4) then
323 302 ret.particle = self:addParticles(Particles.new("shader_ring_rotating", 1, {rotation=-0.01, radius=1.2}, {type="stone", hide_center=1, zoom=0.6, color1={0.4, 0.4, 0, 1}, color2={0.5, 0.5, 0, 1}, xy={self.x, self.y}}))
324 303 end
... ...