PDA

View Full Version : SE_SpellVulnerability half fix (druid epic uses)


Shin Noir
09-29-2009, 05:18 PM
Ok, still up, who knows why.. This spell effect is used it seems primarily on druid epic, it makes the target more weak to damage. Malasinese uses it too (lvl 76/77 spell?) and some NPCs use it. I say "half fix" because I think that in the case of the NPC's they are supposed to boost/decrease dmg on all spell types, and not just instant detrimental spells.

I ran into an issue, and wrote a new function to solve it. This function is Mob::FindTypeValue(), and what this function does is it will return spelldata values from a mob that match the spell effect type specified. This is so if a mob has spell vulnerability on a debuff, it will look for it and return the value mod. I need to fix the loop to ensure it's returning the highest value if multiples of this SE is on it. Probably a few other debugs here or there. :P

I also am not entirely sure this excludes heals, I didn't test this very well, but heals weren't affected the little bit I did which kind of boggled me.

I left my printf console debug lines in there for anyone who wants to test, but commented out for now.

Index: mob.h
================================================== =================
--- mob.h (revision 998)
+++ mob.h (working copy)
@@ -495,6 +495,7 @@
void DamageShield(Mob* other);
bool FindBuff(int16 spellid);
bool FindType(int8 type, bool bOffensive = false, int16 threshold = 100);
+ sint32 FindTypeValue(int8 type, int8 stat); //Shin: Added for finding mob raw spell data.
sint8 GetBuffSlotFromType(int8 type);
int CountDispellableBuffs();
bool HasBuffIcon(Mob* caster, Mob* target, int16 spell_id);
Index: spdat.h
================================================== =================
--- spdat.h (revision 998)
+++ spdat.h (working copy)
@@ -401,7 +401,7 @@
//#define SE_Unknown293 293 //not used
#define SE_CriticalSpellChance 294 //not implemented
//#define SE_Unknown295 295 //not used
-#define SE_SpellVulnerability 296 //not implemented, base % increase in incoming spell damage
+#define SE_SpellVulnerability 296 //Shin: Minor fix to detrimental spells only, base % increase in incoming spell damage
#define SE_Empathy 297 //some kind of damage focus effect, maybe defensive?
#define SE_ChangeHeight 298 //not implemented
#define SE_WakeTheDead 299
Index: spell_effects.cpp
================================================== =================
--- spell_effects.cpp (revision 998)
+++ spell_effects.cpp (working copy)
@@ -173,7 +173,10 @@
{
// take partial damage into account
dmg = (sint32) (dmg * partial / 100);
-
+ //printf("Dmg before: %d", dmg);
+ //Shin: See if target has vulnerability debuff (or can be a invul buff if negative).
+ if (FindTypeValue(SE_SpellVulnerability,0)!=0) dmg += (dmg*FindTypeValue(SE_SpellVulnerability,0)/100);
+ //printf("Dmg After: %d did we find it? %d", dmg, FindTypeValue(SE_SpellVulnerability,0));
//handles AAs and what not...
if(caster)
dmg = caster->GetActSpellDamage(spell_id, dmg);
@@ -2752,6 +2755,7 @@
case SE_LimitMinLevel:
case SE_LimitCastTime:
case SE_NoCombatSkills:
+ case SE_SpellVulnerability: //Shin: This is a debuff handled SE.
{
break;
}
Index: spells.cpp
================================================== =================
--- spells.cpp (revision 998)
+++ spells.cpp (working copy)
@@ -4165,6 +4165,22 @@
return false;
}

+//Shin: FindTypeValue is used to return spell data. stat supports 3 values, 0: base, 1: base2, 3: max
+sint32 Mob::FindTypeValue(int8 type, int8 stat) {
+ for (int i = 0; i < BUFF_COUNT; i++) {
+ if (buffs[i].spellid != SPELL_UNKNOWN) {
+ for (int j = 0; j < EFFECT_COUNT; j++) {
+ if (spells[buffs[i].spellid].effectid[j] == type )
+ printf("Found value data.");
+ if (stat == 0) return spells[buffs[i].spellid].base[j];
+ if (stat == 1) return spells[buffs[i].spellid].base2[j];
+ if (stat == 2) return spells[buffs[i].spellid].max[j];
+ }
+ }
+ }
+ return 0;
+}
+
bool Mob::AddProcToWeapon(int16 spell_id, bool bPerma, int16 iChance) {
if(spell_id == SPELL_UNKNOWN)
return(false);