Guest User

Insanity

a guest
Sep 18th, 2014
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.81 KB | None | 0 0
  1. newTalent{
  2.     name = "Insanity", shortname = "INSANITY"
  3.     type = {"cursed/horror", 3},
  4.     points = 5,
  5.     mode = "passive",
  6.     require = cursed_wil_req2,
  7.     on_learn = function(self, t)
  8.         local lev = self:getTalentLevelRaw(t)
  9.         if lev == 1 then
  10.             self:learnTalent(self.T_TYRANT), true, nil, {no_unlearn=true})
  11.         elseif lev == 2 then
  12.             self:learnTalent(self.TYRANT), true, nil, {no_unlearn=true})
  13.         elseif lev == 3 then
  14.             self:learnTalent(self.T_TYRANT), true, nil, {no_unlearn=true})
  15.         elseif lev == 4 then
  16.             self:learnTalent(self.T_TYRANT), true, nil, {no_unlearn=true})
  17.         elseif lev == 5 then
  18.             self:learnTalent(self.T_TYRANT), true, nil, {no_unlearn=true})
  19.         end
  20.     end,
  21.     on_unlearn = function(self, t)
  22.         local lev = self:getTalentLevelRaw(t)
  23.         if lev == 0 then
  24.             self:unlearnTalent(self.T_TYRANT)
  25.         elseif lev == 1 then
  26.             self:unlearnTalent(self.T_TYRANT)
  27.         elseif lev == 2 then
  28.             self:unlearnTalent(self.T_TYRANT)
  29.         elseif lev == 3 then
  30.             self:unlearnTalent(self.T_TYRANT)
  31.         elseif lev == 4 then
  32.             self:unlearnTalent(self.T_TYRANT)
  33.         end
  34.     end,
  35.    
  36.     getChance = function(self, t) return self:combatLimit(self:getTalentLevel(t)^0.5, 100, 8, 1, 17.9, 2.23) end, -- Limit < 100%
  37.     getMindResistChange = function(self, t) return -self:combatTalentLimit(t, 50, 15, 35) end, -- Limit < 50%
  38.     doMadness = function(target, t, src)
  39.         local chance = t.getChance(src, t)
  40.         if target and src and target:reactionToward(src) < 0 and src:checkHit(src:combatMindpower(), target:combatMentalResist(), 0, chance, 5) then
  41.             local mindResistChange = t.getMindResistChange(src, t)
  42.             local effect = rng.range(1, 3)
  43.             if effect == 1 then
  44.                 -- confusion
  45.                 if target:canBe("confusion") and not target:hasEffect(target.EFF_MADNESS_CONFUSED) then
  46.                     target:setEffect(target.EFF_MADNESS_CONFUSED, 3, {power=50, mindResistChange=mindResistChange}) -- Consistent with other confusion
  47.                 end
  48.             elseif effect == 2 then
  49.                 -- stun
  50.                 if target:canBe("stun") and not target:hasEffect(target.EFF_MADNESS_STUNNED) then
  51.                     target:setEffect(target.EFF_MADNESS_STUNNED, 3, {mindResistChange=mindResistChange})
  52.                 end
  53.             elseif effect == 3 then
  54.                 -- slow
  55.                 if target:canBe("slow") and not target:hasEffect(target.EFF_MADNESS_SLOW) then
  56.                     target:setEffect(target.EFF_MADNESS_SLOW, 3, {power=0.3, mindResistChange=mindResistChange})
  57.                 end
  58.             end
  59.         end
  60.     end,
  61.     info = function(self, t)
  62.         local chance = t.getChance(self, t)
  63.         local mindResistChange = t.getMindResistChange(self, t)
  64.         return ([[Every time you inflict mental damage, there is a %d%% chance that your foe must save against your Mindpower or go mad. Madness can cause them to become confused, slowed or stunned for 3 turns, and lowers resistance to darkness damage by %d%%.
  65.         Additionally, you learn Tyrant at this talent's level.]]):format(chance, -mindResistChange)
  66.     end,
  67. }
Advertisement
Add Comment
Please, Sign In to add comment