1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-12 02:28:11 +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

@ -486,7 +486,8 @@
{ {
"immuneToFire" : "immuneToFire" :
{ {
"type" : "FIRE_IMMUNITY" "type" : "FIRE_IMMUNITY",
"subtype" : 0 //this IS important
}, },
}, },
"graphics" : "graphics" :
@ -516,7 +517,8 @@
}, },
"immuneToFire" : "immuneToFire" :
{ {
"type" : "FIRE_IMMUNITY" "type" : "FIRE_IMMUNITY",
"subtype" : 0 //this IS important
}, },
"rebirth" : "rebirth" :
{ {

View File

@ -1181,7 +1181,7 @@ std::set<BattleHex> CBattleInfoCallback::getStoppers(BattlePerspective::BattlePe
return ret; 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); 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) for(int g=0; g<GameConstants::BFIELD_SIZE; ++g)
{ {
const CStack * atG = battleGetStackByPos(g); const CStack * atG = battleGetStackByPos(g);
if (ignoreItself && atG == closest) //don't attack itself in berserk if(!atG || atG->ID == closest->ID) //if there is no stack or we are the closest one
continue;
if(!atG || atG->ID == closest->ID) //if there is not stack or we are the closest one
continue; continue;
if(boost::logic::indeterminate(attackerOwned) || atG->attackerOwned == attackerOwned) if(boost::logic::indeterminate(attackerOwned) || atG->attackerOwned == attackerOwned)
{ {
if (reachability.isReachable(g)) 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}; DistStack hlp = {reachability.distances[reachability.predecessors[g]], atG};
stackPairs.push_back(hlp); stackPairs.push_back(hlp);
} }
} }
}
if(stackPairs.size() > 0) if (stackPairs.size())
{ {
auto comparator = [](DistStack lhs, DistStack rhs) { return lhs.distanceToPred < rhs.distanceToPred; }; auto comparator = [](DistStack lhs, DistStack rhs) { return lhs.distanceToPred < rhs.distanceToPred; };
auto minimal = boost::min_element(stackPairs, comparator); auto minimal = boost::min_element(stackPairs, comparator);
return std::make_pair(minimal->stack, reachability.predecessors[minimal->stack->position]); return std::make_pair(minimal->stack, reachability.predecessors[minimal->stack->position]);
} }
else
return std::make_pair<const CStack * , BattleHex>(NULL, BattleHex::INVALID); return std::make_pair<const CStack * , BattleHex>(NULL, BattleHex::INVALID);
} }

View File

@ -291,7 +291,7 @@ public:
AccessibilityInfo getAccesibility() const; AccessibilityInfo getAccesibility() const;
AccessibilityInfo getAccesibility(const CStack *stack) const; //Hexes ocupied by stack will be marked as accessible. 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 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: protected:
ReachabilityInfo getFlyingReachability(const ReachabilityInfo::Parameters params) const; ReachabilityInfo getFlyingReachability(const ReachabilityInfo::Parameters params) const;
ReachabilityInfo makeBFS(const AccessibilityInfo &accessibility, const ReachabilityInfo::Parameters params) const; ReachabilityInfo makeBFS(const AccessibilityInfo &accessibility, const ReachabilityInfo::Parameters params) const;

View File

@ -3839,7 +3839,7 @@ void CGameHandler::playerMessage( PlayerColor player, const std::string &message
{ {
CGHeroInstance *hero = gs->getHero(gs->getPlayer(player)->currentSelection); CGHeroInstance *hero = gs->getHero(gs->getPlayer(player)->currentSelection);
if(!hero) return; 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); giveHeroNewArtifact(hero, VLC->arth->artifacts[g], ArtifactPosition::PRE_FIRST);
} }
else else
@ -5827,7 +5827,7 @@ void CGameHandler::runBattle()
if(next->hasBonusOfType(Bonus::ATTACKS_NEAREST_CREATURE)) //while in berserk if(next->hasBonusOfType(Bonus::ATTACKS_NEAREST_CREATURE)) //while in berserk
{ //fixme: stack should not attack itself { //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) if(attackInfo.first != NULL)
{ {
BattleAction attack; BattleAction attack;