Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- ToME - Tales of Maj'Eyal
- -- Copyright (C) 2009, 2010, 2011, 2012, 2013 Nicolas Casalini
- --
- -- This program is free software: you can redistribute it and/or modify
- -- it under the terms of the GNU General Public License as published by
- -- the Free Software Foundation, either version 3 of the License, or
- -- (at your option) any later version.
- --
- -- This program is distributed in the hope that it will be useful,
- -- but WITHOUT ANY WARRANTY; without even the implied warranty of
- -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- -- GNU General Public License for more details.
- --
- -- You should have received a copy of the GNU General Public License
- -- along with this program. If not, see <http://www.gnu.org/licenses/>.
- --
- -- Nicolas Casalini "DarkGod"
- local _M = loadPrevious(...)
- local function cancelPoisons(self)
- local todel = {}
- for tid, p in pairs(self.sustain_talents) do
- local t = self:getTalentFromId(tid)
- if t.type[1] == "cunning/poisons-effects" then
- todel[#todel+1] = tid
- end
- end
- while #todel > 1 do self:forceUseTalent(rng.tableRemove(todel), {ignore_energy=true}) end
- end
- newTalent{
- name = "Deadly Poison", short_name = "D_POISON",
- type = {"cunning/poisons", 1},
- require = cuns_req1,
- mode = "sustained",
- points = 5,
- cooldown = 10,
- no_break_stealth = true,
- tactical = { BUFF = 2 },
- getDuration = function(self, t) return math.floor(self:combatTalentScale(t, 4, 7)) end,
- getChance = function(self,t) return 20 + self:getTalentLevel(t) * 5 end,
- getDamage = function(self, t) return 8 + self:combatTalentStatDamage(t, "cun", 10, 60) * 0.4 end,
- callbackOnMeleeAttack = function(self, t, target, hitted, crit, weapon, damtype, mult, dam)
- if target and target:canBe("poison") and rng.percent(t.getChance(self,t)) then
- if self.vile_poisons and next(self.vile_poisons) then
- local tid = rng.table(table.keys(self.vile_poisons))
- if tid then
- local t = self:getTalentFromId(tid)
- t.proc2(self, t, target, weapon)
- end
- else
- target:setEffect(target.EFF_POISONED, t.getDuration(self, t), {src=self, power=t.getDamage(self, t), max_power=t.getDamage(self, t) * 4, apply_power=self:combatAttack()})
- end
- end
- end,
- activate = function(self, t)
- local ret = {
- }
- return ret
- end,
- deactivate = function(self, t, p)
- return true
- end,
- info = function(self, t)
- return ([[Learn how to coat your melee weapons, throwing knives, sling and bow ammo with poison, giving your attacks a %d%% chance to poison the target for %d nature damage per turn for %d turns. Every application of the poison stacks, up to a maximum of %d nature damage per turn.
- The damage scales with your Cunning.]]):
- format(t.getChance(self,t), damDesc(self, DamageType.NATURE, t.getDamage(self, t)), t.getDuration(self, t), damDesc(self, DamageType.NATURE, t.getDamage(self, t)*4))
- end,
- }
- Talents.talents_def.T_EMPOWER_POISONS.hide = true
- Talents.talents_def.T_TOXIC_DEATH.getChance = function(self, t) return self:combatTalentScale(t, 10, 30) end
- Talents.talents_def.T_TOXIC_DEATH.radius = function(self, t) return math.floor(self:combatTalentScale(t, 2, 4)) end
- Talents.talents_def.T_TOXIC_DEATH.type = {"cunning/poisons", 2}
- Talents.talents_def.T_TOXIC_DEATH.require = cuns_req2
- Talents.talents_def.T_TOXIC_DEATH.callbackOnMeleeAttack = function(self, t, target, hitted, crit, weapon, damtype, mult, dam)
- if target and rng.percent(t.getChance(self,t)) then
- local poisons = {}
- for k, v in pairs(target.tmp) do
- local e = target.tempeffect_def[k]
- if e.subtype.poison and v.src and v.src == self then
- poisons[k] = target:copyEffect(k)
- end
- end
- local tg = {type="ball", range = 10, radius=1, selffire = false, friendlyfire = false, talent=t}
- self:project(tg, target.x, target.y, function(tx, ty)
- local target2 = game.level.map(tx, ty, Map.ACTOR)
- if not target2 or target2 == self then return end
- for eff, p in pairs(poisons) do
- target2:setEffect(eff, p.dur, table.clone(p))
- end
- end)
- end
- end
- Talents.talents_def.T_TOXIC_DEATH.on_kill = function(self, t, target)
- local poisons = {}
- for k, v in pairs(target.tmp) do
- local e = target.tempeffect_def[k]
- if e.subtype.poison and v.src and v.src == self then
- poisons[k] = target:copyEffect(k)
- end
- end
- local tg = {type="ball", range = 10, radius=self:getTalentRadius(t), selffire = false, friendlyfire = false, talent=t}
- self:project(tg, target.x, target.y, function(tx, ty)
- local target2 = game.level.map(tx, ty, Map.ACTOR)
- if not target2 or target2 == self then return end
- for eff, p in pairs(poisons) do
- target2:setEffect(eff, p.dur, table.clone(p))
- end
- end)
- end
- Talents.talents_def.T_TOXIC_DEATH.info = function(self, t)
- chance = t.getChance(self,t)
- rad = self:getTalentRadius(t)
- return ([[Your melee attacks have a %d%% chance to spray envenomed blood from your enemy, spreading their poisons to adjacent enemies.
- Killing a creature instead gives a %d%% chance for poisons to spread to foes in a radius of %d.]]):
- format(chance, 20 + self:getTalentLevelRaw(t) * 8, rad)
- end
- Talents.talents_def.T_VILE_POISONS.type = {"cunning/poisons", 3}
- Talents.talents_def.T_VILE_POISONS.require = cuns_req3
- Talents.talents_def.T_VILE_POISONS.on_learn = function(self, t)
- local lev = self:getTalentLevelRaw(t)
- if lev == 1 then
- self.vile_poisons = {}
- self:learnTalent(self.T_NUMBING_POISON, true, nil, {no_unlearn=true})
- elseif lev == 2 then
- self:learnTalent(self.T_INSIDIOUS_POISON, true, nil, {no_unlearn=true})
- elseif lev == 3 then
- self:learnTalent(self.T_CRIPPLING_POISON, true, nil, {no_unlearn=true})
- elseif lev == 4 then
- self:learnTalent(self.T_LEECHING_POISON, true, nil, {no_unlearn=true})
- elseif lev == 5 then
- self:learnTalent(self.T_VOLATILE_POISON, true, nil, {no_unlearn=true})
- end
- end
- Talents.talents_def.T_VILE_POISONS.on_unlearn = function(self, t)
- local lev = self:getTalentLevelRaw(t)
- if lev == 0 then
- self:unlearnTalent(self.T_NUMBING_POISON)
- self.vile_poisons = nil
- elseif lev == 1 then
- self:unlearnTalent(self.T_INSIDIOUS_POISON)
- elseif lev == 2 then
- self:unlearnTalent(self.T_CRIPPLING_POISON)
- elseif lev == 3 then
- self:unlearnTalent(self.T_LEECHING_POISON)
- elseif lev == 4 then
- self:unlearnTalent(self.T_VOLATILE_POISON)
- end
- end
- Talents.talents_def.T_VILE_POISONS.info = function(self, t)
- return ([[Learn how to enhance your Deadly Poison with new effects, causing it's standard poison to be replaced with a new effect. Each level, you will learn a new kind of poison:
- Level 1: Numbing Poison
- Level 2: Insidious Poison
- Level 3: Crippling Poison
- Level 4: Leeching Poison
- Level 5: Volatile Poison
- New poisons can also be learned from special teachers in the world.
- Also increases the effectiveness of your poisons by %d%%. (The effect varies for each poison.)
- Coating your weapons in poisons does not break stealth.
- You may only have two poisons active at once, and the one which is applied is randomly determined.]]):
- format(self:getTalentLevel(t) * 20)
- end
- Talents.talents_def.T_NUMBING_POISON.proc = function(self, t, target)
- end
- Talents.talents_def.T_NUMBING_POISON.proc2 = function(self, t, target)
- local dam = self:callTalent(self.T_D_POISON, "getDamage")
- local dur = self:callTalent(self.T_D_POISON, "getDuration")
- target:setEffect(target.EFF_NUMBING_POISON, dur, {src=self, power=dam, reduce=t.getEffect(self, t), max_power=dam*2})
- end
- Talents.talents_def.T_NUMBING_POISON.info = function(self, t)
- return ([[Enhances your Deadly Poison with a numbing agent, causing it to reduce the damage dealt by enemies by %d%%.]]):
- format(t.getEffect(self, t))
- end
- Talents.talents_def.T_INSIDIOUS_POISON.proc = function(self, t, target)
- end
- Talents.talents_def.T_INSIDIOUS_POISON.proc2 = function(self, t, target)
- local dam = self:callTalent(self.T_D_POISON, "getDamage")
- local dur = self:callTalent(self.T_D_POISON, "getDuration")
- target:setEffect(target.EFF_INSIDIOUS_POISON, dur, {src=self, power=dam, heal_factor=t.getEffect(self, t), max_power=dam*2})
- end
- Talents.talents_def.T_INSIDIOUS_POISON.info = function(self, t)
- return ([[Enhances your Deadly Poison with an insidious agent, causing it to reduce the healing taken by enemies by %d%%.]]):
- format(t.getEffect(self, t))
- end
- Talents.talents_def.T_CRIPPLING_POISON.proc = function(self, t, target)
- end
- Talents.talents_def.T_CRIPPLING_POISON.proc2 = function(self, t, target)
- local dam = self:callTalent(self.T_D_POISON, "getDamage")
- local dur = self:callTalent(self.T_D_POISON, "getDuration")
- target:setEffect(target.EFF_CRIPPLING_POISON, dur, {src=self, power=dam, fail=t.getEffect(self, t), max_power=dam*2})
- end
- Talents.talents_def.T_CRIPPLING_POISON.info = function(self, t)
- return ([[Enhances your Deadly Poison with a crippling agent, giving enemies a %d%% chance on using a talent to fail and lose a turn.]]):
- format(t.getEffect(self, t))
- end
- newTalent{
- name = "Leeching Poison",
- type = {"cunning/poisons-effects", 1},
- points = 1,
- mode = "sustained",
- cooldown = 10,
- no_break_stealth = true,
- no_energy = true,
- tactical = { BUFF = 2 },
- no_unlearn_last = true,
- getEffect = function(self, t) return self:combatTalentLimit(self:getTalentLevel(self.T_VILE_POISONS), 150, 50, 100) end, -- Limit effect to < 50%
- proc2 = function(self, t, target)
- local dam = self:callTalent(self.T_D_POISON, "getDamage")
- local dur = self:callTalent(self.T_D_POISON, "getDuration")
- target:setEffect(target.EFF_LEECHING_POISON, dur, {src=self, power=dam, heal=t.getEffect(self, t), max_power=dam*2})
- end,
- activate = function(self, t)
- cancelPoisons(self)
- self.vile_poisons = self.vile_poisons or {}
- self.vile_poisons[t.id] = true
- return {}
- end,
- deactivate = function(self, t, p)
- self.vile_poisons[t.id] = nil
- return true
- end,
- info = function(self, t)
- return ([[Enhances your Deadly Poison with a leeching agent, causing the poison to heal you for %d%% of the damage dealt.]]):
- format(t.getEffect(self, t))
- end,
- }
- newTalent{
- name = "Volatile Poison",
- type = {"cunning/poisons-effects", 1},
- points = 1,
- mode = "sustained",
- cooldown = 10,
- no_break_stealth = true,
- no_energy = true,
- tactical = { BUFF = 2 },
- no_unlearn_last = true,
- proc2 = function(self, t, target)
- local dam = self:callTalent(self.T_D_POISON, "getDamage")
- local dur = self:callTalent(self.T_D_POISON, "getDuration")
- target:setEffect(target.EFF_VOLATILE_POISON, dur, {src=self, power=dam, max_power=dam*2})
- end,
- activate = function(self, t)
- cancelPoisons(self)
- self.vile_poisons = self.vile_poisons or {}
- self.vile_poisons[t.id] = true
- return {}
- end,
- deactivate = function(self, t, p)
- self.vile_poisons[t.id] = nil
- return true
- end,
- info = function(self, t)
- return ([[Enhances your Deadly Poison with a volatile agent, causing the poison to also damage adjacent enemies.]]):
- format()
- end,
- }
- local temp = Talents.talents_types_def["cunning/poisons"].talents[1]
- Talents.talents_types_def["cunning/poisons"].talents[1] = Talents.talents_types_def["cunning/poisons"].talents[3]
- Talents.talents_types_def["cunning/poisons"].talents[3] = temp
- local temp2 = Talents.talents_types_def["cunning/poisons"].talents[5]
- Talents.talents_types_def["cunning/poisons"].talents[5] = Talents.talents_types_def["cunning/poisons"].talents[1]
- Talents.talents_types_def["cunning/poisons"].talents[1] = temp2
- local temp3 = Talents.talents_types_def["cunning/poisons"].talents[2]
- Talents.talents_types_def["cunning/poisons"].talents[2] = Talents.talents_types_def["cunning/poisons"].talents[4]
- Talents.talents_types_def["cunning/poisons"].talents[4] = temp3
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement