2016-05-20 09:17:51 +00:00
|
|
|
#include "CDamageInfo.hpp"
|
|
|
|
#include "CDamageVulnerability.hpp"
|
2017-01-27 02:58:21 +00:00
|
|
|
#include "DataSpec/DNACommon/Tweaks/ITweakPlayerGun.hpp"
|
2016-05-20 09:17:51 +00:00
|
|
|
|
|
|
|
namespace urde
|
|
|
|
{
|
|
|
|
|
2017-01-27 02:58:21 +00:00
|
|
|
CDamageInfo::CDamageInfo(const DataSpec::SShotParam& other)
|
|
|
|
: x0_weaponMode(CWeaponMode(EWeaponType(other.weaponType), other.Charged(), other.Comboed(), other.InstaKill()))
|
|
|
|
, x8_damage(other.damage)
|
|
|
|
, xc_radiusDamage(other.radiusDamage)
|
|
|
|
, x10_radius(other.radius)
|
|
|
|
, x14_knockback(other.knockback)
|
2016-05-20 09:17:51 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2017-01-27 02:58:21 +00:00
|
|
|
CDamageInfo& CDamageInfo::operator=(const DataSpec::SShotParam& other)
|
|
|
|
{
|
|
|
|
x0_weaponMode = CWeaponMode(EWeaponType(other.weaponType), other.Charged(), other.Comboed(), other.InstaKill());
|
|
|
|
x8_damage = other.damage;
|
|
|
|
xc_radiusDamage = x8_damage;
|
|
|
|
x10_radius = other.radius;
|
|
|
|
x14_knockback = other.knockback;
|
|
|
|
x18_ = false;
|
|
|
|
return *this;
|
|
|
|
}
|
2017-02-10 05:43:07 +00:00
|
|
|
|
2017-03-29 02:51:12 +00:00
|
|
|
float CDamageInfo::GetDamage(const CDamageVulnerability& dVuln) const
|
2017-02-10 05:43:07 +00:00
|
|
|
{
|
|
|
|
EVulnerability vuln = dVuln.GetVulnerability(x0_weaponMode, false);
|
|
|
|
if (vuln == EVulnerability::Reflect)
|
|
|
|
return 0.f;
|
|
|
|
else if (vuln == EVulnerability::DoubleDamage)
|
|
|
|
return 2.f * x8_damage;
|
|
|
|
|
|
|
|
return x8_damage;
|
|
|
|
}
|
|
|
|
|
2017-03-29 02:51:12 +00:00
|
|
|
float CDamageInfo::GetRadiusDamage(const CDamageVulnerability& dVuln) const
|
2017-02-10 05:43:07 +00:00
|
|
|
{
|
|
|
|
EVulnerability vuln = dVuln.GetVulnerability(x0_weaponMode, false);
|
|
|
|
if (vuln == EVulnerability::Reflect)
|
|
|
|
return 0.f;
|
|
|
|
else if (vuln == EVulnerability::DoubleDamage)
|
|
|
|
return 2.f * xc_radiusDamage;
|
|
|
|
|
|
|
|
return xc_radiusDamage;
|
|
|
|
}
|
|
|
|
|
2016-05-20 09:17:51 +00:00
|
|
|
}
|