ToME: the Tales of Maj'Eyal

Everything about ToME
It is currently Mon Sep 16, 2019 12:49 pm

All times are UTC




Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: Mon Sep 02, 2019 1:26 pm 
Offline
Higher

Joined: Sat Sep 29, 2018 3:43 am
Posts: 63
the talent description is:
Code:
The connection between predator and prey allows you to speak to the mind of your target and beckon them closer. For %d turns, they will try to come to you, even pushing others aside to do so. They will move towards you instead of acting %d%% of the time, but can save verses Mindpower to slow the effect. If they take significant damage, the beckoning may be overcome altogether. The effect makes concentration difficult for your target, reducing Spellpower and Mindpower by %d until they reach you. The Spellpower and Mindpower reduction increases with your Willpower.

which sounds like they will lose actions, just like when they're confused (but instead of acting randomly, they'll approach you).

but I see no action loss in the code of Beckoned effect. I'm not good at coding at all, so here is this topic.


Top
 Profile  
 
PostPosted: Mon Sep 02, 2019 3:21 pm 
Offline
Spiderkin

Joined: Wed Jan 22, 2014 1:46 pm
Posts: 477
Moving use energy so they do lose an action doing it.
Even better if they're slow/stunned as well they'll lose even more. And if you've both stunned AND slowed them and they move, enjoy your 10 turns of bashing them without retaliation !

_________________
I write guides and make addons too now, apparently

You can go here for a compilation of everything I wrote, plus some other important stuff!

Includes general guides (inscriptions, zone, prodigies), and class guides (Demo, Anorithil, Bulwark, Zerker, Sblade)


Top
 Profile  
 
PostPosted: Mon Sep 02, 2019 3:36 pm 
Offline
Higher

Joined: Sat Sep 29, 2018 3:43 am
Posts: 63
ok, I should have posted the code of the Beckoned effect.
it uses mod.class.NPC.move function to move the target, which I haven't found in the code, but according to my test, it does not use energy.


Top
 Profile  
 
PostPosted: Mon Sep 02, 2019 3:38 pm 
Offline
Spiderkin

Joined: Wed Jan 22, 2014 1:46 pm
Posts: 477
Get beckoned, you'll see if you don't get double turned :P
If the question is what part of the code use up the energy, yeah, post it because I'm on phone and reading code on it is a pain ^^

_________________
I write guides and make addons too now, apparently

You can go here for a compilation of everything I wrote, plus some other important stuff!

Includes general guides (inscriptions, zone, prodigies), and class guides (Demo, Anorithil, Bulwark, Zerker, Sblade)


Top
 Profile  
 
PostPosted: Mon Sep 02, 2019 3:42 pm 
Offline
Higher

Joined: Sat Sep 29, 2018 3:43 am
Posts: 63
Code:
newEffect{
   name = "BECKONED", image = "talents/beckon.png",
   desc = "Beckoned",
   long_desc = function(self, eff)
      local message = ("The target has been beckoned by %s and is heeding the call. There is a %d%% chance of moving towards the beckoner each turn."):format(eff.src.name, eff.chance)
      if eff.spellpowerChangeId and eff.mindpowerChangeId then
         message = message..(" (spellpower: %d, mindpower: %d"):format(eff.spellpowerChange, eff.mindpowerChange)
      end
      return message
   end,
   type = "mental",
   subtype = { dominate=true },
   status = "detrimental",
   parameters = { speedChange=0.5 },
   on_gain = function(self, err) return "#Target# has been beckoned.", "+Beckoned" end,
   on_lose = function(self, err) return "#Target# is no longer beckoned.", "-Beckoned" end,
   activate = function(self, eff)
      eff.particle = self:addParticles(Particles.new("beckoned", 1))

      eff.spellpowerChangeId = self:addTemporaryValue("combat_spellpower", eff.spellpowerChange)
      eff.mindpowerChangeId = self:addTemporaryValue("combat_mindpower", eff.mindpowerChange)
   end,
   deactivate = function(self, eff)
      if eff.particle then self:removeParticles(eff.particle) end

      if eff.spellpowerChangeId then
         self:removeTemporaryValue("combat_spellpower", eff.spellpowerChangeId)
         eff.spellpowerChangeId = nil
      end
      if eff.mindpowerChangeId then
         self:removeTemporaryValue("combat_mindpower", eff.mindpowerChangeId)
         eff.mindpowerChangeId = nil
      end
   end,
   on_timeout = function(self, eff)
   end,
   do_act = function(self, eff)
      if eff.src.dead then
         self:removeEffect(self.EFF_BECKONED)
         return
      end
      if not self:enoughEnergy() then return nil end

      -- apply periodic timer instead of random chance
      if not eff.timer then
         eff.timer = rng.float(0, 100)
      end
      if not self:checkHit(eff.src:combatMindpower(), self:combatMentalResist(), 0, 95, 5) then
         eff.timer = eff.timer + eff.chance * 0.5
         game.logSeen(self, "#F53CBE#%s struggles against the beckoning.", self.name:capitalize())
      else
         eff.timer = eff.timer + eff.chance
      end

      if eff.timer > 100 then
         eff.timer = eff.timer - 100

         local distance = self.x and eff.src.x and core.fov.distance(self.x, self.y, eff.src.x, eff.src.y) or 1000
         if math.floor(distance) > 1 and distance <= eff.range then
            -- in range but not adjacent

            -- add debuffs
            if not eff.spellpowerChangeId then eff.spellpowerChangeId = self:addTemporaryValue("combat_spellpower", eff.spellpowerChange) end
            if not eff.mindpowerChangeId then eff.mindpowerChangeId = self:addTemporaryValue("combat_mindpower", eff.mindpowerChange) end

            -- custom pull logic (adapted from move_dmap; forces movement, pushes others aside, custom particles)

            if not self:attr("never_move") then
               local source = eff.src
               local moveX, moveY = source.x, source.y -- move in general direction by default
               if not self:hasLOS(source.x, source.y) then
                  local a = Astar.new(game.level.map, self)
                  local path = a:calc(self.x, self.y, source.x, source.y)
                  if path then
                     moveX, moveY = path[1].x, path[1].y
                  end
               end

               if moveX and moveY then
                  local old_move_others, old_x, old_y = self.move_others, self.x, self.y
                  self.move_others = true
                  local old = rawget(self, "aiCanPass")
                  self.aiCanPass = mod.class.NPC.aiCanPass
                  mod.class.NPC.moveDirection(self, moveX, moveY, false)
                  self.aiCanPass = old
                  self.move_others = old_move_others
                  if old_x ~= self.x or old_y ~= self.y then
                     game.level.map:particleEmitter(self.x, self.y, 1, "beckoned_move", {power=power, dx=self.x - source.x, dy=self.y - source.y})
                  end
               end
            end
         else
            -- adjacent or out of range..remove debuffs
            if eff.spellpowerChangeId then
               self:removeTemporaryValue("combat_spellpower", eff.spellpowerChangeId)
               eff.spellpowerChangeId = nil
            end
            if eff.mindpowerChangeId then
               self:removeTemporaryValue("combat_mindpower", eff.mindpowerChangeId)
               eff.mindpowerChangeId = nil
            end
         end
      end
   end,
   do_onTakeHit = function(self, eff, dam)
      eff.resistChance = (eff.resistChance or 0) + math.min(100, math.max(0, dam / self.max_life * 100))
      if rng.percent(eff.resistChance) then
         game.logSeen(self, "#F53CBE#%s is jolted to attention by the damage and is no longer being beckoned.", self.name:capitalize())
         self:removeEffect(self.EFF_BECKONED)
      end

      return dam
   end,
}


ok, here we go.
and I personally never remember losing actions when beckoned and forced to move (well, this may also be because those cursed were so weak that double-turned made few difference lol), and I remember moving 2 tiles toward that cursed when beckoned with just 1 click.


Top
 Profile  
 
PostPosted: Mon Sep 02, 2019 11:40 pm 
Offline
Perspiring Physicist

Joined: Sun Sep 09, 2012 7:43 am
Posts: 5931
mod.class.NPC.moveDirection(self, moveX, moveY, false) calls actor:move, which then deducts Energy for the move action.

_________________
My feedback meter decays into coding. Give me feedback and I make mods.


Top
 Profile  
 
PostPosted: Tue Sep 03, 2019 1:54 pm 
Offline
Archmage

Joined: Mon Mar 28, 2011 12:42 pm
Posts: 392
helminthauge wrote:
and I personally never remember losing actions when beckoned and forced to move (well, this may also be because those cursed were so weak that double-turned made few difference lol), and I remember moving 2 tiles toward that cursed when beckoned with just 1 click.


I sure do. I've been obliterated without a chance to respond due to bad luck vs. Beckon.

_________________
My class guides: Possessor, Oozemancer


Top
 Profile  
 
PostPosted: Thu Sep 05, 2019 4:01 pm 
Offline
Higher

Joined: Sat Sep 29, 2018 3:43 am
Posts: 63
confirmed, positive.


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


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