ToME: the Tales of Maj'Eyal

Everything about ToME
It is currently Thu Oct 18, 2018 11:44 am

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Thu Sep 24, 2015 8:32 pm 
Offline
Uruivellas

Joined: Tue May 14, 2013 3:45 pm
Posts: 832
I have a talent that causes mobs under a timed effect to spawn an allied ghost on death. This appears to be causing their loot drops to displace, similar to when you kill a mob stuck inside a wall. Any ideas what's causing this? Code below:

Code:
...
   on_die = function(self, eff)
      if eff.src.knowTalent and eff.src:knowTalent(eff.src.T_SHACKLE_SOUL) then
         local t = eff.src:getTalentFromId(eff.src.T_SHACKLE_SOUL)
         if rng.percent(t.getChance(eff.src, t)) then
            t.spawn_ghost(eff.src, self, t)
         end
      end
   end,
}



Code:
newTalent{
   name = "Shackle Soul",
   type = {"spell/dread", 2},
   require = spells_req2,
   points = 5,
   mode = "passive",
   getChance = function(self, t) return self:combatTalentLimit(t, 100, 20, 70) end,
   getDuration = function(self, t) return (self:combatTalentScale(t, 3, 7)) end,
   spawn_ghost = function (self, target, t)
      local x, y = util.findFreeGrid(target.x, target.y, 10, true, {[Map.ACTOR]=true})
      if not x then return nil 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.wraith_summon then nb = nb + 1 end
         end
      end
      
      if nb >= 4 then return nil end
      
      local m = ghost(self, target, t.getDuration(self,t), x, y)
      if not m then return nil end

      m:logCombat(target, "A #WHITE##Source##LAST# rises from the corpse of #Target#!")
   end,
   info = function(self, t)
   local chance = t.getChance(self,t)
   local dur = t.getDuration(self,t)
      return ([[Your enervate shackles the souls of your enemies, giving a %d%% chance on death for them to rise as a wraith under your control for %d turns. Wraiths assault your enemies with blasts of cold that deal increased damage with each point invested in this talent.
      You cannot have more than 4 wraiths active at a time.
      The first point in this talent increases the range of your Necrotic Aura by 1.]]):
      format(chance, dur)
   end,
}


Code:
ghost = function(self, target, duration, x, y)
   local m = mod.class.NPC.new{
         type = "undead", subtype = "ghost",
         display = "G", color=colors.WHITE, image = "npc/shackled_soul.png",
         name = "wraith", faction = self.faction,
         desc = [[]],
         autolevel = "caster",
         ai = "summoned", ai_real = "tactical",
         ai_state = { talent_in=1, },
         ai_tactic = resolvers.tactic"ranged",
         stats = { str=14, dex=18, mag=20, con=12 },
         stats = { mag=self:getMag(), wil=self:getWil(), cun=self:getCun()},
         rank = 2,
         size_category = 3,
         infravision = 10,
      
         can_pass = {pass_wall=70},
         resists = {all = 35, [DamageType.LIGHT] = -70, [DamageType.DARKNESS] = 65},
      
         no_breath = 1,
         stone_immune = 1,
         confusion_immune = 1,
         fear_immune = 1,
         teleport_immune = 0.5,
         disease_immune = 1,
         poison_immune = 1,
         stun_immune = 1,
         blind_immune = 1,
         cut_immune = 1,
         see_invisible = 80,
         undead = 1,
         resolvers.sustains_at_birth(),
         not_power_source = {nature=true},
      
         max_life = resolvers.rngavg(5,9),
         life_rating= 6,
         combat_armor = 7, combat_def = 6,
         resolvers.talents{
            [Talents.T_FROSTBLAST]=math.floor(self:getTalentLevel(self.T_SHACKLE_SOUL)),
         },
         combat_spellpower = self:combatSpellpower(),

         summoner = self, summoner_gain_exp=true, wraith_summon=true,
         summon_time = duration,
         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 {}
   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")
   m.inc_damage = table.clone(self.inc_damage, true)

   -- Summons never flee
   m.ai_tactic.escape = 0
   m.summon_time = duration

   mod.class.NPC.castAs(m)
   engine.interface.ActorAI.init(m, m)

   return m
end


Top
 Profile  
 
PostPosted: Thu Sep 24, 2015 10:36 pm 
Offline
Uruivellas

Joined: Wed Apr 30, 2008 5:55 pm
Posts: 708
Have you tried delaying the spawn with onTickEnd ?

_________________
Addons: Arcane Blade Tweaks, Fallen Race, Monk Class, Weapons Pack
Currently working on Elementals. It's a big project, so any help would be appreciated. :)


Top
 Profile  
 
PostPosted: Sat Sep 26, 2015 11:02 am 
Offline
Uruivellas

Joined: Tue May 14, 2013 3:45 pm
Posts: 832
grayswandir wrote:
Have you tried delaying the spawn with onTickEnd ?


That did it, thanks.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group