1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-12 02:28:11 +02:00

- Added missing abilities for devil & ghost dragon

- Stack affected by Berserk should not try to attack itself

Neither of these can be actually seen in game duo to more general engine bugs :/
This commit is contained in:
DjWarmonger 2013-04-27 06:39:59 +00:00
parent 0f7d175896
commit 32c87f532f
6 changed files with 22 additions and 9 deletions

View File

@ -347,7 +347,8 @@
{ {
"type" : "HATE", "type" : "HATE",
"subtype" : "creature.angel", "subtype" : "creature.angel",
"val" : 50 "val" : 50,
"description" : "Devil -1"
}, },
"FLYING_ARMY" : "FLYING_ARMY" :
{ {

View File

@ -329,6 +329,12 @@
"dragon" : "dragon" :
{ {
"type" : "DRAGON_NATURE" "type" : "DRAGON_NATURE"
},
"descreaseMorale" :
{
"type" : "MORALE",
"effectRange" : "ONLY_ENEMY_ARMY",
"val" : -1
} }
}, },
"upgrades": ["ghostDragon"], "upgrades": ["ghostDragon"],
@ -354,7 +360,13 @@
{ {
"dragon" : "dragon" :
{ {
"type" : "DRAGON_NATURE" "type" : "DRAGON_NATURE",
},
"descreaseMorale" :
{
"type" : "MORALE",
"effectRange" : "ONLY_ENEMY_ARMY",
"val" : -1
}, },
"age" : "age" :
{ {

View File

@ -684,7 +684,7 @@ BattleInfo * BattleInfo::setupBattle( int3 tile, ETerrainType terrain, BFieldTyp
curB->tacticDistance = 0; curB->tacticDistance = 0;
// workaround — bonuses affecting only enemy // workaround — bonuses affecting only enemy - DOES NOT WORK
for(int i = 0; i < 2; i++) for(int i = 0; i < 2; i++)
{ {
TNodes nodes; TNodes nodes;
@ -883,8 +883,6 @@ void CStack::postInit()
assert(type); assert(type);
assert(getParentNodes().size()); assert(getParentNodes().size());
//FIXME: the following should take into account ONLY_ENEMY_ARMY bonus range
firstHPleft = MaxHealth(); firstHPleft = MaxHealth();
shots = getCreature()->valOfBonuses(Bonus::SHOTS); shots = getCreature()->valOfBonuses(Bonus::SHOTS);
counterAttacks = 1 + valOfBonuses(Bonus::ADDITIONAL_RETALIATION); counterAttacks = 1 + valOfBonuses(Bonus::ADDITIONAL_RETALIATION);

View File

@ -1175,7 +1175,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) const std::pair<const CStack *, BattleHex> CBattleInfoCallback::getNearestStack(const CStack * closest, boost::logic::tribool attackerOwned, bool ignoreItself) const
{ {
auto reachability = getReachability(closest); auto reachability = getReachability(closest);
@ -1190,6 +1190,8 @@ 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
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 not stack or we are the closest one
continue; continue;

View File

@ -290,7 +290,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) const; std::pair<const CStack *, BattleHex> getNearestStack(const CStack * closest, boost::logic::tribool attackerOwned, bool ignoreItself = false) 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

@ -5780,8 +5780,8 @@ 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
std::pair<const CStack *, int> attackInfo = curB.getNearestStack(next, boost::logic::indeterminate); std::pair<const CStack *, int> attackInfo = curB.getNearestStack(next, boost::logic::indeterminate, true);
if(attackInfo.first != NULL) if(attackInfo.first != NULL)
{ {
BattleAction attack; BattleAction attack;