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
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
namespace urde {
|
2016-05-20 09:17:51 +00:00
|
|
|
|
2017-01-27 02:58:21 +00:00
|
|
|
CDamageInfo::CDamageInfo(const DataSpec::SShotParam& other)
|
2017-09-05 03:00:19 +00:00
|
|
|
: x0_weaponMode(CWeaponMode(EWeaponType(other.weaponType), other.charged, other.combo, other.instaKill))
|
2017-01-27 02:58:21 +00:00
|
|
|
, x8_damage(other.damage)
|
|
|
|
, xc_radiusDamage(other.radiusDamage)
|
|
|
|
, x10_radius(other.radius)
|
|
|
|
, x14_knockback(other.knockback)
|
2018-12-08 05:30:43 +00:00
|
|
|
, x18_noImmunity(other.noImmunity) {}
|
|
|
|
|
|
|
|
CDamageInfo& CDamageInfo::operator=(const DataSpec::SShotParam& other) {
|
|
|
|
x0_weaponMode = CWeaponMode(EWeaponType(other.weaponType), other.charged, other.combo, other.instaKill);
|
|
|
|
x8_damage = other.damage;
|
|
|
|
xc_radiusDamage = other.radiusDamage;
|
|
|
|
x10_radius = other.radius;
|
|
|
|
x14_knockback = other.knockback;
|
|
|
|
x18_noImmunity = other.noImmunity;
|
|
|
|
return *this;
|
2016-05-20 09:17:51 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
float CDamageInfo::GetDamage(const CDamageVulnerability& dVuln) const {
|
|
|
|
EVulnerability vuln = dVuln.GetVulnerability(x0_weaponMode, false);
|
|
|
|
if (vuln == EVulnerability::Deflect)
|
|
|
|
return 0.f;
|
|
|
|
else if (vuln == EVulnerability::Weak)
|
|
|
|
return 2.f * x8_damage;
|
2017-02-10 05:43:07 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
return x8_damage;
|
2017-02-10 05:43:07 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
float CDamageInfo::GetRadiusDamage(const CDamageVulnerability& dVuln) const {
|
|
|
|
EVulnerability vuln = dVuln.GetVulnerability(x0_weaponMode, false);
|
|
|
|
if (vuln == EVulnerability::Deflect)
|
|
|
|
return 0.f;
|
|
|
|
else if (vuln == EVulnerability::Weak)
|
|
|
|
return 2.f * xc_radiusDamage;
|
2017-02-10 05:43:07 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
return xc_radiusDamage;
|
2017-02-10 05:43:07 +00:00
|
|
|
}
|
2018-11-14 04:16:11 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
CDamageInfo::CDamageInfo(const CDamageInfo& other, float dt) {
|
|
|
|
x0_weaponMode = other.x0_weaponMode;
|
|
|
|
x8_damage = other.x8_damage * (60.f * dt);
|
|
|
|
xc_radiusDamage = x8_damage;
|
|
|
|
x10_radius = other.x10_radius;
|
|
|
|
x14_knockback = other.x14_knockback;
|
|
|
|
x18_noImmunity = true;
|
2016-05-20 09:17:51 +00:00
|
|
|
}
|
2018-12-08 05:30:43 +00:00
|
|
|
} // namespace urde
|