[Feature] Add LuaMod functions for CommonDamage and HealDamage (#4227)

* Add LuaMod functions for CommonDamage and HealDamage

* Remove extra bracket
This commit is contained in:
Xackery
2024-03-31 08:30:16 -07:00
committed by GitHub
parent 9e3bf91374
commit b638795f9b
5 changed files with 163 additions and 0 deletions
+25
View File
@@ -3964,6 +3964,18 @@ bool Mob::CheckDoubleAttack()
}
void Mob::CommonDamage(Mob* attacker, int64 &damage, const uint16 spell_id, const EQ::skills::SkillType skill_used, bool &avoidable, const int8 buffslot, const bool iBuffTic, eSpecialAttacks special) {
#ifdef LUA_EQEMU
int64 lua_ret = 0;
bool ignore_default = false;
lua_ret = LuaParser::Instance()->CommonDamage(this, attacker, damage, spell_id, static_cast<int>(skill_used), avoidable, buffslot, iBuffTic, static_cast<int>(special), ignore_default);
if (lua_ret != 0) {
damage = lua_ret;
}
if (ignore_default) {
//return lua_ret;
}
#endif
// This method is called with skill_used=ABJURE for Damage Shield damage.
bool FromDamageShield = (skill_used == EQ::skills::SkillAbjuration);
bool ignore_invul = false;
@@ -4691,6 +4703,19 @@ void Mob::CommonDamage(Mob* attacker, int64 &damage, const uint16 spell_id, cons
void Mob::HealDamage(uint64 amount, Mob* caster, uint16 spell_id)
{
#ifdef LUA_EQEMU
uint64 lua_ret = 0;
bool ignore_default = false;
lua_ret = LuaParser::Instance()->HealDamage(this, caster, amount, spell_id, ignore_default);
if (lua_ret != 0) {
amount = lua_ret;
}
if (ignore_default) {
//return lua_ret;
}
#endif
int64 maxhp = GetMaxHP();
int64 curhp = GetHP();
uint64 acthealed = 0;