1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00
This commit is contained in:
AlexVinS 2016-09-24 09:27:58 +03:00
parent 6c63041d1a
commit 849e3fc04e
3 changed files with 13 additions and 3 deletions

View File

@ -2073,6 +2073,7 @@ void CBattleInterface::handleHex(BattleHex myNumber, int eventType)
break;
case TELEPORT:
{
//todo: move to mechanics
ui8 skill = 0;
if (creatureCasting)
skill = sactive->getEffectLevel(SpellID(SpellID::TELEPORT).toSpell());

View File

@ -52,7 +52,7 @@ namespace SiegeStuffThatShouldBeMovedToHandlers // <=== TODO
const bool stackLeft = pos1 < wallInStackLine;
const bool destLeft = pos2 < wallInDestLine;
return stackLeft != destLeft;
return stackLeft == destLeft;
}
// parts of wall
@ -500,7 +500,11 @@ si8 CBattleInfoCallback::battleCanTeleportTo(const CStack * stack, BattleHex des
if (!getAccesibility(stack).accessible(destHex, stack))
return false;
if (battleGetSiegeLevel() && telportLevel < 2) //check for wall
const ui8 siegeLevel = battleGetSiegeLevel();
//check for wall
//advanced teleport can pass wall of fort|citadel, expert - of castle
if ((siegeLevel > CGTownInstance::NONE && telportLevel < 2) || (siegeLevel >= CGTownInstance::CASTLE && telportLevel < 3))
return sameSideOfWall(stack->position, destHex);
return true;

View File

@ -856,7 +856,6 @@ bool SummonMechanics::requiresCreatureTarget() const
///TeleportMechanics
void TeleportMechanics::applyBattleEffects(const SpellCastEnvironment * env, const BattleSpellCastParameters & parameters, SpellCastContext & ctx) const
{
//todo: check legal teleport
if(parameters.destinations.size() == 2)
{
//first destination hex to move to
@ -875,6 +874,12 @@ void TeleportMechanics::applyBattleEffects(const SpellCastEnvironment * env, con
return;
}
if(!parameters.cb->battleCanTeleportTo(target, destination, parameters.effectLevel))
{
env->complain("TeleportMechanics: forbidden teleport");
return;
}
BattleStackMoved bsm;
bsm.distance = -1;
bsm.stack = target->ID;