diff --git a/config/creatures/conflux.json b/config/creatures/conflux.json index 500a8c653..9043a1d96 100644 --- a/config/creatures/conflux.json +++ b/config/creatures/conflux.json @@ -486,7 +486,8 @@ { "immuneToFire" : { - "type" : "FIRE_IMMUNITY" + "type" : "FIRE_IMMUNITY", + "subtype" : 0 //this IS important }, }, "graphics" : @@ -516,7 +517,8 @@ }, "immuneToFire" : { - "type" : "FIRE_IMMUNITY" + "type" : "FIRE_IMMUNITY", + "subtype" : 0 //this IS important }, "rebirth" : { diff --git a/lib/CBattleCallback.cpp b/lib/CBattleCallback.cpp index 4710d9aec..ed811340d 100644 --- a/lib/CBattleCallback.cpp +++ b/lib/CBattleCallback.cpp @@ -1181,7 +1181,7 @@ std::set CBattleInfoCallback::getStoppers(BattlePerspective::BattlePe return ret; } -std::pair CBattleInfoCallback::getNearestStack(const CStack * closest, boost::logic::tribool attackerOwned, bool ignoreItself) const +std::pair CBattleInfoCallback::getNearestStack(const CStack * closest, boost::logic::tribool attackerOwned) const { auto reachability = getReachability(closest); @@ -1196,29 +1196,28 @@ std::pair CBattleInfoCallback::getNearestStack(const for(int g=0; gID == 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(NULL, BattleHex::INVALID); + else + return std::make_pair(NULL, BattleHex::INVALID); } si8 CBattleInfoCallback::battleGetTacticDist() const diff --git a/lib/CBattleCallback.h b/lib/CBattleCallback.h index a899513ee..779178105 100644 --- a/lib/CBattleCallback.h +++ b/lib/CBattleCallback.h @@ -291,7 +291,7 @@ public: AccessibilityInfo getAccesibility() const; AccessibilityInfo getAccesibility(const CStack *stack) const; //Hexes ocupied by stack will be marked as accessible. AccessibilityInfo getAccesibility(const std::vector &accessibleHexes) const; //given hexes will be marked as accessible - std::pair getNearestStack(const CStack * closest, boost::logic::tribool attackerOwned, bool ignoreItself = false) const; + std::pair getNearestStack(const CStack * closest, boost::logic::tribool attackerOwned) const; protected: ReachabilityInfo getFlyingReachability(const ReachabilityInfo::Parameters params) const; ReachabilityInfo makeBFS(const AccessibilityInfo &accessibility, const ReachabilityInfo::Parameters params) const; diff --git a/server/CGameHandler.cpp b/server/CGameHandler.cpp index ed5aa9cb8..57ca083c5 100644 --- a/server/CGameHandler.cpp +++ b/server/CGameHandler.cpp @@ -3839,7 +3839,7 @@ void CGameHandler::playerMessage( PlayerColor player, const std::string &message { CGHeroInstance *hero = gs->getHero(gs->getPlayer(player)->currentSelection); if(!hero) return; - for (int g=7; g<=140; ++g) + for (int g = 7; g < VLC->arth->artifacts.size(); ++g) //including artifacts from mods giveHeroNewArtifact(hero, VLC->arth->artifacts[g], ArtifactPosition::PRE_FIRST); } else @@ -5827,7 +5827,7 @@ void CGameHandler::runBattle() if(next->hasBonusOfType(Bonus::ATTACKS_NEAREST_CREATURE)) //while in berserk { //fixme: stack should not attack itself - std::pair attackInfo = curB.getNearestStack(next, boost::logic::indeterminate, true); + std::pair attackInfo = curB.getNearestStack(next, boost::logic::indeterminate); if(attackInfo.first != NULL) { BattleAction attack;