CBattleEffectsController.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*
  2. * CBattleEffectsController.h, 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. #pragma once
  11. #include "../../lib/battle/BattleHex.h"
  12. VCMI_LIB_NAMESPACE_BEGIN
  13. class BattleAction;
  14. struct CustomEffectInfo;
  15. struct BattleTriggerEffect;
  16. VCMI_LIB_NAMESPACE_END
  17. struct SDL_Surface;
  18. class CAnimation;
  19. class CCanvas;
  20. class BattleInterface;
  21. class BattleRenderer;
  22. class CPointEffectAnimation;
  23. namespace EBattleEffect
  24. {
  25. enum EBattleEffect
  26. {
  27. // list of battle effects that have hardcoded triggers
  28. FEAR = 15,
  29. GOOD_LUCK = 18,
  30. GOOD_MORALE = 20,
  31. BAD_MORALE = 30,
  32. BAD_LUCK = 48,
  33. RESURRECT = 50,
  34. DRAIN_LIFE = 52, // hardcoded constant in CGameHandler
  35. POISON = 67,
  36. DEATH_BLOW = 73,
  37. REGENERATION = 74,
  38. MANA_DRAIN = 77,
  39. INVALID = -1,
  40. };
  41. }
  42. /// Struct for battle effect animation e.g. morale, prayer, armageddon, bless,...
  43. struct BattleEffect
  44. {
  45. int x, y; //position on the screen
  46. float currentFrame;
  47. std::shared_ptr<CAnimation> animation;
  48. int effectID; //uniqueID equal ot ID of appropriate CSpellEffectAnim
  49. BattleHex position; //Indicates if effect which hex the effect is drawn on
  50. };
  51. class BattleEffectsController
  52. {
  53. BattleInterface * owner;
  54. /// list of current effects that are being displayed on screen (spells & creature abilities)
  55. std::vector<BattleEffect> battleEffects;
  56. public:
  57. BattleEffectsController(BattleInterface * owner);
  58. void startAction(const BattleAction* action);
  59. void displayCustomEffects(const std::vector<CustomEffectInfo> & customEffects);
  60. //displays custom effect on the battlefield
  61. void displayEffect(EBattleEffect::EBattleEffect effect, const BattleHex & destTile);
  62. void displayEffect(EBattleEffect::EBattleEffect effect, uint32_t soundID, const BattleHex & destTile);
  63. //void displayEffects(EBattleEffect::EBattleEffect effect, uint32_t soundID, const std::vector<BattleHex> & destTiles);
  64. void battleTriggerEffect(const BattleTriggerEffect & bte);
  65. void collectRenderableObjects(BattleRenderer & renderer);
  66. friend class CPointEffectAnimation;
  67. };