Timed.h 998 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * Timed.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 "UnitEffect.h"
  12. VCMI_LIB_NAMESPACE_BEGIN
  13. struct Bonus;
  14. struct SetStackEffect;
  15. struct MetaString;
  16. namespace spells
  17. {
  18. namespace effects
  19. {
  20. class Timed : public UnitEffect
  21. {
  22. public:
  23. bool cumulative;
  24. std::vector<std::shared_ptr<Bonus>> bonus;
  25. Timed();
  26. virtual ~Timed();
  27. void apply(ServerCallback * server, const Mechanics * m, const EffectTarget & target) const override;
  28. protected:
  29. void serializeJsonUnitEffect(JsonSerializeFormat & handler) override final;
  30. private:
  31. void convertBonus(const Mechanics * m, int32_t & duration, std::vector<Bonus> & converted) const;
  32. void describeEffect(std::vector<MetaString> & log, const Mechanics * m, const std::vector<Bonus> & bonuses, const battle::Unit * target) const;
  33. };
  34. }
  35. }
  36. VCMI_LIB_NAMESPACE_END