Skip to content
Snippets Groups Projects
Commit 2be6c9bd authored by DarkGod's avatar DarkGod
Browse files

Fixed Worm Rot

parent 8aa76659
No related branches found
No related tags found
No related merge requests found
Pipeline #
......@@ -7222,8 +7222,8 @@ function _M:dispel(effid_or_tid, src, allow_immunity, params)
if self:fireTalentCheck("callbackOnDispel", "effect", effid_or_tid, src, allow_immunity) then allowed = false end
end
if allowed then
self:removeEffect(effid_or_tid, params.silent, params.force)
self:fireTalentCheck("callbackOnDispelled", "effect", effid_or_tid, src, allow_immunity)
self:removeEffect(effid_or_tid, params.silent, params.force)
return true
else
game.logSeen(self, "%s resists the dispelling of %s!", self:getName():capitalize(), eff.desc)
......@@ -7242,8 +7242,8 @@ function _M:dispel(effid_or_tid, src, allow_immunity, params)
if self:fireTalentCheck("callbackOnDispel", "sustain", effid_or_tid, src, allow_immunity) then allowed = false end
end
if allowed then
self:forceUseTalent(effid_or_tid, params)
self:fireTalentCheck("callbackOnDispelled", "sustain", effid_or_tid, src, allow_immunity)
self:forceUseTalent(effid_or_tid, params)
return true
else
game.logSeen(self, "%s resists the dispelling of %s!", self:getName():capitalize(), t.name)
......
......@@ -60,38 +60,37 @@ newTalent{
carrionworm = function(self, target, duration, x, y)
local m = mod.class.NPC.new{
type = "vermin", subtype = "worms",
display = "w", color=colors.SANDY_BROWN, image = "npc/vermin_worms_carrion_worm_mass.png",
name = "carrion worm mass", faction = self.faction,
desc = _t[[A worm spawned from a damaged horror. Destroying it may have consequences.]],
autolevel = "none",
ai = "summoned", ai_real = "tactical",
ai_state = { ai_move="move_complex", talent_in=1, ally_compassion=10, ai_target="target_closest", },
ai_tactic = resolvers.tactic"melee",
stats = { str=10, dex=15, mag=3, con=3 },
level_range = {1, self.level}, exp_worth = 0,
global_speed_base = 1.0,
max_life = resolvers.rngavg(5,9),
size_category = 1,
cut_immune = 1,
blind_immune = 1,
life_rating = 6,
disease_immune = 1,
movement_speed = 1.5,
melee_project={[DamageType.PESTILENT_BLIGHT] = self:callTalent(self.T_PESTILENT_BLIGHT, "getChance")/2,},
resists = { [DamageType.PHYSICAL] = 50, [DamageType.ACID] = 100, [DamageType.BLIGHT] = 100, [DamageType.FIRE] = -50},
combat_armor = 1, combat_def = 1,
combat = { dam=40, atk=900, apr=900 }, -- We only care about making sure we do at least 1 damage for on hit stuff
autolevel = "warriormage",
resolvers.talents{
[Talents.T_INFECTIOUS_BITE]=math.floor(self:getTalentLevelRaw(self.T_INFESTATION)),
},
summoner = self, summoner_gain_exp=true, carrion_worm = true,
summon_time = 5,
carrion_worm = true, -- This prevents combat log spam from blight pools dealing 0 damage and lets the AI pick targets for Worm Rot
type = "vermin", subtype = "worms",
display = "w", color=colors.SANDY_BROWN, image = "npc/vermin_worms_carrion_worm_mass.png",
name = "carrion worm mass", faction = self.faction,
desc = _t[[A worm spawned from a damaged horror. Destroying it may have consequences.]],
autolevel = "none",
ai = "summoned", ai_real = "tactical",
ai_state = { ai_move="move_complex", talent_in=1, ally_compassion=10, ai_target="target_closest", },
ai_tactic = resolvers.tactic"melee",
stats = { str=10, dex=15, mag=3, con=3 },
level_range = {1, self.level}, exp_worth = 0,
global_speed_base = 1.0,
max_life = resolvers.rngavg(5,9),
size_category = 1,
cut_immune = 1,
blind_immune = 1,
life_rating = 6,
disease_immune = 1,
movement_speed = 1.5,
melee_project={[DamageType.PESTILENT_BLIGHT] = self:callTalent(self.T_PESTILENT_BLIGHT, "getChance")/2,},
resists = { [DamageType.PHYSICAL] = 50, [DamageType.ACID] = 100, [DamageType.BLIGHT] = 100, [DamageType.FIRE] = -50},
combat_armor = 1, combat_def = 1,
combat = { dam=40, atk=900, apr=900 }, -- We only care about making sure we do at least 1 damage for on hit stuff
autolevel = "warriormage",
resolvers.talents{
[Talents.T_INFECTIOUS_BITE]=math.floor(self:getTalentLevelRaw(self.T_INFESTATION)),
},
summoner = self, summoner_gain_exp=true, carrion_worm = true,
summon_time = 5,
carrion_worm = true, -- This prevents combat log spam from blight pools dealing 0 damage and lets the AI pick targets for Worm Rot
}
m.unused_stats = 0
m.unused_talents = 0
......@@ -105,15 +104,13 @@ carrionworm = function(self, target, duration, x, y)
-- Try to use stored AI talents to preserve tweaking over multiple summons
m.ai_talents = self.stored_ai_talents and self.stored_ai_talents[m.name] or {}
m.on_die = function(self, src)
local t = self.summoner:getTalentFromId(self.summoner.T_INFESTATION)
game.level.map:addEffect(self,
self.x, self.y, 5,
engine.DamageType.WORMBLIGHT, t.getDamage(self.summoner, t),
2,
5, nil,
engine.MapEffect.new{alpha=90, color_br=1, color_bg=1, color_bb=1, effect_shader="shader_images/poison_effect.png"}
)
game.logSeen(self, "%s exudes a corrupted gas as it dies.", self:getName():capitalize())
local t = self.summoner:getTalentFromId(self.summoner.T_INFESTATION)
game.level.map:addEffect(self, self.x, self.y, 5,
engine.DamageType.WORMBLIGHT, t.getDamage(self.summoner, t),
2, 5, nil,
engine.MapEffect.new{alpha=90, color_br=1, color_bg=1, color_bb=1, effect_shader="shader_images/poison_effect.png"}
)
game.logSeen(self, "%s exudes a corrupted gas as it dies.", self:getName():capitalize())
end
-- Snapshot the casters effective (not base) spellpower
......@@ -352,22 +349,19 @@ newTalent{
tactical = { ATTACK = { ACID = 1, BLIGHT = 1 }, DISABLE = 4 },
getBurstDamage = function(self, t) return self:combatTalentSpellDamage(t, 10, 150) end,
getDamage = function(self, t) return self:combatTalentSpellDamage(t, 10, 55) end,
getChance = function(self, t) return math.min(100,self:combatTalentScale(t, 20, 90)) end,
getChance = function(self, t) return math.min(100, self:combatTalentScale(t, 20, 90)) end,
target = function(self, t) return {type="hit", range=self:getTalentRange(t), talent=t, display={particle="bolt_slime"}} end,
spawn_carrion_worm = function (self, target, t)
spawn_carrion_worm = function(self, t, target)
if not game.level then return end
local nb = 0
if game.level then
for _, act in pairs(game.level.entities) do
if act.summoner and act.summoner == self and act.carrion_worm then nb = nb + 1 end
end
for _, act in pairs(game.level.entities) do
if act.summoner and act.summoner == self and act.carrion_worm then nb = nb + 1 end
end
if nb >= 5 then return nil end
local x, y = util.findFreeGrid(target.x, target.y, 10, true, {[Map.ACTOR]=true})
if not x then return nil end
local m = carrionworm(self, self, 10, x, y)
local m = carrionworm(self, self, 10, x, y)
end,
action = function(self, t)
local tg = self:getTalentTarget(t)
......@@ -378,7 +372,7 @@ newTalent{
local target = game.level.map(px, py, engine.Map.ACTOR)
if not target then return end
if target:canBe("disease") then
target:setEffect(target.EFF_WORM_ROT, 5, {src=self, dam=t.getDamage(self, t), burst=t.getBurstDamage(self, t), rot_timer = 5, apply_power=self:combatSpellpower()})
target:setEffect(target.EFF_WORM_ROT, 5, {src=self, chance=t.getChance(self,t), dam=t.getDamage(self, t), burst=t.getBurstDamage(self, t), apply_power=self:combatSpellpower()})
else
game.logSeen(target, "%s resists the worm rot!", target:getName():capitalize())
end
......
......@@ -2344,55 +2344,43 @@ newEffect{
type = "magical",
subtype = {disease=true, blight=true, acid=true},
status = "detrimental",
parameters = {},
parameters = {chance=20, dam=10, burst=20},
on_gain = function(self, err) return _t"#Target# is afflicted by a terrible worm rot!" end,
on_lose = function(self, err) return _t"#Target# is free from the worm rot." end,
callbackOnDispelled = function(self, eff, type, effid_or_tid, src, allow_immunity)
if effid_or_tid ~= self.EFF_WORM_ROT then return end
if rng.percent(eff.chance) then
local ed = self:getEffectFromId(eff.effect_id)
ed.spawn_worm(self, eff)
else
-- Fake it, we missed out chance!
eff.spawned = true
end
end,
spawn_worm = function(self, eff)
if eff.spawned then return end
DamageType:get(DamageType.BLIGHT).projector(eff.src, self.x, self.y, DamageType.BLIGHT, eff.burst, {from_disease=true})
eff.src:callTalent(eff.src.T_WORM_ROT, "spawn_carrion_worm", self)
game.logSeen(self, "#LIGHT_RED#A carrion worm mass bursts out of %s!", self:getName():capitalize())
eff.spawned = true
self:removeEffect(self.EFF_WORM_ROT)
end,
-- Damage each turn
on_timeout = function(self, eff)
eff.rot_timer = eff.rot_timer - 1
-- disease damage
if self:attr("purify_disease") then
self:heal(eff.dam, eff.src)
else
DamageType:get(DamageType.BLIGHT).projector(eff.src, self.x, self.y, DamageType.BLIGHT, eff.dam, {from_disease=true})
if self:attr("purify_disease") then self:heal(eff.dam, eff.src)
else DamageType:get(DamageType.BLIGHT).projector(eff.src, self.x, self.y, DamageType.BLIGHT, eff.dam, {from_disease=true})
end
-- acid damage from the larvae
DamageType:get(DamageType.ACID).projector(eff.src, self.x, self.y, DamageType.ACID, eff.dam)
local effs = {}
-- Go through all physical effects
for eff_id, p in pairs(self.tmp) do
local e = self.tempeffect_def[eff_id]
if e.status == "beneficial" and e.type == "physical" then
effs[#effs+1] = {"effect", eff_id}
end
end
-- remove a random physical effect
if #effs > 0 then
local eff = rng.tableRemove(effs)
if eff[1] == "effect" then
self:dispel(eff[2], eff.src)
end
end
-- burst and spawn a worm mass
local t = eff.src:getTalentFromId(eff.src.T_WORM_ROT)
if eff.rot_timer == 0 then
DamageType:get(DamageType.BLIGHT).projector(eff.src, self.x, self.y, DamageType.BLIGHT, eff.burst, {from_disease=true})
t.spawn_carrion_worm(eff.src, self, t)
game.logSeen(self, "#LIGHT_RED#A carrion worm mass bursts out of %s!", self:getName():capitalize())
self:removeEffect(self.EFF_WORM_ROT)
end
-- Remove one effect
self:removeEffectsFilter(eff.src, {type="physical", status="beneficial"}, 1)
end,
deactivate = function(self, eff)
local t = eff.src:getTalentFromId(eff.src.T_WORM_ROT)
if rng.percent(t.getChance(eff.src,t)) then
DamageType:get(DamageType.BLIGHT).projector(eff.src, self.x, self.y, DamageType.BLIGHT, eff.burst, {from_disease=true})
t.spawn_carrion_worm(eff.src, self, t)
game.logSeen(self, "#LIGHT_RED#A carrion worm mass bursts out of %s!", self:getName():capitalize())
self:removeEffect(self.EFF_WORM_ROT)
end
local ed = self:getEffectFromId(eff.effect_id)
ed.spawn_worm(self, eff)
end,
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment