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",
"subtype" : "creature.angel",
"val" : 50
"val" : 50,
"description" : "Devil -1"
},
"FLYING_ARMY" :
{

View File

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

View File

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

View File

@ -1175,7 +1175,7 @@ std::set<BattleHex> CBattleInfoCallback::getStoppers(BattlePerspective::BattlePe
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);
@ -1190,6 +1190,8 @@ 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
continue;

View File

@ -290,7 +290,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) const;
std::pair<const CStack *, BattleHex> getNearestStack(const CStack * closest, boost::logic::tribool attackerOwned, bool ignoreItself = false) const;
protected:
ReachabilityInfo getFlyingReachability(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
{
std::pair<const CStack *, int> attackInfo = curB.getNearestStack(next, boost::logic::indeterminate);
{ //fixme: stack should not attack itself
std::pair<const CStack *, int> attackInfo = curB.getNearestStack(next, boost::logic::indeterminate, true);
if(attackInfo.first != NULL)
{
BattleAction attack;