瀏覽代碼

Added missing files.

DjWarmonger 10 年之前
父節點
當前提交
b5c270082b
共有 2 個文件被更改,包括 71 次插入0 次删除
  1. 52 0
      lib/spells/CDefaultSpellMechanics.h
  2. 19 0
      lib/spells/SpellMechanics.h

+ 52 - 0
lib/spells/CDefaultSpellMechanics.h

@@ -0,0 +1,52 @@
+/*
+ * CDefaultSpellMechanics.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"
+
+class ISpellMechanics;
+class BattleSpellCast;
+class StacksInjured;
+
+struct SpellCastContext
+{
+	SpellCastContext(std::vector<const CStack *> & attackedCres, BattleSpellCast & sc, StacksInjured & si):
+		attackedCres(attackedCres), sc(sc), si(si){};
+	std::vector<const CStack *> & attackedCres;
+	BattleSpellCast & sc;
+	StacksInjured & si;
+};
+
+class DLL_LINKAGE DefaultSpellMechanics : public ISpellMechanics
+{
+public:
+	DefaultSpellMechanics(CSpell * s): ISpellMechanics(s){};
+
+	std::vector<BattleHex> rangeInHexes(BattleHex centralHex, ui8 schoolLvl, ui8 side, bool * outDroppedHexes = nullptr) const override;
+	std::set<const CStack *> getAffectedStacks(SpellTargetingContext & ctx) const override;
+
+	ESpellCastProblem::ESpellCastProblem isImmuneByStack(const CGHeroInstance * caster, const CStack * obj) const override;
+
+	virtual void applyBattle(BattleInfo * battle, const BattleSpellCast * packet) const override;
+	bool adventureCast(const SpellCastEnvironment * env, AdventureSpellCastParameters & parameters) const override final;
+	void battleCast(const SpellCastEnvironment * env, BattleSpellCastParameters & parameters) const override;
+
+protected:
+	virtual void applyBattleEffects(const SpellCastEnvironment * env, BattleSpellCastParameters & parameters, SpellCastContext & ctx) const;
+
+	virtual int calculateDuration(const CGHeroInstance * caster, int usedSpellPower) const;
+
+	///calculate healed HP for all spells casted by hero
+	ui32 calculateHealedHP(const CGHeroInstance * caster, const CStack * stack, const CStack * sacrificedStack) const;
+
+	///actual adventure cast implementation
+	virtual bool applyAdventureEffects(const SpellCastEnvironment * env, AdventureSpellCastParameters & parameters) const;
+};

+ 19 - 0
lib/spells/SpellMechanics.h

@@ -0,0 +1,19 @@
+/*
+* SpellMechanics.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 "CSpellHandler.h"
+
+#include "ISpellMechanics.h"
+#include "CDefaultSpellMechanics.h"
+#include "AdventureSpellMechanics.h"
+#include "BattleSpellMechanics.h"
+#include "CreatureSpellMechanics.h"