Advertisement
Guest User

blight

a guest
Nov 1st, 2014
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.27 KB | None | 0 0
  1. ---hooks
  2.     if data.type == DamageType.BLIGHT and data.src and data.src:knowTalent(data.src.T_PESTILENT_BLIGHT) then
  3.         if data.dam > 0 and target then
  4.             data.src:callTalent(data.src.T_PESTILENT_BLIGHT, "do_rot", target, data.dam)
  5.         end
  6.     end
  7.  
  8.     if data.src and data.src:knowTalent(data.src.T_WORM_BLIGHT) then
  9.         if data.dam > 0 and target then
  10.             data.src:callTalent(data.src.T_WORM_BLIGHT, "do_rot", target, data.dam)
  11.         end
  12.     end
  13.  
  14. ---talents
  15.  
  16. carrionworm = function(self, target, duration, x, y)
  17.     local m = NPC.new{
  18.             type = "vermin", subtype = "worms",
  19.             display = "w", color=colors.SANDY_BROWN, image = "npc/vermin_worms_carrion_worm_mass.png",
  20.             name = "carrion worm mass", faction = self.faction,
  21.             desc = [[]],
  22.             autolevel = "none",
  23.             ai = "summoned", ai_real = "dumb_talented_simple", ai_state = { talent_in=5, },
  24.             stats = { str=10, dex=15, mag=3, con=3 },
  25.             level_range = {self.level, self.level}, exp_worth = 0,
  26.             global_speed_base = 1.0,
  27.  
  28.             max_life = resolvers.rngavg(5,9),
  29.             size_category = 1,
  30.             cut_immune = 1,
  31.             blind_immune = 1,
  32.             life_rating = 6,
  33.             disease_immune = 1,
  34.             resists = { [DamageType.PHYSICAL] = 50, [DamageType.ACID] = 100, [DamageType.BLIGHT] = 100, [DamageType.FIRE] = -50},
  35.            
  36.             combat_armor = 1, combat_def = 1,
  37.             combat = { dam=1, atk=15, apr=100 },
  38.             autolevel = "warriormage",
  39.             resolvers.talents{
  40.             [Talents.T_CRAWL_ACID]=math.ceil(self.level/10),
  41.             [Talents.T_ROTTING_DISEASE]=math.ceil(self.level/5),
  42.             [Talents.T_WORM_BLIGHT]= math.floor(self:getTalentLevel(self.T_PESTILENT_BLIGHT)),
  43.             },
  44.  
  45.            
  46.             combat_spellpower = self:combatSpellpower(),
  47.  
  48.             summoner = self, summoner_gain_exp=true,
  49.             summon_time = 10,
  50.             ai_target = {actor=target}
  51.            
  52.  
  53.  
  54.     }
  55.  
  56.     m.unused_stats = 0
  57.     m.unused_talents = 0
  58.     m.unused_generics = 0
  59.     m.unused_talents_types = 0
  60.     m.no_inventory_access = true
  61.     m.no_points_on_levelup = true
  62.     m.save_hotkeys = true
  63.     m.ai_state = m.ai_state or {}
  64.     m.ai_state.tactic_leash = 100
  65.     -- Try to use stored AI talents to preserve tweaking over multiple summons
  66.     m.ai_talents = self.stored_ai_talents and self.stored_ai_talents[m.name] or {}
  67.     local damincrease = self:getTalentLevel(self.T_INFESTATION)*10
  68.     m.inc_damage.all = 0 + (damincrease or 0)
  69.     m.poolmult = (1 + self:getTalentLevel(self.T_WORM_WALK)*8/100 or 1)
  70.     m.on_die = function(self, src)
  71.                 game.level.map:addEffect(self,
  72.                 self.x, self.y, 5,
  73.                 engine.DamageType.WORMBLIGHT, self:combatSpellpower()*self.poolmult,
  74.                     2,
  75.                     5, nil,
  76.                     engine.MapEffect.new{color_br=150, color_bg=255, color_bb=150, effect_shader="shader_images/poison_effect.png"}
  77.                 )
  78.                 game.logSeen(self, "%s exudes a corrupted gas as it dies.", self.name:capitalize())
  79.     end
  80.            
  81.     if game.party:hasMember(self) then
  82.         m.remove_from_party_on_death = true
  83.     end
  84.     m:resolve() m:resolve(nil, true)
  85.     m:forceLevelup(self.level)
  86.     game.zone:addEntity(game.level, m, "actor", x, y)
  87.     game.level.map:particleEmitter(x, y, 1, "summon")
  88.  
  89.     -- Summons never flee
  90.     m.ai_tactic = m.ai_tactic or {}
  91.     m.ai_tactic.escape = 0
  92.     m.summon_time = 10
  93.  
  94.     mod.class.NPC.castAs(m)
  95.     engine.interface.ActorAI.init(m, m)
  96.  
  97.     return m
  98. end
  99.  
  100. newTalent{
  101.     name = "Pestilent Blight",
  102.     type = {"corruption/rot",3},
  103.     require = corrs_req_high3,
  104.     points = 5,
  105.     mode = "passive",
  106.     getChance = function(self, t) return self:combatTalentSpellDamage(t, 10, 60) end,
  107.     getDuration = function(self, t)  return math.floor(self:combatTalentScale(t, 2, 4)) end,
  108.     do_rot = function(self, t, target, dam)
  109.         local chance = t.getChance(self,t)
  110.         local dur = t.getDuration(self,t)
  111.         if not dam or type(dam) ~= "number" then return end
  112.         if rng.percent(chance) and dam >= (target.max_life*0.1) then
  113.             game.logSeen(self, "%s rots away!", target.name)
  114.  
  115.             local eff = rng.table{"blind", "silence", "disarm", "pin", }
  116.             if eff == "blind" and target:canBe("blind") then target:setEffect(target.EFF_BLINDED, dur, {apply_power=self:combatSpellpower()})
  117.             elseif eff == "silence" and target:canBe("silence") then target:setEffect(target.EFF_SILENCED, dur, {apply_power=self:combatSpellpower()})
  118.             elseif eff == "disarm" and target:canBe("disarm") then target:setEffect(target.EFF_DISARMED, dur, {apply_power=self:combatSpellpower()})
  119.             elseif eff == "pin" and target:canBe("pin") then target:setEffect(target.EFF_PINNED, dur, {apply_power=self:combatSpellpower()})
  120.             end
  121.         end
  122.     end,
  123. info = function(self, t)
  124.     local chance = t.getChance(self,t)
  125.     local duration = t.getDuration(self,t)
  126.         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.
  127. Your worms also have a %d%% chance to trigger this effect with their attacks.
  128. The chance to apply this effect will increase with your Spellpower.]]):
  129.         format(chance, duration, self:getTalentLevel(t)*4)
  130.     end,
  131. }
  132.  
  133. newTalent{
  134.     name = "Worm Blight",
  135.     type = {"corruption/other",1},
  136.     points = 5,
  137.     mode = "passive",
  138.     getChance = function(self, t) return self:getTalentLevel(t)*4 end,
  139.     getDuration = function(self, t)  return math.floor(self:combatTalentScale(t, 2, 4)) end,
  140.     do_rot = function(self, t, target, dam)
  141.         local chance = t.getChance(self,t)
  142.         local dur = t.getDuration(self,t)
  143.         if not dam or type(dam) ~= "number" then return end
  144.         if rng.percent(chance) then
  145.             game.logSeen(self, "%s rots away!", target.name)
  146.  
  147.             local eff = rng.table{"blind", "silence", "disarm", "pin", }
  148.             if eff == "blind" and target:canBe("blind") then target:setEffect(target.EFF_BLINDED, dur, {apply_power=self:combatSpellpower()})
  149.             elseif eff == "silence" and target:canBe("silence") then target:setEffect(target.EFF_SILENCED, dur, {apply_power=self:combatSpellpower()})
  150.             elseif eff == "disarm" and target:canBe("disarm") then target:setEffect(target.EFF_DISARMED, dur, {apply_power=self:combatSpellpower()})
  151.             elseif eff == "pin" and target:canBe("pin") then target:setEffect(target.EFF_PINNED, dur, {apply_power=self:combatSpellpower()})
  152.             end
  153.         end
  154.     end,
  155. info = function(self, t)
  156.     local chance = t.getChance(self,t)
  157.     local duration = t.getDuration(self,t)
  158.         return ([[Damage you deal has a %d%% chance to cause the target to rot away, silencing, disarming, blinding or pinning them for %d turns.]]):
  159.         format(chance, duration)
  160.     end,
  161. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement