mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	Drafts
This commit is contained in:
		| @@ -116,7 +116,8 @@ class CBattleInterface : public CIntObject | ||||
| 		MOVE_STACK, ATTACK, WALK_AND_ATTACK, ATTACK_AND_RETURN, SHOOT, //OPEN_GATE, //we can open castle gate during siege | ||||
| 		NO_LOCATION, ANY_LOCATION, FRIENDLY_CREATURE_SPELL, HOSTILE_CREATURE_SPELL, RISING_SPELL, ANY_CREATURE, OBSTACLE, TELEPORT, SACRIFICE, RANDOM_GENIE_SPELL, | ||||
| 		FREE_LOCATION, //used with Force Field and Fire Wall - all tiles affected by spell must be free | ||||
| 		CATAPULT, HEAL, RISE_DEMONS | ||||
| 		CATAPULT, HEAL, RISE_DEMONS, | ||||
| 		AIMED_SPELL | ||||
| 	}; | ||||
| private: | ||||
| 	SDL_Surface * background, * menu, * amountNormal, * amountNegative, * amountPositive, * amountEffNeutral, * cellBorders, * backgroundWithHexes; | ||||
|   | ||||
| @@ -747,6 +747,13 @@ ESpellCastProblem::ESpellCastProblem DefaultSpellMechanics::canBeCast(const CBat | ||||
| 	return ESpellCastProblem::OK; | ||||
| } | ||||
|  | ||||
| ESpellCastProblem DefaultSpellMechanics::canBeCast(const SpellTargetingContext & ctx) const | ||||
| { | ||||
| 	//no problems by default, this method is for spell-specific problems | ||||
| 	//common problems handled by CSpell | ||||
| 	return ESpellCastProblem::OK; | ||||
| } | ||||
|  | ||||
| ESpellCastProblem::ESpellCastProblem DefaultSpellMechanics::isImmuneByStack(const ISpellCaster * caster, const CStack * obj) const | ||||
| { | ||||
| 	//by default use general algorithm | ||||
|   | ||||
| @@ -41,6 +41,7 @@ public: | ||||
| 	std::set<const CStack *> getAffectedStacks(SpellTargetingContext & ctx) const override; | ||||
|  | ||||
| 	ESpellCastProblem::ESpellCastProblem canBeCast(const CBattleInfoCallback * cb, const ISpellCaster * caster) const override; | ||||
| 	ESpellCastProblem::ESpellCastProblem canBeCast(const SpellTargetingContext & ctx) const override; | ||||
|  | ||||
| 	ESpellCastProblem::ESpellCastProblem isImmuneByStack(const ISpellCaster * caster, const CStack * obj) const override; | ||||
|  | ||||
|   | ||||
| @@ -305,6 +305,17 @@ void CSpell::getEffects(std::vector<Bonus> & lst, const int level) const | ||||
| 	} | ||||
| } | ||||
|  | ||||
| ESpellCastProblem::ESpellCastProblem CSpell::canBeCastAt(const CBattleInfoCallback * cb, const ISpellCaster * caster, ECastingMode::ECastingMode mode, BattleHex destination) const | ||||
| { | ||||
|  | ||||
| 	//todo: CSpell::canBeCastAt check common problems | ||||
|  | ||||
| 	SpellTargetingContext ctx(this, cb, mode, caster, , destination); | ||||
|  | ||||
| 	return mechanics->canBeCast(cb, caster, mode, destination); | ||||
| } | ||||
|  | ||||
|  | ||||
| ESpellCastProblem::ESpellCastProblem CSpell::isImmuneAt(const CBattleInfoCallback * cb, const ISpellCaster * caster, ECastingMode::ECastingMode mode, BattleHex destination) const | ||||
| { | ||||
| 	// Get all stacks at destination hex. only alive if not rising spell | ||||
|   | ||||
| @@ -270,6 +270,9 @@ public: | ||||
| 	ESpellCastProblem::ESpellCastProblem canBeCast(const CBattleInfoCallback * cb, const ISpellCaster * caster) const; | ||||
|  | ||||
| 	///checks for creature immunity / anything that prevent casting *at given hex* - doesn't take into account general problems such as not having spellbook or mana points etc. | ||||
| 	ESpellCastProblem::ESpellCastProblem canBeCastAt(const CBattleInfoCallback * cb, const ISpellCaster * caster, ECastingMode::ECastingMode mode, BattleHex destination) const; | ||||
|  | ||||
| 	///checks for creature immunity *at given hex*. | ||||
| 	ESpellCastProblem::ESpellCastProblem isImmuneAt(const CBattleInfoCallback * cb, const ISpellCaster * caster, ECastingMode::ECastingMode mode, BattleHex destination) const; | ||||
|  | ||||
| 	///checks for creature immunity / anything that prevent casting *at given target* - doesn't take into account general problems such as not having spellbook or mana points etc. | ||||
|   | ||||
| @@ -108,6 +108,8 @@ public: | ||||
|  | ||||
| 	virtual ESpellCastProblem::ESpellCastProblem canBeCast(const CBattleInfoCallback * cb, const ISpellCaster * caster) const = 0; | ||||
|  | ||||
| 	virtual ESpellCastProblem::ESpellCastProblem canBeCast(const SpellTargetingContext & ctx) const = 0; | ||||
|  | ||||
| 	virtual ESpellCastProblem::ESpellCastProblem isImmuneByStack(const ISpellCaster * caster, const CStack * obj) const = 0; | ||||
|  | ||||
| 	virtual void applyBattle(BattleInfo * battle, const BattleSpellCast * packet) const = 0; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user