mirror of
https://github.com/vcmi/vcmi.git
synced 2025-02-03 13:01:33 +02:00
Fix Admiral's Hat whirlpool immunity. Reduce usage of
convertFromVisitablePos
This commit is contained in:
parent
6a624cbaf7
commit
9c05e80315
@ -1321,7 +1321,7 @@ bool AIGateway::moveHeroToTile(int3 dst, HeroPtr h)
|
||||
{
|
||||
destinationTeleport = exitId;
|
||||
if(exitPos.valid())
|
||||
destinationTeleportPos = h->convertFromVisitablePos(exitPos);
|
||||
destinationTeleportPos = exitPos;
|
||||
cb->moveHero(*h, h->pos, false);
|
||||
destinationTeleport = ObjectInstanceID();
|
||||
destinationTeleportPos = int3(-1);
|
||||
|
@ -1899,7 +1899,7 @@ bool VCAI::moveHeroToTile(int3 dst, HeroPtr h)
|
||||
{
|
||||
destinationTeleport = exitId;
|
||||
if(exitPos.valid())
|
||||
destinationTeleportPos = h->convertFromVisitablePos(exitPos);
|
||||
destinationTeleportPos = exitPos;
|
||||
cb->moveHero(*h, h->pos, false);
|
||||
destinationTeleport = ObjectInstanceID();
|
||||
destinationTeleportPos = int3(-1);
|
||||
|
@ -90,9 +90,7 @@ void HeroMovementController::showTeleportDialog(const CGHeroInstance * hero, Tel
|
||||
|
||||
for(size_t i = 0; i < exits.size(); ++i)
|
||||
{
|
||||
const auto * teleporter = LOCPLINT->cb->getObj(exits[i].first);
|
||||
|
||||
if(teleporter && teleporter->visitableAt(nextNode.coord))
|
||||
if(exits[i].second == nextNode.coord)
|
||||
{
|
||||
// Remove this node from path - it will be covered by teleportation
|
||||
//LOCPLINT->localState->removeLastNode(hero);
|
||||
|
@ -490,7 +490,7 @@ void CGMonolith::onHeroVisit( const CGHeroInstance * h ) const
|
||||
auto exits = cb->getTeleportChannelExits(channel);
|
||||
for(const auto & exit : exits)
|
||||
{
|
||||
td.exits.push_back(std::make_pair(exit, h->convertFromVisitablePos(cb->getObj(exit)->visitablePos())));
|
||||
td.exits.push_back(std::make_pair(exit, cb->getObj(exit)->visitablePos()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -522,9 +522,9 @@ void CGMonolith::teleportDialogAnswered(const CGHeroInstance *hero, ui32 answer,
|
||||
else if(vstd::isValidIndex(exits, answer))
|
||||
dPos = exits[answer].second;
|
||||
else
|
||||
dPos = hero->convertFromVisitablePos(cb->getObj(randomExit)->visitablePos());
|
||||
dPos = cb->getObj(randomExit)->visitablePos();
|
||||
|
||||
cb->moveHero(hero->id, dPos, EMovementMode::MONOLITH);
|
||||
cb->moveHero(hero->id, hero->convertFromVisitablePos(dPos), EMovementMode::MONOLITH);
|
||||
}
|
||||
|
||||
void CGMonolith::initObj(CRandomGenerator & rand)
|
||||
@ -566,7 +566,7 @@ void CGSubterraneanGate::onHeroVisit( const CGHeroInstance * h ) const
|
||||
else
|
||||
{
|
||||
auto exit = getRandomExit(h);
|
||||
td.exits.push_back(std::make_pair(exit, h->convertFromVisitablePos(cb->getObj(exit)->visitablePos())));
|
||||
td.exits.push_back(std::make_pair(exit, cb->getObj(exit)->visitablePos()));
|
||||
}
|
||||
|
||||
cb->showTeleportDialog(&td);
|
||||
@ -676,7 +676,7 @@ void CGWhirlpool::onHeroVisit( const CGHeroInstance * h ) const
|
||||
{
|
||||
auto blockedPosList = cb->getObj(exit)->getBlockedPos();
|
||||
for(const auto & bPos : blockedPosList)
|
||||
td.exits.push_back(std::make_pair(exit, h->convertFromVisitablePos(bPos)));
|
||||
td.exits.push_back(std::make_pair(exit, bPos));
|
||||
}
|
||||
}
|
||||
|
||||
@ -700,10 +700,10 @@ void CGWhirlpool::teleportDialogAnswered(const CGHeroInstance *hero, ui32 answer
|
||||
|
||||
const auto * obj = cb->getObj(exit);
|
||||
std::set<int3> tiles = obj->getBlockedPos();
|
||||
dPos = hero->convertFromVisitablePos(*RandomGeneratorUtil::nextItem(tiles, CRandomGenerator::getDefault()));
|
||||
dPos = *RandomGeneratorUtil::nextItem(tiles, CRandomGenerator::getDefault());
|
||||
}
|
||||
|
||||
cb->moveHero(hero->id, dPos, EMovementMode::MONOLITH);
|
||||
cb->moveHero(hero->id, hero->convertFromVisitablePos(dPos), EMovementMode::MONOLITH);
|
||||
}
|
||||
|
||||
bool CGWhirlpool::isProtected(const CGHeroInstance * h)
|
||||
|
Loading…
x
Reference in New Issue
Block a user