CBattleEffectsController.h 2.2 KB

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