Code: Select all
newTalent{
name = "Virulent Disease",
type = {"corruption/plague", 1},
require = corrs_req1,
points = 5,
vim = 8,
cooldown = 3,
random_ego = "attack",
tactical = { ATTACK = {BLIGHT = 2} },
requires_target = true,
no_energy = true,
--getTargetDiseases = getTargetDiseases,
target = function(self, t) return {type="hit", range=self:getTalentRange(t), talent=t} end,
range = function(self, t) return 5 end, -- Instant cast should not do thousands of damage at long range. This is still too powerful, though
action = function(self, t)
local tg = self:getTalentTarget(t)
local x, y = self:getTarget(tg)
if not x or not y then return nil end
local diseases = {{self.EFF_WEAKNESS_DISEASE, "str"}, {self.EFF_ROTTING_DISEASE, "con"}, {self.EFF_DECREPITUDE_DISEASE, "dex"}}
local disease = rng.table(diseases)
-- Try to rot !
self:project(tg, x, y, function(px, py)
local target = game.level.map(px, py, engine.Map.ACTOR)
if not target then return end
if target:canBe("disease") then
local str, dex, con = not target:hasEffect(self.EFF_WEAKNESS_DISEASE) and target:getStr() or 0, not target:hasEffect(self.EFF_DECREPITUDE_DISEASE) and target:getDex() or 0, not target:hasEffect(self.EFF_ROTTING_DISEASE) and target:getCon() or 0
if str >= dex and str >= con then
disease = {self.EFF_WEAKNESS_DISEASE, "str"}
elseif dex >= str and dex >= con then
disease = {self.EFF_DECREPITUDE_DISEASE, "dex"}
elseif con > 0 then
disease = {self.EFF_ROTTING_DISEASE, "con"}
end
target:setEffect(disease[1], 6, {src=self, dam=self:spellCrit(7 + self:combatTalentSpellDamage(t, 6, 45)), [disease[2]]=self:combatTalentSpellDamage(t, 5, 35), apply_power=self:combatSpellpower()})
else
game.logSeen(target, "%s resists the disease!", target.name:capitalize())
end
game.level.map:particleEmitter(px, py, 1, "circle", {oversize=0.7, a=200, limit_life=8, appear=8, speed=-2, img="disease_circle", radius=0})
end)
game:playSoundNear(self, "talents/slime")
return true
end,
info = function(self, t)
return ([[Fires a bolt of pure filth, diseasing your target with a disease doing %0.2f blight damage per turn for 6 turns, and reducing one of its physical stats (strength, constitution, dexterity) by %d. The three diseases can stack.
Virulent Disease will always try to apply a disease the target does not currently have, and also one that will have the most debilitating effect for the target.
The effect will increase with your Spellpower.]]):
format(damDesc(self, DamageType.BLIGHT, 7 + self:combatTalentSpellDamage(t, 6, 65)), self:combatTalentSpellDamage(t, 5, 35))
end,
}