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);
|
EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough, EDeflectType::None);
|
||||||
|
|
||||||
static constexpr bool is_deflect_direct(EVulnerability vuln) {
|
static constexpr bool is_deflect_direct(EVulnerability vuln) {
|
||||||
return vuln == EVulnerability::Deflect || vuln == EVulnerability::DirectWeak ||
|
return vuln == EVulnerability::Deflect ||
|
||||||
vuln == EVulnerability::DirectNormal || vuln == EVulnerability::DirectImmune;
|
(EVulnerability(u32(vuln) - u32(EVulnerability::DirectWeak)) < EVulnerability::Deflect) ||
|
||||||
|
vuln == EVulnerability::DirectImmune;
|
||||||
}
|
}
|
||||||
|
|
||||||
static constexpr bool is_normal_or_weak(EVulnerability vuln) {
|
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 {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
if (mode.IsInstantKill()) {
|
if (mode.IsInstantKill()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
const auto normalVuln = x0_normal[u32(mode.GetType())];
|
auto vuln = x0_normal[u32(mode.GetType())];
|
||||||
bool normalHits = true;
|
bool normalHits = true;
|
||||||
if (!checkDirect) {
|
if (!checkDirect) {
|
||||||
normalHits = is_not_deflect(normalVuln);
|
normalHits = is_not_deflect(vuln);
|
||||||
} else if (is_deflect_direct(normalVuln)) {
|
} else if (is_deflect_direct(vuln)) {
|
||||||
normalHits = false;
|
normalHits = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool chargedHits = true;
|
bool chargedHits = true;
|
||||||
if (mode.GetType() < EWeaponType::Bomb) {
|
if (mode.GetType() < EWeaponType::Bomb) {
|
||||||
const auto chargedVuln = x3c_charged[u32(mode.GetType())];
|
vuln = x3c_charged[u32(mode.GetType())];
|
||||||
if (!checkDirect) {
|
if (!checkDirect) {
|
||||||
chargedHits = is_not_deflect(chargedVuln);
|
chargedHits = is_not_deflect(vuln);
|
||||||
} else if (is_deflect_direct(normalVuln)) {
|
} else if (is_deflect_direct(vuln)) {
|
||||||
chargedHits = false;
|
chargedHits = false;
|
||||||
} else {
|
} else {
|
||||||
chargedHits = true;
|
chargedHits = true;
|
||||||
|
@ -204,10 +205,10 @@ bool CDamageVulnerability::WeaponHits(const CWeaponMode& mode, bool checkDirect)
|
||||||
|
|
||||||
bool comboedHits = true;
|
bool comboedHits = true;
|
||||||
if (mode.GetType() < EWeaponType::Bomb) {
|
if (mode.GetType() < EWeaponType::Bomb) {
|
||||||
const auto chargedVuln = x3c_charged[u32(mode.GetType())];
|
vuln = x4c_combo[u32(mode.GetType())];
|
||||||
if (!checkDirect) {
|
if (!checkDirect) {
|
||||||
comboedHits = is_not_deflect(chargedVuln);
|
comboedHits = is_not_deflect(vuln);
|
||||||
} else if (is_deflect_direct(normalVuln)) {
|
} else if (is_deflect_direct(vuln)) {
|
||||||
comboedHits = false;
|
comboedHits = false;
|
||||||
} else {
|
} else {
|
||||||
comboedHits = true;
|
comboedHits = true;
|
||||||
|
|
Loading…
Reference in New Issue