1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-17 01:32:21 +02:00

Start moving server side spell mechanics

This commit is contained in:
AlexVinS
2014-11-25 14:19:13 +03:00
parent f2bf3d7f7b
commit 0fda90c67d
4 changed files with 172 additions and 19 deletions

View File

@ -29,6 +29,7 @@ class CStack;
class CBattleInfoCallback;
struct CPackForClient;
class CRandomGenerator;
struct SpellSchoolInfo
{
@ -44,25 +45,28 @@ struct SpellSchoolInfo
class DLL_LINKAGE SpellCastEnvironment
{
public:
virtual void sendAndApply(CPackForClient * info) = 0;
virtual void sendAndApply(CPackForClient * info) const = 0;
virtual CRandomGenerator & getRandomGenerator() const = 0;
};
///helper struct
struct DLL_LINKAGE SpellCastContext
struct DLL_LINKAGE BattleSpellCastParameters
{
public:
const SpellCastEnvironment * env;
int spellLvl;
// BattleHex destination;
BattleHex destination;
ui8 casterSide;
PlayerColor casterColor;
const CGHeroInstance * caster;
const CGHeroInstance * secHero;
int usedSpellPower;
ECastingMode::ECastingMode mode;
const CStack * targetStack;
const CStack * selectedStack;
const CStack * casterStack;
const CStack * selectedStack;
const CBattleInfoCallback * cb;
};
@ -148,6 +152,9 @@ public:
CSpell();
~CSpell();
//void adventureCast() const;
void battleCast(const SpellCastEnvironment * env, const BattleSpellCastParameters & parameters) const;
bool isCastableBy(const IBonusBearer * caster, bool hasSpellBook, const std::set<SpellID> & spellBook) const;
std::vector<BattleHex> rangeInHexes(BattleHex centralHex, ui8 schoolLvl, ui8 side, bool *outDroppedHexes = nullptr ) const; //convert range to specific hexes; last optional out parameter is set to true, if spell would cover unavailable hexes (that are not included in ret)