[b38] Minor: Scatter Shot displays ASCII symbol

Where bugs go to lie down and rest

Moderator: Moderator

Post Reply
Message
Author
PowerWyrm
Sher'Tul
Posts: 1106
Joined: Thu Nov 21, 2002 9:53 pm

[b38] Minor: Scatter Shot displays ASCII symbol

#1 Post by PowerWyrm »

While using all other archery talents will display the normal arrow tile, Scatter Shot will display a basic white "/" when using it.

jenx
Sher'Tul Godslayer
Posts: 2263
Joined: Mon Feb 14, 2011 11:16 pm

Re: [b38] Minor: Scatter Shot displays ASCII symbol

#2 Post by jenx »

I've tried without success to track this down in the code.

The only thing I noticed was that this talent differs from all other archery talents in one relevant place: in the third argument of the function:

[code] 365                 self:archeryShoot(targets, t, tg, {mult=self:combatTalentWeaponDamage(t, 0.5, 1.5)})
[/code]

All the other functions have "nil" rather than "tg".

The function makes a lot of this variable:
[code]
270 function _M:archeryShoot(targets, talent, tg, params)
271         local weapon, ammo = self:hasArcheryWeapon()
272         if not weapon then
273                 game.logPlayer(self, "You must wield a bow or a sling (%s)!", ammo)
274                 rn lh
275         end
276         if self:attr("disarmed") then
277                 game.logPlayer(self, "You are disarmed!")
278                 return nil
279         end
280         print("[SHOOT WITH]", weapon.name, ammo.name)
281         local realweapon = weapon
282         weapon = weapon.combat
283
284         local tg = tg or {}
285         tg.type = tg.type or weapon.tg_type or ammo.combat.tg_type or tg.type or "bolt"
286         tg.talent = tg.talent or talent
287
288         if not tg.range then tg.range=weapon.range or 6 end
289         tg.display = tg.display or {display=' ', particle="arrow", particle_args={tile="shockbolt/"..(ammo.proj_image or realweapon.proj_image):gsub("%.png$", "")}}
290         tg.speed = (tg.speed or 10) + (ammo.combat.travel_speed or 0) + (weapon.travel_speed or 0) + (self.travel_speed or 0)
291         tg.archery = params or {}
292         tg.archery.weapon = weapon
293         for i = 1, #targets do
294                 local tg = table.clone(tg)
295                 tg.archery.ammo = targets[i].ammo
296                 self:projectile(tg, targets[i].x, targets[i].y, archery_projectile)
297         end
298 end
299
[/code]
MADNESS rocks

PowerWyrm
Sher'Tul
Posts: 1106
Joined: Thu Nov 21, 2002 9:53 pm

Re: [b38] Minor: Scatter Shot displays ASCII symbol

#3 Post by PowerWyrm »

Hmm this code looks really messy.

Code: Select all

local tg = tg or {}
If I'm not mistaken, this means: if tg = nil then initialize local tg with empty values else use the tg parameter.

Code: Select all

tg.display = tg.display or {display=' ', particle="arrow", particle_args={tile="shockbolt/"..(ammo.proj_image or realweapon.proj_image):gsub("%.png$", "")}}
So here, the tile displayed is the one specified by the tg parameter or the one loaded directly from the shockbolt tileset. If the tile is an ASCII symbol for the Scatter Shot talent, this means that it has not been initialized in the tg parameter.

Post Reply