mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-21 21:17:49 +02:00
Implement behavior
This commit is contained in:
parent
c0b90432cb
commit
464ad63749
@ -365,9 +365,10 @@ void CRewardableObject::grantRewardAfterLevelup(const CRewardVisitInfo & info, c
|
||||
|
||||
if(!info.reward.casts.empty())
|
||||
{
|
||||
caster = std::make_unique<spells::OuterCaster>(hero, 3);
|
||||
for(const auto & c : info.reward.casts)
|
||||
{
|
||||
cb->castSpell(hero, c, int3{-1, -1, -1});
|
||||
cb->castSpell(caster.get(), c, int3{-1, -1, -1});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
#include "../NetPacksBase.h"
|
||||
#include "../ResourceSet.h"
|
||||
#include "../spells/OuterCaster.h"
|
||||
|
||||
VCMI_LIB_NAMESPACE_BEGIN
|
||||
|
||||
@ -170,7 +171,7 @@ public:
|
||||
std::vector<SpellID> spells;
|
||||
std::vector<CStackBasicDescriptor> creatures;
|
||||
|
||||
/// actions that hero may execute
|
||||
/// actions that hero may execute and object caster
|
||||
std::vector<SpellID> casts;
|
||||
|
||||
/// list of components that will be added to reward description. First entry in list will override displayed component
|
||||
@ -321,6 +322,9 @@ protected:
|
||||
bool wasVisitedBefore(const CGHeroInstance * contextHero) const;
|
||||
|
||||
bool onceVisitableObjectCleared;
|
||||
|
||||
/// caster to cast adveture spells
|
||||
mutable std::unique_ptr<spells::OuterCaster> caster;
|
||||
|
||||
public:
|
||||
EVisitMode getVisitMode() const;
|
||||
|
@ -199,6 +199,8 @@ public:
|
||||
|
||||
void changeFogOfWar(int3 center, ui32 radius, PlayerColor player, bool hide) override;
|
||||
void changeFogOfWar(std::unordered_set<int3, ShashInt3> &tiles, PlayerColor player, bool hide) override;
|
||||
|
||||
void castSpell(const spells::Caster * caster, SpellID spellID, const int3 &pos) override;
|
||||
|
||||
bool isVisitCoveredByAnotherQuery(const CGObjectInstance *obj, const CGHeroInstance *hero) override;
|
||||
void setObjProperty(ObjectInstanceID objid, int prop, si64 val) override;
|
||||
@ -275,8 +277,6 @@ public:
|
||||
void moveArmy(const CArmedInstance *src, const CArmedInstance *dst, bool allowMerging);
|
||||
const ObjectInstanceID putNewObject(Obj ID, int subID, int3 pos);
|
||||
|
||||
void castSpell(const spells::Caster * caster, SpellID spellID, const int3 &pos);
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
h & QID;
|
||||
|
Loading…
x
Reference in New Issue
Block a user