View Single Post
  #1  
Old 04-26-2012, 07:11 PM
Hateborne
Hill Giant
 
Join Date: May 2010
Posts: 125
Exclamation SpellVulnerability Inconsistency?

Sorry to bother everyone again, but I am noticing something off with SpellVulnerability (in my limited experiences).

SpellVulnerability is being treated as a buff when attached to song. A buff in the sense that it is REDUCING damage taken. I do not have the exact numbers on hand at the moment. When attached to a bard spell, SpellVulnerability with base_value of 10 reduces damage by 10%. I thought I would get clever and do -10...it seemed to still reduce it by 10%.

When using SpellVulnerability on a spell, it seems to have a cap of sorts when using positive base_values. 10/25/50 seemed to all do the same thing. However, -10/-25/-50 caused VERY erratic numbers. I do remember -10 and -50 being higher than -25. All of the negative numbers caused a substantial damage increase.

Can anyone point out where I might look to trace the path of SpellVulnerability? I cannot find anything other than:
Code:
Spdat.h
#define SE_SpellVulnerability			296	// implemented - increase in incoming spell damage


spell_effects.cpp
		case SE_SpellVulnerability:
		{
			if(type == focusSpellVulnerability)
			{
				value = 1;
			}
			break;
		}

mob.h
typedef enum {	//focus types
	focusSpellHaste = 1,
	focusSpellDuration,
	focusRange,
	focusReagentCost,
	focusManaCost,
	focusImprovedHeal,
	focusImprovedDamage,
	focusImprovedDOT,		//i dont know about this...
	focusImprovedCritical,
	focusImprovedUndeadDamage,
	focusPetPower,
	focusResistRate,
	focusSpellHateMod,
	focusTriggerOnCast,
	focusSpellVulnerability,
	focusTwincast,
	focusSympatheticProc,
	focusSpellDamage,
	focusSpellDurByTic,
	focusSwarmPetDuration,
	focusReduceRecastTime,
	focusBlockNextSpell,
} focusType;
And from mob.cpp:
Code:
sint32 Mob::GetVulnerability(sint32 damage, Mob *caster, uint32 spell_id, int32 ticsremaining)
{
	// If we increased the datatype on GetBuffSlotFromType, this wouldnt be needed
	uint32 buff_count = GetMaxTotalSlots();
	for(int i = 0; i < buff_count; i++) 
	{
		if(IsEffectInSpell(buffs[i].spellid, SE_SpellVulnerability))
		{
			// For Clients, Pets and Bots that are casting the spell, see if the vulnerability affects their spell.
			if(!caster->IsNPC())
			{
				sint32 focus = caster->CalcFocusEffect(focusSpellVulnerability, buffs[i].spellid, spell_id);
				if(focus == 1)
				{
					damage += damage * spells[buffs[i].spellid].base[0] / 100;
					break;
				}
			}
			// If an NPC is casting the spell on a player that has a vulnerability, relaxed restrictions on focus 
			// so that either the Client is vulnerable to DoTs or DDs of various resists or all.
			else if (caster->IsNPC())
			{
				int npc_resist = 0;
				int npc_instant = 0;
				int npc_duration = 0;
				for(int j = 0; j < EFFECT_COUNT; j++)
				{
					switch (spells[buffs[i].spellid].effectid[j]) 
					{
					
					case SE_Blank:
						break;

					case SE_LimitResist:
						if(spells[buffs[i].spellid].base[j])
						{
							if(spells[spell_id].resisttype == spells[buffs[i].spellid].base[j])
								npc_resist = 1;
						}
						break;

					case SE_LimitInstant:
						if(!ticsremaining) 
						{
							npc_instant = 1;
							break;
						}

					case SE_LimitMinDur:
						if(ticsremaining) 
						{
							npc_duration = 1;
							break;
						}

						default:{
						// look pretty
							break;
						}	
					}
				}
				// DDs and Dots of all resists 
				if ((npc_instant) || (npc_duration)) 
					damage += damage * spells[buffs[i].spellid].base[0] / 100;
				
				else if (npc_resist) 
				{
					// DDs and Dots restricted by resists
					if ((npc_instant) || (npc_duration)) 
					{
						damage += damage * spells[buffs[i].spellid].base[0] / 100;
					}
					// DD and Dots of 1 resist ... these are to maintain compatibility with current spells, not ideal.
					else if (!npc_instant && !npc_duration)
					{
						damage += damage * spells[buffs[i].spellid].base[0] / 100;
					}
				}
			}
		}
	}
	return damage;
}
Thank you in advance.

-Hate
Reply With Quote