[Quest API] Add IsAttackAllowed() to Perl/Lua. (#2672)

# Perl
- Add `$mob->IsAttackAllowed(target)`.
- Add `$mob->IsAttackAllowed(target, is_spell_attack)`.

# Lua
- Add `mob:IsAttackAllowed(target)`.

# Notes
- Lua had `mob:IsAttackAllowed(target, is_spell_attack)` but not the other overload.
- Perl had neither.
This commit is contained in:
Alex King
2022-12-25 16:17:46 -05:00
committed by GitHub
parent 860b545fe3
commit d1430f6834
3 changed files with 26 additions and 7 deletions
+12 -6
View File
@@ -2253,11 +2253,6 @@ int16 Lua_Mob::GetMeleeMinDamageMod_SE(uint16 skill)
return self->GetMeleeMinDamageMod_SE(skill);
}
bool Lua_Mob::IsAttackAllowed(Lua_Mob target, bool isSpellAttack) {
Lua_Safe_Call_Bool();
return self->IsAttackAllowed(target, isSpellAttack);
}
bool Lua_Mob::IsCasting() {
Lua_Safe_Call_Bool();
return self->IsCasting();
@@ -2752,6 +2747,16 @@ void Lua_Mob::CopyHateList(Lua_Mob to) {
self->CopyHateList(to);
}
bool Lua_Mob::IsAttackAllowed(Lua_Mob target) {
Lua_Safe_Call_Bool();
return self->IsAttackAllowed(target);
}
bool Lua_Mob::IsAttackAllowed(Lua_Mob target, bool is_spell_attack) {
Lua_Safe_Call_Bool();
return self->IsAttackAllowed(target, is_spell_attack);
}
#ifdef BOTS
void Lua_Mob::DamageAreaBots(int64 damage) {
Lua_Safe_Call_Void();
@@ -3157,7 +3162,8 @@ luabind::scope lua_register_mob() {
.def("InterruptSpell", (void(Lua_Mob::*)(void))&Lua_Mob::InterruptSpell)
.def("IsAIControlled", (bool(Lua_Mob::*)(void))&Lua_Mob::IsAIControlled)
.def("IsAmnesiad", (bool(Lua_Mob::*)(void))&Lua_Mob::IsAmnesiad)
.def("IsAttackAllowed", &Lua_Mob::IsAttackAllowed)
.def("IsAttackAllowed", (bool(Lua_Mob::*)(Lua_Mob))&Lua_Mob::IsAttackAllowed)
.def("IsAttackAllowed", (bool(Lua_Mob::*)(Lua_Mob,bool))&Lua_Mob::IsAttackAllowed)
.def("IsBeneficialAllowed", (bool(Lua_Mob::*)(Lua_Mob))&Lua_Mob::IsBeneficialAllowed)
.def("IsBerserk", &Lua_Mob::IsBerserk)
.def("IsBlind", (bool(Lua_Mob::*)(void))&Lua_Mob::IsBlind)