1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-06 09:09:40 +02:00
Files
vcmi/lib/spells/adventure/AdventureSpellMechanics.h

47 lines
1.5 KiB
C++

/*
* 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
class IAdventureSpellEffect;
class AdventureSpellMechanics final : public IAdventureSpellMechanics, boost::noncopyable
{
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;
const LevelOptions & getLevel(const spells::Caster * caster) const;
void giveBonuses(SpellCastEnvironment * env, const AdventureSpellCastParameters & parameters) const;
public:
AdventureSpellMechanics(const CSpell * s);
~AdventureSpellMechanics();
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;
bool adventureCast(SpellCastEnvironment * env, const AdventureSpellCastParameters & parameters) const final;
const IAdventureSpellEffect * getEffect(const spells::Caster * caster) const final;
bool givesBonus(const spells::Caster * caster, BonusType which) const final;
void performCast(SpellCastEnvironment * env, const AdventureSpellCastParameters & parameters) const;
};
VCMI_LIB_NAMESPACE_END