1.1.5 - passive talent callbacks don't trigger correctly

Where bugs go to lie down and rest

Moderator: Moderator

Post Reply
Message
Author
Doctornull
Sher'Tul Godslayer
Posts: 2402
Joined: Tue Jun 18, 2013 10:46 pm
Location: Ambush!

1.1.5 - passive talent callbacks don't trigger correctly

#1 Post by Doctornull »

Callbacks don't seem to trigger unless I designate a "passives" function inside the passive talent.
Check out my addons: Nullpack (classes), Null Tweaks (items & talents), and New Gems fork.

darkgod
Master of Eyal
Posts: 10751
Joined: Wed Jul 24, 2002 9:26 pm
Location: Angolwen
Contact:

Re: 1.1.5 - passive talent callbacks don't trigger correctly

#2 Post by darkgod »

can you show code to replicate that ?
[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning ;)

Doctornull
Sher'Tul Godslayer
Posts: 2402
Joined: Tue Jun 18, 2013 10:46 pm
Location: Ambush!

Re: 1.1.5 - passive talent callbacks don't trigger correctly

#3 Post by Doctornull »

Code: Select all

   newTalent{
      name = "Twist the Knife", short_name = "NULL_BLOOD_TWIST_THE_KNIFE",
      type = {"corruption/blood-magic", 3},
      require = lowReqGen('mag', 3),
      points = 5,
      mode = "passive",

      callbackOnMeleeAttack = function(self, t, target, hitted, crit, weapon, damtype, mult, dam)
	 if hitted and target and (not target.dead) then
	    if rng.percent( t.getChance(self, t) ) then
	       print("[NULLPACK] attempting Twist the Knife via Melee")
	       t.doStab(self, t, target)
	    else
	       print("[NULLPACK] tried Twist the Knife, but RNG says no")
	    end
	 end
      end,

      vimBonus = function(self, t)
	 return self:getTalentLevelRaw(t)
      end,

      passives = function(self, t, p) -- Remove this section, and the callbackOnMeleeAttack never prints log messages
	 local vim  = t.vimBonus(self, t)
	 self:talentTemporaryValue(p, "vim_on_crit", vim)
      end,

      getChance = function(self, t)
	 return self:combatTalentLimit(t, 90, 8, 30)
      end,

      getDuration = function(self, t)
	 return math.ceil(self:combatTalentLimit(t, 10, 1, 4))
      end,

      doStab = function(self, t, target)
	 local qualified = false
	 for eff_id, p in pairs(target.tmp) do
	    local e = target.tempeffect_def[eff_id]
	    qualified = qualified or e.subtype.cut or e.subtype.disease or e.subtype.poison or e.subtype.wound
	    if qualified then break end
	 end
	 if not qualified then return nil end

	 local try_effect = {'slow', 'stun', 'blind', 'silence'}
	 local effect = {}
	 for i,e in ipairs(try_effect) do
	    if target:canBe(e) then effect[#effect+1] = e end
	 end

	 if not effect then return nil end

	 local e = rng.table( effect )
	 local apply_power = math.max(self:combatSpellpower(), self:combatAttack())
	 local dur = t.getDuration(self, t)

	 if 'stun' == e then
	    target:setEffect(target.EFF_STUNNED, dur, {src=self, apply_power=apply_power })
	 elseif 'slow' == e then
	    target:setEffect(target.EFF_SLOW, dur, {src=self, apply_power=apply_power, power=0.3 })
	 elseif 'blind' == e then
	    target:setEffect(target.EFF_BLINDED, dur, {src=self, apply_power=apply_power })
	 elseif 'silence' == e then
	    target:setEffect(target.EFF_SILENCED, dur, {src=self, apply_power=apply_power })
	 else
	    print("[NULLPACK] unexpected effect value '%s' in talent '%s'", e, t.name)
	 end
      end,

      info = function(self, t)
	 local chance = t.getChance(self, t)
	 local dur = t.getDuration(self, t)
	 local vim  = t.vimBonus(self, t)

	 return ([[You have a talent for causing things pain. When you strike a foe in melee who is already suffering from a disease, a cut, or a poison effect, you may increase its suffering: you have a %d%% chance to inflict slow, stun, blindness or silence on your target for %d turns. You inflict this effect with your Accuracy or your Spellpower, whichever is greater.
  Also, when you cast a critical spell, you regain %0.2f Vim.]]
	 ):format( chance, dur, vim )
      end,
   }
Check out my addons: Nullpack (classes), Null Tweaks (items & talents), and New Gems fork.

Post Reply