1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-04-15 11:46:56 +02:00

Formatting

This commit is contained in:
Victor Luchits 2020-05-09 13:51:00 +03:00
parent be10694b73
commit 59c39527c5
3 changed files with 191 additions and 187 deletions

View File

@ -77,13 +77,13 @@ AttackPossibility AttackPossibility::evaluate(const BattleAttackInfo & attackInf
AttackPossibility bestAp(hex, BattleHex::INVALID, attackInfo);
std::vector<BattleHex> defenderHex;
if(attackInfo.shooting) {
if(attackInfo.shooting)
defenderHex = defender->getHexes();
} else {
else
defenderHex = CStack::meleeAttackHexes(attacker, defender, hex);
}
for(BattleHex defHex : defenderHex) {
for(BattleHex defHex : defenderHex)
{
if(defHex == hex) {
// should be impossible but check anyway
continue;
@ -157,7 +157,9 @@ AttackPossibility AttackPossibility::evaluate(const BattleAttackInfo & attackInf
ap.collateralDamage += damageDealt;
if(u->unitId() == defender->unitId() ||
(!attackInfo.shooting && CStack::isMeleeAttackPossible(u, attacker, hex))) { //FIXME: handle RANGED_RETALIATION ?
(!attackInfo.shooting && CStack::isMeleeAttackPossible(u, attacker, hex)))
{
//FIXME: handle RANGED_RETALIATION ?
ap.damageReceived += damageReceived;
}

View File

@ -164,11 +164,12 @@ BattleAction CBattleAI::activeStack( const CStack * stack )
return BattleAction::makeCreatureSpellcast(stack, bestSpellcast->dest, bestSpellcast->spell->id);
else if(bestAttack.attack.shooting)
return BattleAction::makeShotAttack(stack, bestAttack.attack.defender);
else {
else
{
auto &target = bestAttack;
logAi->debug("BattleAI: %s -> %s %d from, %d curpos %d dist %d speed %d: %d %d %d",
VLC->creh->creatures.at(target.attackerState->creatureId())->identifier.c_str(),
VLC->creh->creatures.at(target.affectedUnits[0]->creatureId())->identifier.c_str(),
VLC->creh->creatures.at(target.attackerState->creatureId())->identifier,
VLC->creh->creatures.at(target.affectedUnits[0]->creatureId())->identifier,
(int)target.affectedUnits.size(), (int)target.from, (int)bestAttack.attack.attacker->getPosition().hex,
(int)bestAttack.attack.chargedFields, (int)bestAttack.attack.attacker->Speed(0, true),
(int)target.damageDealt, (int)target.damageReceived, (int)target.attackValue()

View File

@ -69,7 +69,8 @@ PotentialTargets::PotentialTargets(const battle::Unit * attacker, const Hypothet
}
else
{
for(BattleHex hex : avHexes) {
for(BattleHex hex : avHexes)
{
if(!CStack::isMeleeAttackPossible(attackerInfo, defender, hex))
continue;