Hooks
static bool BeforeCvLuaUnit_lGetCombatDamage(lua_State* L, int& result);static void AfterCvLuaUnit_lGetCombatDamage(lua_State* L, int& result);static int ReplaceCvLuaUnit_lGetCombatDamage(int (*original)(lua_State*), lua_State* L);CivRegisterBefore<CivHooks::CvLuaUnit_lGetCombatDamage>(host, &BeforeCvLuaUnit_lGetCombatDamage);CivRegisterAfter<CivHooks::CvLuaUnit_lGetCombatDamage>(host, &AfterCvLuaUnit_lGetCombatDamage);CivRegisterReplace<CivHooks::CvLuaUnit_lGetCombatDamage>(host, &ReplaceCvLuaUnit_lGetCombatDamage);
Code
878// int getCombatDamage(int iStrength, int iOpponentStrength, int iCurrentDamage, bool bIncludeRand = true, bool bAttackerIsCity = false, bool bDefenderIsCity = false);879int CvLuaUnit::lGetCombatDamage(lua_State* L)880{881 CvUnit* pkUnit = GetInstance(L);882 const int iStrength = lua_tointeger(L, 2);883 const int iOpponentStrength = lua_tointeger(L, 3);884 const int iCurrentDamage = lua_tointeger(L, 4);885 const bool bIncludeRand = lua_toboolean(L, 5);886 const bool bAttackerIsCity = lua_toboolean(L, 6);887 const bool bDefenderIsCity = lua_toboolean(L, 7);888889 const int iResult = pkUnit->getCombatDamage(iStrength, iOpponentStrength, iCurrentDamage, bIncludeRand, bAttackerIsCity, bDefenderIsCity);890 lua_pushinteger(L, iResult);891892 return 1;893}