Timed.h 1.1 KB

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