|
@@ -19,14 +19,16 @@
|
|
#include "../GameInstance.h"
|
|
#include "../GameInstance.h"
|
|
|
|
|
|
#include "../../lib/Point.h"
|
|
#include "../../lib/Point.h"
|
|
|
|
+#include "../../lib/battle/CPlayerBattleCallback.h"
|
|
|
|
+#include "../../lib/battle/IBattleState.h"
|
|
#include "../../lib/callback/CCallback.h"
|
|
#include "../../lib/callback/CCallback.h"
|
|
#include "../../lib/mapObjects/CGHeroInstance.h"
|
|
#include "../../lib/mapObjects/CGHeroInstance.h"
|
|
#include "../../lib/mapObjects/MiscObjects.h"
|
|
#include "../../lib/mapObjects/MiscObjects.h"
|
|
-#include "../../lib/spells/CSpellHandler.h"
|
|
|
|
#include "../../lib/mapping/CMap.h"
|
|
#include "../../lib/mapping/CMap.h"
|
|
#include "../../lib/pathfinder/CGPathNode.h"
|
|
#include "../../lib/pathfinder/CGPathNode.h"
|
|
-#include "../../lib/battle/CPlayerBattleCallback.h"
|
|
|
|
-#include "../../lib/battle/IBattleState.h"
|
|
|
|
|
|
+#include "../../lib/spells/CSpellHandler.h"
|
|
|
|
+#include "../../lib/spells/ISpellMechanics.h"
|
|
|
|
+#include "../../lib/spells/Problem.h"
|
|
|
|
|
|
MapRendererBaseContext::MapRendererBaseContext(const MapRendererContextState & viewState)
|
|
MapRendererBaseContext::MapRendererBaseContext(const MapRendererContextState & viewState)
|
|
: viewState(viewState)
|
|
: viewState(viewState)
|
|
@@ -367,15 +369,14 @@ bool MapRendererAdventureContext::showTextOverlay() const
|
|
|
|
|
|
bool MapRendererAdventureContext::showSpellRange(const int3 & position) const
|
|
bool MapRendererAdventureContext::showSpellRange(const int3 & position) const
|
|
{
|
|
{
|
|
- if (!settingSpellRange)
|
|
|
|
- return false;
|
|
|
|
-
|
|
|
|
auto hero = GAME->interface()->localState->getCurrentHero();
|
|
auto hero = GAME->interface()->localState->getCurrentHero();
|
|
|
|
+ auto spell = GAME->interface()->localState->getCurrentSpell();
|
|
|
|
|
|
- if (!hero)
|
|
|
|
|
|
+ if (!hero || !spell.hasValue())
|
|
return false;
|
|
return false;
|
|
|
|
|
|
- return !isInScreenRange(hero->getSightCenter(), position);
|
|
|
|
|
|
+ spells::detail::ProblemImpl problem;;
|
|
|
|
+ return !spell.toSpell()->getAdventureMechanics().isTargetInRange(problem, GAME->interface()->cb.get(), hero, position);
|
|
}
|
|
}
|
|
|
|
|
|
MapRendererAdventureTransitionContext::MapRendererAdventureTransitionContext(const MapRendererContextState & viewState)
|
|
MapRendererAdventureTransitionContext::MapRendererAdventureTransitionContext(const MapRendererContextState & viewState)
|