Cure Potency
Posted: Wed Aug 22, 2012 12:02 am
Tonight I found out that Cure Potency items weren't working, or weren't working as intended, so I took a look at the .lua's for cures. While adding MOD_CURE_POTENCY (Vienna is in the process of adding the necessary mods for item_mods.sql), I noticed that Divine Seal wasn't applied correctly (should be 1 added to cure potency, bypassing the 50% cap), and that Stoneskin from Afflatus Solace was applied before checking whether the target was a player. I also noticed that cures would do the same minimum amount of damage as they would restoring HP, which isn't retail standard. I moved that minimum check to the if block that's confirmed the target is a player.
Here is the new Cure 1:
Here is the new Cure 1:
Code: Select all
function onSpellCast(caster,target,spell)
--Pull base stats from caster.
MND = caster:getStat(MOD_MND);
VIT = target:getStat(MOD_VIT);
Healing = caster:getSkillLevel(HEALING_MAGIC_SKILL);
power = ((3 * MND) + (VIT) + (3 * math.floor(Healing / 5)));
--printf("MIND: %u",MND);
--printf("VIT: %u",VIT);
--printf("POWER: %u",power);
-- Rate and Constant are based on which soft caps have been overcome by the caster.
rate = 1;
constant = -10;
if(power > 100) then
rate = 57;
constant = 29.125;
elseif(power > 60) then
rate = 2;
constant = 5;
end
--Amount to cure the target with.
cure = (math.floor(power / 2)) / (rate) + constant;
--printf("CURE: %u",cure);
--Adjust bonus for staff.
--staff = StaffBonus(caster,spell);--Don't need this anymore.
--Check for cure potency equipment. Cure potency caps at 50%
potency = caster:getMod(MOD_CURE_POTENCY);
if(potency > 50)
potency = 0.5;
else
potency = (potency / 100)
end;
day = 1;--spellDayWeatherBonus(caster, spell, false);
--print("Total day/weather bonus:",day);
--Final amount to heal the target with.
--final = cure * day * (1 + potency) * CURE_POWER;
final = cure * day;
-- Do it!
if(target:getRank() ~= nil) then
--Divine Seal adds 100% to cure potency
if(caster:getStatusEffect(EFFECT_DIVINE_SEAL) ~= nil) then
potency = potency + 1;
end;
final = (final * potency);
--Raise the amount above the minimum hard cap. Cure used as a nuke CAN hit for 0, so this check is inside this if block.
if(final < 10) then
final = 10;
end;
final = (final * CURE_POWER);
--Apply stoneskin from Afflatus Solace, 25% of cure power after potency and Divine Seal
if(caster:getStatusEffect(EFFECT_AFFLATUS_SOLACE) ~= nil) and (target:getStatusEffect(EFFECT_STONESKIN) == nil) then
Afflatus_Stoneskin = math.floor(final / 4);
if(Afflatus_Stoneskin > 300) then
Afflatus_Stoneskin = 300;
end;
target:addStatusEffect(EFFECT_STONESKIN,Afflatus_Stoneskin,0,25);
end;
--Check to see if the target doesn't need that much healing.
maxhp = target:getMaxHP();
hp = target:getHP();
diff = (maxhp - hp);
if(final > diff) then
final = diff;
end;
final = math.floor(final);
target:addHP(final);
else
final = (final * potency * CURE_POWER);
harm = 1;--cureResist(target:getFamily());
if(harm < 0) then
spell:setMsg(2);
if(mobfinal < 0) then
mobfinal = mobfinal * -1;
end;
target:delHP(mobfinal);
final = mobfinal;
else
final = 0;
end;
end;
caster:updateEnmityFromCure(target,final);
return final;
end;