Post by sekira on Nov 27, 2010 11:47:23 GMT -5
Rod zapping radius was not affected by Mage's Explosive spells ability
Here is the fix
replace the entire zap_rod(...) function in scripts\objects.lua with this:
If you just want to change the lines I changed rather than a big cut and paste, code in green was added, code in yellow replaces the existing code in that position
I also noticed that item_activation(...) doesn't seem to take Mage Explosive Spells ability into account when calculating radius, but I haven't figured out the fix yet.
Here is the fix
replace the entire zap_rod(...) function in scripts\objects.lua with this:
function zap_rod ()
local dir
local rad
local dam
local i
local j
local z
-- First, let's check if the player is wearing a rod
-- Any rods in any hands will do.
if (not(inven(INVEN_WIELD).tval == TV_ROD) and not(inven(INVEN_WIELD + 1).tval == TV_ROD)) then
msg_print("You must wield a rod.")
return
else
--Now, check for a crystal */
if (not(inven(INVEN_TOOL).tval == TV_CRYSTAL)) then
msg_print("You must be using a crystal!")
return
else
local r
if (inven(INVEN_WIELD).tval == TV_ROD and inven(INVEN_WIELD + 1).tval == TV_ROD) then
i = 0
j = 1
elseif (inven(INVEN_WIELD).tval == TV_ROD) then
i = 0
j = 0
else
i = 1
j = 1
end
for r = i, j do
local zaps
zaps = 1 + (p_ptr.abilities[(CLASS_MAGE * 10) + 6] / 10)
for z = 1, zaps do
-- Is the crystal charged?
if (inven(INVEN_TOOL).pval <= 0) then
msg_print("This crystal has no charges left.")
return
else
local spellstat
if (p_ptr.stat_ind[A_INT+1] >= p_ptr.stat_ind[A_WIS+1]) then
spellstat = A_INT
else
spellstat = A_WIS
end
dam = spell_damages(inven(INVEN_TOOL).branddam, spellstat, 0)
rad = inven(INVEN_TOOL).brandrad + (p_ptr.abilities[(CLASS_MAGE * 10) + 5] / 5)
dir = lua_get_aim_dir()
rod_zap = 1
fire_ball(inven(INVEN_TOOL).brandtype, dir, dam, rad)
rod_zap = 0
if (p_ptr.skill[18] < 15) then inven(INVEN_TOOL).pval = inven(INVEN_TOOL).pval - 1 end
update_and_handle()
energy_use = 100
end
end
end
end
end
end
If you just want to change the lines I changed rather than a big cut and paste, code in green was added, code in yellow replaces the existing code in that position
I also noticed that item_activation(...) doesn't seem to take Mage Explosive Spells ability into account when calculating radius, but I haven't figured out the fix yet.