2025-07-07 17:28:16 +03:00
|
|
|
/*
|
|
|
|
|
* AdventureSpellMechanics.h, part of VCMI engine
|
|
|
|
|
*
|
|
|
|
|
* Authors: listed in file AUTHORS in main folder
|
|
|
|
|
*
|
|
|
|
|
* License: GNU General Public License v2.0 or later
|
|
|
|
|
* Full text of license available in license.txt file, in main folder
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "../ISpellMechanics.h"
|
|
|
|
|
|
|
|
|
|
VCMI_LIB_NAMESPACE_BEGIN
|
|
|
|
|
|
2025-07-08 19:20:13 +03:00
|
|
|
class IAdventureSpellEffect;
|
2025-07-07 17:28:16 +03:00
|
|
|
|
2025-07-08 19:20:13 +03:00
|
|
|
class AdventureSpellMechanics final : public IAdventureSpellMechanics, boost::noncopyable
|
2025-07-07 17:28:16 +03:00
|
|
|
{
|
2025-07-08 19:20:13 +03:00
|
|
|
struct LevelOptions
|
|
|
|
|
{
|
|
|
|
|
std::unique_ptr<IAdventureSpellEffect> effect;
|
|
|
|
|
std::vector<std::shared_ptr<Bonus>> bonuses;
|
|
|
|
|
int castsPerDay;
|
|
|
|
|
int castsPerDayXL;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
std::array<LevelOptions, GameConstants::SPELL_SCHOOL_LEVELS> levelOptions;
|
|
|
|
|
|
2025-07-11 16:47:37 +03:00
|
|
|
const LevelOptions & getLevel(const spells::Caster * caster) const;
|
|
|
|
|
void giveBonuses(SpellCastEnvironment * env, const AdventureSpellCastParameters & parameters) const;
|
2025-07-13 17:25:26 +03:00
|
|
|
std::unique_ptr<IAdventureSpellEffect> createAdventureEffect(const CSpell * s, const JsonNode & node);
|
2025-07-11 16:47:37 +03:00
|
|
|
|
2025-07-07 17:28:16 +03:00
|
|
|
public:
|
|
|
|
|
AdventureSpellMechanics(const CSpell * s);
|
2025-07-08 19:20:13 +03:00
|
|
|
~AdventureSpellMechanics();
|
|
|
|
|
|
2025-07-13 17:25:26 +03:00
|
|
|
void performCast(SpellCastEnvironment * env, const AdventureSpellCastParameters & parameters) const;
|
|
|
|
|
|
|
|
|
|
private:
|
2025-07-07 17:28:16 +03:00
|
|
|
bool canBeCast(spells::Problem & problem, const IGameInfoCallback * cb, const spells::Caster * caster) const final;
|
|
|
|
|
bool canBeCastAt(spells::Problem & problem, const IGameInfoCallback * cb, const spells::Caster * caster, const int3 & pos) const final;
|
2025-07-08 19:20:13 +03:00
|
|
|
bool adventureCast(SpellCastEnvironment * env, const AdventureSpellCastParameters & parameters) const final;
|
2025-07-11 16:47:37 +03:00
|
|
|
const IAdventureSpellEffect * getEffect(const spells::Caster * caster) const final;
|
2025-07-11 17:38:03 +03:00
|
|
|
bool givesBonus(const spells::Caster * caster, BonusType which) const final;
|
2025-07-07 17:28:16 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
VCMI_LIB_NAMESPACE_END
|