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-20 06:08:49 +02:00
|
|
|
#include "CUnitState.h"
|
2017-06-24 15:51:07 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
BattleAttackInfo::BattleAttackInfo(const battle::Unit * Attacker, const battle::Unit * Defender, bool Shooting)
|
|
|
|
: attacker(Attacker),
|
|
|
|
defender(Defender)
|
2017-06-24 15:51:07 +02:00
|
|
|
{
|
|
|
|
shooting = Shooting;
|
|
|
|
chargedFields = 0;
|
2017-07-20 06:08:49 +02:00
|
|
|
additiveBonus = 0.0;
|
|
|
|
multBonus = 1.0;
|
2019-06-28 20:05:25 +02:00
|
|
|
attackerPos = BattleHex::INVALID;
|
|
|
|
defenderPos = BattleHex::INVALID;
|
2017-06-24 15:51:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
BattleAttackInfo BattleAttackInfo::reverse() const
|
|
|
|
{
|
|
|
|
BattleAttackInfo ret = *this;
|
2017-07-20 06:08:49 +02:00
|
|
|
|
2017-06-24 15:51:07 +02:00
|
|
|
std::swap(ret.attacker, ret.defender);
|
2019-06-28 20:05:25 +02:00
|
|
|
std::swap(ret.defenderPos, ret.attackerPos);
|
2017-06-24 15:51:07 +02:00
|
|
|
|
|
|
|
ret.shooting = false;
|
|
|
|
ret.chargedFields = 0;
|
2017-07-20 06:08:49 +02:00
|
|
|
|
|
|
|
ret.additiveBonus = 0.0;
|
|
|
|
ret.multBonus = 1.0;
|
2017-06-24 15:51:07 +02:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|