Post by Frumple on Feb 11, 2008 2:29:18 GMT -5
Because I finally got the physical-returning code to honor Iron Skin, despite having... um... never really looked at LUA before. At all. Besides that, it'd probably be neat if anyone had little, well, code-snippits laying around that makes this-modification or that-modification without really diserving a full patch. Anyway, my pride and (likely horrifically coded) joy: A seemingly functioning change to the physical returning code that, huzzah of huzzahs, is effected by the Defender's Iron Skin ability. This is really useful to dagger-users!
Of course, I have zero doubt there's some easier way to code that. I've been awake for too long to tell, kehe.
EDIT 14/2/08: Non-soaked damage now honors physical resistance! My weapon-using ghost knockoffs are now deliciously happy.
To-do: Well... since M.Defense can dodge returned magic attacks, everything similar should probably do the same for physical. That's sooo going to bloat that code...
-- Bosses/Elites can be immune to weapons...
if (get_monster_ability(monster(cave(y, x).m_idx), BOSS_RETURNING) and (p_ptr.abilities[(CLASS_DEFENDER * 10) + 2] >= 1)) then
local returndamages
returndamages = ((k / 2) - (p_ptr.abilities[(CLASS_DEFENDER * 10) + 2] * 100))
if returndamages >= 1 then
msg_print("You hurt yourself!")
take_hit(returndamages, "Their own stupid self.")
end
elseif (get_monster_ability(monster(cave(y, x).m_idx), BOSS_RETURNING) and (p_ptr.abilities[(CLASS_DEFENDER * 10) + 2] < 1)) then
local returndamages
returndamages = ((k / 2) - (((k / 2) * (p_ptr.resistances[GF_PHYSICAL+1])) / 100))
if returndamages >= 1 then
msg_print("You hurt yourself!")
take_hit(returndamages, "Their own stupid self.")
end
end
Of course, I have zero doubt there's some easier way to code that. I've been awake for too long to tell, kehe.
EDIT 14/2/08: Non-soaked damage now honors physical resistance! My weapon-using ghost knockoffs are now deliciously happy.
To-do: Well... since M.Defense can dodge returned magic attacks, everything similar should probably do the same for physical. That's sooo going to bloat that code...