1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-23 00:28:08 +02:00

- Fixed Phoenix fire immunity. Again.

- Cheat code with grant all artifacts, including the ones added by mods
- Some clean-up of Berserk effect, however it doesn't work at the moment.
This commit is contained in:
DjWarmonger
2013-05-25 07:06:00 +00:00
parent 1c7aad6a50
commit c9e95f76df
4 changed files with 18 additions and 17 deletions

View File

@ -1181,7 +1181,7 @@ std::set<BattleHex> CBattleInfoCallback::getStoppers(BattlePerspective::BattlePe
return ret;
}
std::pair<const CStack *, BattleHex> CBattleInfoCallback::getNearestStack(const CStack * closest, boost::logic::tribool attackerOwned, bool ignoreItself) const
std::pair<const CStack *, BattleHex> CBattleInfoCallback::getNearestStack(const CStack * closest, boost::logic::tribool attackerOwned) const
{
auto reachability = getReachability(closest);
@ -1196,29 +1196,28 @@ std::pair<const CStack *, BattleHex> CBattleInfoCallback::getNearestStack(const
for(int g=0; g<GameConstants::BFIELD_SIZE; ++g)
{
const CStack * atG = battleGetStackByPos(g);
if (ignoreItself && atG == closest) //don't attack itself in berserk
continue;
if(!atG || atG->ID == closest->ID) //if there is not stack or we are the closest one
if(!atG || atG->ID == closest->ID) //if there is no stack or we are the closest one
continue;
if(boost::logic::indeterminate(attackerOwned) || atG->attackerOwned == attackerOwned)
{
if(reachability.isReachable(g))
continue;
DistStack hlp = {reachability.distances[reachability.predecessors[g]], atG};
stackPairs.push_back(hlp);
if (reachability.isReachable(g))
//FIXME: hexes occupied by enemy stack are not accessible. Need to use BattleInfo::getPath or similiar
{
DistStack hlp = {reachability.distances[reachability.predecessors[g]], atG};
stackPairs.push_back(hlp);
}
}
}
if(stackPairs.size() > 0)
if (stackPairs.size())
{
auto comparator = [](DistStack lhs, DistStack rhs) { return lhs.distanceToPred < rhs.distanceToPred; };
auto minimal = boost::min_element(stackPairs, comparator);
return std::make_pair(minimal->stack, reachability.predecessors[minimal->stack->position]);
}
return std::make_pair<const CStack * , BattleHex>(NULL, BattleHex::INVALID);
else
return std::make_pair<const CStack * , BattleHex>(NULL, BattleHex::INVALID);
}
si8 CBattleInfoCallback::battleGetTacticDist() const