mirror of https://github.com/AxioDL/metaforce.git
CDamageVulnerability: Fix WeaponHits
This commit is contained in:
parent
74d9bf4abc
commit
eddaa24b1e
|
@ -34,8 +34,9 @@ constexpr CDamageVulnerability CDamageVulnerability::sPassThroughVulnerability(
|
||||||
EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough,
|
EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough,
|
||||||
EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough, EDeflectType::None);
|
EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough, EDeflectType::None);
|
||||||
|
|
||||||
static constexpr bool is_not_immune(EVulnerability vuln) {
|
static constexpr bool is_not_deflect_direct(EVulnerability vuln) {
|
||||||
return vuln != EVulnerability::Immune && vuln != EVulnerability::DirectImmune;
|
return vuln != EVulnerability::Deflect && vuln != EVulnerability::DirectWeak &&
|
||||||
|
vuln != EVulnerability::DirectNormal && vuln != EVulnerability::DirectImmune;
|
||||||
}
|
}
|
||||||
|
|
||||||
static constexpr bool is_normal_or_weak(EVulnerability vuln) {
|
static constexpr bool is_normal_or_weak(EVulnerability vuln) {
|
||||||
|
@ -145,34 +146,40 @@ 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::None || mode.GetType() > EWeaponType::OrangePhazon) {
|
||||||
return false;
|
return false;
|
||||||
if (mode.IsInstantKill())
|
}
|
||||||
|
if (mode.IsInstantKill()) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool normalVuln;
|
bool normalVuln;
|
||||||
if (!checkDirect)
|
if (!checkDirect) {
|
||||||
normalVuln = (&x0_power)[u32(mode.GetType())] != EVulnerability::Immune;
|
normalVuln = (&x0_power)[u32(mode.GetType())] != EVulnerability::Deflect;
|
||||||
else
|
} else {
|
||||||
normalVuln = is_not_immune((&x0_power)[u32(mode.GetType())]);
|
normalVuln = is_not_deflect_direct((&x0_power)[u32(mode.GetType())]);
|
||||||
|
}
|
||||||
|
|
||||||
bool chargedVuln = true;
|
bool chargedVuln = true;
|
||||||
bool comboedVuln = true;
|
bool comboedVuln = true;
|
||||||
|
|
||||||
if (mode.GetType() < EWeaponType::Bomb) {
|
if (mode.GetType() < EWeaponType::Bomb) {
|
||||||
|
const EVulnerability chargedPowerVuln = (&x3c_chargedPower)[u32(mode.GetType())];
|
||||||
|
const EVulnerability superMissileVuln = (&x4c_superMissile)[u32(mode.GetType())];
|
||||||
if (!checkDirect) {
|
if (!checkDirect) {
|
||||||
chargedVuln = (&x3c_chargedPower)[u32(mode.GetType())] != EVulnerability::Immune;
|
chargedVuln = chargedPowerVuln != EVulnerability::Deflect;
|
||||||
comboedVuln = (&x4c_superMissile)[u32(mode.GetType())] != EVulnerability::Immune;
|
comboedVuln = superMissileVuln != EVulnerability::Deflect;
|
||||||
} else {
|
} else {
|
||||||
chargedVuln = is_not_immune((&x3c_chargedPower)[u32(mode.GetType())]);
|
chargedVuln = is_not_deflect_direct(chargedPowerVuln);
|
||||||
comboedVuln = is_not_immune((&x4c_superMissile)[u32(mode.GetType())]);
|
comboedVuln = is_not_deflect_direct(superMissileVuln);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (normalVuln && !mode.IsCharged() && !mode.IsComboed())
|
if (normalVuln && !mode.IsCharged() && !mode.IsComboed()) {
|
||||||
return true;
|
return true;
|
||||||
if (chargedVuln && mode.IsCharged())
|
}
|
||||||
|
if (chargedVuln && mode.IsCharged()) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
return comboedVuln && mode.IsComboed();
|
return comboedVuln && mode.IsComboed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue