mirror of
https://github.com/vcmi/vcmi.git
synced 2025-04-15 11:46:56 +02:00
Formatting
This commit is contained in:
parent
be10694b73
commit
59c39527c5
@ -77,13 +77,13 @@ AttackPossibility AttackPossibility::evaluate(const BattleAttackInfo & attackInf
|
|||||||
AttackPossibility bestAp(hex, BattleHex::INVALID, attackInfo);
|
AttackPossibility bestAp(hex, BattleHex::INVALID, attackInfo);
|
||||||
|
|
||||||
std::vector<BattleHex> defenderHex;
|
std::vector<BattleHex> defenderHex;
|
||||||
if(attackInfo.shooting) {
|
if(attackInfo.shooting)
|
||||||
defenderHex = defender->getHexes();
|
defenderHex = defender->getHexes();
|
||||||
} else {
|
else
|
||||||
defenderHex = CStack::meleeAttackHexes(attacker, defender, hex);
|
defenderHex = CStack::meleeAttackHexes(attacker, defender, hex);
|
||||||
}
|
|
||||||
|
|
||||||
for(BattleHex defHex : defenderHex) {
|
for(BattleHex defHex : defenderHex)
|
||||||
|
{
|
||||||
if(defHex == hex) {
|
if(defHex == hex) {
|
||||||
// should be impossible but check anyway
|
// should be impossible but check anyway
|
||||||
continue;
|
continue;
|
||||||
@ -157,7 +157,9 @@ AttackPossibility AttackPossibility::evaluate(const BattleAttackInfo & attackInf
|
|||||||
ap.collateralDamage += damageDealt;
|
ap.collateralDamage += damageDealt;
|
||||||
|
|
||||||
if(u->unitId() == defender->unitId() ||
|
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;
|
ap.damageReceived += damageReceived;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,11 +164,12 @@ BattleAction CBattleAI::activeStack( const CStack * stack )
|
|||||||
return BattleAction::makeCreatureSpellcast(stack, bestSpellcast->dest, bestSpellcast->spell->id);
|
return BattleAction::makeCreatureSpellcast(stack, bestSpellcast->dest, bestSpellcast->spell->id);
|
||||||
else if(bestAttack.attack.shooting)
|
else if(bestAttack.attack.shooting)
|
||||||
return BattleAction::makeShotAttack(stack, bestAttack.attack.defender);
|
return BattleAction::makeShotAttack(stack, bestAttack.attack.defender);
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
auto &target = bestAttack;
|
auto &target = bestAttack;
|
||||||
logAi->debug("BattleAI: %s -> %s %d from, %d curpos %d dist %d speed %d: %d %d %d",
|
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.attackerState->creatureId())->identifier,
|
||||||
VLC->creh->creatures.at(target.affectedUnits[0]->creatureId())->identifier.c_str(),
|
VLC->creh->creatures.at(target.affectedUnits[0]->creatureId())->identifier,
|
||||||
(int)target.affectedUnits.size(), (int)target.from, (int)bestAttack.attack.attacker->getPosition().hex,
|
(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)bestAttack.attack.chargedFields, (int)bestAttack.attack.attacker->Speed(0, true),
|
||||||
(int)target.damageDealt, (int)target.damageReceived, (int)target.attackValue()
|
(int)target.damageDealt, (int)target.damageReceived, (int)target.attackValue()
|
||||||
|
@ -69,7 +69,8 @@ PotentialTargets::PotentialTargets(const battle::Unit * attacker, const Hypothet
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for(BattleHex hex : avHexes) {
|
for(BattleHex hex : avHexes)
|
||||||
|
{
|
||||||
if(!CStack::isMeleeAttackPossible(attackerInfo, defender, hex))
|
if(!CStack::isMeleeAttackPossible(attackerInfo, defender, hex))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user