ToME: the Tales of Maj'Eyal

Everything about ToME
It is currently Sun Jun 24, 2018 5:18 am

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Sat Feb 10, 2018 5:09 pm 
Offline
Thalore

Joined: Thu Jul 27, 2006 2:50 am
Posts: 157
I'm trying to rewrite shockwave bomb into a skill that deals the theoretical maximum bonus of explosive expert contained to a single tile based on the level of throw bomb, and only have range scale with talent level (with damage being based on throw bomb's talent level/damage formula). It took a bit but I got shockwave bomb (renamed contained explosion) to deal the same multiplier as the maximum of explosion fairly easily.

However, I'm stumped on how to get it to have its damage based on throw bomb's. It's very easy to give it the same formula as throw bomb, but it feels somewhat weird to need 5 points in it.

I've tried replacing compute damage with
Code:
dam = self:callTalent(self.T_THROW_BOMB "computeDamage", t),

throws (attempt to index global 'self' (nil value)
Code:

computeDamage = function(self, t) return self:callTalent(self.T_THROW_BOMB, "computeDamage") end,


returns :
attempt to index local 'ammo' a nil value

When I try to add ammo to it it gets... weird.
Code:
computeDamage = function(self, t, ammo) return self:callTalent(self.T_THROW_BOMB, "computeDamage") end,


I'll just post the screenshot of the error it gives when trying to create a new character.
Image
Disabling zomnibus gives this error instead :
https://imgur.com/a/K2i9n

I've also tried creating a local variable that gets the talent level of throw bomb and then just using that in place of the "t" in the same compute damage block as I have in throw bomb.
Code:
   computeDamage = function(self, t, ammo)
      local inc_dam = 0
      local predam = self:getTalentLevel(self.T_THROW_BOMB)
      local damtype = DamageType.SPELLKNOCKBACK
      local particle = "ball_physical"
      if self:isTalentActive(self.T_ACID_INFUSION) then damtype = DamageType.ACID_BLIND; particle = "ball_acid"
      elseif self:isTalentActive(self.T_LIGHTNING_INFUSION) then damtype = DamageType.LIGHTNING_DAZE; particle = "ball_lightning_beam"
      elseif self:isTalentActive(self.T_FROST_INFUSION) then damtype = DamageType.ICE_SLOWONLY; particle = "ball_ice"
      elseif self:isTalentActive(self.T_FIRE_INFUSION) then damtype = DamageType.FIREBURN; particle = "fireflash"
      end
      -- want to make field occur twice but am unsure how
      inc_dam = inc_dam + (ammo.alchemist_bomb and ammo.alchemist_power or 0) / 100
      local dam = self:combatTalentSpellDamage(predam, 5, 175, ((self:combatSpellpower()*1.5 - 5)))
      local dam = dam * (1 + inc_dam)
      return dam, damtype, particle
   end,


When I do this, contained explosion deals 5.7 damage while throw bomb deals 33.7, and I'm not sure why (just on hovering over it at level 1, and when trying it out this damage calculation is correct, though it's pre explosion expert modifier).

edit : I believe i've figured it out. I needed to call it under action(self, t)
like this :
Code:
local dam, damtype, particle = self:callTalent(self.T_THROW_BOMB, "computeDamage", self, t, ammo)


It's doing exactly 25% lower damage for some reason, but that's really easy to fix.


Top
 Profile  
 
PostPosted: Sat Feb 10, 2018 11:43 pm 
Offline
Higher

Joined: Sun Dec 10, 2017 12:27 am
Posts: 77
I think your plan works, but your call is messed up.

callTalent has parameters of
Code:
(self, tid, name, ...)

where [...] represents 'any number of additional parameters, which I will put into a table and then sugar back into the function if it asks for additional parameters'. You seem to have included an unnecessary variable 't' in there, as a first additional parameter, which is probably a reference to the talent table for Shockwave Bomb. Since computeDamage needs a parameter for ammo, callTalent is assuming that the next parameter after the function name must be the ammo table. In fact, it's a talent table which is confusing it a little.

Your first example could read
Code:
dam = {self:callTalent(self.T_THROW_BOMB, "computeDamage", self:hasAlchemistWeapon())}

Throw Bomb gets your ammo and passes it to computeDamage, so you need to get your ammo and pass it via the callTalent call. You probably need to do some reference checking first though, so store self:hasAlchemistWeapon() in a local, test to verify it's not nil, then pass the local to the call.

EDIT: Oh, nevermind.
25% lower damage than what, exactly?


Top
 Profile  
 
PostPosted: Sun Feb 11, 2018 1:06 am 
Offline
Thalore

Joined: Thu Jul 27, 2006 2:50 am
Posts: 157
Lokean wrote:
I think your plan works, but your call is messed up.

callTalent has parameters of
Code:
(self, tid, name, ...)

where [...] represents 'any number of additional parameters, which I will put into a table and then sugar back into the function if it asks for additional parameters'. You seem to have included an unnecessary variable 't' in there, as a first additional parameter, which is probably a reference to the talent table for Shockwave Bomb. Since computeDamage needs a parameter for ammo, callTalent is assuming that the next parameter after the function name must be the ammo table. In fact, it's a talent table which is confusing it a little.

Your first example could read
Code:
dam = {self:callTalent(self.T_THROW_BOMB, "computeDamage", self:hasAlchemistWeapon())}

Throw Bomb gets your ammo and passes it to computeDamage, so you need to get your ammo and pass it via the callTalent call. You probably need to do some reference checking first though, so store self:hasAlchemistWeapon() in a local, test to verify it's not nil, then pass the local to the call.

EDIT: Oh, nevermind.
25% lower damage than what, exactly?

For some reason it did exactly 25% less damage than throw bomb (wasn't just a tooltip error, I tested it). I just did this to fix that :
Code:
      
local dam, damtype, particle = self:callTalent(self.T_THROW_BOMB, "computeDamage", self, t, ammo)
dam = dam * 1.25
dam = self:spellCrit(dam)


and this for the tooltip :
Code:
info = function(self, t)
      local ammo = self:hasAlchemistWeapon()
      local dam, damtype = 1
      if ammo then dam, damtype = self:callTalent(self.T_THROW_BOMB, "computeDamage", self, t, ammo) end
      dam = dam * 1.25
      dam = damDesc(self, DamageType.PHYSICAL, dam)
      return ([[Using mentally exhausting alchemical energies, you contain the explosion of a single bomb to a smaller space, dealing %0.1f damage of the active infusion type. If used without an infusion, deals physical damage. Range scales with talent level.
      The damge is multiplied by the theoretical maximum of explosion expert. Each kind of gem will also provide the same effect as a normal throw. The damage will improve with throw bomb level, better gems, and with your Spellpower.]]):format(dam)
   end,


(yeah, I could update the tooltip to list the damage type correctly)

For reference my explosion expert talent is coded differently than the base explosives ones, but I believe you're correct about what the problem was (the structures of the calls on the others are the same)

edit :
I believe I've figured out this issue as well :
local dam, damtype, particle = self:callTalent(self.T_THROW_BOMB, "computeDamage", ammo, ammo)
appears to have fixed it.


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