CBattleEffectsController.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. struct SDL_Surface;
  13. class BattleAction;
  14. class CAnimation;
  15. class CCanvas;
  16. class CBattleInterface;
  17. struct BattleObjectsByHex;
  18. struct CustomEffectInfo;
  19. struct BattleTriggerEffect;
  20. class CEffectAnimation;
  21. namespace EBattleEffect
  22. {
  23. enum EBattleEffect
  24. {
  25. // list of battle effects that have hardcoded triggers
  26. FEAR = 15,
  27. GOOD_LUCK = 18,
  28. GOOD_MORALE = 20,
  29. BAD_MORALE = 30,
  30. BAD_LUCK = 48,
  31. RESURRECT = 50,
  32. POISON = 67,
  33. DEATH_BLOW = 73,
  34. REGENERATION = 74,
  35. MANA_DRAIN = 77,
  36. INVALID = -1,
  37. };
  38. }
  39. /// Struct for battle effect animation e.g. morale, prayer, armageddon, bless,...
  40. struct BattleEffect
  41. {
  42. int x, y; //position on the screen
  43. float currentFrame;
  44. std::shared_ptr<CAnimation> animation;
  45. int effectID; //uniqueID equal ot ID of appropriate CSpellEffectAnim
  46. BattleHex position; //Indicates if effect which hex the effect is drawn on
  47. };
  48. class CBattleEffectsController
  49. {
  50. CBattleInterface * owner;
  51. /// list of current effects that are being displayed on screen (spells & creature abilities)
  52. std::vector<BattleEffect> battleEffects;
  53. public:
  54. CBattleEffectsController(CBattleInterface * owner);
  55. void startAction(const BattleAction* action);
  56. void displayCustomEffects(const std::vector<CustomEffectInfo> & customEffects);
  57. void displayEffect(EBattleEffect::EBattleEffect effect, const BattleHex & destTile); //displays custom effect on the battlefield
  58. void displayEffect(EBattleEffect::EBattleEffect effect, uint32_t soundID, const BattleHex & destTile); //displays custom effect on the battlefield
  59. void battleTriggerEffect(const BattleTriggerEffect & bte);
  60. void showBattlefieldObjects(std::shared_ptr<CCanvas> canvas, const BattleHex & destTile);
  61. friend class CEffectAnimation; // currently, battleEffects is largely managed by CEffectAnimation, TODO: move this logic into CBattleEffectsController
  62. };