mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-24 08:32:34 +02:00
- fixed #1375
- damage done by turrets is properly increased by built buldings
This commit is contained in:
parent
13acb58d55
commit
a719e03b30
@ -608,7 +608,7 @@ void CClient::battleStarted(const BattleInfo * info)
|
||||
};
|
||||
|
||||
callBattleStart(leftSide.color, 0);
|
||||
callBattleStart(leftSide.color, 1);
|
||||
callBattleStart(rightSide.color, 1);
|
||||
callBattleStart(PlayerColor::UNFLAGGABLE, 1);
|
||||
|
||||
if(info->tacticDistance && vstd::contains(battleints,info->sides[info->tacticsSide].color))
|
||||
|
@ -101,6 +101,9 @@ void CGuiHandler::popIntTotally( IShowActivatable *top )
|
||||
|
||||
void CGuiHandler::pushInt( IShowActivatable *newInt )
|
||||
{
|
||||
assert(newInt);
|
||||
assert(boost::range::find(listInt, newInt) == listInt.end()); // do not add same object twice
|
||||
|
||||
//a new interface will be present, we'll need to use buffer surface (unless it's advmapint that will alter screenBuf on activate anyway)
|
||||
screenBuf = screen2;
|
||||
|
||||
|
@ -21,24 +21,19 @@
|
||||
|
||||
namespace SiegeStuffThatShouldBeMovedToHandlers // <=== TODO
|
||||
{
|
||||
static void retreiveTurretDamageRange(const CStack *turret, double &outMinDmg, double &outMaxDmg)
|
||||
static void retreiveTurretDamageRange(const CGTownInstance * town, const CStack *turret, double &outMinDmg, double &outMaxDmg)
|
||||
{
|
||||
assert(turret->getCreature()->idNumber == CreatureID::ARROW_TOWERS);
|
||||
assert(town);
|
||||
assert(turret->position >= -4 && turret->position <= -2);
|
||||
|
||||
switch(turret->position)
|
||||
{
|
||||
case -2: //keep
|
||||
outMinDmg = 15;
|
||||
outMaxDmg = 15;
|
||||
break;
|
||||
case -3: case -4: //turrets
|
||||
outMinDmg = 7.5;
|
||||
outMaxDmg = 7.5;
|
||||
break;
|
||||
default:
|
||||
logGlobal->warnStream() << "Unknown turret type!";
|
||||
outMaxDmg = outMinDmg = 1;
|
||||
}
|
||||
float multiplier = (turret->position == -2) ? 1 : 0.5;
|
||||
|
||||
int baseMin = 6;
|
||||
int baseMax = 10;
|
||||
|
||||
outMinDmg = multiplier * (baseMin + town->getTownLevel() * 2);
|
||||
outMaxDmg = multiplier * (baseMax + town->getTownLevel() * 3);
|
||||
}
|
||||
|
||||
static BattleHex lineToWallHex(int line) //returns hex with wall in given line (y coordinate)
|
||||
@ -816,7 +811,7 @@ TDmgRange CBattleInfoCallback::calculateDmgRange(const BattleAttackInfo &info) c
|
||||
|
||||
if(attackerType->idNumber == CreatureID::ARROW_TOWERS)
|
||||
{
|
||||
SiegeStuffThatShouldBeMovedToHandlers::retreiveTurretDamageRange(info.attacker, minDmg, maxDmg);
|
||||
SiegeStuffThatShouldBeMovedToHandlers::retreiveTurretDamageRange(battleGetDefendedTown(), info.attacker, minDmg, maxDmg);
|
||||
}
|
||||
|
||||
if(info.attackerBonuses->hasBonusOfType(Bonus::SIEGE_WEAPON) && attackerType->idNumber != CreatureID::ARROW_TOWERS) //any siege weapon, but only ballista can attack (second condition - not arrow turret)
|
||||
|
@ -2616,6 +2616,15 @@ bool CGTownInstance::armedGarrison() const
|
||||
return stacksCount() || garrisonHero;
|
||||
}
|
||||
|
||||
int CGTownInstance::getTownLevel() const
|
||||
{
|
||||
// count all buildings that are not upgrades
|
||||
return boost::range::count_if(builtBuildings, [&](const BuildingID & build)
|
||||
{
|
||||
return town->buildings[build] && town->buildings[build]->upgrade == -1;
|
||||
});
|
||||
}
|
||||
|
||||
CBonusSystemNode * CGTownInstance::whatShouldBeAttached()
|
||||
{
|
||||
return &townAndVis;
|
||||
|
@ -660,6 +660,7 @@ public:
|
||||
int dailyIncome() const; //calculates daily income of this town
|
||||
int spellsAtLevel(int level, bool checkGuild) const; //levels are counted from 1 (1 - 5)
|
||||
bool armedGarrison() const; //true if town has creatures in garrison or garrisoned hero
|
||||
int getTownLevel() const;
|
||||
|
||||
void removeCapitols (PlayerColor owner) const;
|
||||
void addHeroToStructureVisitors(const CGHeroInstance *h, si32 structureInstanceID) const; //hero must be visiting or garrisoned in town
|
||||
|
Loading…
Reference in New Issue
Block a user