mirror of https://github.com/AxioDL/metaforce.git
CDamageVulnerability: Fix WeaponHits and WeaponHurts with near matching imps
This commit is contained in:
parent
8ac39d1712
commit
95b3859503
|
@ -109,125 +109,111 @@ EDeflectType CDamageVulnerability::GetDeflectionType(const CWeaponMode& mode) co
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CDamageVulnerability::WeaponHurts(const CWeaponMode& mode, bool ignoreDirect) const {
|
bool CDamageVulnerability::WeaponHurts(const CWeaponMode& mode, bool ignoreDirect) const {
|
||||||
if (mode.GetType() == EWeaponType::None || mode.GetType() > EWeaponType::OrangePhazon) {
|
EWeaponType weaponType = mode.GetType();
|
||||||
|
if (weaponType < EWeaponType::Power || weaponType > EWeaponType::OrangePhazon) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode.IsInstantKill()) {
|
if (mode.IsInstantKill()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool normalHurts = true;
|
EVulnerability vuln = x0_normal[u32(weaponType)];
|
||||||
const auto vuln = x0_normal[u32(mode.GetType())];
|
bool normalHurts = ignoreDirect == 0 ? (is_normal_or_weak(vuln) || vuln == EVulnerability::DirectWeak ||
|
||||||
if (!ignoreDirect) {
|
vuln == EVulnerability::DirectNormal)
|
||||||
bool directHurts = true;
|
: is_normal_or_weak(vuln);
|
||||||
if (!is_normal_or_weak(vuln) && vuln != EVulnerability::DirectWeak) {
|
|
||||||
directHurts = false;
|
bool chargedHurts;
|
||||||
}
|
if (weaponType < EWeaponType::Bomb) {
|
||||||
if (!directHurts && vuln != EVulnerability::DirectNormal) {
|
vuln = x3c_charged[u32(weaponType)];
|
||||||
normalHurts = false;
|
chargedHurts = ignoreDirect == 0 ? (is_normal_or_weak(vuln) || vuln == EVulnerability::DirectWeak ||
|
||||||
}
|
vuln == EVulnerability::DirectNormal)
|
||||||
} else if (!is_normal_or_weak(vuln)) {
|
: is_normal_or_weak(vuln);
|
||||||
normalHurts = false;
|
;
|
||||||
|
} else {
|
||||||
|
chargedHurts = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool chargedHurts = true;
|
bool comboedHurts;
|
||||||
if (mode.GetType() < EWeaponType::Bomb) {
|
if (weaponType < EWeaponType::Bomb) {
|
||||||
const auto chargedVuln = x3c_charged[u32(mode.GetType())];
|
vuln = x3c_charged[u32(weaponType)];
|
||||||
if (!ignoreDirect) {
|
comboedHurts = ignoreDirect == 0 ? (is_normal_or_weak(vuln) || vuln == EVulnerability::DirectWeak ||
|
||||||
bool directHurts = true;
|
vuln == EVulnerability::DirectNormal)
|
||||||
if (!is_normal_or_weak(chargedVuln) && chargedVuln != EVulnerability::DirectWeak) {
|
: is_normal_or_weak(vuln);
|
||||||
directHurts = false;
|
;
|
||||||
|
} else {
|
||||||
|
comboedHurts = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!directHurts && chargedVuln != EVulnerability::DirectNormal) {
|
bool result = false;
|
||||||
chargedHurts = false;
|
if ((normalHurts && !mode.IsCharged() && !mode.IsComboed()) || (chargedHurts && mode.IsCharged()) ||
|
||||||
}
|
(comboedHurts && mode.IsComboed())) {
|
||||||
} else if (!is_normal_or_weak(chargedVuln)) {
|
result = true;
|
||||||
chargedHurts = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool comboedHurts = true;
|
return result;
|
||||||
if (mode.GetType() < EWeaponType::Bomb) {
|
|
||||||
const auto comboedVuln = x4c_combo[u32(mode.GetType())];
|
|
||||||
if (!ignoreDirect) {
|
|
||||||
bool directHurts = true;
|
|
||||||
if (!is_normal_or_weak(comboedVuln) && comboedVuln != EVulnerability::DirectWeak) {
|
|
||||||
directHurts = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!directHurts && comboedVuln != EVulnerability::DirectNormal) {
|
|
||||||
comboedHurts = false;
|
|
||||||
}
|
|
||||||
} else if (!is_normal_or_weak(comboedVuln)) {
|
|
||||||
comboedHurts = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (((!normalHurts || mode.IsCharged()) || mode.IsComboed()) && (!chargedHurts || !mode.IsCharged())) {
|
|
||||||
if (!comboedHurts) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!mode.IsComboed()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CDamageVulnerability::WeaponHits(const CWeaponMode& mode, bool checkDirect) const {
|
bool CDamageVulnerability::WeaponHits(const CWeaponMode& mode, bool checkDirect) const {
|
||||||
if (mode.GetType() < EWeaponType::Power || mode.GetType() > EWeaponType::OrangePhazon) {
|
const EWeaponType weaponType = mode.GetType();
|
||||||
|
if (weaponType < EWeaponType::Power || weaponType > EWeaponType::OrangePhazon) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (mode.IsInstantKill()) {
|
if (mode.IsInstantKill()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
auto vuln = x0_normal[u32(mode.GetType())];
|
|
||||||
bool normalHits = true;
|
EVulnerability vuln = x0_normal[u32(weaponType)];
|
||||||
|
bool normalHits;
|
||||||
if (!checkDirect) {
|
if (!checkDirect) {
|
||||||
normalHits = is_not_deflect(vuln);
|
normalHits = is_not_deflect(vuln);
|
||||||
} else if (is_deflect_direct(vuln)) {
|
} else if (vuln == EVulnerability::Deflect ||
|
||||||
|
(static_cast<EVulnerability>((u32)vuln - (u32)EVulnerability::DirectWeak) <= EVulnerability::Normal) ||
|
||||||
|
vuln == EVulnerability::DirectImmune) {
|
||||||
normalHits = false;
|
normalHits = false;
|
||||||
|
} else {
|
||||||
|
normalHits = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool chargedHits = true;
|
bool chargedHits;
|
||||||
if (mode.GetType() < EWeaponType::Bomb) {
|
if (weaponType < EWeaponType::Bomb) {
|
||||||
vuln = x3c_charged[u32(mode.GetType())];
|
vuln = x3c_charged[u32(weaponType)];
|
||||||
if (!checkDirect) {
|
if (!checkDirect) {
|
||||||
chargedHits = is_not_deflect(vuln);
|
chargedHits = is_not_deflect(vuln);
|
||||||
} else if (is_deflect_direct(vuln)) {
|
} else if (vuln == EVulnerability::Deflect ||
|
||||||
|
(static_cast<EVulnerability>((u32)vuln - (u32)EVulnerability::DirectWeak) <= EVulnerability::Normal) ||
|
||||||
|
vuln == EVulnerability::DirectImmune) {
|
||||||
chargedHits = false;
|
chargedHits = false;
|
||||||
} else {
|
} else {
|
||||||
chargedHits = true;
|
chargedHits = true;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
chargedHits = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool comboedHits = true;
|
bool comboedHits;
|
||||||
if (mode.GetType() < EWeaponType::Bomb) {
|
if (weaponType < EWeaponType::Bomb) {
|
||||||
vuln = x4c_combo[u32(mode.GetType())];
|
vuln = x4c_combo[u32(weaponType)];
|
||||||
if (!checkDirect) {
|
if (!checkDirect) {
|
||||||
comboedHits = is_not_deflect(vuln);
|
comboedHits = is_not_deflect(vuln);
|
||||||
} else if (is_deflect_direct(vuln)) {
|
} else if (vuln == EVulnerability::Deflect ||
|
||||||
|
(static_cast<EVulnerability>((u32)vuln - (u32)EVulnerability::DirectWeak) <= EVulnerability::Normal ||
|
||||||
|
vuln == EVulnerability::DirectImmune)) {
|
||||||
comboedHits = false;
|
comboedHits = false;
|
||||||
} else {
|
} else {
|
||||||
comboedHits = true;
|
comboedHits = true;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
comboedHits = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (normalHits && !mode.IsCharged() && !mode.IsComboed()) {
|
bool result = false;
|
||||||
return true;
|
if ((normalHits && !mode.IsCharged() && !mode.IsComboed()) || (chargedHits && mode.IsCharged()) ||
|
||||||
|
(comboedHits && mode.IsComboed())) {
|
||||||
|
result = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!chargedHits || !mode.IsCharged()) {
|
return result;
|
||||||
if (!comboedHits) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!mode.IsComboed()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EVulnerability CDamageVulnerability::GetVulnerability(const CWeaponMode& mode, bool ignoreDirect) const {
|
EVulnerability CDamageVulnerability::GetVulnerability(const CWeaponMode& mode, bool ignoreDirect) const {
|
||||||
|
|
Loading…
Reference in New Issue