mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
This commit is contained in:
parent
6c63041d1a
commit
849e3fc04e
@ -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());
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user