|
|
 |
 |
 |
 |
|
 |
 |
|
 |
 |
|
 |
|
 |
|
 |

07-11-2010, 09:23 PM
|
Dragon
|
|
Join Date: May 2009
Location: Milky Way
Posts: 539
|
|
COMMITTED: SE_HealRate
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
|
 |
|
 |

07-13-2010, 12:17 AM
|
 |
Developer
|
|
Join Date: Aug 2006
Location: USA
Posts: 5,946
|
|
Couple suggestions:
spell effects.cpp
Code:
@@ -272,6 +276,8 @@
val = cap;
if(val > 0)
+ if(caster)
+ val = GetHealRate(val, caster->GetTarget());
HealDamage(val, caster);
break;
I assume you intended this instead:
Code:
if(val > 0)
{
if(caster && caster->GetTarget())
val = GetHealRate(val, caster->GetTarget());
HealDamage(val, caster);
}
Needed the brackets surrounding it and I added a check to make sure the caster has a target before sending them to the function that does not appear to check for a null pointer in the target. Those null pointers can be nasty :P
|

07-15-2010, 08:34 AM
|
 |
Developer
|
|
Join Date: Aug 2006
Location: USA
Posts: 5,946
|
|
I am still testing most of the effects you have submitted. I haven't been able to test this one or the skill attack one yet due to some crash issues in the latest source updates. I wanted to mention here that I was also getting some crashes that seemed to be caused by the heal code here. I think they were just related to a potential null pointer that is easily fixed by doing something like this:
Code:
@@ -3143,7 +3139,10 @@
//healing spell...
//healing aggro would go here; removed for now
if(caster)
+ {
+ if(caster->GetTarget())
+ effect_value = GetHealRate(effect_value, caster->GetTarget());
effect_value = caster->GetActSpellHealing(spell_id, effect_value);
+ }
HealDamage(effect_value, caster);
}
|
 |
|
 |

07-15-2010, 10:17 AM
|
 |
Demi-God
|
|
Join Date: May 2007
Location: b
Posts: 1,449
|
|
Quote:
Originally Posted by trevius
I am still testing most of the effects you have submitted. I haven't been able to test this one or the skill attack one yet due to some crash issues in the latest source updates. I wanted to mention here that I was also getting some crashes that seemed to be caused by the heal code here. I think they were just related to a potential null pointer that is easily fixed by doing something like this:
Code:
@@ -3143,7 +3139,10 @@
//healing spell...
//healing aggro would go here; removed for now
if(caster)
+ {
+ if(caster->GetTarget())
+ effect_value = GetHealRate(effect_value, caster->GetTarget());
effect_value = caster->GetActSpellHealing(spell_id, effect_value);
+ }
HealDamage(effect_value, caster);
}
|
Yeah, unfortunately there's no way to get a caster out of zone, so this is the best solution for now; same issues I ran into with Mythic, Timesfive, etc, when doing the spelldamage/healing code. It may be worth mentioning that it's probably better to add GetHealRate into GetActSpellHealing instead of that function. Also, it may be worth looking into making an NPC::GetActSpellHealing, for those times when NPCs calculate differently.
|
 |
|
 |

07-16-2010, 09:36 AM
|
 |
Developer
|
|
Join Date: Aug 2006
Location: USA
Posts: 5,946
|
|
I think it was that NPCs don't change targets when self buffing, as far as I know. So, when NPCs started self buffing on zone startup and cast certain buffs that might run through this code, it crashed the zone. At least that is my best guess. It was definitely NPCs causing it.
Finally got to test it again with the latest source and it no longer crashes with the few changes I have made.
|

07-16-2010, 08:01 PM
|
Dragon
|
|
Join Date: May 2009
Location: Milky Way
Posts: 539
|
|
thanks for the testing Trev, hopefully we can get these effects solid pretty soon.
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 10:45 AM.
|
|
 |
|
 |
|
|
|
 |
|
 |
|
 |