I knew there was a cleaner way to do these types of effects but since the SpellVulnerability code was so intertwined with the spell shielding stuff atm, I wanted to do a clean test case on a similar effect. You may remember this effect from fun spells like
Balance of Zebuxoruk and paladins will be happy to have their epic 2.0 click working(
Flames of the Valiant)
I'm going to go redo the spellvulner code to match this way as I think its much cleaner and of course crits matching dmg is always a bonus. Will post diffs of just the spell shielding code and then the spell effect code as well, to keep it cleaner in that thread. Will have to update the skilldmgtaken effect as well as crits arent matching dmg.
mob.h
Code:
Index: mob.h
===================================================================
--- mob.h (revision 1596)
+++ mob.h (working copy)
@@ -778,6 +778,7 @@
bool TryDeathSave();
void DoBuffWearOffEffect(uint32 index);
void TryTriggerOnCast(Mob *target, uint32 spell_id);
+ int32 GetHealRate(uint32 amount, Mob *target);
static int32 GetAppearanceValue(EmuAppearance iAppearance);
void SendAppearancePacket(int32 type, int32 value, bool WholeZone = true, bool iIgnoreSelf = false, Client *specific_target=NULL);
mob.cpp
Code:
Index: mob.cpp
===================================================================
--- mob.cpp (revision 1596)
+++ mob.cpp (working copy)
@@ -3036,4 +3036,32 @@
}
}
}
+}
+
+int32 Mob::GetHealRate(uint32 amount, Mob *target)
+{
+
+ int slot = target->GetBuffSlotFromType(SE_HealRate);
+ if(slot >= 0)
+ {
+ sint32 modify_amount = amount;
+ for(int i = 0; i < EFFECT_COUNT; i++)
+ {
+ if (spells[buffs[slot].spellid].effectid[i] == SE_HealRate)
+ {
+ // if the effect reduces the heal amount below 0, return 0.
+ if(spells[buffs[slot].spellid].base[i] < -100)
+ {
+ amount = 0;
+ break;
+ }
+ else
+ {
+ amount += (modify_amount * spells[buffs[slot].spellid].base[i] / 100);
+ break;
+ }
+ }
+ }
+ }
+ return amount;
}
\ No newline at end of file
spell effects.cpp
Code:
Index: spell_effects.cpp
===================================================================
--- spell_effects.cpp (revision 1596)
+++ spell_effects.cpp (working copy)
@@ -211,8 +211,10 @@
else if(dmg > 0) {
//healing spell...
if(caster)
+ {
+ dmg = GetHealRate(dmg, caster->GetTarget());
dmg = caster->GetActSpellHealing(spell_id, dmg);
-
+ }
HealDamage(dmg, caster);
}
@@ -248,6 +250,8 @@
dmg = -dmg;
Damage(caster, dmg, spell_id, spell.skill, false, buffslot, false);
} else {
+ if(caster)
+ dmg = GetHealRate(dmg, caster->GetTarget());
HealDamage(dmg, caster);
}
break;
@@ -272,6 +276,8 @@
val = cap;
if(val > 0)
+ if(caster)
+ val = GetHealRate(val, caster->GetTarget());
HealDamage(val, caster);
break;
@@ -2209,17 +2215,6 @@
break;
}
- case SE_HealRate:
- {
-#ifdef SPELL_EFFECT_SPAM
- snprintf(effect_desc, _EDLEN, "Heal Effectiveness: %d%%", effect_value);
-#endif
- // solar: TODO implement this
- const char *msg = "Heal Effectiveness is not implemented.";
- if(caster) caster->Message(13, msg);
- break;
- }
-
case SE_Screech:
{
#ifdef SPELL_EFFECT_SPAM
@@ -2812,6 +2807,7 @@
case SE_LimitCastTime:
case SE_NoCombatSkills:
case SE_TriggerOnCast:
+ case SE_HealRate:
{
break;
}
@@ -3143,7 +3139,10 @@
//healing spell...
//healing aggro would go here; removed for now
if(caster)
+ {
+ effect_value = GetHealRate(effect_value, caster->GetTarget());
effect_value = caster->GetActSpellHealing(spell_id, effect_value);
+ }
HealDamage(effect_value, caster);
}
@@ -3151,8 +3150,9 @@
}
case SE_HealOverTime:
{
+
effect_value = CalcSpellEffectValue(spell_id, i, caster_level);
-
+ effect_value = GetHealRate(effect_value, this);
//is this affected by stuff like GetActSpellHealing??
HealDamage(effect_value, caster);
//healing aggro would go here; removed for now