1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-12 02:28:11 +02:00

Dimension Door: fix movement points cost for expert level

This commit is contained in:
ArseniyShestakov 2015-12-21 18:44:21 +03:00
parent 87eaa78ffd
commit 48be566050

View File

@ -148,13 +148,14 @@ ESpellCastResult DimensionDoorMechanics::applyAdventureEffects(const SpellCastEn
return ESpellCastResult::ERROR;
}
if(parameters.caster->movement <= 0)
if(parameters.caster->movement <= 0) //unlike town portal non-zero MP is enough
{
env->complain("Hero needs movement points to cast Dimension Door!");
return ESpellCastResult::ERROR;
}
const int schoolLevel = parameters.caster->getSpellSchoolLevel(owner);
const int movementCost = GameConstants::BASE_MOVEMENT_COST * ((schoolLevel >= 3) ? 2 : 3);
if(parameters.caster->getBonusesCount(Bonus::SPELL_EFFECT, SpellID::DIMENSION_DOOR) >= owner->getPower(schoolLevel)) //limit casts per turn
{
@ -182,7 +183,7 @@ ESpellCastResult DimensionDoorMechanics::applyAdventureEffects(const SpellCastEn
{
SetMovePoints smp;
smp.hid = parameters.caster->id;
smp.val = std::max<ui32>(0, parameters.caster->movement - 300);
smp.val = std::max<ui32>(0, parameters.caster->movement - movementCost);
env->sendAndApply(&smp);
}
return ESpellCastResult::OK;
@ -241,7 +242,7 @@ ESpellCastResult TownPortalMechanics::applyAdventureEffects(const SpellCastEnvir
}
const int movementCost = (parameters.caster->getSpellSchoolLevel(owner) >= 3) ? 200 : 300;
const int movementCost = GameConstants::BASE_MOVEMENT_COST * ((parameters.caster->getSpellSchoolLevel(owner) >= 3) ? 2 : 3);
if(parameters.caster->movement < movementCost)
{