mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +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:
parent
1c7aad6a50
commit
c9e95f76df
@ -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" :
|
||||
{
|
||||
|
@ -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,28 +1196,27 @@ 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;
|
||||
|
||||
//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]);
|
||||
}
|
||||
|
||||
else
|
||||
return std::make_pair<const CStack * , BattleHex>(NULL, BattleHex::INVALID);
|
||||
}
|
||||
|
||||
|
@ -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<BattleHex> &accessibleHexes) const; //given hexes will be marked as accessible
|
||||
std::pair<const CStack *, BattleHex> getNearestStack(const CStack * closest, boost::logic::tribool attackerOwned, bool ignoreItself = false) const;
|
||||
std::pair<const CStack *, BattleHex> 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;
|
||||
|
@ -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<const CStack *, int> attackInfo = curB.getNearestStack(next, boost::logic::indeterminate, true);
|
||||
std::pair<const CStack *, int> attackInfo = curB.getNearestStack(next, boost::logic::indeterminate);
|
||||
if(attackInfo.first != NULL)
|
||||
{
|
||||
BattleAction attack;
|
||||
|
Loading…
Reference in New Issue
Block a user