From 5c7484cea26376441c2959a440f0a4aaae3b4ef4 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 28 Feb 2014 17:43:37 -0500 Subject: [PATCH] Switched some heal messages to StringIDs --- zone/StringIDs.h | 2 ++ zone/attack.cpp | 20 ++++++------------- zone/effects.cpp | 51 +++++++++++++++++++++++++----------------------- 3 files changed, 35 insertions(+), 38 deletions(-) diff --git a/zone/StringIDs.h b/zone/StringIDs.h index 5609ec2cd..2cc076b59 100644 --- a/zone/StringIDs.h +++ b/zone/StringIDs.h @@ -125,6 +125,7 @@ #define YOU_ARE_PROTECTED 424 //%1 tries to cast a spell on you, but you are protected. #define TARGET_RESISTED 425 //Your target resisted the %1 spell. #define YOU_RESIST 426 //You resist the %1 spell! +#define YOU_CRIT_HEAL 427 //You perform an exceptional heal! (%1) #define YOU_CRIT_BLAST 428 //You deliver a critical blast! (%1) #define SUMMONING_CORPSE 429 //Summoning your corpse. #define SUMMONING_CORPSE_OTHER 430 //Summoning %1's corpse. @@ -169,6 +170,7 @@ #define OTHER_REGAIN_CAST 1033 //%1 regains concentration and continues casting. #define GENERIC_SHOUT 1034 //%1 shouts '%2' #define GENERIC_EMOTE 1036 //%1 %2 +#define OTHER_CRIT_HEAL 1039 //%1 performs an exceptional heal! (%2) #define OTHER_CRIT_BLAST 1040 //%1 delivers a critical blast! (%2) #define NPC_ENRAGE_START 1042 //%1 has become ENRAGED. #define NPC_ENRAGE_END 1043 //%1 is no longer enraged. diff --git a/zone/attack.cpp b/zone/attack.cpp index 0b59632b1..52dd97196 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -3851,24 +3851,17 @@ void Mob::HealDamage(uint32 amount, Mob* caster) { } } - if(amount > (maxhp - curhp)) acthealed = (maxhp - curhp); else acthealed = amount; - char *TempString = nullptr; - - MakeAnyLenString(&TempString, "%d", acthealed); - - if(acthealed > 100){ - if(caster){ - Message_StringID(MT_NonMelee, YOU_HEALED, caster->GetCleanName(), TempString); - if(caster != this){ - caster->Message_StringID(MT_NonMelee, YOU_HEAL, GetCleanName(), TempString); - } - } - else{ + if (acthealed > 100) { + if (caster) { + Message_StringID(MT_NonMelee, YOU_HEALED, caster->GetCleanName(), itoa(acthealed)); + if (caster != this) + caster->Message_StringID(MT_NonMelee, YOU_HEAL, GetCleanName(), itoa(acthealed)); + } else { Message(MT_NonMelee, "You have been healed for %d points of damage.", acthealed); } } @@ -3882,7 +3875,6 @@ void Mob::HealDamage(uint32 amount, Mob* caster) { SendHPUpdate(); } - safe_delete_array(TempString); } //proc chance includes proc bonus diff --git a/zone/effects.cpp b/zone/effects.cpp index 39ee1ab18..c5e9dc20a 100644 --- a/zone/effects.cpp +++ b/zone/effects.cpp @@ -259,7 +259,7 @@ int32 NPC::GetActSpellHealing(uint16 spell_id, int32 value, Mob* target) { } int32 Client::GetActSpellHealing(uint16 spell_id, int32 value, Mob* target) { - + if (target == nullptr) target = this; @@ -267,54 +267,57 @@ int32 Client::GetActSpellHealing(uint16 spell_id, int32 value, Mob* target) { int16 chance = 0; int8 modifier = 1; bool Critical = false; - - value_BaseEffect = value + (value*GetFocusEffect(focusFcBaseEffects, spell_id)/100); - + + value_BaseEffect = value + (value*GetFocusEffect(focusFcBaseEffects, spell_id)/100); + value = value_BaseEffect; - value += int(value_BaseEffect*GetFocusEffect(focusImprovedHeal, spell_id)/100); - + value += int(value_BaseEffect*GetFocusEffect(focusImprovedHeal, spell_id)/100); + // Instant Heals if(spells[spell_id].buffduration < 1) { - chance += itembonuses.CriticalHealChance + spellbonuses.CriticalHealChance + aabonuses.CriticalHealChance; + chance += itembonuses.CriticalHealChance + spellbonuses.CriticalHealChance + aabonuses.CriticalHealChance; + + chance += target->GetFocusIncoming(focusFcHealPctCritIncoming, SE_FcHealPctCritIncoming, this, spell_id); - chance += target->GetFocusIncoming(focusFcHealPctCritIncoming, SE_FcHealPctCritIncoming, this, spell_id); - if (spellbonuses.CriticalHealDecay) - chance += GetDecayEffectValue(spell_id, SE_CriticalHealDecay); - + chance += GetDecayEffectValue(spell_id, SE_CriticalHealDecay); + if(chance && (MakeRandomInt(0,99) < chance)) { Critical = true; modifier = 2; //At present time no critical heal amount modifier SPA exists. } - + value *= modifier; - value += GetFocusEffect(focusFcHealAmtCrit, spell_id) * modifier; - value += GetFocusEffect(focusFcHealAmt, spell_id); - value += target->GetFocusIncoming(focusFcHealAmtIncoming, SE_FcHealAmtIncoming, this, spell_id); - + value += GetFocusEffect(focusFcHealAmtCrit, spell_id) * modifier; + value += GetFocusEffect(focusFcHealAmt, spell_id); + value += target->GetFocusIncoming(focusFcHealAmtIncoming, SE_FcHealAmtIncoming, this, spell_id); + if(itembonuses.HealAmt && spells[spell_id].classes[(GetClass()%16) - 1] >= GetLevel() - 5) value += GetExtraSpellAmt(spell_id, itembonuses.HealAmt, value) * modifier; - value += value*target->GetHealRate(spell_id, this)/100; + value += value*target->GetHealRate(spell_id, this)/100; - if (Critical) - entity_list.MessageClose(this, false, 100, MT_SpellCrits, "%s performs an exceptional heal! (%d)", GetName(), value); + if (Critical) { + entity_list.MessageClose_StringID(this, true, 100, MT_SpellCrits, + OTHER_CRIT_HEAL, GetName(), itoa(value)); + Message_StringID(MT_SpellCrits, YOU_CRIT_HEAL, itoa(value)); + } return value; } //Heal over time spells. [Heal Rate and Additional Healing effects do not increase this value] else { - - chance = itembonuses.CriticalHealOverTime + spellbonuses.CriticalHealOverTime + aabonuses.CriticalHealOverTime; - chance += target->GetFocusIncoming(focusFcHealPctCritIncoming, SE_FcHealPctCritIncoming, this, spell_id); - + chance = itembonuses.CriticalHealOverTime + spellbonuses.CriticalHealOverTime + aabonuses.CriticalHealOverTime; + + chance += target->GetFocusIncoming(focusFcHealPctCritIncoming, SE_FcHealPctCritIncoming, this, spell_id); + if (spellbonuses.CriticalRegenDecay) chance += GetDecayEffectValue(spell_id, SE_CriticalRegenDecay); - + if(chance && (MakeRandomInt(0,99) < chance)) return (value * 2); }