|
@@ -65,14 +65,14 @@ class ServerSpellCastEnvironment: public SpellCastEnvironment
|
|
|
public:
|
|
public:
|
|
|
ServerSpellCastEnvironment(CGameHandler * gh);
|
|
ServerSpellCastEnvironment(CGameHandler * gh);
|
|
|
~ServerSpellCastEnvironment(){};
|
|
~ServerSpellCastEnvironment(){};
|
|
|
- void sendAndApply(CPackForClient * info) const override;
|
|
|
|
|
|
|
+ void sendAndApply(CPackForClient * info) const override;
|
|
|
CRandomGenerator & getRandomGenerator() const override;
|
|
CRandomGenerator & getRandomGenerator() const override;
|
|
|
void complain(const std::string & problem) const override;
|
|
void complain(const std::string & problem) const override;
|
|
|
const CMap * getMap() const override;
|
|
const CMap * getMap() const override;
|
|
|
const CGameInfoCallback * getCb() const override;
|
|
const CGameInfoCallback * getCb() const override;
|
|
|
- bool moveHero(ObjectInstanceID hid, int3 dst, ui8 teleporting, PlayerColor asker = PlayerColor::NEUTRAL) const override;
|
|
|
|
|
|
|
+ bool moveHero(ObjectInstanceID hid, int3 dst, ui8 teleporting, PlayerColor asker = PlayerColor::NEUTRAL) const override;
|
|
|
private:
|
|
private:
|
|
|
- mutable CGameHandler * gh;
|
|
|
|
|
|
|
+ mutable CGameHandler * gh;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
CondSh<bool> battleMadeAction;
|
|
CondSh<bool> battleMadeAction;
|
|
@@ -102,7 +102,7 @@ public:
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-template <>
|
|
|
|
|
|
|
+template <>
|
|
|
class CApplyOnGH<CPack> : public CBaseForGHApply
|
|
class CApplyOnGH<CPack> : public CBaseForGHApply
|
|
|
{
|
|
{
|
|
|
public:
|
|
public:
|
|
@@ -799,15 +799,15 @@ void CGameHandler::prepareAttack(BattleAttack &bat, const CStack *att, const CSt
|
|
|
|
|
|
|
|
const Bonus * bonus = att->getBonusLocalFirst(Selector::type(Bonus::SPELL_LIKE_ATTACK));
|
|
const Bonus * bonus = att->getBonusLocalFirst(Selector::type(Bonus::SPELL_LIKE_ATTACK));
|
|
|
if (bonus && (bat.shot())) //TODO: make it work in melee?
|
|
if (bonus && (bat.shot())) //TODO: make it work in melee?
|
|
|
- {
|
|
|
|
|
|
|
+ {
|
|
|
//this is need for displaying hit animation
|
|
//this is need for displaying hit animation
|
|
|
bat.flags |= BattleAttack::SPELL_LIKE;
|
|
bat.flags |= BattleAttack::SPELL_LIKE;
|
|
|
bat.spellID = SpellID(bonus->subtype);
|
|
bat.spellID = SpellID(bonus->subtype);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
//TODO: should spell override creature`s projectile?
|
|
//TODO: should spell override creature`s projectile?
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
std::set<const CStack*> attackedCreatures = SpellID(bonus->subtype).toSpell()->getAffectedStacks(gs->curB, ECastingMode::SPELL_LIKE_ATTACK, att->owner, bonus->val, targetHex, att);
|
|
std::set<const CStack*> attackedCreatures = SpellID(bonus->subtype).toSpell()->getAffectedStacks(gs->curB, ECastingMode::SPELL_LIKE_ATTACK, att->owner, bonus->val, targetHex, att);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
//TODO: get exact attacked hex for defender
|
|
//TODO: get exact attacked hex for defender
|
|
|
|
|
|
|
|
for(const CStack * stack : attackedCreatures)
|
|
for(const CStack * stack : attackedCreatures)
|
|
@@ -817,7 +817,7 @@ void CGameHandler::prepareAttack(BattleAttack &bat, const CStack *att, const CSt
|
|
|
applyBattleEffects(bat, att, stack, distance, true);
|
|
applyBattleEffects(bat, att, stack, distance, true);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
//now add effect info for all attacked stacks
|
|
//now add effect info for all attacked stacks
|
|
|
for(BattleStackAttacked & bsa : bat.bsa)
|
|
for(BattleStackAttacked & bsa : bat.bsa)
|
|
|
{
|
|
{
|
|
@@ -828,7 +828,7 @@ void CGameHandler::prepareAttack(BattleAttack &bat, const CStack *att, const CSt
|
|
|
bsa.spellID = SpellID(bonus->subtype);
|
|
bsa.spellID = SpellID(bonus->subtype);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
void CGameHandler::applyBattleEffects(BattleAttack &bat, const CStack *att, const CStack *def, int distance, bool secondary) //helper function for prepareAttack
|
|
void CGameHandler::applyBattleEffects(BattleAttack &bat, const CStack *att, const CStack *def, int distance, bool secondary) //helper function for prepareAttack
|
|
@@ -917,7 +917,7 @@ void CGameHandler::handleConnection(std::set<PlayerColor> players, CConnection &
|
|
|
c << &applied;
|
|
c << &applied;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- CBaseForGHApply *apply = applier->apps[packType]; //and appropriae applier object
|
|
|
|
|
|
|
+ CBaseForGHApply *apply = applier->apps[packType]; //and appropriate applier object
|
|
|
if(isBlockedByQueries(pack, player))
|
|
if(isBlockedByQueries(pack, player))
|
|
|
{
|
|
{
|
|
|
sendPackageResponse(false);
|
|
sendPackageResponse(false);
|
|
@@ -1026,7 +1026,7 @@ int CGameHandler::moveStack(int stack, BattleHex dest)
|
|
|
int v = path.first.size()-1;
|
|
int v = path.first.size()-1;
|
|
|
|
|
|
|
|
bool stackIsMoving = true;
|
|
bool stackIsMoving = true;
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
while(stackIsMoving)
|
|
while(stackIsMoving)
|
|
|
{
|
|
{
|
|
|
if(v<tilesToMove)
|
|
if(v<tilesToMove)
|
|
@@ -1079,10 +1079,10 @@ int CGameHandler::moveStack(int stack, BattleHex dest)
|
|
|
if(obs->stopsMovement() || !curStack->alive())
|
|
if(obs->stopsMovement() || !curStack->alive())
|
|
|
stackIsMoving = false;
|
|
stackIsMoving = false;
|
|
|
|
|
|
|
|
- obs.reset();
|
|
|
|
|
|
|
+ obs.reset();
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
processObstacle(obstacle);
|
|
processObstacle(obstacle);
|
|
|
if(curStack->alive())
|
|
if(curStack->alive())
|
|
|
processObstacle(obstacle2);
|
|
processObstacle(obstacle2);
|
|
@@ -1105,14 +1105,14 @@ int CGameHandler::moveStack(int stack, BattleHex dest)
|
|
|
if(curStack->alive() && curStack->doubleWide())
|
|
if(curStack->alive() && curStack->doubleWide())
|
|
|
{
|
|
{
|
|
|
BattleHex otherHex = curStack->occupiedHex(curStack->position);
|
|
BattleHex otherHex = curStack->occupiedHex(curStack->position);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if(otherHex.isValid())
|
|
if(otherHex.isValid())
|
|
|
if(auto theLastObstacle = battleGetObstacleOnPos(otherHex, false))
|
|
if(auto theLastObstacle = battleGetObstacleOnPos(otherHex, false))
|
|
|
{
|
|
{
|
|
|
//two hex creature hit obstacle by backside
|
|
//two hex creature hit obstacle by backside
|
|
|
handleDamageFromObstacle(*theLastObstacle, curStack);
|
|
handleDamageFromObstacle(*theLastObstacle, curStack);
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
|
|
+ }
|
|
|
return ret;
|
|
return ret;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1125,7 +1125,7 @@ CGameHandler::CGameHandler(void)
|
|
|
registerTypesServerPacks(*applier);
|
|
registerTypesServerPacks(*applier);
|
|
|
visitObjectAfterVictory = false;
|
|
visitObjectAfterVictory = false;
|
|
|
queries.gh = this;
|
|
queries.gh = this;
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
spellEnv = new ServerSpellCastEnvironment(this);
|
|
spellEnv = new ServerSpellCastEnvironment(this);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -3924,8 +3924,8 @@ bool CGameHandler::makeBattleAction( BattleAction &ba )
|
|
|
complain("That stack can't cast spells!");
|
|
complain("That stack can't cast spells!");
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
|
- const CSpell * spell = SpellID(spellID).toSpell();
|
|
|
|
|
- BattleSpellCastParameters parameters(gs->curB, stack, spell);
|
|
|
|
|
|
|
+ const CSpell * spell = SpellID(spellID).toSpell();
|
|
|
|
|
+ BattleSpellCastParameters parameters(gs->curB, stack, spell);
|
|
|
parameters.spellLvl = 0;
|
|
parameters.spellLvl = 0;
|
|
|
if (spellcaster)
|
|
if (spellcaster)
|
|
|
vstd::amax(parameters.spellLvl, spellcaster->val);
|
|
vstd::amax(parameters.spellLvl, spellcaster->val);
|
|
@@ -3957,12 +3957,12 @@ void CGameHandler::playerMessage( PlayerColor player, const std::string &message
|
|
|
{
|
|
{
|
|
|
SetMana sm;
|
|
SetMana sm;
|
|
|
GiveBonus giveBonus(GiveBonus::HERO);
|
|
GiveBonus giveBonus(GiveBonus::HERO);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
CGHeroInstance *h = gs->getHero(currObj);
|
|
CGHeroInstance *h = gs->getHero(currObj);
|
|
|
if(!h && complain("Cannot realize cheat, no hero selected!")) return;
|
|
if(!h && complain("Cannot realize cheat, no hero selected!")) return;
|
|
|
|
|
|
|
|
sm.hid = h->id;
|
|
sm.hid = h->id;
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
giveBonus.id = h->id.getNum();
|
|
giveBonus.id = h->id.getNum();
|
|
|
|
|
|
|
|
//give all spells with bonus (to allow banned spells)
|
|
//give all spells with bonus (to allow banned spells)
|
|
@@ -4124,11 +4124,11 @@ bool CGameHandler::makeCustomAction( BattleAction &ba )
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const CSpell * s = SpellID(ba.additionalInfo).toSpell();
|
|
const CSpell * s = SpellID(ba.additionalInfo).toSpell();
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
BattleSpellCastParameters parameters(gs->curB, h, s);
|
|
BattleSpellCastParameters parameters(gs->curB, h, s);
|
|
|
parameters.aimToHex(ba.destinationTile);//todo: allow multiple destinations
|
|
parameters.aimToHex(ba.destinationTile);//todo: allow multiple destinations
|
|
|
parameters.mode = ECastingMode::HERO_CASTING;
|
|
parameters.mode = ECastingMode::HERO_CASTING;
|
|
|
- parameters.selectedStack = gs->curB->battleGetStackByID(ba.selectedStack, false);
|
|
|
|
|
|
|
+ parameters.selectedStack = gs->curB->battleGetStackByID(ba.selectedStack, false);
|
|
|
|
|
|
|
|
ESpellCastProblem::ESpellCastProblem escp = gs->curB->battleCanCastThisSpell(h, s, ECastingMode::HERO_CASTING);//todo: should we check aimed cast(battleCanCastThisSpellHere)?
|
|
ESpellCastProblem::ESpellCastProblem escp = gs->curB->battleCanCastThisSpell(h, s, ECastingMode::HERO_CASTING);//todo: should we check aimed cast(battleCanCastThisSpellHere)?
|
|
|
if(escp != ESpellCastProblem::OK)
|
|
if(escp != ESpellCastProblem::OK)
|
|
@@ -4140,9 +4140,9 @@ bool CGameHandler::makeCustomAction( BattleAction &ba )
|
|
|
|
|
|
|
|
StartAction start_action(ba);
|
|
StartAction start_action(ba);
|
|
|
sendAndApply(&start_action); //start spell casting
|
|
sendAndApply(&start_action); //start spell casting
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
s->battleCast(spellEnv, parameters);
|
|
s->battleCast(spellEnv, parameters);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
sendAndApply(&end_action);
|
|
sendAndApply(&end_action);
|
|
|
if( !gs->curB->battleGetStackByID(gs->curB->activeStack, true))
|
|
if( !gs->curB->battleGetStackByID(gs->curB->activeStack, true))
|
|
|
{
|
|
{
|
|
@@ -4272,8 +4272,8 @@ void CGameHandler::stackTurnTrigger(const CStack * st)
|
|
|
auto bonus = *RandomGeneratorUtil::nextItem(bl, gs->getRandomGenerator());
|
|
auto bonus = *RandomGeneratorUtil::nextItem(bl, gs->getRandomGenerator());
|
|
|
auto spellID = SpellID(bonus->subtype);
|
|
auto spellID = SpellID(bonus->subtype);
|
|
|
const CSpell * spell = SpellID(spellID).toSpell();
|
|
const CSpell * spell = SpellID(spellID).toSpell();
|
|
|
- bl.remove_if([&bonus](Bonus * b){return b==bonus;});
|
|
|
|
|
-
|
|
|
|
|
|
|
+ bl.remove_if([&bonus](Bonus * b){return b==bonus;});
|
|
|
|
|
+
|
|
|
if (gs->curB->battleCanCastThisSpell(st, spell, ECastingMode::ENCHANTER_CASTING) == ESpellCastProblem::OK)
|
|
if (gs->curB->battleCanCastThisSpell(st, spell, ECastingMode::ENCHANTER_CASTING) == ESpellCastProblem::OK)
|
|
|
{
|
|
{
|
|
|
BattleSpellCastParameters parameters(gs->curB, st, spell);
|
|
BattleSpellCastParameters parameters(gs->curB, st, spell);
|
|
@@ -4282,8 +4282,8 @@ void CGameHandler::stackTurnTrigger(const CStack * st)
|
|
|
parameters.aimToHex(BattleHex::INVALID);
|
|
parameters.aimToHex(BattleHex::INVALID);
|
|
|
parameters.mode = ECastingMode::ENCHANTER_CASTING;
|
|
parameters.mode = ECastingMode::ENCHANTER_CASTING;
|
|
|
parameters.selectedStack = nullptr;
|
|
parameters.selectedStack = nullptr;
|
|
|
-
|
|
|
|
|
- spell->battleCast(spellEnv, parameters);
|
|
|
|
|
|
|
+
|
|
|
|
|
+ spell->battleCast(spellEnv, parameters);
|
|
|
|
|
|
|
|
//todo: move to mechanics
|
|
//todo: move to mechanics
|
|
|
BattleSetStackProperty ssp;
|
|
BattleSetStackProperty ssp;
|
|
@@ -4292,9 +4292,9 @@ void CGameHandler::stackTurnTrigger(const CStack * st)
|
|
|
ssp.val = bonus->additionalInfo; //increase cooldown counter
|
|
ssp.val = bonus->additionalInfo; //increase cooldown counter
|
|
|
ssp.stackID = st->ID;
|
|
ssp.stackID = st->ID;
|
|
|
sendAndApply(&ssp);
|
|
sendAndApply(&ssp);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
cast = true;
|
|
cast = true;
|
|
|
- }
|
|
|
|
|
|
|
+ }
|
|
|
};
|
|
};
|
|
|
}
|
|
}
|
|
|
bl = *(st->getBonuses(Selector::type(Bonus::ENCHANTED)));
|
|
bl = *(st->getBonuses(Selector::type(Bonus::ENCHANTED)));
|
|
@@ -4400,7 +4400,7 @@ void CGameHandler::handleTimeEvents()
|
|
|
while(gs->map->events.size() && gs->map->events.front().firstOccurence+1 == gs->day)
|
|
while(gs->map->events.size() && gs->map->events.front().firstOccurence+1 == gs->day)
|
|
|
{
|
|
{
|
|
|
CMapEvent ev = gs->map->events.front();
|
|
CMapEvent ev = gs->map->events.front();
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
for (int player = 0; player < PlayerColor::PLAYER_LIMIT_I; player++)
|
|
for (int player = 0; player < PlayerColor::PLAYER_LIMIT_I; player++)
|
|
|
{
|
|
{
|
|
|
auto color = PlayerColor(player);
|
|
auto color = PlayerColor(player);
|
|
@@ -4994,7 +4994,7 @@ void CGameHandler::attackCasting(const BattleAttack & bat, Bonus::BonusType atta
|
|
|
parameters.mode = ECastingMode::AFTER_ATTACK_CASTING;
|
|
parameters.mode = ECastingMode::AFTER_ATTACK_CASTING;
|
|
|
parameters.selectedStack = nullptr;
|
|
parameters.selectedStack = nullptr;
|
|
|
|
|
|
|
|
- spell->battleCast(spellEnv, parameters);
|
|
|
|
|
|
|
+ spell->battleCast(spellEnv, parameters);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -5011,7 +5011,7 @@ void CGameHandler::handleAfterAttackCasting( const BattleAttack & bat )
|
|
|
const CStack * attacker = gs->curB->battleGetStackByID(bat.stackAttacking);
|
|
const CStack * attacker = gs->curB->battleGetStackByID(bat.stackAttacking);
|
|
|
if (!attacker) //could be already dead
|
|
if (!attacker) //could be already dead
|
|
|
return;
|
|
return;
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
auto cast = [=](SpellID spellID, int power)
|
|
auto cast = [=](SpellID spellID, int power)
|
|
|
{
|
|
{
|
|
|
const CSpell * spell = SpellID(spellID).toSpell();
|
|
const CSpell * spell = SpellID(spellID).toSpell();
|
|
@@ -5020,13 +5020,13 @@ void CGameHandler::handleAfterAttackCasting( const BattleAttack & bat )
|
|
|
parameters.spellLvl = 0;
|
|
parameters.spellLvl = 0;
|
|
|
parameters.effectLevel = 0;
|
|
parameters.effectLevel = 0;
|
|
|
parameters.aimToStack(gs->curB->battleGetStackByID(bat.bsa.at(0).stackAttacked));
|
|
parameters.aimToStack(gs->curB->battleGetStackByID(bat.bsa.at(0).stackAttacked));
|
|
|
- parameters.effectPower = power;
|
|
|
|
|
|
|
+ parameters.effectPower = power;
|
|
|
parameters.mode = ECastingMode::AFTER_ATTACK_CASTING;
|
|
parameters.mode = ECastingMode::AFTER_ATTACK_CASTING;
|
|
|
parameters.selectedStack = nullptr;
|
|
parameters.selectedStack = nullptr;
|
|
|
|
|
|
|
|
- spell->battleCast(this->spellEnv, parameters);
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
|
|
+ spell->battleCast(this->spellEnv, parameters);
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
attackCasting(bat, Bonus::SPELL_AFTER_ATTACK, attacker);
|
|
attackCasting(bat, Bonus::SPELL_AFTER_ATTACK, attacker);
|
|
|
|
|
|
|
|
if(bat.bsa.at(0).newAmount <= 0)
|
|
if(bat.bsa.at(0).newAmount <= 0)
|
|
@@ -5077,11 +5077,11 @@ void CGameHandler::handleAfterAttackCasting( const BattleAttack & bat )
|
|
|
bool CGameHandler::castSpell(const CGHeroInstance *h, SpellID spellID, const int3 &pos)
|
|
bool CGameHandler::castSpell(const CGHeroInstance *h, SpellID spellID, const int3 &pos)
|
|
|
{
|
|
{
|
|
|
const CSpell *s = spellID.toSpell();
|
|
const CSpell *s = spellID.toSpell();
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
AdventureSpellCastParameters p;
|
|
AdventureSpellCastParameters p;
|
|
|
p.caster = h;
|
|
p.caster = h;
|
|
|
p.pos = pos;
|
|
p.pos = pos;
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
return s->adventureCast(spellEnv, p);
|
|
return s->adventureCast(spellEnv, p);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -5319,8 +5319,8 @@ void CGameHandler::runBattle()
|
|
|
auto h = gs->curB->battleGetFightingHero(i);
|
|
auto h = gs->curB->battleGetFightingHero(i);
|
|
|
if(h && h->hasBonusOfType(Bonus::OPENING_BATTLE_SPELL))
|
|
if(h && h->hasBonusOfType(Bonus::OPENING_BATTLE_SPELL))
|
|
|
{
|
|
{
|
|
|
- TBonusListPtr bl = h->getBonuses(Selector::type(Bonus::OPENING_BATTLE_SPELL));
|
|
|
|
|
-
|
|
|
|
|
|
|
+ TBonusListPtr bl = h->getBonuses(Selector::type(Bonus::OPENING_BATTLE_SPELL));
|
|
|
|
|
+
|
|
|
for (Bonus *b : *bl)
|
|
for (Bonus *b : *bl)
|
|
|
{
|
|
{
|
|
|
const CSpell * spell = SpellID(b->subtype).toSpell();
|
|
const CSpell * spell = SpellID(b->subtype).toSpell();
|
|
@@ -5329,7 +5329,7 @@ void CGameHandler::runBattle()
|
|
|
parameters.effectLevel = 3;
|
|
parameters.effectLevel = 3;
|
|
|
parameters.aimToHex(BattleHex::INVALID);
|
|
parameters.aimToHex(BattleHex::INVALID);
|
|
|
parameters.mode = ECastingMode::PASSIVE_CASTING;
|
|
parameters.mode = ECastingMode::PASSIVE_CASTING;
|
|
|
- parameters.selectedStack = nullptr;
|
|
|
|
|
|
|
+ parameters.selectedStack = nullptr;
|
|
|
parameters.enchantPower = b->val;
|
|
parameters.enchantPower = b->val;
|
|
|
spell->battleCast(spellEnv, parameters);
|
|
spell->battleCast(spellEnv, parameters);
|
|
|
}
|
|
}
|
|
@@ -5368,7 +5368,6 @@ void CGameHandler::runBattle()
|
|
|
const CStack *next;
|
|
const CStack *next;
|
|
|
while(!battleResult.get() && (next = curB.getNextStack()) && next->willMove())
|
|
while(!battleResult.get() && (next = curB.getNextStack()) && next->willMove())
|
|
|
{
|
|
{
|
|
|
-
|
|
|
|
|
//check for bad morale => freeze
|
|
//check for bad morale => freeze
|
|
|
int nextStackMorale = next->MoraleVal();
|
|
int nextStackMorale = next->MoraleVal();
|
|
|
if( nextStackMorale < 0 &&
|
|
if( nextStackMorale < 0 &&
|
|
@@ -5504,7 +5503,7 @@ void CGameHandler::runBattle()
|
|
|
{
|
|
{
|
|
|
logGlobal->traceStream() << "Activating " << next->nodeName();
|
|
logGlobal->traceStream() << "Activating " << next->nodeName();
|
|
|
auto nextId = next->ID;
|
|
auto nextId = next->ID;
|
|
|
- BattleSetActiveStack sas;
|
|
|
|
|
|
|
+ BattleSetActiveStack sas;
|
|
|
sas.stack = nextId;
|
|
sas.stack = nextId;
|
|
|
sendAndApply(&sas);
|
|
sendAndApply(&sas);
|
|
|
|
|
|
|
@@ -5710,7 +5709,7 @@ bool CGameHandler::isValidObject(const CGObjectInstance *obj) const
|
|
|
|
|
|
|
|
bool CGameHandler::isBlockedByQueries(const CPack *pack, PlayerColor player)
|
|
bool CGameHandler::isBlockedByQueries(const CPack *pack, PlayerColor player)
|
|
|
{
|
|
{
|
|
|
- if(dynamic_cast<const PlayerMessage*>(pack))
|
|
|
|
|
|
|
+ if(!strcmp(typeid(*pack).name(), typeid(PlayerMessage).name()))
|
|
|
return false;
|
|
return false;
|
|
|
|
|
|
|
|
auto query = queries.topQuery(player);
|
|
auto query = queries.topQuery(player);
|
|
@@ -5849,7 +5848,7 @@ CasualtiesAfterBattle::CasualtiesAfterBattle(const CArmedInstance *army, BattleI
|
|
|
//catapult artifact remain even if "creature" killed in siege
|
|
//catapult artifact remain even if "creature" killed in siege
|
|
|
if(warMachine != ArtifactID::NONE && warMachine != ArtifactID::CATAPULT)
|
|
if(warMachine != ArtifactID::NONE && warMachine != ArtifactID::CATAPULT)
|
|
|
{
|
|
{
|
|
|
- auto hero = dynamic_cast<const CGHeroInstance*> (army);
|
|
|
|
|
|
|
+ auto hero = dynamic_ptr_cast<CGHeroInstance> (army);
|
|
|
if (hero)
|
|
if (hero)
|
|
|
removedWarMachines.push_back (ArtifactLocation(hero, hero->getArtPos(warMachine, true)));
|
|
removedWarMachines.push_back (ArtifactLocation(hero, hero->getArtPos(warMachine, true)));
|
|
|
}
|
|
}
|
|
@@ -5922,7 +5921,7 @@ CGameHandler::FinishingBattleHelper::FinishingBattleHelper()
|
|
|
///ServerSpellCastEnvironment
|
|
///ServerSpellCastEnvironment
|
|
|
ServerSpellCastEnvironment::ServerSpellCastEnvironment(CGameHandler * gh): gh(gh)
|
|
ServerSpellCastEnvironment::ServerSpellCastEnvironment(CGameHandler * gh): gh(gh)
|
|
|
{
|
|
{
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void ServerSpellCastEnvironment::sendAndApply(CPackForClient * info) const
|
|
void ServerSpellCastEnvironment::sendAndApply(CPackForClient * info) const
|
|
@@ -5955,4 +5954,3 @@ bool ServerSpellCastEnvironment::moveHero(ObjectInstanceID hid, int3 dst, ui8 te
|
|
|
{
|
|
{
|
|
|
return gh->moveHero(hid, dst, teleporting, false, asker);
|
|
return gh->moveHero(hid, dst, teleporting, false, asker);
|
|
|
}
|
|
}
|
|
|
-
|
|
|