Merge pull request #477 from KinglyKrab/master

Added GetMeleeMitigation() to Perl and Lua for Mobs (Clients/NPCs).
This commit is contained in:
Akkadius 2015-12-21 15:47:16 -06:00
commit f883e085e3
6 changed files with 47 additions and 1 deletions

View File

@ -6,6 +6,8 @@ Natedog: Updated item table fields and added a few missing fields for evolving i
items in your shared bank. (but item field located on items table)
-NYI - SkillModMax: Max skill point modification from the percent mods. EX:
100% 2HSlashing (Max 50) - can only increase 2hslash by 50 MAX! (item field located though)
Kinglykrab: Added GetMeleeMitigation() for NPCs and Clients in Perl and Lua.
- This allows you to check total item, spell, and AA melee mitigation contribution.
== 12/19/2015 ==
Kinglykrab: Added many methods to Perl and Lua, list below:

View File

@ -1976,6 +1976,11 @@ bool Lua_Mob::IsAmnesiad() {
return self->IsAmnesiad();
}
int32 Lua_Mob::GetMeleeMitigation() {
Lua_Safe_Call_Int();
return self->GetMeleeMitigation();
}
luabind::scope lua_register_mob() {
return luabind::class_<Lua_Mob, Lua_Entity>("Mob")
.def(luabind::constructor<>())
@ -2317,7 +2322,8 @@ luabind::scope lua_register_mob() {
.def("IsPet", (bool(Lua_Mob::*)(void))&Lua_Mob::IsPet)
.def("HasPet", (bool(Lua_Mob::*)(void))&Lua_Mob::HasPet)
.def("IsSilenced", (bool(Lua_Mob::*)(void))&Lua_Mob::IsSilenced)
.def("IsAmnesiad", (bool(Lua_Mob::*)(void))&Lua_Mob::IsAmnesiad);
.def("IsAmnesiad", (bool(Lua_Mob::*)(void))&Lua_Mob::IsAmnesiad)
.def("GetMeleeMitigation", (int32(Lua_Mob::*)(void))&Lua_Mob::GetMeleeMitigation);
}
luabind::scope lua_register_special_abilities() {

View File

@ -377,6 +377,7 @@ public:
bool HasPet();
bool IsSilenced();
bool IsAmnesiad();
int32 GetMeleeMitigation();
};
#endif

View File

@ -5682,3 +5682,11 @@ void Mob::SetCurrentSpeed(int in){
}
}
}
int32 Mob::GetMeleeMitigation() {
int32 mitigation = 0;
mitigation += spellbonuses.MeleeMitigationEffect;
mitigation += itembonuses.MeleeMitigationEffect;
mitigation += aabonuses.MeleeMitigationEffect;
return mitigation;
}

View File

@ -752,6 +752,7 @@ public:
inline bool GetInvul(void) { return invulnerable; }
inline void SetExtraHaste(int Haste) { ExtraHaste = Haste; }
virtual int GetHaste();
int32 GetMeleeMitigation();
uint8 GetWeaponDamageBonus(const Item_Struct* weapon, bool offhand = false);
uint16 GetDamageTable(SkillUseTypes skillinuse);

View File

@ -8981,6 +8981,33 @@ XS(XS_Mob_IsAmnesiad) {
XSRETURN(1);
}
XS(XS_Mob_GetMeleeMitigation);
XS(XS_Mob_GetMeleeMitigation) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: Mob::GetMeleeMitigation(THIS)");
{
Mob* THIS;
int32 RETVAL;
dXSTARG;
if (sv_derived_from(ST(0), "Mob")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Mob*, tmp);
}
else
Perl_croak(aTHX_ "THIS is not of type Mob");
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetMeleeMitigation();
XSprePUSH;
PUSHi((IV)RETVAL);
}
XSRETURN(1);
}
#ifdef __cplusplus
extern "C"
#endif
@ -9313,6 +9340,7 @@ XS(boot_Mob)
newXSproto(strcpy(buf, "HasPet"), XS_Mob_HasPet, file, "$");
newXSproto(strcpy(buf, "IsSilenced"), XS_Mob_IsSilenced, file, "$");
newXSproto(strcpy(buf, "IsAmnesiad"), XS_Mob_IsAmnesiad, file, "$");
newXSproto(strcpy(buf, "GetMeleeMitigation"), XS_Mob_GetMeleeMitigation, file, "$");
XSRETURN_YES;
}