2017-06-24 15:51:07 +02:00
|
|
|
/*
|
|
|
|
* BattleAttackInfo.cpp, part of VCMI engine
|
|
|
|
*
|
|
|
|
* Authors: listed in file AUTHORS in main folder
|
|
|
|
*
|
|
|
|
* License: GNU General Public License v2.0 or later
|
|
|
|
* Full text of license available in license.txt file, in main folder
|
|
|
|
*
|
|
|
|
*/
|
2017-07-01 20:05:10 +02:00
|
|
|
#include "StdInc.h"
|
2017-06-24 15:51:07 +02:00
|
|
|
#include "BattleAttackInfo.h"
|
|
|
|
|
|
|
|
|
2017-07-04 13:24:46 +02:00
|
|
|
BattleAttackInfo::BattleAttackInfo(const CStack * Attacker, const CStack * Defender, bool Shooting):
|
2017-07-08 20:20:38 +02:00
|
|
|
attackerHealth(Attacker->health), defenderHealth(Defender->health)
|
2017-06-24 15:51:07 +02:00
|
|
|
{
|
|
|
|
attacker = Attacker;
|
|
|
|
defender = Defender;
|
|
|
|
|
|
|
|
attackerBonuses = Attacker;
|
|
|
|
defenderBonuses = Defender;
|
|
|
|
|
|
|
|
attackerPosition = Attacker->position;
|
|
|
|
defenderPosition = Defender->position;
|
|
|
|
|
|
|
|
shooting = Shooting;
|
|
|
|
chargedFields = 0;
|
|
|
|
|
|
|
|
luckyHit = false;
|
|
|
|
unluckyHit = false;
|
|
|
|
deathBlow = false;
|
|
|
|
ballistaDoubleDamage = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
BattleAttackInfo BattleAttackInfo::reverse() const
|
|
|
|
{
|
|
|
|
BattleAttackInfo ret = *this;
|
|
|
|
std::swap(ret.attacker, ret.defender);
|
|
|
|
std::swap(ret.attackerBonuses, ret.defenderBonuses);
|
|
|
|
std::swap(ret.attackerPosition, ret.defenderPosition);
|
2017-07-04 13:24:46 +02:00
|
|
|
std::swap(ret.attackerHealth, ret.defenderHealth);
|
2017-06-24 15:51:07 +02:00
|
|
|
|
|
|
|
ret.shooting = false;
|
|
|
|
ret.chargedFields = 0;
|
|
|
|
ret.luckyHit = ret.ballistaDoubleDamage = ret.deathBlow = false;
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|