View Single Post
  #12  
Old 09-08-2014, 10:18 PM
Torven
Sarnak
 
Join Date: Aug 2014
Posts: 52
Default

I just ran your code and it has the same problem mine had before I changed spell_effects.cpp.

If you cast a low level DD spell on a mob with near-immunity, it will do zero damage, show no non-melee text, and instead display two emote messages, like this:

Code:
[Mon Sep 08 17:49:52 2014] You say, '#cast 93'
[Mon Sep 08 17:49:52 2014] Your Earring of Influxed Gravity begins to glow.
[Mon Sep 08 17:49:52 2014] The Idol of Rallos Zek singes as the Burst of Flame hits them.
[Mon Sep 08 17:49:52 2014] The Idol of Rallos Zek singes as the Burst of Flame hits them.
[Mon Sep 08 17:49:53 2014] You say, '#cast 93'
[Mon Sep 08 17:49:53 2014] Your Earring of Influxed Gravity begins to glow.
[Mon Sep 08 17:49:53 2014] Your target resisted the Burst of Flame spell.
(I am however using a very old client)

The cause is because spell_effects.cpp floors the damage when it converts to an int32:

dmg = (int32) (dmg * partial / 100);

And low damage spells and/or very low partial rolls will result in a damage that is < 1.

In fact since spells can't hit for anywhere near full damage at near-immunity resist levels, if you for example cast burst of flame on a target with 570 fire resist, every single non-resist will hit for 0 damage.

partial_modifier = ((150 * (resist_chance - roll)) / resist_chance);

Fill in 570 for resist chance (mob resist value, modified by level and such if applicable) and 200 for roll (maximum possible roll) then you get ~97.3684. Floor it since partial_modifier is an int, you get 97. So the absolute highest damage possible spell at 570 resist is 3% the spell's maximum.

ResistSpell() returning 0 will register as a full resist-- it's the non-zero returns that are resulting in 0 damage casts but no resist message. All these casts should not be full resisting either, otherwise you'll end up with NPCs being immune to low damage spells below the 600 threshold. If you view my Soldier of Fire logs at -58 resist debuff, you can see that every single non-resist cast hits for 1 damage (using a 20 damage spell).
Reply With Quote