---hooks if data.type == DamageType.BLIGHT and data.src and data.src:knowTalent(data.src.T_PESTILENT_BLIGHT) then if data.dam > 0 and target then data.src:callTalent(data.src.T_PESTILENT_BLIGHT, "do_rot", target, data.dam) end end if data.src and data.src:knowTalent(data.src.T_WORM_BLIGHT) then if data.dam > 0 and target then data.src:callTalent(data.src.T_WORM_BLIGHT, "do_rot", target, data.dam) end end ---talents carrionworm = function(self, target, duration, x, y) local m = 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 = [[]], autolevel = "none", ai = "summoned", ai_real = "dumb_talented_simple", ai_state = { talent_in=5, }, stats = { str=10, dex=15, mag=3, con=3 }, level_range = {self.level, 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, resists = { [DamageType.PHYSICAL] = 50, [DamageType.ACID] = 100, [DamageType.BLIGHT] = 100, [DamageType.FIRE] = -50}, combat_armor = 1, combat_def = 1, combat = { dam=1, atk=15, apr=100 }, autolevel = "warriormage", resolvers.talents{ [Talents.T_CRAWL_ACID]=math.ceil(self.level/10), [Talents.T_ROTTING_DISEASE]=math.ceil(self.level/5), [Talents.T_WORM_BLIGHT]= math.floor(self:getTalentLevel(self.T_PESTILENT_BLIGHT)), }, combat_spellpower = self:combatSpellpower(), summoner = self, summoner_gain_exp=true, summon_time = 10, ai_target = {actor=target} } m.unused_stats = 0 m.unused_talents = 0 m.unused_generics = 0 m.unused_talents_types = 0 m.no_inventory_access = true m.no_points_on_levelup = true m.save_hotkeys = true m.ai_state = m.ai_state or {} m.ai_state.tactic_leash = 100 -- 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 {} local damincrease = self:getTalentLevel(self.T_INFESTATION)*10 m.inc_damage.all = 0 + (damincrease or 0) m.poolmult = (1 + self:getTalentLevel(self.T_WORM_WALK)*8/100 or 1) m.on_die = function(self, src) game.level.map:addEffect(self, self.x, self.y, 5, engine.DamageType.WORMBLIGHT, self:combatSpellpower()*self.poolmult, 2, 5, nil, engine.MapEffect.new{color_br=150, color_bg=255, color_bb=150, effect_shader="shader_images/poison_effect.png"} ) game.logSeen(self, "%s exudes a corrupted gas as it dies.", self.name:capitalize()) end if game.party:hasMember(self) then m.remove_from_party_on_death = true end m:resolve() m:resolve(nil, true) m:forceLevelup(self.level) game.zone:addEntity(game.level, m, "actor", x, y) game.level.map:particleEmitter(x, y, 1, "summon") -- Summons never flee m.ai_tactic = m.ai_tactic or {} m.ai_tactic.escape = 0 m.summon_time = 10 mod.class.NPC.castAs(m) engine.interface.ActorAI.init(m, m) return m end newTalent{ name = "Pestilent Blight", type = {"corruption/rot",3}, require = corrs_req_high3, points = 5, mode = "passive", getChance = function(self, t) return self:combatTalentSpellDamage(t, 10, 60) end, getDuration = function(self, t) return math.floor(self:combatTalentScale(t, 2, 4)) end, do_rot = function(self, t, target, dam) local chance = t.getChance(self,t) local dur = t.getDuration(self,t) if not dam or type(dam) ~= "number" then return end if rng.percent(chance) and dam >= (target.max_life*0.1) then game.logSeen(self, "%s rots away!", target.name) local eff = rng.table{"blind", "silence", "disarm", "pin", } if eff == "blind" and target:canBe("blind") then target:setEffect(target.EFF_BLINDED, dur, {apply_power=self:combatSpellpower()}) elseif eff == "silence" and target:canBe("silence") then target:setEffect(target.EFF_SILENCED, dur, {apply_power=self:combatSpellpower()}) elseif eff == "disarm" and target:canBe("disarm") then target:setEffect(target.EFF_DISARMED, dur, {apply_power=self:combatSpellpower()}) elseif eff == "pin" and target:canBe("pin") then target:setEffect(target.EFF_PINNED, dur, {apply_power=self:combatSpellpower()}) end end end, info = function(self, t) local chance = t.getChance(self,t) local duration = t.getDuration(self,t) return ([[Blight damage you deal that is greater than 10%% of the target's maximum health has a %d%% chance to cause them to rot away, silencing, disarming, blinding or pinning them for %d turns. Your worms also have a %d%% chance to trigger this effect with their attacks. The chance to apply this effect will increase with your Spellpower.]]): format(chance, duration, self:getTalentLevel(t)*4) end, } newTalent{ name = "Worm Blight", type = {"corruption/other",1}, points = 5, mode = "passive", getChance = function(self, t) return self:getTalentLevel(t)*4 end, getDuration = function(self, t) return math.floor(self:combatTalentScale(t, 2, 4)) end, do_rot = function(self, t, target, dam) local chance = t.getChance(self,t) local dur = t.getDuration(self,t) if not dam or type(dam) ~= "number" then return end if rng.percent(chance) then game.logSeen(self, "%s rots away!", target.name) local eff = rng.table{"blind", "silence", "disarm", "pin", } if eff == "blind" and target:canBe("blind") then target:setEffect(target.EFF_BLINDED, dur, {apply_power=self:combatSpellpower()}) elseif eff == "silence" and target:canBe("silence") then target:setEffect(target.EFF_SILENCED, dur, {apply_power=self:combatSpellpower()}) elseif eff == "disarm" and target:canBe("disarm") then target:setEffect(target.EFF_DISARMED, dur, {apply_power=self:combatSpellpower()}) elseif eff == "pin" and target:canBe("pin") then target:setEffect(target.EFF_PINNED, dur, {apply_power=self:combatSpellpower()}) end end end, info = function(self, t) local chance = t.getChance(self,t) local duration = t.getDuration(self,t) return ([[Damage you deal has a %d%% chance to cause the target to rot away, silencing, disarming, blinding or pinning them for %d turns.]]): format(chance, duration) end, }