1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-26 03:52:01 +02:00

Add outer caster class

This commit is contained in:
nordsoft 2023-04-10 05:39:25 +04:00
parent 7041950ae1
commit 56b0e900d8
3 changed files with 70 additions and 0 deletions

View File

@ -136,6 +136,7 @@ macro(add_main_lib TARGET_NAME LIBRARY_TYPE)
${MAIN_LIB_DIR}/spells/CSpellHandler.cpp
${MAIN_LIB_DIR}/spells/ISpellMechanics.cpp
${MAIN_LIB_DIR}/spells/ObstacleCasterProxy.cpp
${MAIN_LIB_DIR}/spells/OuterCaster.cpp
${MAIN_LIB_DIR}/spells/Problem.cpp
${MAIN_LIB_DIR}/spells/ProxyCaster.cpp
${MAIN_LIB_DIR}/spells/TargetCondition.cpp
@ -398,6 +399,7 @@ macro(add_main_lib TARGET_NAME LIBRARY_TYPE)
${MAIN_LIB_DIR}/spells/BonusCaster.h
${MAIN_LIB_DIR}/spells/CSpellHandler.h
${MAIN_LIB_DIR}/spells/ISpellMechanics.h
${MAIN_LIB_DIR}/spells/OuterCaster.h
${MAIN_LIB_DIR}/spells/Problem.h
${MAIN_LIB_DIR}/spells/ProxyCaster.h
${MAIN_LIB_DIR}/spells/TargetCondition.h

View File

@ -0,0 +1,36 @@
/*
* OuterCaster.cpp, 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
*
*/
#include "OuterCaster.h"
VCMI_LIB_NAMESPACE_BEGIN
namespace spells
{
OuterCaster::OuterCaster(const Caster * actualCaster_, int schoolLevel_)
: ProxyCaster(actualCaster_), schoolLevel(schoolLevel_)
{
}
void OuterCaster::spendMana(ServerCallback * server, const int32_t spellCost) const
{
//do nothing
}
int32_t OuterCaster::getSpellSchoolLevel(const Spell * spell, int32_t * outSelectedSchool) const
{
return schoolLevel;
}
}
VCMI_LIB_NAMESPACE_END

32
lib/spells/OuterCaster.h Normal file
View File

@ -0,0 +1,32 @@
/*
* OuterCaster.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 "ProxyCaster.h"
VCMI_LIB_NAMESPACE_BEGIN
namespace spells
{
class DLL_LINKAGE OuterCaster : public ProxyCaster
{
int schoolLevel;
public:
OuterCaster(const Caster * actualCaster_, int schoolLevel_);
int32_t getSpellSchoolLevel(const Spell * spell, int32_t * outSelectedSchool = nullptr) const override;
void spendMana(ServerCallback * server, const int32_t spellCost) const override;
};
} // namespace spells
VCMI_LIB_NAMESPACE_END