mirror of https://github.com/AxioDL/metaforce.git
CDamageVulnerability: Minor fixes
This commit is contained in:
parent
a85eebe496
commit
a994907dd4
|
@ -35,8 +35,9 @@ const CDamageVulnerability CDamageVulnerability::sPassThroughVulnerability(
|
|||
EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough, EDeflectType::None);
|
||||
|
||||
static constexpr bool is_deflect_direct(EVulnerability vuln) {
|
||||
return vuln == EVulnerability::Deflect || vuln == EVulnerability::DirectWeak ||
|
||||
vuln == EVulnerability::DirectNormal || vuln == EVulnerability::DirectImmune;
|
||||
return vuln == EVulnerability::Deflect ||
|
||||
(EVulnerability(u32(vuln) - u32(EVulnerability::DirectWeak)) < EVulnerability::Deflect) ||
|
||||
vuln == EVulnerability::DirectImmune;
|
||||
}
|
||||
|
||||
static constexpr bool is_normal_or_weak(EVulnerability vuln) {
|
||||
|
@ -176,26 +177,26 @@ bool CDamageVulnerability::WeaponHurts(const CWeaponMode& mode, bool ignoreDirec
|
|||
}
|
||||
|
||||
bool CDamageVulnerability::WeaponHits(const CWeaponMode& mode, bool checkDirect) const {
|
||||
if (mode.GetType() <= EWeaponType::None || mode.GetType() > EWeaponType::OrangePhazon) {
|
||||
if (mode.GetType() < EWeaponType::Power || mode.GetType() > EWeaponType::OrangePhazon) {
|
||||
return false;
|
||||
}
|
||||
if (mode.IsInstantKill()) {
|
||||
return true;
|
||||
}
|
||||
const auto normalVuln = x0_normal[u32(mode.GetType())];
|
||||
auto vuln = x0_normal[u32(mode.GetType())];
|
||||
bool normalHits = true;
|
||||
if (!checkDirect) {
|
||||
normalHits = is_not_deflect(normalVuln);
|
||||
} else if (is_deflect_direct(normalVuln)) {
|
||||
normalHits = is_not_deflect(vuln);
|
||||
} else if (is_deflect_direct(vuln)) {
|
||||
normalHits = false;
|
||||
}
|
||||
|
||||
bool chargedHits = true;
|
||||
if (mode.GetType() < EWeaponType::Bomb) {
|
||||
const auto chargedVuln = x3c_charged[u32(mode.GetType())];
|
||||
vuln = x3c_charged[u32(mode.GetType())];
|
||||
if (!checkDirect) {
|
||||
chargedHits = is_not_deflect(chargedVuln);
|
||||
} else if (is_deflect_direct(normalVuln)) {
|
||||
chargedHits = is_not_deflect(vuln);
|
||||
} else if (is_deflect_direct(vuln)) {
|
||||
chargedHits = false;
|
||||
} else {
|
||||
chargedHits = true;
|
||||
|
@ -204,10 +205,10 @@ bool CDamageVulnerability::WeaponHits(const CWeaponMode& mode, bool checkDirect)
|
|||
|
||||
bool comboedHits = true;
|
||||
if (mode.GetType() < EWeaponType::Bomb) {
|
||||
const auto chargedVuln = x3c_charged[u32(mode.GetType())];
|
||||
vuln = x4c_combo[u32(mode.GetType())];
|
||||
if (!checkDirect) {
|
||||
comboedHits = is_not_deflect(chargedVuln);
|
||||
} else if (is_deflect_direct(normalVuln)) {
|
||||
comboedHits = is_not_deflect(vuln);
|
||||
} else if (is_deflect_direct(vuln)) {
|
||||
comboedHits = false;
|
||||
} else {
|
||||
comboedHits = true;
|
||||
|
|
Loading…
Reference in New Issue