Browse Source

Add outer caster class

nordsoft 2 years ago
parent
commit
56b0e900d8
3 changed files with 70 additions and 0 deletions
  1. 2 0
      cmake_modules/VCMI_lib.cmake
  2. 36 0
      lib/spells/OuterCaster.cpp
  3. 32 0
      lib/spells/OuterCaster.h

+ 2 - 0
cmake_modules/VCMI_lib.cmake

@@ -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

+ 36 - 0
lib/spells/OuterCaster.cpp

@@ -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 - 0
lib/spells/OuterCaster.h

@@ -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