UnitProxy.cpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * UnitProxy.cpp, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #include "StdInc.h"
  11. #include "UnitProxy.h"
  12. #include "../../LuaStack.h"
  13. #include "../../LuaCallWrapper.h"
  14. #include "../Registry.h"
  15. VCMI_LIB_NAMESPACE_BEGIN
  16. namespace scripting
  17. {
  18. namespace api
  19. {
  20. namespace battle
  21. {
  22. VCMI_REGISTER_SCRIPT_API(UnitProxy, "battle.Unit")
  23. const std::vector<UnitProxy::CustomRegType> UnitProxy::REGISTER_CUSTOM =
  24. {
  25. {"getMinDamage", LuaMethodWrapper<Unit, decltype(&ACreature::getMinDamage), &ACreature::getMinDamage>::invoke, false},
  26. {"getMaxDamage", LuaMethodWrapper<Unit, decltype(&ACreature::getMaxDamage), &ACreature::getMaxDamage>::invoke, false},
  27. {"getAttack", LuaMethodWrapper<Unit, decltype(&ACreature::getAttack), &ACreature::getAttack>::invoke, false},
  28. {"getDefense", LuaMethodWrapper<Unit, decltype(&ACreature::getDefense), &ACreature::getDefense>::invoke, false},
  29. {"isAlive", LuaMethodWrapper<Unit, decltype(&Unit::alive), &Unit::alive>::invoke, false},
  30. {"unitId", LuaMethodWrapper<Unit, decltype(&IUnitInfo::unitId), &IUnitInfo::unitId>::invoke, false},
  31. };
  32. }
  33. }
  34. }
  35. VCMI_LIB_NAMESPACE_END