I noticed tonight math seems to be off when a heal crits it does not factor in the healing bonus when HAPPY_HEAL is active.
I am not sure if I am missing the order of operations when it crits or what
It seems to work when it non-crits but I am not sure exactly how to write it for it to work during crits
Code:
case SPELL_HEAL_LIGHT:
crit_percent = ((rand_number(1,100)) + (GET_SPELL_MODS(ch, DMG_INCREASE_CRITPER)));
if (affected_by_spell(ch, SPELL_BEACON_OF_HOPE)) {
crit_percent += 50;
if (crit_percent > 100) {
crit_percent = 100;
}
}
if (crit_percent <= 99) {
if ((IS_HAPPYHOUR && IS_HAPPYHEAL) && (!IS_NPC(ch))) {
victim_add_hits = (60 + (GET_SPELL_MODS(ch, DMG_INCREASE_HEAL)));
victim_add_hits += HAPPY_HEAL;
}
if ((IS_HAPPYHOUR && !IS_HAPPYHEAL) && (!IS_NPC(ch))) {
victim_add_hits = (60 + (GET_SPELL_MODS(ch, DMG_INCREASE_HEAL)));
}
if ((!IS_HAPPYHOUR) || (IS_NPC(ch))) {
victim_add_hits = (60 + (GET_SPELL_MODS(ch, DMG_INCREASE_HEAL)));
}
send_to_char(victim, "A warm feeling fills your body.\r\n");
if (victim != ch) {
act("You heal $N.", FALSE, ch, 0, victim, TO_CHAR);
}
to_room = "$n heals $N.";
}
if (crit_percent >= 100) {
dam = (60 + (GET_SPELL_MODS(ch, DMG_INCREASE_HEAL)));
crit_damage = ((dam * (GET_SPELL_MODS(ch, DMG_INCREASE_CRITDMG))) / 100);
total_damage = (dam + crit_damage);
if ((IS_HAPPYHOUR && IS_HAPPYHEAL) && (!IS_NPC(ch))) {
victim_add_hits = (total_damage + HAPPY_HEAL);
}
if ((IS_HAPPYHOUR && !IS_HAPPYHEAL) && (!IS_NPC(ch))) {
victim_add_hits = total_damage;
}
if ((!IS_HAPPYHOUR) || (IS_NPC(ch))) {
victim_add_hits = total_damage;
}
send_to_char(victim, "@Y*CRITICAL*@n A warm feeling fills your body.\r\n");
if (victim != ch) {
act("@Y*CRITICAL*@n You heal $N.", FALSE, ch, 0, victim, TO_CHAR);
}
to_room = "$n heals $N.";
}
break;
Example:If there's a +20 HAPPY_HEAL Bonus and the player has +99 to healing stats with their gear and buffs and a heal light heals for +60 hp.
- Calculate the base healing amount with the bonus (dam): dam = 60 + GET_SPELL_MODS(ch, DMG_INCREASE_HEAL) + HAPPY_HEAL = 60 + 99 + 20 (assuming GET_SPELL_MODS(ch, DMG_INCREASE_HEAL) is 99 and there's a +20 bonus) dam = 179
- Calculate the critical damage bonus (crit_damage): crit_damage = (dam * GET_SPELL_MODS(ch, DMG_INCREASE_CRITDMG)) / 100 crit_damage = (179 * 10) / 100 crit_damage = 17.9 (rounded to 18 since healing amounts are typically integers)
- Calculate the total critical healing amount (total_damage): total_damage = dam + crit_damage total_damage = 179 + 18 total_damage = 197
So, with the +20 bonus to healing spells per cast and a 10% crit chance, the critical healing amount for the "Heal Light" spell with a base healing amount of 179 should be approximately 197.
However, currently when a heal crits its just calculating dam as 60 + GET_SPELL_MODS(ch, DMG_INCREASE_HEAL) which only equals 159.
That divided by 100 is 15.9 and its only healing for 174-175 hp.