Browse Source

Dimension door movement points fix

When hero with one move point make dimension doors then he can have on
graphics full move points. Caused by substraction that make unsigned
variable < 0.
FeniksFire 8 năm trước cách đây
mục cha
commit
f331386b6f

+ 4 - 1
lib/spells/AdventureSpellMechanics.cpp

@@ -322,7 +322,10 @@ ESpellCastResult DimensionDoorMechanics::applyAdventureEffects(const SpellCastEn
 	{
 	{
 		SetMovePoints smp;
 		SetMovePoints smp;
 		smp.hid = parameters.caster->id;
 		smp.hid = parameters.caster->id;
-		smp.val = std::max<ui32>(0, parameters.caster->movement - movementCost);
+		if(movementCost < parameters.caster->movement)
+			smp.val = parameters.caster->movement - movementCost;
+		else
+			smp.val = 0;
 		env->sendAndApply(&smp);
 		env->sendAndApply(&smp);
 	}
 	}
 	return ESpellCastResult::OK;
 	return ESpellCastResult::OK;