2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-05-14 19:11:22 +00:00
metaforce/Runtime/World/CDamageInfo.cpp
Lioncash 221cc5c6b8 RuntimeCommonB: Normalize cpp file includes
Like the prior changes normalizing the inclusions within headers, this
tackles the cpp files of the RuntimeCommonB target, making these source
files consistent with their headers.
2019-12-22 18:12:04 -05:00

56 lines
1.7 KiB
C++

#include "Runtime/World/CDamageInfo.hpp"
#include "Runtime/World/CDamageVulnerability.hpp"
#include "DataSpec/DNACommon/Tweaks/ITweakPlayerGun.hpp"
namespace urde {
CDamageInfo::CDamageInfo(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) {}
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;
}
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;
return x8_damage;
}
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;
return xc_radiusDamage;
}
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;
}
} // namespace urde