|
|
@@ -1208,11 +1208,11 @@ void CGameHandler::addGenericKilledLog(BattleLogMessage & blm, const CStack * de
|
|
|
boost::format txt(formatString);
|
|
|
if(killed > 1)
|
|
|
{
|
|
|
- txt % killed % (multiple ? VLC->generaltexth->allTexts[43] : defender->getCreature()->getNamePluralTranslated()); // creatures perish
|
|
|
+ txt % killed % (multiple ? VLC->generaltexth->allTexts[43] : defender->unitType()->getNamePluralTranslated()); // creatures perish
|
|
|
}
|
|
|
else //killed == 1
|
|
|
{
|
|
|
- txt % (multiple ? VLC->generaltexth->allTexts[42] : defender->getCreature()->getNameSingularTranslated()); // creature perishes
|
|
|
+ txt % (multiple ? VLC->generaltexth->allTexts[42] : defender->unitType()->getNameSingularTranslated()); // creature perishes
|
|
|
}
|
|
|
MetaString line;
|
|
|
line << txt.str();
|
|
|
@@ -4478,10 +4478,10 @@ void CGameHandler::updateGateState()
|
|
|
// - deals moat damage to attacker if bridge is closed (fortress only)
|
|
|
|
|
|
bool hasForceFieldOnBridge = !battleGetAllObstaclesOnPos(BattleHex(ESiegeHex::GATE_BRIDGE), true).empty();
|
|
|
- bool hasStackAtGateInner = gs->curB->battleGetStackByPos(BattleHex(ESiegeHex::GATE_INNER), false) != nullptr;
|
|
|
- bool hasStackAtGateOuter = gs->curB->battleGetStackByPos(BattleHex(ESiegeHex::GATE_OUTER), false) != nullptr;
|
|
|
- bool hasStackAtGateBridge = gs->curB->battleGetStackByPos(BattleHex(ESiegeHex::GATE_BRIDGE), false) != nullptr;
|
|
|
- bool hasWideMoat = vstd::contains_if(battleGetAllObstaclesOnPos(BattleHex(ESiegeHex::GATE_BRIDGE), false), [](const std::shared_ptr<const CObstacleInstance> & obst)
|
|
|
+ bool hasStackAtGateInner = gs->curB->battleGetUnitByPos(BattleHex(ESiegeHex::GATE_INNER), false) != nullptr;
|
|
|
+ bool hasStackAtGateOuter = gs->curB->battleGetUnitByPos(BattleHex(ESiegeHex::GATE_OUTER), false) != nullptr;
|
|
|
+ bool hasStackAtGateBridge = gs->curB->battleGetUnitByPos(BattleHex(ESiegeHex::GATE_BRIDGE), false) != nullptr;
|
|
|
+ bool hasWideMoat = vstd::contains_if(battleGetAllObstaclesOnPos(BattleHex(ESiegeHex::GATE_BRIDGE), false), [](const std::shared_ptr<const CObstacleInstance> & obst)
|
|
|
{
|
|
|
return obst->obstacleType == CObstacleInstance::MOAT;
|
|
|
});
|
|
|
@@ -6031,8 +6031,8 @@ void CGameHandler::handleAfterAttackCasting(bool ranged, const CStack * attacker
|
|
|
|
|
|
int bonusAdditionalInfo = attacker->getBonus(Selector::type()(Bonus::TRANSMUTATION))->additionalInfo[0];
|
|
|
|
|
|
- if(defender->getCreature()->getId() == bonusAdditionalInfo ||
|
|
|
- (bonusAdditionalInfo == CAddInfo::NONE && defender->getCreature()->getId() == attacker->getCreature()->getId()))
|
|
|
+ if(defender->unitType()->getId() == bonusAdditionalInfo ||
|
|
|
+ (bonusAdditionalInfo == CAddInfo::NONE && defender->unitType()->getId() == attacker->unitType()->getId()))
|
|
|
return;
|
|
|
|
|
|
battle::UnitInfo resurrectInfo;
|
|
|
@@ -6421,7 +6421,7 @@ void CGameHandler::runBattle()
|
|
|
auto accessibility = getAccesibility();
|
|
|
CreatureID creatureData = CreatureID(summonInfo->subtype);
|
|
|
std::vector<BattleHex> targetHexes;
|
|
|
- const bool targetIsBig = stack->getCreature()->isDoubleWide(); //target = creature to guard
|
|
|
+ const bool targetIsBig = stack->unitType()->isDoubleWide(); //target = creature to guard
|
|
|
const bool guardianIsBig = creatureData.toCreature()->isDoubleWide();
|
|
|
|
|
|
/*Chosen idea for two hex units was to cover all possible surrounding hexes of target unit with as small number of stacks as possible.
|
|
|
@@ -6606,7 +6606,7 @@ void CGameHandler::runBattle()
|
|
|
}
|
|
|
|
|
|
const CGHeroInstance * curOwner = battleGetOwnerHero(next);
|
|
|
- const int stackCreatureId = next->getCreature()->getId();
|
|
|
+ const int stackCreatureId = next->unitType()->getId();
|
|
|
|
|
|
if ((stackCreatureId == CreatureID::ARROW_TOWERS || stackCreatureId == CreatureID::BALLISTA)
|
|
|
&& (!curOwner || getRandomGenerator().nextInt(99) >= curOwner->valOfBonuses(Bonus::MANUAL_CONTROL, stackCreatureId)))
|
|
|
@@ -6622,7 +6622,7 @@ void CGameHandler::runBattle()
|
|
|
|
|
|
for(auto & elem : gs->curB->stacks)
|
|
|
{
|
|
|
- if(elem->getCreature()->getId() != CreatureID::CATAPULT
|
|
|
+ if(elem->unitType()->getId() != CreatureID::CATAPULT
|
|
|
&& elem->owner != next->owner
|
|
|
&& elem->isValidTarget()
|
|
|
&& gs->curB->battleCanShoot(next, elem->getPosition()))
|
|
|
@@ -6644,7 +6644,7 @@ void CGameHandler::runBattle()
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
- if (next->getCreature()->getId() == CreatureID::CATAPULT)
|
|
|
+ if (next->unitType()->getId() == CreatureID::CATAPULT)
|
|
|
{
|
|
|
const auto & attackableBattleHexes = curB.getAttackableBattleHexes();
|
|
|
|
|
|
@@ -6666,7 +6666,7 @@ void CGameHandler::runBattle()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (next->getCreature()->getId() == CreatureID::FIRST_AID_TENT)
|
|
|
+ if (next->unitType()->getId() == CreatureID::FIRST_AID_TENT)
|
|
|
{
|
|
|
TStacks possibleStacks = battleGetStacksIf([=](const CStack * s)
|
|
|
{
|