BattleEvents.cpp 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. * BattleEvents.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 "BattleEvents.h"
  12. #include "../../LuaStack.h"
  13. #include "../../LuaCallWrapper.h"
  14. #include "../Registry.h"
  15. #include "../../../../lib/battle/Unit.h"
  16. #include "SubscriptionRegistryProxy.h"
  17. VCMI_LIB_NAMESPACE_BEGIN
  18. namespace scripting
  19. {
  20. namespace api
  21. {
  22. namespace events
  23. {
  24. using ::events::ApplyDamage;
  25. VCMI_REGISTER_SCRIPT_API(ApplyDamageProxy, "events.ApplyDamage");
  26. const std::vector<ApplyDamageProxy::CustomRegType> ApplyDamageProxy::REGISTER_CUSTOM =
  27. {
  28. {
  29. "subscribeBefore",
  30. &SubscriptionRegistryProxy<ApplyDamageProxy>::subscribeBefore,
  31. true
  32. },
  33. {
  34. "subscribeAfter",
  35. &SubscriptionRegistryProxy<ApplyDamageProxy>::subscribeAfter,
  36. true
  37. },
  38. {
  39. "getInitalDamage",
  40. LuaMethodWrapper<ApplyDamage, decltype(&ApplyDamage::getInitalDamage), &ApplyDamage::getInitalDamage>::invoke,
  41. false
  42. },
  43. {
  44. "getDamage",
  45. LuaMethodWrapper<ApplyDamage, decltype(&ApplyDamage::getDamage), &ApplyDamage::getDamage>::invoke,
  46. false
  47. },
  48. {
  49. "setDamage",
  50. LuaMethodWrapper<ApplyDamage, decltype(&ApplyDamage::setDamage), &ApplyDamage::setDamage>::invoke,
  51. false
  52. },
  53. {
  54. "getTarget",
  55. LuaMethodWrapper<ApplyDamage, decltype(&ApplyDamage::getTarget), &ApplyDamage::getTarget>::invoke,
  56. false
  57. },
  58. };
  59. }
  60. }
  61. }
  62. VCMI_LIB_NAMESPACE_END