effect.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. //
  2. // Created by IgorBat on 17.03.2018.
  3. //
  4. #ifndef THE_GAME_EFFECT_H
  5. #define THE_GAME_EFFECT_H
  6. #pragma once
  7. #include <iostream>
  8. #include <vector>
  9. #include <QFile>
  10. #include <QString>
  11. #include <QTextStream>
  12. #include <QImage>
  13. class Unit;
  14. class Cell;
  15. class Effect : public QObject {
  16. Q_OBJECT
  17. public:
  18. enum TypeOfTrigger{
  19. InCome = 1,
  20. AfterAction = 2,
  21. AfterEndTurn = 3
  22. };
  23. Effect() = default;
  24. explicit Effect(QString parameters);
  25. virtual ~Effect() {}
  26. int getCount();
  27. void setCount(int value);
  28. int getDurability();
  29. void setDurability(int value);
  30. //---------------------------------------------//
  31. //----------------GUI section------------------//
  32. //---------------------------------------------//
  33. QString getEffectName() const;
  34. QString getEffectDescr() const;
  35. QImage getEffectIcon() const;
  36. //---------------------------------------------//
  37. //-----------Parameters load section-----------//
  38. //---------------------------------------------//
  39. private:
  40. void loadEffectDescr(QString effect_folder);
  41. void loadEffectIcon(QString effect_folder);
  42. public:
  43. virtual void OperateOnCell(Cell* cell) = 0;
  44. virtual void OperateOnUnit(Unit* unit) = 0;
  45. virtual void OperateOnUnitToCell(Unit* who, Cell* where) = 0;
  46. virtual void Execute(Cell* from, Cell* where, Unit* who, Unit* whom, TypeOfTrigger Type) = 0;
  47. protected:
  48. int count_;
  49. int durability_;
  50. // GUI values
  51. QString effect_name_;
  52. QString effect_descr_;
  53. QImage effect_icon_;
  54. };
  55. #endif //THE_GAME_EFFECT_H