From 86f241e21a5a1e89c9c8e5527406ab2878295c6e Mon Sep 17 00:00:00 2001 From: FlufflesTheMicrosaur Date: Tue, 24 Feb 2026 23:18:25 -0800 Subject: [PATCH 1/4] feat: 106405: improve physicalized damage API internally to be more clear (proper naming) and separate out SDamageMethodAdj struct to its different usecases. --- Mammoth/Include/TSEAdventureDesc.h | 70 ++++++++-------- Mammoth/Include/TSEArmor.h | 8 +- Mammoth/Include/TSEDeviceClassesImpl.h | 2 +- Mammoth/Include/TSEEngineDefs.h | 3 + Mammoth/Include/TSEShipSystems.h | 2 +- Mammoth/Include/TSEStationType.h | 2 +- Mammoth/Include/TSEUtil.h | 111 ++++++++++++++++++++++--- Mammoth/Include/TSEWeaponFireDesc.h | 2 +- Mammoth/TSE/CArmorClass.cpp | 4 +- Mammoth/TSE/CEngineOptions.cpp | 50 ++++++----- Mammoth/TSE/CShieldClass.cpp | 4 +- Mammoth/TSE/CShip.cpp | 18 ++-- Mammoth/TSE/CShipArmorDesc.cpp | 4 +- Mammoth/TSE/CShipArmorSegmentDesc.cpp | 4 +- Mammoth/TSE/CShipInteriorDesc.cpp | 2 +- Mammoth/TSE/CStationHullDesc.cpp | 12 +-- 16 files changed, 197 insertions(+), 101 deletions(-) diff --git a/Mammoth/Include/TSEAdventureDesc.h b/Mammoth/Include/TSEAdventureDesc.h index 9077baedc..8dfc456ae 100644 --- a/Mammoth/Include/TSEAdventureDesc.h +++ b/Mammoth/Include/TSEAdventureDesc.h @@ -19,23 +19,23 @@ class CEngineOptions const CDeviceDamageLevelDesc* GetExternalDeviceDamageMaxLevels () const { return &m_ExternalDeviceDamageMaxLevels; } const CDeviceDamageLevelDesc* GetInternalDeviceDamageMaxLevels () const { return &m_InternalDeviceDamageMaxLevels; } const CDamageMethodDesc* GetDamageMethodDesc (EDamageMethod iMethod) const; - Metric GetDamageMethodAdjItemArmor (EDamageMethod iMethod) const { return GetDamageMethodAdj(m_DamageMethodItemAdj.Armor, iMethod); }; - Metric GetDamageMethodAdjItemShield (EDamageMethod iMethod) const { return GetDamageMethodAdj(m_DamageMethodItemAdj.Shield, iMethod); }; - Metric GetDamageMethodAdjShipArmorCritical (EDamageMethod iMethod) const { return GetDamageMethodAdj(m_DamageMethodShipAdj.Armor.Critical, iMethod); }; - Metric GetDamageMethodAdjShipArmorCriticalUncrewed (EDamageMethod iMethod) const { return GetDamageMethodAdj(m_DamageMethodShipAdj.Armor.CriticalUncrewed, iMethod); }; - Metric GetDamageMethodAdjShipArmorNonCritical (EDamageMethod iMethod) const { return GetDamageMethodAdj(m_DamageMethodShipAdj.Armor.NonCritical, iMethod); }; - Metric GetDamageMethodAdjShipArmorNonCriticalDestruction (EDamageMethod iMethod) const { return GetDamageMethodAdj(m_DamageMethodShipAdj.Armor.NonCriticalDestruction, iMethod); }; - Metric GetDamageMethodAdjShipArmorNonCriticalDestructionChance () const { return m_DamageMethodShipAdj.Armor.rNonCriticalDestructionChance; }; - Metric GetDamageMethodAdjShipCompartmentGeneral (EDamageMethod iMethod) const { return GetDamageMethodAdj(m_DamageMethodShipAdj.Compartment.General, iMethod); }; - Metric GetDamageMethodAdjShipCompartmentMainDrive (EDamageMethod iMethod) const { return GetDamageMethodAdj(m_DamageMethodShipAdj.Compartment.MainDrive, iMethod); }; - Metric GetDamageMethodAdjShipCompartmentCargo (EDamageMethod iMethod) const { return GetDamageMethodAdj(m_DamageMethodShipAdj.Compartment.Cargo, iMethod); }; - Metric GetDamageMethodAdjShipCompartmentUncrewed (EDamageMethod iMethod) const { return GetDamageMethodAdj(m_DamageMethodShipAdj.Compartment.Uncrewed, iMethod); }; - Metric GetDamageMethodAdjStationHullSingle (EDamageMethod iMethod) const { return GetDamageMethodAdj(m_DamageMethodStationAdj.Hull.Single, iMethod); }; - Metric GetDamageMethodAdjStationHullMulti (EDamageMethod iMethod) const { return GetDamageMethodAdj(m_DamageMethodStationAdj.Hull.Multi, iMethod); }; - Metric GetDamageMethodAdjStationHullAsteroid (EDamageMethod iMethod) const { return GetDamageMethodAdj(m_DamageMethodStationAdj.Hull.Asteroid, iMethod); }; - Metric GetDamageMethodAdjStationHullUnderground (EDamageMethod iMethod) const { return GetDamageMethodAdj(m_DamageMethodStationAdj.Hull.Underground, iMethod); }; - Metric GetDamageMethodAdjStationHullUncrewed (EDamageMethod iMethod) const { return GetDamageMethodAdj(m_DamageMethodStationAdj.Hull.Uncrewed, iMethod); }; - Metric GetDamageMethodAdjStationHullArmor (EDamageMethod iMethod) const { return GetDamageMethodAdj(m_DamageMethodStationAdj.Hull.Armor, iMethod); }; + Metric GetDmgMethodFortificationItemArmor (EDamageMethod iMethod) const { return GetDamageMethodFortification(m_DamageMethodItemAdj.Armor, iMethod); }; + Metric GetDmgMethodFortificationItemShield (EDamageMethod iMethod) const { return GetDamageMethodFortification(m_DamageMethodItemAdj.Shield, iMethod); }; + Metric GetDmgMethodFortificationShipArmorCritical (EDamageMethod iMethod) const { return GetDamageMethodFortification(m_DamageMethodShipAdj.Armor.Critical, iMethod); }; + Metric GetDmgMethodFortificationShipArmorCriticalUncrewed (EDamageMethod iMethod) const { return GetDamageMethodFortification(m_DamageMethodShipAdj.Armor.CriticalUncrewed, iMethod); }; + Metric GetDmgMethodFortificationShipArmorNonCritical (EDamageMethod iMethod) const { return GetDamageMethodFortification(m_DamageMethodShipAdj.Armor.NonCritical, iMethod); }; + Metric GetDmgMethodFortificationShipArmorNonCriticalDestruction (EDamageMethod iMethod) const { return GetDamageMethodFortification(m_DamageMethodShipAdj.Armor.NonCriticalDestruction, iMethod); }; + Metric GetDmgMethodFortificationShipArmorNonCriticalDestructionChance () const { return m_DamageMethodShipAdj.Armor.rNonCriticalDestructionChance; }; + Metric GetDmgMethodFortificationShipCompartmentGeneral (EDamageMethod iMethod) const { return GetDamageMethodFortification(m_DamageMethodShipAdj.Compartment.General, iMethod); }; + Metric GetDmgMethodFortificationShipCompartmentMainDrive (EDamageMethod iMethod) const { return GetDamageMethodFortification(m_DamageMethodShipAdj.Compartment.MainDrive, iMethod); }; + Metric GetDmgMethodFortificationShipCompartmentCargo (EDamageMethod iMethod) const { return GetDamageMethodFortification(m_DamageMethodShipAdj.Compartment.Cargo, iMethod); }; + Metric GetDmgMethodFortificationShipCompartmentUncrewed (EDamageMethod iMethod) const { return GetDamageMethodFortification(m_DamageMethodShipAdj.Compartment.Uncrewed, iMethod); }; + Metric GetDmgMethodFortificationStationHullSingle (EDamageMethod iMethod) const { return GetDamageMethodFortification(m_DamageMethodStationAdj.Hull.Single, iMethod); }; + Metric GetDmgMethodFortificationStationHullMulti (EDamageMethod iMethod) const { return GetDamageMethodFortification(m_DamageMethodStationAdj.Hull.Multi, iMethod); }; + Metric GetDmgMethodFortificationStationHullAsteroid (EDamageMethod iMethod) const { return GetDamageMethodFortification(m_DamageMethodStationAdj.Hull.Asteroid, iMethod); }; + Metric GetDmgMethodFortificationStationHullUnderground (EDamageMethod iMethod) const { return GetDamageMethodFortification(m_DamageMethodStationAdj.Hull.Underground, iMethod); }; + Metric GetDmgMethodFortificationStationHullUncrewed (EDamageMethod iMethod) const { return GetDamageMethodFortification(m_DamageMethodStationAdj.Hull.Uncrewed, iMethod); }; + Metric GetDmgMethodFortificationStationHullArmor (EDamageMethod iMethod) const { return GetDamageMethodFortification(m_DamageMethodStationAdj.Hull.Armor, iMethod); }; Metric GetDamageMethodMinDamage () const { return m_rDamageMethodAdjMinDamage; } EDamageMethodSystem GetDamageMethodSystem () const { return m_iDamageMethodSystem; } Metric GetItemDefaultDensity () const { return m_rDefaultItemDensity; } @@ -60,26 +60,26 @@ class CEngineOptions struct SDamageMethodItemAdj { - SDamageMethodAdj Armor; - SDamageMethodAdj Shield; + SDamageMethodFortification Armor; + SDamageMethodFortification Shield; }; struct SDamageMethodShipAdj { struct SDamageMethodShipArmorAdj { - SDamageMethodAdj Critical; - SDamageMethodAdj CriticalUncrewed; - SDamageMethodAdj NonCritical; - SDamageMethodAdj NonCriticalDestruction; + SDamageMethodFortification Critical; + SDamageMethodFortification CriticalUncrewed; + SDamageMethodFortification NonCritical; + SDamageMethodFortification NonCriticalDestruction; Metric rNonCriticalDestructionChance = 0.05; }; struct SDamageMethodShipCompartmentAdj { - SDamageMethodAdj General; - SDamageMethodAdj MainDrive; - SDamageMethodAdj Cargo; - SDamageMethodAdj Uncrewed; + SDamageMethodFortification General; + SDamageMethodFortification MainDrive; + SDamageMethodFortification Cargo; + SDamageMethodFortification Uncrewed; }; SDamageMethodShipArmorAdj Armor; SDamageMethodShipCompartmentAdj Compartment; @@ -89,12 +89,12 @@ class CEngineOptions { struct SDamageMethodStationHullAdj { - SDamageMethodAdj Single; - SDamageMethodAdj Multi; - SDamageMethodAdj Asteroid; - SDamageMethodAdj Underground; - SDamageMethodAdj Uncrewed; - SDamageMethodAdj Armor; + SDamageMethodFortification Single; + SDamageMethodFortification Multi; + SDamageMethodFortification Asteroid; + SDamageMethodFortification Underground; + SDamageMethodFortification Uncrewed; + SDamageMethodFortification Armor; }; SDamageMethodStationHullAdj Hull; }; @@ -129,9 +129,9 @@ class CEngineOptions CDamageMethodDesc desc[3] = { CDamageMethodDesc(), CDamageMethodDesc(), CDamageMethodDesc()}; }; - Metric GetDamageMethodAdj (const SDamageMethodAdj &adj, EDamageMethod iMethod) const; + Metric GetDamageMethodFortification (const SDamageMethodFortification &adj, EDamageMethod iMethod) const; bool InitDamageAdjFromXML (SDesignLoadCtx &Ctx, const CXMLElement &XMLDesc, CDamageAdjDesc *DestTable); - bool InitDamageMethodAdjFromCC (SDesignLoadCtx& Ctx, SDamageMethodAdj& adj, ICCItem* pStruct); + bool InitDamageMethodFortificationFromCC (SDesignLoadCtx& Ctx, SDamageMethodFortification& adj, ICCItem* pStruct); void InitDefaultGlobals (); void InitDefaultDescs (); diff --git a/Mammoth/Include/TSEArmor.h b/Mammoth/Include/TSEArmor.h index 3bca61c4f..816091ca1 100644 --- a/Mammoth/Include/TSEArmor.h +++ b/Mammoth/Include/TSEArmor.h @@ -173,7 +173,7 @@ class CArmorClass DamageTypeSet m_Reflective; // Types of damage reflected CString m_sArmorClass; // Armor class (provided in xml or computed in bind) int m_iBalanceAdj; // Manual adjustment to balance calculation - SDamageMethodAdj m_Fortification; // Fortification Adj for Damage Method curves on this armor + SDamageMethodFortification m_Fortification; // Fortification Adj for Damage Method curves on this armor DWORD m_fPhotoRecharge:1; // TRUE if refuels when near a star DWORD m_fShieldInterference:1; // TRUE if armor interferes with shields @@ -222,7 +222,7 @@ class CShipArmorSegmentDesc DWORD dwArmorUNID, int iLevel, const CRandomEnhancementGenerator &Enhancement, - SDamageMethodAdj rFortification); + SDamageMethodFortification rFortification); ALERROR InitFromXML ( SDesignLoadCtx &Ctx, const CXMLElement &Desc, @@ -230,7 +230,7 @@ class CShipArmorSegmentDesc int iDefaultLevel, int iDefaultAngle, const CRandomEnhancementGenerator &DefaultEnhancement, - SDamageMethodAdj rDefaultFortification, + SDamageMethodFortification rDefaultFortification, int *retiSpan = NULL); static const CShipArmorSegmentDesc m_Null; @@ -244,7 +244,7 @@ class CShipArmorSegmentDesc int m_iLevel = 1; // For scalable armor CRandomEnhancementGenerator m_Enhanced;// Mods DWORD m_dwAreaSet = 0; // Areas that this section protects - SDamageMethodAdj m_Fortification; // Adjusts WMD adj curve from the WMD0 end + SDamageMethodFortification m_Fortification; // Adjusts WMD adj curve from the WMD0 end }; class CShipArmorDesc diff --git a/Mammoth/Include/TSEDeviceClassesImpl.h b/Mammoth/Include/TSEDeviceClassesImpl.h index 324e22ae1..c33b909b8 100644 --- a/Mammoth/Include/TSEDeviceClassesImpl.h +++ b/Mammoth/Include/TSEDeviceClassesImpl.h @@ -571,7 +571,7 @@ class CShieldClass : public CDeviceClass DamageTypeSet m_WeaponSuppress; // Types of weapons suppressed DamageTypeSet m_Reflective; // Types of damage reflected int m_iTimeBetweenFlashEffects; // Minimum time between flash effects in ticks - SDamageMethodAdj m_Fortification; // Fortification damage method curve adj + SDamageMethodFortification m_Fortification; // Fortification damage method curve adj int m_iExtraHPPerCharge; // Extra HP for each point of charge int m_iExtraPowerPerCharge; // Extra power use for each point of charge (1/10 megawatt) diff --git a/Mammoth/Include/TSEEngineDefs.h b/Mammoth/Include/TSEEngineDefs.h index a57f9f864..2ddf33276 100644 --- a/Mammoth/Include/TSEEngineDefs.h +++ b/Mammoth/Include/TSEEngineDefs.h @@ -319,6 +319,9 @@ #define KEY_CORE_DMG_METHOD_CRUSH CONSTLIT("crush") #define KEY_CORE_DMG_METHOD_PIERCE CONSTLIT("pierce") #define KEY_CORE_DMG_METHOD_SHRED CONSTLIT("shred") +#define KEY_CORE_DMG_METHOD_SCOUR CONSTLIT("scour") +#define KEY_CORE_DMG_METHOD_OVERWHELM CONSTLIT("overwhelm") +#define KEY_CORE_DMG_METHOD_DIRECT CONSTLIT("direct") // core.hide???Immune // diff --git a/Mammoth/Include/TSEShipSystems.h b/Mammoth/Include/TSEShipSystems.h index 6076fd94b..d59aaf71f 100644 --- a/Mammoth/Include/TSEShipSystems.h +++ b/Mammoth/Include/TSEShipSystems.h @@ -370,7 +370,7 @@ class CShipInteriorDesc TArray m_Compartments; TArray m_PaintOrder; - SDamageMethodAdj m_Fortification; // Adjusts WMD adj curve from the WMD0 end + SDamageMethodFortification m_Fortification; // Adjusts WMD adj curve from the WMD0 end DWORD m_fHasAttached:1; DWORD m_fIsMultiHull:1; diff --git a/Mammoth/Include/TSEStationType.h b/Mammoth/Include/TSEStationType.h index 74b982609..41ad647b7 100644 --- a/Mammoth/Include/TSEStationType.h +++ b/Mammoth/Include/TSEStationType.h @@ -54,7 +54,7 @@ class CStationHullDesc int m_iHitPoints = 0; // Hit points at creation time int m_iMaxHitPoints = 0; // Max hit points CRegenDesc m_Regen; // Repair rate - SDamageMethodAdj m_Fortification; // WMD damage adj curve at WMD0 + SDamageMethodFortification m_Fortification; // WMD damage adj curve at WMD0 int m_iStructuralHP = 0; // Initial structural hit points int m_iMaxStructuralHP = 0; // Max structural hp (0 = station is permanent) diff --git a/Mammoth/Include/TSEUtil.h b/Mammoth/Include/TSEUtil.h index 0b2fff456..f4751a33c 100644 --- a/Mammoth/Include/TSEUtil.h +++ b/Mammoth/Include/TSEUtil.h @@ -679,22 +679,53 @@ enum class EDamageMethod { methodError = -100, // Uninitialized or error state + // WMD methodWMD = 0, // original WMD - methodCrush = 1, // Physicalized: crush - methodPierce = 2, // Physicalized: pierce - methodShred = 3, // Physicalized: shred + + // Physicalized + methodCrush = 1, // analog of WMD+mining, defeats bulk solids + methodPierce = 2, // defeats heavy armor + methodShred = 3, // analog of WMD, defeats large ship/station internals + methodScour = 4, // analog of non-WMD, defeats small targets + methodOverwhelm = 5, // hard-to-resist type for things like core mind powers and superweapons + methodDirect = 6, // analog of generic damage, but for damage methods }; -constexpr BYTE PHYSICALIZED_DAMAGE_METHOD_COUNT = 3; -constexpr EDamageMethod PHYSICALIZED_DAMAGE_METHODS[3] = {EDamageMethod::methodCrush, EDamageMethod::methodPierce, EDamageMethod::methodShred}; +constexpr BYTE PHYSICALIZED_DAMAGE_METHOD_COUNT = 6; +constexpr EDamageMethod PHYSICALIZED_DAMAGE_METHODS[6] = { + EDamageMethod::methodCrush, + EDamageMethod::methodPierce, + EDamageMethod::methodShred, + EDamageMethod::methodScour, + EDamageMethod::methodOverwhelm, + EDamageMethod::methodDirect, + }; -struct SDamageMethodAdj +struct SDamageMethod { public: + // Flags for indicating type of data stored + static const DWORD FLAG_FORTIFICATION = 0x00000001; + static const DWORD FLAG_ADJ = 0x00000002; + static const DWORD FLAG_METHOD_RATIO = 0x00000004; Metric GetCrush () const { return rAdj[0]; } Metric GetPierce () const { return rAdj[1]; } Metric GetShred () const { return rAdj[2]; } + Metric GetScour () const { return rAdj[3]; } + Metric GetOverwhelm () const { return rAdj[4]; } + Metric GetDirect () const + { + switch (dwFlags & FLAGS_STRUCT_TYPE) + { + case FLAG_FORTIFICATION: + return 0.0; + case FLAG_ADJ: + return 1.0; + default: + return rAdj[5]; + } + } Metric GetWMD () const { return rAdj[0]; } Metric Get (EDamageMethod iMethod) const { @@ -703,22 +734,35 @@ struct SDamageMethodAdj case EDamageMethod::methodCrush: case EDamageMethod::methodWMD: return rAdj[0]; - break; case EDamageMethod::methodPierce: return rAdj[1]; - break; case EDamageMethod::methodShred: return rAdj[2]; - break; + case EDamageMethod::methodScour: + return rAdj[3]; + case EDamageMethod::methodOverwhelm: + return rAdj[4]; + case EDamageMethod::methodDirect: + return GetDirect(); default: ASSERT(false); return R_NAN; } } + // we use true : false because our output might get used + // in a bitwise operator. true sets all bits to 1. + + bool isFortification () { return dwFlags & FLAG_FORTIFICATION ? true : false; } + bool isAdj () { return dwFlags & FLAG_ADJ ? true : false; } + bool isMethodRatio () { return dwFlags & FLAG_METHOD_RATIO ? true : false; } + void SetCrush (Metric rNew) { rAdj[0] = rNew; } void SetPierce (Metric rNew) { rAdj[1] = rNew; } void SetShred (Metric rNew) { rAdj[2] = rNew; } + void SetScour (Metric rNew) { rAdj[3] = rNew; } + void SetOverwhelm (Metric rNew) { rAdj[4] = rNew; } + void SetDirect (Metric rNew) { if (dwFlags & FLAG_METHOD_RATIO) { rAdj[5] = rNew; } } void SetWMD (Metric rNew) { rAdj[0] = rNew; } void Set (EDamageMethod iMethod, Metric rNew) { @@ -734,21 +778,62 @@ struct SDamageMethodAdj case EDamageMethod::methodShred: rAdj[2] = rNew; break; + case EDamageMethod::methodScour: + rAdj[3] = rNew; + break; + case EDamageMethod::methodOverwhelm: + rAdj[4] = rNew; + break; + case EDamageMethod::methodDirect: + rAdj[5] = rNew; + break; default: ASSERT(false); } } + void SetFlag(DWORD dwFlag) + { + if (dwFlag & FLAGS_STRUCT_TYPE) + { + ASSERT(false); + return; + } + else + dwFlags |= dwFlag; + } void Reset () { - rAdj[0] = 0.0; - rAdj[1] = 0.0; - rAdj[2] = 0.0; + for (DWORD i = 0; i < NUM_METHODS; i++) + rAdj[i] = 0.0; } private: + static const DWORD NUM_METHODS = 6; + static const DWORD FLAGS_STRUCT_TYPE = 0x00000007; + + Metric rAdj[6] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }; + + // flags + DWORD dwFlags = 0x0; + }; + +struct SDamageMethodAdj :SDamageMethod + { + private: + DWORD dwFlags = FLAG_ADJ; + }; + +struct SDamageMethodFortification :SDamageMethod + { + private: + DWORD dwFlags = FLAG_FORTIFICATION; + }; - Metric rAdj[3] = { 0.0, 0.0, 0.0 }; +struct SDamageMethodRatio :SDamageMethod + { + private: + DWORD dwFlags = FLAG_METHOD_RATIO; }; enum class EDamageMethodTarget diff --git a/Mammoth/Include/TSEWeaponFireDesc.h b/Mammoth/Include/TSEWeaponFireDesc.h index 63e50c7f6..ab465aa41 100644 --- a/Mammoth/Include/TSEWeaponFireDesc.h +++ b/Mammoth/Include/TSEWeaponFireDesc.h @@ -416,7 +416,7 @@ struct SDamageCtx int iShieldDamage = 0; // Damage taken by shields int iOriginalAbsorb = 0; // Computed absorb value, if shot had not been reflected int iOriginalShieldDamage = 0; // Computed shield damage value, if shot had not been reflected - SDamageMethodAdj ArmorExternFortification; // External armor fortification (Ex, from a segment slot) + SDamageMethodFortification ArmorExternFortification; // External armor fortification (Ex, from a segment slot) int iArmorAbsorb = 0; // Damage absorbed by armor int iArmorDamage = 0; // Damage taken by armor diff --git a/Mammoth/TSE/CArmorClass.cpp b/Mammoth/TSE/CArmorClass.cpp index 91a447e3d..61aadc952 100644 --- a/Mammoth/TSE/CArmorClass.cpp +++ b/Mammoth/TSE/CArmorClass.cpp @@ -782,7 +782,7 @@ void CArmorClass::CalcAdjustedDamage (CItemCtx &ItemCtx, SDamageCtx &Ctx) // Stacked fortification modifiers are added together if (IS_NAN(m_Fortification.Get(iMethod))) - rMethodFortificationAdj += g_pUniverse->GetEngineOptions().GetDamageMethodAdjItemArmor(iMethod); + rMethodFortificationAdj += g_pUniverse->GetEngineOptions().GetDmgMethodFortificationItemArmor(iMethod); else rMethodFortificationAdj += m_Fortification.Get(iMethod); @@ -800,7 +800,7 @@ void CArmorClass::CalcAdjustedDamage (CItemCtx &ItemCtx, SDamageCtx &Ctx) // Stacked fortification modifiers are added together if (IS_NAN(m_Fortification.GetWMD())) - rFortificationAdj += g_pUniverse->GetEngineOptions().GetDamageMethodAdjItemArmor(iMethod); + rFortificationAdj += g_pUniverse->GetEngineOptions().GetDmgMethodFortificationItemArmor(iMethod); else rFortificationAdj += m_Fortification.GetWMD(); diff --git a/Mammoth/TSE/CEngineOptions.cpp b/Mammoth/TSE/CEngineOptions.cpp index 249aa619b..b49106356 100644 --- a/Mammoth/TSE/CEngineOptions.cpp +++ b/Mammoth/TSE/CEngineOptions.cpp @@ -572,14 +572,14 @@ bool CEngineOptions::InitDamageAdjFromXML (SDesignLoadCtx &Ctx, const CXMLElemen return true; } -// InitDamageMethodAdjFromCC +// InitDamageMethodFortificationFromCC // // Use an ICCItem loaded from an adventure property to initialize // Damage Method Adj // // Note: Requires adj to be pre-configured to the appropriate defaults // -bool CEngineOptions::InitDamageMethodAdjFromCC(SDesignLoadCtx& Ctx, SDamageMethodAdj& adj, ICCItem* pStruct) +bool CEngineOptions::InitDamageMethodFortificationFromCC(SDesignLoadCtx& Ctx, SDamageMethodFortification& adj, ICCItem* pStruct) { switch (m_iDamageMethodSystem) { @@ -588,6 +588,8 @@ bool CEngineOptions::InitDamageMethodAdjFromCC(SDesignLoadCtx& Ctx, SDamageMetho adj.SetCrush(max(pStruct->GetDoubleAt(KEY_CORE_DMG_METHOD_CRUSH, adj.GetCrush()), 0.0)); adj.SetPierce(max(pStruct->GetDoubleAt(KEY_CORE_DMG_METHOD_PIERCE, adj.GetPierce()), 0.0)); adj.SetShred(max(pStruct->GetDoubleAt(KEY_CORE_DMG_METHOD_SHRED, adj.GetShred()), 0.0)); + adj.SetScour(max(pStruct->GetDoubleAt(KEY_CORE_DMG_METHOD_SCOUR, adj.GetScour()), 0.0)); + adj.SetOverwhelm(max(pStruct->GetDoubleAt(KEY_CORE_DMG_METHOD_OVERWHELM, adj.GetOverwhelm()), 0.0)); return true; } case EDamageMethodSystem::dmgMethodSysWMD: @@ -822,7 +824,7 @@ CDamageMethodDesc CEngineOptions::GetDefaultWMDAdj (int apiVersion) return Desc; } -Metric CEngineOptions::GetDamageMethodAdj(const SDamageMethodAdj &adj, EDamageMethod iMethod) const +Metric CEngineOptions::GetDamageMethodFortification(const SDamageMethodFortification &adj, EDamageMethod iMethod) const { switch (m_iDamageMethodSystem) { @@ -836,10 +838,16 @@ Metric CEngineOptions::GetDamageMethodAdj(const SDamageMethodAdj &adj, EDamageMe return adj.GetPierce(); case EDamageMethod::methodShred: return adj.GetShred(); + case EDamageMethod::methodScour: + return adj.GetScour(); + case EDamageMethod::methodOverwhelm: + return adj.GetOverwhelm(); + case EDamageMethod::methodDirect: + return 0.0; default: { ASSERT(false); - return 1.0; + return 0.0; } } } @@ -945,7 +953,7 @@ bool CEngineOptions::InitFromProperties (SDesignLoadCtx &Ctx, const CDesignType } // We need to initialize the engine defaults for this damage method before loading up any custom - // adventure-level defaults, since InitDamageMethodAdjFromCC requires that the engine default + // adventure-level defaults, since InitDamageMethodFortificationFromCC requires that the engine default // is already loaded up InitDefaultDamageMethods(); @@ -968,14 +976,14 @@ bool CEngineOptions::InitFromProperties (SDesignLoadCtx &Ctx, const CDesignType ICCItem* pItmArmorStruct = pValue->GetElement(KEY_CORE_DMG_METHOD_ITEM_ARMOR); if (pItmArmorStruct) { - if (!InitDamageMethodAdjFromCC(Ctx, m_DamageMethodItemAdj.Armor, pItmArmorStruct)) + if (!InitDamageMethodFortificationFromCC(Ctx, m_DamageMethodItemAdj.Armor, pItmArmorStruct)) return false; } ICCItem* pItmShieldStruct = pValue->GetElement(KEY_CORE_DMG_METHOD_ITEM_SHIELD); if (pItmShieldStruct) { - if (!InitDamageMethodAdjFromCC(Ctx, m_DamageMethodItemAdj.Shield, pItmShieldStruct)) + if (!InitDamageMethodFortificationFromCC(Ctx, m_DamageMethodItemAdj.Shield, pItmShieldStruct)) return false; } @@ -988,28 +996,28 @@ bool CEngineOptions::InitFromProperties (SDesignLoadCtx &Ctx, const CDesignType ICCItem* pShipArmorCriticalStruct = pShipArmorStruct->GetElement(KEY_CORE_DMG_METHOD_SHIP_ARMOR_CRITICAL); if (pShipArmorCriticalStruct) { - if (!InitDamageMethodAdjFromCC(Ctx, m_DamageMethodShipAdj.Armor.Critical, pShipArmorCriticalStruct)) + if (!InitDamageMethodFortificationFromCC(Ctx, m_DamageMethodShipAdj.Armor.Critical, pShipArmorCriticalStruct)) return false; } ICCItem* pShipArmorCriticalUncrewedStruct = pShipArmorStruct->GetElement(KEY_CORE_DMG_METHOD_SHIP_ARMOR_CRITICAL_UNCREWED); if (pShipArmorCriticalUncrewedStruct) { - if (!InitDamageMethodAdjFromCC(Ctx, m_DamageMethodShipAdj.Armor.CriticalUncrewed, pShipArmorCriticalUncrewedStruct)) + if (!InitDamageMethodFortificationFromCC(Ctx, m_DamageMethodShipAdj.Armor.CriticalUncrewed, pShipArmorCriticalUncrewedStruct)) return false; } ICCItem* pShipArmorNonCriticalStruct = pShipArmorStruct->GetElement(KEY_CORE_DMG_METHOD_SHIP_ARMOR_NONCRITICAL); if (pShipArmorNonCriticalStruct) { - if (!InitDamageMethodAdjFromCC(Ctx, m_DamageMethodShipAdj.Armor.NonCritical, pShipArmorNonCriticalStruct)) + if (!InitDamageMethodFortificationFromCC(Ctx, m_DamageMethodShipAdj.Armor.NonCritical, pShipArmorNonCriticalStruct)) return false; } ICCItem* pShipArmorNonCriticalDestructionStruct = pShipArmorStruct->GetElement(KEY_CORE_DMG_METHOD_SHIP_ARMOR_NONCRITICAL_DESTRUCTION); if (pShipArmorNonCriticalDestructionStruct) { - if (!InitDamageMethodAdjFromCC(Ctx, m_DamageMethodShipAdj.Armor.NonCriticalDestruction, pShipArmorNonCriticalDestructionStruct)) + if (!InitDamageMethodFortificationFromCC(Ctx, m_DamageMethodShipAdj.Armor.NonCriticalDestruction, pShipArmorNonCriticalDestructionStruct)) return false; } @@ -1027,28 +1035,28 @@ bool CEngineOptions::InitFromProperties (SDesignLoadCtx &Ctx, const CDesignType ICCItem* pShipCompartmentGeneralStruct = pShipCompartmentStruct->GetElement(KEY_CORE_DMG_METHOD_SHIP_COMPARTMENT_GENERAL); if (pShipCompartmentGeneralStruct) { - if (!InitDamageMethodAdjFromCC(Ctx, m_DamageMethodShipAdj.Compartment.General, pShipCompartmentGeneralStruct)) + if (!InitDamageMethodFortificationFromCC(Ctx, m_DamageMethodShipAdj.Compartment.General, pShipCompartmentGeneralStruct)) return false; } ICCItem* pShipCompartmentCargoStruct = pShipCompartmentStruct->GetElement(KEY_CORE_DMG_METHOD_SHIP_COMPARTMENT_CARGO); if (pShipCompartmentCargoStruct) { - if (!InitDamageMethodAdjFromCC(Ctx, m_DamageMethodShipAdj.Compartment.Cargo, pShipCompartmentCargoStruct)) + if (!InitDamageMethodFortificationFromCC(Ctx, m_DamageMethodShipAdj.Compartment.Cargo, pShipCompartmentCargoStruct)) return false; } ICCItem* pShipCompartmentMainDriveStruct = pShipCompartmentStruct->GetElement(KEY_CORE_DMG_METHOD_SHIP_COMPARTMENT_MAIN_DRIVE); if (pShipCompartmentMainDriveStruct) { - if (!InitDamageMethodAdjFromCC(Ctx, m_DamageMethodShipAdj.Compartment.MainDrive, pShipCompartmentMainDriveStruct)) + if (!InitDamageMethodFortificationFromCC(Ctx, m_DamageMethodShipAdj.Compartment.MainDrive, pShipCompartmentMainDriveStruct)) return false; } ICCItem* pShipCompartmentUncrewedStruct = pShipCompartmentStruct->GetElement(KEY_CORE_DMG_METHOD_SHIP_COMPARTMENT_UNCREWED); if (pShipCompartmentUncrewedStruct) { - if (!InitDamageMethodAdjFromCC(Ctx, m_DamageMethodShipAdj.Compartment.Uncrewed, pShipCompartmentUncrewedStruct)) + if (!InitDamageMethodFortificationFromCC(Ctx, m_DamageMethodShipAdj.Compartment.Uncrewed, pShipCompartmentUncrewedStruct)) return false; } @@ -1061,42 +1069,42 @@ bool CEngineOptions::InitFromProperties (SDesignLoadCtx &Ctx, const CDesignType ICCItem* pStationHullSingleStruct = pStationHullStruct->GetElement(KEY_CORE_DMG_METHOD_STATION_HULL_SINGLE); if (pStationHullSingleStruct) { - if (!InitDamageMethodAdjFromCC(Ctx, m_DamageMethodStationAdj.Hull.Single, pStationHullSingleStruct)) + if (!InitDamageMethodFortificationFromCC(Ctx, m_DamageMethodStationAdj.Hull.Single, pStationHullSingleStruct)) return false; } ICCItem* pStationHullMultiStruct = pStationHullStruct->GetElement(KEY_CORE_DMG_METHOD_STATION_HULL_MULTI); if (pStationHullMultiStruct) { - if (!InitDamageMethodAdjFromCC(Ctx, m_DamageMethodStationAdj.Hull.Multi, pStationHullMultiStruct)) + if (!InitDamageMethodFortificationFromCC(Ctx, m_DamageMethodStationAdj.Hull.Multi, pStationHullMultiStruct)) return false; } ICCItem* pStationHullAsteroidStruct = pStationHullStruct->GetElement(KEY_CORE_DMG_METHOD_STATION_HULL_ASTEROID); if (pStationHullAsteroidStruct) { - if (!InitDamageMethodAdjFromCC(Ctx, m_DamageMethodStationAdj.Hull.Asteroid, pStationHullAsteroidStruct)) + if (!InitDamageMethodFortificationFromCC(Ctx, m_DamageMethodStationAdj.Hull.Asteroid, pStationHullAsteroidStruct)) return false; } ICCItem* pStationHullUndergroundStruct = pStationHullStruct->GetElement(KEY_CORE_DMG_METHOD_STATION_HULL_UNDERGROUND); if (pStationHullUndergroundStruct) { - if (!InitDamageMethodAdjFromCC(Ctx, m_DamageMethodStationAdj.Hull.Underground, pStationHullUndergroundStruct)) + if (!InitDamageMethodFortificationFromCC(Ctx, m_DamageMethodStationAdj.Hull.Underground, pStationHullUndergroundStruct)) return false; } ICCItem* pStationHullUncrewedStruct = pStationHullStruct->GetElement(KEY_CORE_DMG_METHOD_STATION_HULL_UNCREWED); if (pStationHullUncrewedStruct) { - if (!InitDamageMethodAdjFromCC(Ctx, m_DamageMethodStationAdj.Hull.Uncrewed, pStationHullUncrewedStruct)) + if (!InitDamageMethodFortificationFromCC(Ctx, m_DamageMethodStationAdj.Hull.Uncrewed, pStationHullUncrewedStruct)) return false; } ICCItem* pStationHullArmorStruct = pStationHullStruct->GetElement(KEY_CORE_DMG_METHOD_STATION_HULL_ARMOR); if (pStationHullArmorStruct) { - if (!InitDamageMethodAdjFromCC(Ctx, m_DamageMethodStationAdj.Hull.Armor, pStationHullArmorStruct)) + if (!InitDamageMethodFortificationFromCC(Ctx, m_DamageMethodStationAdj.Hull.Armor, pStationHullArmorStruct)) return false; } diff --git a/Mammoth/TSE/CShieldClass.cpp b/Mammoth/TSE/CShieldClass.cpp index 6f1c96988..a06afc110 100644 --- a/Mammoth/TSE/CShieldClass.cpp +++ b/Mammoth/TSE/CShieldClass.cpp @@ -177,7 +177,7 @@ bool CShieldClass::AbsorbDamage (CInstalledDevice *pDevice, CSpaceObject *pShip, // Stacked fortification modifiers are multiplied together if (IS_NAN(m_Fortification.Get(iMethod))) - rMethodFortificationAdj = g_pUniverse->GetEngineOptions().GetDamageMethodAdjItemArmor(iMethod); + rMethodFortificationAdj = g_pUniverse->GetEngineOptions().GetDmgMethodFortificationItemShield(iMethod); else rMethodFortificationAdj = m_Fortification.Get(iMethod); @@ -195,7 +195,7 @@ bool CShieldClass::AbsorbDamage (CInstalledDevice *pDevice, CSpaceObject *pShip, // Stacked fortification modifiers are multiplied together if (IS_NAN(m_Fortification.GetWMD())) - rFortificationAdj = g_pUniverse->GetEngineOptions().GetDamageMethodAdjItemArmor(iMethod); + rFortificationAdj = g_pUniverse->GetEngineOptions().GetDmgMethodFortificationItemShield(iMethod); else rFortificationAdj = m_Fortification.GetWMD(); diff --git a/Mammoth/TSE/CShip.cpp b/Mammoth/TSE/CShip.cpp index ede702a76..97c1e6cdb 100644 --- a/Mammoth/TSE/CShip.cpp +++ b/Mammoth/TSE/CShip.cpp @@ -4716,12 +4716,12 @@ EDamageResults CShip::OnDamage (SDamageCtx &Ctx) if (bTrueCriticalSegments && bSectMarkedCritical) { if (bUncrewedCompartment) - rExternFortify = g_pUniverse->GetEngineOptions().GetDamageMethodAdjShipArmorCriticalUncrewed(iMethod); + rExternFortify = g_pUniverse->GetEngineOptions().GetDmgMethodFortificationShipArmorCriticalUncrewed(iMethod); else - rExternFortify = g_pUniverse->GetEngineOptions().GetDamageMethodAdjShipArmorCritical(iMethod); + rExternFortify = g_pUniverse->GetEngineOptions().GetDmgMethodFortificationShipArmorCritical(iMethod); } else - rExternFortify = g_pUniverse->GetEngineOptions().GetDamageMethodAdjShipArmorNonCritical(iMethod); + rExternFortify = g_pUniverse->GetEngineOptions().GetDmgMethodFortificationShipArmorNonCritical(iMethod); } Ctx.ArmorExternFortification.Set(iMethod, rExternFortify); } @@ -4758,12 +4758,12 @@ EDamageResults CShip::OnDamage (SDamageCtx &Ctx) if (bTrueCriticalSegments && bSectMarkedCritical) { if (bUncrewedCompartment) - rExternFortify = g_pUniverse->GetEngineOptions().GetDamageMethodAdjShipArmorCriticalUncrewed(iMethod); + rExternFortify = g_pUniverse->GetEngineOptions().GetDmgMethodFortificationShipArmorCriticalUncrewed(iMethod); else - rExternFortify = g_pUniverse->GetEngineOptions().GetDamageMethodAdjShipArmorCritical(iMethod); + rExternFortify = g_pUniverse->GetEngineOptions().GetDmgMethodFortificationShipArmorCritical(iMethod); } else - rExternFortify = g_pUniverse->GetEngineOptions().GetDamageMethodAdjShipArmorNonCritical(iMethod); + rExternFortify = g_pUniverse->GetEngineOptions().GetDmgMethodFortificationShipArmorNonCritical(iMethod); } Ctx.ArmorExternFortification.SetWMD(rExternFortify); } @@ -4933,7 +4933,7 @@ EDamageResults CShip::OnDamage (SDamageCtx &Ctx) { EDamageMethodSystem iDmgSystem = g_pUniverse->GetEngineOptions().GetDamageMethodSystem(); EDamageMethod iMethod; - Metric rChanceToDie = g_pUniverse->GetEngineOptions().GetDamageMethodAdjShipArmorNonCriticalDestructionChance(); + Metric rChanceToDie = g_pUniverse->GetEngineOptions().GetDmgMethodFortificationShipArmorNonCriticalDestructionChance(); int iChanceOfDeath = mathRoundStochastic(rChanceToDie * 100); if (iDmgSystem == EDamageMethodSystem::dmgMethodSysPhysicalized) @@ -4944,7 +4944,7 @@ EDamageResults CShip::OnDamage (SDamageCtx &Ctx) { iMethod = PHYSICALIZED_DAMAGE_METHODS[i]; - Metric rNonCriticalAdjust = g_pUniverse->GetEngineOptions().GetDamageMethodAdjShipArmorNonCriticalDestruction(iMethod); + Metric rNonCriticalAdjust = g_pUniverse->GetEngineOptions().GetDmgMethodFortificationShipArmorNonCriticalDestruction(iMethod); rDamageMethodAdj *= Ctx.CalcDamageMethodFortifiedAdj(iMethod, rNonCriticalAdjust); } @@ -4973,7 +4973,7 @@ EDamageResults CShip::OnDamage (SDamageCtx &Ctx) // This is to preserve legacy balance until this system gets a // proper replacement - Metric rNonCriticalAdjust = g_pUniverse->GetEngineOptions().GetDamageMethodAdjShipArmorNonCriticalDestruction(iMethod); + Metric rNonCriticalAdjust = g_pUniverse->GetEngineOptions().GetDmgMethodFortificationShipArmorNonCriticalDestruction(iMethod); int iWMDDamage = Ctx.CalcDamageMethodAdjDamage(iMethod, rNonCriticalAdjust); diff --git a/Mammoth/TSE/CShipArmorDesc.cpp b/Mammoth/TSE/CShipArmorDesc.cpp index d68de2fbb..12f9a6256 100644 --- a/Mammoth/TSE/CShipArmorDesc.cpp +++ b/Mammoth/TSE/CShipArmorDesc.cpp @@ -202,7 +202,7 @@ ALERROR CShipArmorDesc::InitFromXML (SDesignLoadCtx &Ctx, CXMLElement *pDesc) if (error = SegEnhancement.InitFromXML(Ctx, pDesc)) return error; - SDamageMethodAdj DefaultFortifiedRatios; + SDamageMethodFortification DefaultFortifiedRatios; EDamageMethodSystem iDmgSystem = g_pUniverse->GetEngineOptions().GetDamageMethodSystem(); bool bHasWMDFortify = pDesc->FindAttribute(FORTIFICATION_WMD_ATTRIB); bool bHasPhysicalizedFortify = pDesc->FindAttribute(FORTIFICATION_CRUSH_ATTRIB) || pDesc->FindAttribute(FORTIFICATION_PIERCE_ATTRIB) || pDesc->FindAttribute(FORTIFICATION_SHRED_ATTRIB); @@ -283,7 +283,7 @@ ALERROR CShipArmorDesc::InitFromXML (SDesignLoadCtx &Ctx, CXMLElement *pDesc) if (error = DefaultEnhancement.InitFromXML(Ctx, pDesc)) return error; - SDamageMethodAdj DefaultFortifiedRatios; + SDamageMethodFortification DefaultFortifiedRatios; EDamageMethodSystem iDmgSystem = g_pUniverse->GetEngineOptions().GetDamageMethodSystem(); bool bHasWMDFortify = pDesc->FindAttribute(FORTIFICATION_WMD_ATTRIB); bool bHasPhysicalizedFortify = pDesc->FindAttribute(FORTIFICATION_CRUSH_ATTRIB) || pDesc->FindAttribute(FORTIFICATION_PIERCE_ATTRIB) || pDesc->FindAttribute(FORTIFICATION_SHRED_ATTRIB); diff --git a/Mammoth/TSE/CShipArmorSegmentDesc.cpp b/Mammoth/TSE/CShipArmorSegmentDesc.cpp index 62a9edcbc..b9a509669 100644 --- a/Mammoth/TSE/CShipArmorSegmentDesc.cpp +++ b/Mammoth/TSE/CShipArmorSegmentDesc.cpp @@ -139,7 +139,7 @@ ALERROR CShipArmorSegmentDesc::Init ( DWORD dwArmorUNID, int iLevel, const CRandomEnhancementGenerator &Enhancement, - SDamageMethodAdj Fortification) + SDamageMethodFortification Fortification) { m_iStartAt = AngleMod(iStartAt); @@ -164,7 +164,7 @@ ALERROR CShipArmorSegmentDesc::InitFromXML ( int iDefaultLevel, int iDefaultAngle, const CRandomEnhancementGenerator &DefaultEnhancement, - SDamageMethodAdj DefaultFortification, + SDamageMethodFortification DefaultFortification, int *retiSpan) { diff --git a/Mammoth/TSE/CShipInteriorDesc.cpp b/Mammoth/TSE/CShipInteriorDesc.cpp index 601739f38..7d847d897 100644 --- a/Mammoth/TSE/CShipInteriorDesc.cpp +++ b/Mammoth/TSE/CShipInteriorDesc.cpp @@ -316,7 +316,7 @@ const SCompartmentDesc& CShipInteriorDesc::GetDefaultCompartment() const Metric CShipInteriorDesc::GetFortificationAdj(EDamageMethod iMethod, ECompartmentTypes iCompartmentType) const { Metric rAdj = m_Fortification.Get(iMethod); - return IS_NAN(rAdj) ? g_pUniverse->GetEngineOptions().GetDamageMethodAdjShipCompartmentGeneral(iMethod) : rAdj; + return IS_NAN(rAdj) ? g_pUniverse->GetEngineOptions().GetDmgMethodFortificationShipCompartmentGeneral(iMethod) : rAdj; } int CShipInteriorDesc::GetHitPoints (void) const diff --git a/Mammoth/TSE/CStationHullDesc.cpp b/Mammoth/TSE/CStationHullDesc.cpp index 01987d1c3..7dd23c334 100644 --- a/Mammoth/TSE/CStationHullDesc.cpp +++ b/Mammoth/TSE/CStationHullDesc.cpp @@ -218,18 +218,18 @@ Metric CStationHullDesc::GetFortificationAdj(EDamageMethod iMethod) const switch (m_iType) { case EHullTypes::hullMultiple: - return Options.GetDamageMethodAdjStationHullMulti(iMethod); + return Options.GetDmgMethodFortificationStationHullMulti(iMethod); case EHullTypes::hullAsteroid: - return Options.GetDamageMethodAdjStationHullAsteroid(iMethod); + return Options.GetDmgMethodFortificationStationHullAsteroid(iMethod); case EHullTypes::hullUnderground: - return Options.GetDamageMethodAdjStationHullUnderground(iMethod); + return Options.GetDmgMethodFortificationStationHullUnderground(iMethod); case EHullTypes::hullArmor: - return Options.GetDamageMethodAdjStationHullArmor(iMethod); + return Options.GetDmgMethodFortificationStationHullArmor(iMethod); case EHullTypes::hullUncrewed: - return Options.GetDamageMethodAdjStationHullUncrewed(iMethod); + return Options.GetDmgMethodFortificationStationHullUncrewed(iMethod); case EHullTypes::hullSingle: default: - return Options.GetDamageMethodAdjStationHullSingle(iMethod); + return Options.GetDmgMethodFortificationStationHullSingle(iMethod); } } else From bdb25e5af35500cd5653b4fc226a39ea54e0863d Mon Sep 17 00:00:00 2001 From: FlufflesTheMicrosaur Date: Tue, 24 Feb 2026 23:38:28 -0800 Subject: [PATCH 2/4] chore: 106405: additional renames --- Mammoth/Include/TSEAdventureDesc.h | 40 ++++---- Mammoth/TSE/CEngineOptions.cpp | 154 ++++++++++++++--------------- 2 files changed, 97 insertions(+), 97 deletions(-) diff --git a/Mammoth/Include/TSEAdventureDesc.h b/Mammoth/Include/TSEAdventureDesc.h index 8dfc456ae..0a0fc698a 100644 --- a/Mammoth/Include/TSEAdventureDesc.h +++ b/Mammoth/Include/TSEAdventureDesc.h @@ -19,23 +19,23 @@ class CEngineOptions const CDeviceDamageLevelDesc* GetExternalDeviceDamageMaxLevels () const { return &m_ExternalDeviceDamageMaxLevels; } const CDeviceDamageLevelDesc* GetInternalDeviceDamageMaxLevels () const { return &m_InternalDeviceDamageMaxLevels; } const CDamageMethodDesc* GetDamageMethodDesc (EDamageMethod iMethod) const; - Metric GetDmgMethodFortificationItemArmor (EDamageMethod iMethod) const { return GetDamageMethodFortification(m_DamageMethodItemAdj.Armor, iMethod); }; - Metric GetDmgMethodFortificationItemShield (EDamageMethod iMethod) const { return GetDamageMethodFortification(m_DamageMethodItemAdj.Shield, iMethod); }; - Metric GetDmgMethodFortificationShipArmorCritical (EDamageMethod iMethod) const { return GetDamageMethodFortification(m_DamageMethodShipAdj.Armor.Critical, iMethod); }; - Metric GetDmgMethodFortificationShipArmorCriticalUncrewed (EDamageMethod iMethod) const { return GetDamageMethodFortification(m_DamageMethodShipAdj.Armor.CriticalUncrewed, iMethod); }; - Metric GetDmgMethodFortificationShipArmorNonCritical (EDamageMethod iMethod) const { return GetDamageMethodFortification(m_DamageMethodShipAdj.Armor.NonCritical, iMethod); }; - Metric GetDmgMethodFortificationShipArmorNonCriticalDestruction (EDamageMethod iMethod) const { return GetDamageMethodFortification(m_DamageMethodShipAdj.Armor.NonCriticalDestruction, iMethod); }; - Metric GetDmgMethodFortificationShipArmorNonCriticalDestructionChance () const { return m_DamageMethodShipAdj.Armor.rNonCriticalDestructionChance; }; - Metric GetDmgMethodFortificationShipCompartmentGeneral (EDamageMethod iMethod) const { return GetDamageMethodFortification(m_DamageMethodShipAdj.Compartment.General, iMethod); }; - Metric GetDmgMethodFortificationShipCompartmentMainDrive (EDamageMethod iMethod) const { return GetDamageMethodFortification(m_DamageMethodShipAdj.Compartment.MainDrive, iMethod); }; - Metric GetDmgMethodFortificationShipCompartmentCargo (EDamageMethod iMethod) const { return GetDamageMethodFortification(m_DamageMethodShipAdj.Compartment.Cargo, iMethod); }; - Metric GetDmgMethodFortificationShipCompartmentUncrewed (EDamageMethod iMethod) const { return GetDamageMethodFortification(m_DamageMethodShipAdj.Compartment.Uncrewed, iMethod); }; - Metric GetDmgMethodFortificationStationHullSingle (EDamageMethod iMethod) const { return GetDamageMethodFortification(m_DamageMethodStationAdj.Hull.Single, iMethod); }; - Metric GetDmgMethodFortificationStationHullMulti (EDamageMethod iMethod) const { return GetDamageMethodFortification(m_DamageMethodStationAdj.Hull.Multi, iMethod); }; - Metric GetDmgMethodFortificationStationHullAsteroid (EDamageMethod iMethod) const { return GetDamageMethodFortification(m_DamageMethodStationAdj.Hull.Asteroid, iMethod); }; - Metric GetDmgMethodFortificationStationHullUnderground (EDamageMethod iMethod) const { return GetDamageMethodFortification(m_DamageMethodStationAdj.Hull.Underground, iMethod); }; - Metric GetDmgMethodFortificationStationHullUncrewed (EDamageMethod iMethod) const { return GetDamageMethodFortification(m_DamageMethodStationAdj.Hull.Uncrewed, iMethod); }; - Metric GetDmgMethodFortificationStationHullArmor (EDamageMethod iMethod) const { return GetDamageMethodFortification(m_DamageMethodStationAdj.Hull.Armor, iMethod); }; + Metric GetDmgMethodFortificationItemArmor (EDamageMethod iMethod) const { return GetDamageMethodFortification(m_DmgMethodItemFortification.Armor, iMethod); }; + Metric GetDmgMethodFortificationItemShield (EDamageMethod iMethod) const { return GetDamageMethodFortification(m_DmgMethodItemFortification.Shield, iMethod); }; + Metric GetDmgMethodFortificationShipArmorCritical (EDamageMethod iMethod) const { return GetDamageMethodFortification(m_DmgMethodShipFortification.Armor.Critical, iMethod); }; + Metric GetDmgMethodFortificationShipArmorCriticalUncrewed (EDamageMethod iMethod) const { return GetDamageMethodFortification(m_DmgMethodShipFortification.Armor.CriticalUncrewed, iMethod); }; + Metric GetDmgMethodFortificationShipArmorNonCritical (EDamageMethod iMethod) const { return GetDamageMethodFortification(m_DmgMethodShipFortification.Armor.NonCritical, iMethod); }; + Metric GetDmgMethodFortificationShipArmorNonCriticalDestruction (EDamageMethod iMethod) const { return GetDamageMethodFortification(m_DmgMethodShipFortification.Armor.NonCriticalDestruction, iMethod); }; + Metric GetDmgMethodFortificationShipArmorNonCriticalDestructionChance () const { return m_DmgMethodShipFortification.Armor.rNonCriticalDestructionChance; }; + Metric GetDmgMethodFortificationShipCompartmentGeneral (EDamageMethod iMethod) const { return GetDamageMethodFortification(m_DmgMethodShipFortification.Compartment.General, iMethod); }; + Metric GetDmgMethodFortificationShipCompartmentMainDrive (EDamageMethod iMethod) const { return GetDamageMethodFortification(m_DmgMethodShipFortification.Compartment.MainDrive, iMethod); }; + Metric GetDmgMethodFortificationShipCompartmentCargo (EDamageMethod iMethod) const { return GetDamageMethodFortification(m_DmgMethodShipFortification.Compartment.Cargo, iMethod); }; + Metric GetDmgMethodFortificationShipCompartmentUncrewed (EDamageMethod iMethod) const { return GetDamageMethodFortification(m_DmgMethodShipFortification.Compartment.Uncrewed, iMethod); }; + Metric GetDmgMethodFortificationStationHullSingle (EDamageMethod iMethod) const { return GetDamageMethodFortification(m_DmgMethodStationFortification.Hull.Single, iMethod); }; + Metric GetDmgMethodFortificationStationHullMulti (EDamageMethod iMethod) const { return GetDamageMethodFortification(m_DmgMethodStationFortification.Hull.Multi, iMethod); }; + Metric GetDmgMethodFortificationStationHullAsteroid (EDamageMethod iMethod) const { return GetDamageMethodFortification(m_DmgMethodStationFortification.Hull.Asteroid, iMethod); }; + Metric GetDmgMethodFortificationStationHullUnderground (EDamageMethod iMethod) const { return GetDamageMethodFortification(m_DmgMethodStationFortification.Hull.Underground, iMethod); }; + Metric GetDmgMethodFortificationStationHullUncrewed (EDamageMethod iMethod) const { return GetDamageMethodFortification(m_DmgMethodStationFortification.Hull.Uncrewed, iMethod); }; + Metric GetDmgMethodFortificationStationHullArmor (EDamageMethod iMethod) const { return GetDamageMethodFortification(m_DmgMethodStationFortification.Hull.Armor, iMethod); }; Metric GetDamageMethodMinDamage () const { return m_rDamageMethodAdjMinDamage; } EDamageMethodSystem GetDamageMethodSystem () const { return m_iDamageMethodSystem; } Metric GetItemDefaultDensity () const { return m_rDefaultItemDensity; } @@ -189,9 +189,9 @@ class CEngineOptions double m_rDamageMethodAdjMinDamage = 0.0; - SDamageMethodItemAdj m_DamageMethodItemAdj; - SDamageMethodShipAdj m_DamageMethodShipAdj; - SDamageMethodStationAdj m_DamageMethodStationAdj; + SDamageMethodItemAdj m_DmgMethodItemFortification; + SDamageMethodShipAdj m_DmgMethodShipFortification; + SDamageMethodStationAdj m_DmgMethodStationFortification; // Default Item Stat Card UI diff --git a/Mammoth/TSE/CEngineOptions.cpp b/Mammoth/TSE/CEngineOptions.cpp index b49106356..1f677e2ca 100644 --- a/Mammoth/TSE/CEngineOptions.cpp +++ b/Mammoth/TSE/CEngineOptions.cpp @@ -398,84 +398,84 @@ void CEngineOptions::InitDefaultDamageMethods() { // Items - m_DamageMethodItemAdj.Armor.Reset(); - m_DamageMethodItemAdj.Shield.Reset(); + m_DmgMethodItemFortification.Armor.Reset(); + m_DmgMethodItemFortification.Shield.Reset(); // Ships - m_DamageMethodShipAdj.Armor.Critical.Reset(); - m_DamageMethodShipAdj.Armor.Critical.SetShred(1.0); - m_DamageMethodShipAdj.Armor.CriticalUncrewed.Reset(); - m_DamageMethodShipAdj.Armor.CriticalUncrewed.SetShred(1.0); - m_DamageMethodShipAdj.Armor.NonCritical.Reset(); - m_DamageMethodShipAdj.Armor.NonCritical.SetPierce(1.0); - m_DamageMethodShipAdj.Armor.NonCriticalDestruction.Reset(); - m_DamageMethodShipAdj.Armor.NonCriticalDestruction.SetShred(1.0); - m_DamageMethodShipAdj.Armor.rNonCriticalDestructionChance = 0.05; - - m_DamageMethodShipAdj.Compartment.General.Reset(); - m_DamageMethodShipAdj.Compartment.General.SetShred(1.0); - m_DamageMethodShipAdj.Compartment.Cargo.Reset(); - m_DamageMethodShipAdj.Compartment.Cargo.SetCrush(1.0); - m_DamageMethodShipAdj.Compartment.MainDrive.Reset(); - m_DamageMethodShipAdj.Compartment.MainDrive.SetShred(1.0); - m_DamageMethodShipAdj.Compartment.Uncrewed.Reset(); - m_DamageMethodShipAdj.Compartment.Uncrewed.SetCrush(1.0); + m_DmgMethodShipFortification.Armor.Critical.Reset(); + m_DmgMethodShipFortification.Armor.Critical.SetShred(1.0); + m_DmgMethodShipFortification.Armor.CriticalUncrewed.Reset(); + m_DmgMethodShipFortification.Armor.CriticalUncrewed.SetShred(1.0); + m_DmgMethodShipFortification.Armor.NonCritical.Reset(); + m_DmgMethodShipFortification.Armor.NonCritical.SetPierce(1.0); + m_DmgMethodShipFortification.Armor.NonCriticalDestruction.Reset(); + m_DmgMethodShipFortification.Armor.NonCriticalDestruction.SetShred(1.0); + m_DmgMethodShipFortification.Armor.rNonCriticalDestructionChance = 0.05; + + m_DmgMethodShipFortification.Compartment.General.Reset(); + m_DmgMethodShipFortification.Compartment.General.SetShred(1.0); + m_DmgMethodShipFortification.Compartment.Cargo.Reset(); + m_DmgMethodShipFortification.Compartment.Cargo.SetCrush(1.0); + m_DmgMethodShipFortification.Compartment.MainDrive.Reset(); + m_DmgMethodShipFortification.Compartment.MainDrive.SetShred(1.0); + m_DmgMethodShipFortification.Compartment.Uncrewed.Reset(); + m_DmgMethodShipFortification.Compartment.Uncrewed.SetCrush(1.0); // Stations - m_DamageMethodStationAdj.Hull.Armor.Reset(); - m_DamageMethodStationAdj.Hull.Armor.SetPierce(1.0); - m_DamageMethodStationAdj.Hull.Asteroid.Reset(); - m_DamageMethodStationAdj.Hull.Asteroid.SetCrush(1.0); - m_DamageMethodStationAdj.Hull.Multi.Reset(); - m_DamageMethodStationAdj.Hull.Multi.SetShred(1.0); - m_DamageMethodStationAdj.Hull.Single.Reset(); - m_DamageMethodStationAdj.Hull.Uncrewed.Reset(); - m_DamageMethodStationAdj.Hull.Uncrewed.SetCrush(1.0); - m_DamageMethodStationAdj.Hull.Underground.Reset(); - m_DamageMethodStationAdj.Hull.Underground.SetCrush(0.31); - m_DamageMethodStationAdj.Hull.Underground.SetPierce(0.31); + m_DmgMethodStationFortification.Hull.Armor.Reset(); + m_DmgMethodStationFortification.Hull.Armor.SetPierce(1.0); + m_DmgMethodStationFortification.Hull.Asteroid.Reset(); + m_DmgMethodStationFortification.Hull.Asteroid.SetCrush(1.0); + m_DmgMethodStationFortification.Hull.Multi.Reset(); + m_DmgMethodStationFortification.Hull.Multi.SetShred(1.0); + m_DmgMethodStationFortification.Hull.Single.Reset(); + m_DmgMethodStationFortification.Hull.Uncrewed.Reset(); + m_DmgMethodStationFortification.Hull.Uncrewed.SetCrush(1.0); + m_DmgMethodStationFortification.Hull.Underground.Reset(); + m_DmgMethodStationFortification.Hull.Underground.SetCrush(0.31); + m_DmgMethodStationFortification.Hull.Underground.SetPierce(0.31); break; } case EDamageMethodSystem::dmgMethodSysWMD: { // Items - m_DamageMethodItemAdj.Armor.Reset(); - m_DamageMethodItemAdj.Shield.Reset(); + m_DmgMethodItemFortification.Armor.Reset(); + m_DmgMethodItemFortification.Shield.Reset(); // Ships - m_DamageMethodShipAdj.Armor.Critical.Reset(); - m_DamageMethodShipAdj.Armor.CriticalUncrewed.Reset(); - m_DamageMethodShipAdj.Armor.NonCritical.Reset(); - m_DamageMethodShipAdj.Armor.NonCriticalDestruction.Reset(); - m_DamageMethodShipAdj.Armor.NonCriticalDestruction.SetWMD(1.0); - m_DamageMethodShipAdj.Armor.rNonCriticalDestructionChance = 0.05; - - m_DamageMethodShipAdj.Compartment.General.Reset(); - m_DamageMethodShipAdj.Compartment.General.SetWMD(1.0); - m_DamageMethodShipAdj.Compartment.Cargo.Reset(); - m_DamageMethodShipAdj.Compartment.Cargo.SetWMD(1.0); - m_DamageMethodShipAdj.Compartment.MainDrive.Reset(); - m_DamageMethodShipAdj.Compartment.MainDrive.SetWMD(1.0); - m_DamageMethodShipAdj.Compartment.Uncrewed.Reset(); - m_DamageMethodShipAdj.Compartment.Uncrewed.SetWMD(1.0); + m_DmgMethodShipFortification.Armor.Critical.Reset(); + m_DmgMethodShipFortification.Armor.CriticalUncrewed.Reset(); + m_DmgMethodShipFortification.Armor.NonCritical.Reset(); + m_DmgMethodShipFortification.Armor.NonCriticalDestruction.Reset(); + m_DmgMethodShipFortification.Armor.NonCriticalDestruction.SetWMD(1.0); + m_DmgMethodShipFortification.Armor.rNonCriticalDestructionChance = 0.05; + + m_DmgMethodShipFortification.Compartment.General.Reset(); + m_DmgMethodShipFortification.Compartment.General.SetWMD(1.0); + m_DmgMethodShipFortification.Compartment.Cargo.Reset(); + m_DmgMethodShipFortification.Compartment.Cargo.SetWMD(1.0); + m_DmgMethodShipFortification.Compartment.MainDrive.Reset(); + m_DmgMethodShipFortification.Compartment.MainDrive.SetWMD(1.0); + m_DmgMethodShipFortification.Compartment.Uncrewed.Reset(); + m_DmgMethodShipFortification.Compartment.Uncrewed.SetWMD(1.0); // Stations - m_DamageMethodStationAdj.Hull.Armor.Reset(); - m_DamageMethodStationAdj.Hull.Armor.SetWMD(1.0); - m_DamageMethodStationAdj.Hull.Asteroid.Reset(); - m_DamageMethodStationAdj.Hull.Asteroid.SetWMD(1.0); - m_DamageMethodStationAdj.Hull.Multi.Reset(); - m_DamageMethodStationAdj.Hull.Multi.SetWMD(1.0); - m_DamageMethodStationAdj.Hull.Single.Reset(); - m_DamageMethodStationAdj.Hull.Uncrewed.Reset(); - m_DamageMethodStationAdj.Hull.Uncrewed.SetWMD(1.0); - m_DamageMethodStationAdj.Hull.Underground.Reset(); - m_DamageMethodStationAdj.Hull.Underground.SetWMD(1.0); + m_DmgMethodStationFortification.Hull.Armor.Reset(); + m_DmgMethodStationFortification.Hull.Armor.SetWMD(1.0); + m_DmgMethodStationFortification.Hull.Asteroid.Reset(); + m_DmgMethodStationFortification.Hull.Asteroid.SetWMD(1.0); + m_DmgMethodStationFortification.Hull.Multi.Reset(); + m_DmgMethodStationFortification.Hull.Multi.SetWMD(1.0); + m_DmgMethodStationFortification.Hull.Single.Reset(); + m_DmgMethodStationFortification.Hull.Uncrewed.Reset(); + m_DmgMethodStationFortification.Hull.Uncrewed.SetWMD(1.0); + m_DmgMethodStationFortification.Hull.Underground.Reset(); + m_DmgMethodStationFortification.Hull.Underground.SetWMD(1.0); break; } default: @@ -976,14 +976,14 @@ bool CEngineOptions::InitFromProperties (SDesignLoadCtx &Ctx, const CDesignType ICCItem* pItmArmorStruct = pValue->GetElement(KEY_CORE_DMG_METHOD_ITEM_ARMOR); if (pItmArmorStruct) { - if (!InitDamageMethodFortificationFromCC(Ctx, m_DamageMethodItemAdj.Armor, pItmArmorStruct)) + if (!InitDamageMethodFortificationFromCC(Ctx, m_DmgMethodItemFortification.Armor, pItmArmorStruct)) return false; } ICCItem* pItmShieldStruct = pValue->GetElement(KEY_CORE_DMG_METHOD_ITEM_SHIELD); if (pItmShieldStruct) { - if (!InitDamageMethodFortificationFromCC(Ctx, m_DamageMethodItemAdj.Shield, pItmShieldStruct)) + if (!InitDamageMethodFortificationFromCC(Ctx, m_DmgMethodItemFortification.Shield, pItmShieldStruct)) return false; } @@ -996,35 +996,35 @@ bool CEngineOptions::InitFromProperties (SDesignLoadCtx &Ctx, const CDesignType ICCItem* pShipArmorCriticalStruct = pShipArmorStruct->GetElement(KEY_CORE_DMG_METHOD_SHIP_ARMOR_CRITICAL); if (pShipArmorCriticalStruct) { - if (!InitDamageMethodFortificationFromCC(Ctx, m_DamageMethodShipAdj.Armor.Critical, pShipArmorCriticalStruct)) + if (!InitDamageMethodFortificationFromCC(Ctx, m_DmgMethodShipFortification.Armor.Critical, pShipArmorCriticalStruct)) return false; } ICCItem* pShipArmorCriticalUncrewedStruct = pShipArmorStruct->GetElement(KEY_CORE_DMG_METHOD_SHIP_ARMOR_CRITICAL_UNCREWED); if (pShipArmorCriticalUncrewedStruct) { - if (!InitDamageMethodFortificationFromCC(Ctx, m_DamageMethodShipAdj.Armor.CriticalUncrewed, pShipArmorCriticalUncrewedStruct)) + if (!InitDamageMethodFortificationFromCC(Ctx, m_DmgMethodShipFortification.Armor.CriticalUncrewed, pShipArmorCriticalUncrewedStruct)) return false; } ICCItem* pShipArmorNonCriticalStruct = pShipArmorStruct->GetElement(KEY_CORE_DMG_METHOD_SHIP_ARMOR_NONCRITICAL); if (pShipArmorNonCriticalStruct) { - if (!InitDamageMethodFortificationFromCC(Ctx, m_DamageMethodShipAdj.Armor.NonCritical, pShipArmorNonCriticalStruct)) + if (!InitDamageMethodFortificationFromCC(Ctx, m_DmgMethodShipFortification.Armor.NonCritical, pShipArmorNonCriticalStruct)) return false; } ICCItem* pShipArmorNonCriticalDestructionStruct = pShipArmorStruct->GetElement(KEY_CORE_DMG_METHOD_SHIP_ARMOR_NONCRITICAL_DESTRUCTION); if (pShipArmorNonCriticalDestructionStruct) { - if (!InitDamageMethodFortificationFromCC(Ctx, m_DamageMethodShipAdj.Armor.NonCriticalDestruction, pShipArmorNonCriticalDestructionStruct)) + if (!InitDamageMethodFortificationFromCC(Ctx, m_DmgMethodShipFortification.Armor.NonCriticalDestruction, pShipArmorNonCriticalDestructionStruct)) return false; } ICCItem* pShipArmorNonCriticalDestructionChanceStruct = pShipArmorStruct->GetElement(KEY_CORE_DMG_METHOD_SHIP_ARMOR_NONCRITICAL_DESTRUCTION_CHANCE); if (pShipArmorNonCriticalDestructionChanceStruct) { - m_DamageMethodShipAdj.Armor.rNonCriticalDestructionChance = pShipArmorNonCriticalDestructionChanceStruct->GetDoubleAt(KEY_CORE_DMG_METHOD_SHIP_ARMOR_NONCRITICAL_DESTRUCTION_CHANCE, 0.05); + m_DmgMethodShipFortification.Armor.rNonCriticalDestructionChance = pShipArmorNonCriticalDestructionChanceStruct->GetDoubleAt(KEY_CORE_DMG_METHOD_SHIP_ARMOR_NONCRITICAL_DESTRUCTION_CHANCE, 0.05); } ICCItem* pShipCompartmentStruct = pValue->GetElement(KEY_CORE_DMG_METHOD_SHIP_COMPARTMENT); @@ -1035,28 +1035,28 @@ bool CEngineOptions::InitFromProperties (SDesignLoadCtx &Ctx, const CDesignType ICCItem* pShipCompartmentGeneralStruct = pShipCompartmentStruct->GetElement(KEY_CORE_DMG_METHOD_SHIP_COMPARTMENT_GENERAL); if (pShipCompartmentGeneralStruct) { - if (!InitDamageMethodFortificationFromCC(Ctx, m_DamageMethodShipAdj.Compartment.General, pShipCompartmentGeneralStruct)) + if (!InitDamageMethodFortificationFromCC(Ctx, m_DmgMethodShipFortification.Compartment.General, pShipCompartmentGeneralStruct)) return false; } ICCItem* pShipCompartmentCargoStruct = pShipCompartmentStruct->GetElement(KEY_CORE_DMG_METHOD_SHIP_COMPARTMENT_CARGO); if (pShipCompartmentCargoStruct) { - if (!InitDamageMethodFortificationFromCC(Ctx, m_DamageMethodShipAdj.Compartment.Cargo, pShipCompartmentCargoStruct)) + if (!InitDamageMethodFortificationFromCC(Ctx, m_DmgMethodShipFortification.Compartment.Cargo, pShipCompartmentCargoStruct)) return false; } ICCItem* pShipCompartmentMainDriveStruct = pShipCompartmentStruct->GetElement(KEY_CORE_DMG_METHOD_SHIP_COMPARTMENT_MAIN_DRIVE); if (pShipCompartmentMainDriveStruct) { - if (!InitDamageMethodFortificationFromCC(Ctx, m_DamageMethodShipAdj.Compartment.MainDrive, pShipCompartmentMainDriveStruct)) + if (!InitDamageMethodFortificationFromCC(Ctx, m_DmgMethodShipFortification.Compartment.MainDrive, pShipCompartmentMainDriveStruct)) return false; } ICCItem* pShipCompartmentUncrewedStruct = pShipCompartmentStruct->GetElement(KEY_CORE_DMG_METHOD_SHIP_COMPARTMENT_UNCREWED); if (pShipCompartmentUncrewedStruct) { - if (!InitDamageMethodFortificationFromCC(Ctx, m_DamageMethodShipAdj.Compartment.Uncrewed, pShipCompartmentUncrewedStruct)) + if (!InitDamageMethodFortificationFromCC(Ctx, m_DmgMethodShipFortification.Compartment.Uncrewed, pShipCompartmentUncrewedStruct)) return false; } @@ -1069,42 +1069,42 @@ bool CEngineOptions::InitFromProperties (SDesignLoadCtx &Ctx, const CDesignType ICCItem* pStationHullSingleStruct = pStationHullStruct->GetElement(KEY_CORE_DMG_METHOD_STATION_HULL_SINGLE); if (pStationHullSingleStruct) { - if (!InitDamageMethodFortificationFromCC(Ctx, m_DamageMethodStationAdj.Hull.Single, pStationHullSingleStruct)) + if (!InitDamageMethodFortificationFromCC(Ctx, m_DmgMethodStationFortification.Hull.Single, pStationHullSingleStruct)) return false; } ICCItem* pStationHullMultiStruct = pStationHullStruct->GetElement(KEY_CORE_DMG_METHOD_STATION_HULL_MULTI); if (pStationHullMultiStruct) { - if (!InitDamageMethodFortificationFromCC(Ctx, m_DamageMethodStationAdj.Hull.Multi, pStationHullMultiStruct)) + if (!InitDamageMethodFortificationFromCC(Ctx, m_DmgMethodStationFortification.Hull.Multi, pStationHullMultiStruct)) return false; } ICCItem* pStationHullAsteroidStruct = pStationHullStruct->GetElement(KEY_CORE_DMG_METHOD_STATION_HULL_ASTEROID); if (pStationHullAsteroidStruct) { - if (!InitDamageMethodFortificationFromCC(Ctx, m_DamageMethodStationAdj.Hull.Asteroid, pStationHullAsteroidStruct)) + if (!InitDamageMethodFortificationFromCC(Ctx, m_DmgMethodStationFortification.Hull.Asteroid, pStationHullAsteroidStruct)) return false; } ICCItem* pStationHullUndergroundStruct = pStationHullStruct->GetElement(KEY_CORE_DMG_METHOD_STATION_HULL_UNDERGROUND); if (pStationHullUndergroundStruct) { - if (!InitDamageMethodFortificationFromCC(Ctx, m_DamageMethodStationAdj.Hull.Underground, pStationHullUndergroundStruct)) + if (!InitDamageMethodFortificationFromCC(Ctx, m_DmgMethodStationFortification.Hull.Underground, pStationHullUndergroundStruct)) return false; } ICCItem* pStationHullUncrewedStruct = pStationHullStruct->GetElement(KEY_CORE_DMG_METHOD_STATION_HULL_UNCREWED); if (pStationHullUncrewedStruct) { - if (!InitDamageMethodFortificationFromCC(Ctx, m_DamageMethodStationAdj.Hull.Uncrewed, pStationHullUncrewedStruct)) + if (!InitDamageMethodFortificationFromCC(Ctx, m_DmgMethodStationFortification.Hull.Uncrewed, pStationHullUncrewedStruct)) return false; } ICCItem* pStationHullArmorStruct = pStationHullStruct->GetElement(KEY_CORE_DMG_METHOD_STATION_HULL_ARMOR); if (pStationHullArmorStruct) { - if (!InitDamageMethodFortificationFromCC(Ctx, m_DamageMethodStationAdj.Hull.Armor, pStationHullArmorStruct)) + if (!InitDamageMethodFortificationFromCC(Ctx, m_DmgMethodStationFortification.Hull.Armor, pStationHullArmorStruct)) return false; } From a2bca25635e925c4397c5fd72b38919ad3fd3514 Mon Sep 17 00:00:00 2001 From: FlufflesTheMicrosaur Date: Wed, 25 Feb 2026 00:39:26 -0800 Subject: [PATCH 3/4] feat: 106405: initial code to support fortification for armor classes --- Mammoth/Include/TSEItemDefs.h | 4 ++++ Mammoth/TSE/CArmorClassDefinitions.cpp | 1 + 2 files changed, 5 insertions(+) diff --git a/Mammoth/Include/TSEItemDefs.h b/Mammoth/Include/TSEItemDefs.h index 4b2a3779a..bd814a09f 100644 --- a/Mammoth/Include/TSEItemDefs.h +++ b/Mammoth/Include/TSEItemDefs.h @@ -350,6 +350,10 @@ class CArmorClassDefinitions CString sText; // Text to display on item CString sTextShort; // Text to display in size-constrained UIs + // Sizeclass stats + SDamageMethodFortification Fortification; // Size bonus from fortification + + // Cached values int iCount = 0; // Number of armor types for this class }; diff --git a/Mammoth/TSE/CArmorClassDefinitions.cpp b/Mammoth/TSE/CArmorClassDefinitions.cpp index 40428140c..e954c9cc0 100644 --- a/Mammoth/TSE/CArmorClassDefinitions.cpp +++ b/Mammoth/TSE/CArmorClassDefinitions.cpp @@ -12,6 +12,7 @@ #define LABEL_SHORT_ATTRIB CONSTLIT("shortLabel") #define MASS_ATTRIB CONSTLIT("mass") #define COMPATIBILITY_SIZE_ATTRIB CONSTLIT("compatibilitySize") +#define SIZE_FORTIFICATION CONSTLIT("fortification") #define ARMOR_CLASS_ELEMENT CONSTLIT("ArmorClass") #define ARMOR_CLASS_ELEMENT_LEGACY CONSTLIT("ArmorMass") From 67bc0c9735ec2bc3bb3741f826d3abcc4e2d9269 Mon Sep 17 00:00:00 2001 From: FlufflesTheMicrosaur Date: Wed, 25 Feb 2026 16:26:23 -0800 Subject: [PATCH 4/4] feat: 106405: add parsing damage method string for armor class --- Mammoth/Include/TSEUtil.h | 2 + Mammoth/TSE/CArmorClassDefinitions.cpp | 13 +- Mammoth/TSE/Utilities.cpp | 213 ++++++++++++++++++++++++- 3 files changed, 226 insertions(+), 2 deletions(-) diff --git a/Mammoth/Include/TSEUtil.h b/Mammoth/Include/TSEUtil.h index f4751a33c..8c5d0e09a 100644 --- a/Mammoth/Include/TSEUtil.h +++ b/Mammoth/Include/TSEUtil.h @@ -709,6 +709,8 @@ struct SDamageMethod static const DWORD FLAG_ADJ = 0x00000002; static const DWORD FLAG_METHOD_RATIO = 0x00000004; + bool InitFromString (const CString sDmgMethods, CString* retsError = NULL, EDamageMethod eWMDMapping = EDamageMethod::methodShred); + Metric GetCrush () const { return rAdj[0]; } Metric GetPierce () const { return rAdj[1]; } Metric GetShred () const { return rAdj[2]; } diff --git a/Mammoth/TSE/CArmorClassDefinitions.cpp b/Mammoth/TSE/CArmorClassDefinitions.cpp index e954c9cc0..086a33f2f 100644 --- a/Mammoth/TSE/CArmorClassDefinitions.cpp +++ b/Mammoth/TSE/CArmorClassDefinitions.cpp @@ -12,7 +12,7 @@ #define LABEL_SHORT_ATTRIB CONSTLIT("shortLabel") #define MASS_ATTRIB CONSTLIT("mass") #define COMPATIBILITY_SIZE_ATTRIB CONSTLIT("compatibilitySize") -#define SIZE_FORTIFICATION CONSTLIT("fortification") +#define FORTIFICATION_ATTRIB CONSTLIT("fortification") #define ARMOR_CLASS_ELEMENT CONSTLIT("ArmorClass") #define ARMOR_CLASS_ELEMENT_LEGACY CONSTLIT("ArmorMass") @@ -311,6 +311,17 @@ ALERROR CArmorClassDefinitions::InitFromXML (SDesignLoadCtx &Ctx, CXMLElement *p pClass->sTextShort = pClass->sText; pClass->rMaxSize = rCompatibilitySize; + CString sFortification; + if (pEntry->FindAttribute(FORTIFICATION_ATTRIB, &sFortification)) + { + if (!pClass->Fortification.InitFromString(sFortification, &Ctx.sError)) + { + Ctx.sError = strPatternSubst(CONSTLIT("Failure to parse fortification string in ArmorClass \"%s\": %s"), pClass->sID, Ctx.sError); + CleanupDefinitions(); + return ERR_FAIL; + } + } + pDef->Ids.Insert(pClass->sID, iArmorClass); // Prepare for next loop diff --git a/Mammoth/TSE/Utilities.cpp b/Mammoth/TSE/Utilities.cpp index 2021cb238..2deab8173 100644 --- a/Mammoth/TSE/Utilities.cpp +++ b/Mammoth/TSE/Utilities.cpp @@ -496,7 +496,218 @@ void DiceRange::WriteToStream (IWriteStream *pStream) const pStream->Write(m_iBonus); } -// Miscellaneous functions +// SDamageMethod ------------------------------------------------------------- + +// InitFromString +// +// Initializes SDamageMethod values from a damage method string. +// Returns if successful or false if a parse error occurred. +// +bool SDamageMethod::InitFromString (const CString sDmgMethods, CString* retsError, EDamageMethod eWMDMapping) + { + // Clear existing values + Reset(); + + EDamageMethodSystem eSystem = g_pUniverse->GetEngineOptions().GetDamageMethodSystem(); + + // bMappedNative is used to track if we have mapped a native mapping before a compatibility + // mapping, in which case we ignore the compatibility mapping + bool bMappedNative = false; + + // Use a padded version of sDmgMethods to simplify logic + CString sPaddedDmgMethods = strCat(sDmgMethods, CONSTLIT(" ")); + + bool bInTerm = false; + char* pStart = sPaddedDmgMethods.GetPointer(); + char* pStrStart = pStart; + char* pNameEnd = NULL; + char* pValueStart = NULL; + char* pStrEnd = sPaddedDmgMethods.GetPointer() + sPaddedDmgMethods.GetLength(); + for (char* pC = pStrStart; pC < pStrEnd; pC++) + { + // Keep reading if alphabetic + if (IsCharAlpha(*pC)) + { + if (!bInTerm) + bInTerm = true; + pStart = pC; + continue; + } + + // If its a numeral though (alpha is already filtered out) we switch modes to read + // the number. + // We also include periods in case of "pierce.5" and colons for "pierce:5" + else if (IsCharAlphaNumeric(*pC) || *pC == '.' || *pC == ':') + { + if (pNameEnd < pStart) + pNameEnd = pC - 1; + + // Check for parse errors + if (pNameEnd < pStart) + { + Reset(); + if (retsError) + *retsError = CONSTLIT("Numeral without name found"); + return false; + } + + // Set val start + if (pValueStart <= pNameEnd) + { + if (*pC == ':') + { + pValueStart = pC + 1; + if (pValueStart >= pStrEnd) + { + if (retsError) + *retsError = CONSTLIT("Expected value but reached end of string instead."); + return false; + } + } + else + pValueStart = pC; + } + } + + // If its a delimiter read in the value, or skip if we aren't in a name + else if (*pC == ' ' || *pC == ';' || *pC == ',') + { + if (!bInTerm) + continue; + bInTerm = false; + + // Ensure that we have a valid value + if (pValueStart <= pNameEnd) + { + if (retsError) + *retsError = CONSTLIT("Expected a damage method value."); + return false; + } + + // Attempt to parse the name we have + CString sName = strSlice(sPaddedDmgMethods, (int)(pStart - pStrStart), (int)(pNameEnd - pStrStart)); + + // Attempt to parse the value + CString sValue = strSlice(sPaddedDmgMethods, (int)(pValueStart - pStrStart), (int)(pC - pStrStart)); + bool bFailed = false; + Metric rValue = strToDouble(sValue, 0.0, &bFailed); + + if (bFailed) + { + if (retsError) + *retsError = strPatternSubst(CONSTLIT("Could not parse value %s to double"), sValue); + return false; + } + + if (rValue < 0.0) + { + if (retsError) + *retsError = CONSTLIT("DamageMethod values cannot be less than 0 for adjustment, fortification, or ratios"); + return false; + } + + EDamageMethod eMethod = EDamageMethod::methodError; + + if (strEquals(sName, KEY_CORE_DMG_METHOD_CRUSH)) + eMethod = EDamageMethod::methodCrush; + else if (strEquals(sName, KEY_CORE_DMG_METHOD_OVERWHELM)) + eMethod = EDamageMethod::methodOverwhelm; + else if (strEquals(sName, KEY_CORE_DMG_METHOD_PIERCE)) + eMethod = EDamageMethod::methodPierce; + else if (strEquals(sName, KEY_CORE_DMG_METHOD_SHRED)) + eMethod = EDamageMethod::methodShred; + else if (strEquals(sName, KEY_CORE_DMG_METHOD_SCOUR)) + eMethod = EDamageMethod::methodScour; + else if (strEquals(sName, KEY_CORE_DMG_METHOD_DIRECT)) + eMethod = EDamageMethod::methodDirect; + else if (strEquals(sName, KEY_CORE_DMG_METHOD_WMD)) + eMethod = EDamageMethod::methodWMD; + else + { + if (retsError) + *retsError = strPatternSubst(CONSTLIT("\"%s\" is not a valid damage method name"), sName); + return false; + } + + if (eMethod == EDamageMethod::methodDirect && (dwFlags & FLAG_FORTIFICATION) || (dwFlags & FLAG_ADJ)) + { + if (retsError) + *retsError = CONSTLIT("Damage method \"direct\" cannot be adjusted or fortified against."); + return false; + } + + // Handle physicalized damage method compatibility + if (eSystem == EDamageMethodSystem::dmgMethodSysPhysicalized) + { + if (eMethod == EDamageMethod::methodWMD) + { + if (bMappedNative) + continue; + + Set(eWMDMapping, rValue); + } + else + { + if (eMethod == eWMDMapping) + bMappedNative = true; + + Set(eMethod, rValue); + } + continue; + } + + // Handle WMD damage method compatibility + else + { + if (eMethod == EDamageMethod::methodWMD) + { + bMappedNative = true; + Set(eMethod, rValue); + } + else + { + if (eMethod == eWMDMapping && !bMappedNative) + Set(eMethod, rValue); + } + continue; + } + } + + // If its any other character, this is an error + else + { + if (retsError) + *retsError = strPatternSubst(CONSTLIT("Invalid character \"%s\""), *pC); + return false; + } + } + + // Now we do any extra math required for our type + + if (dwFlags & FLAG_METHOD_RATIO && eSystem == EDamageMethodSystem::dmgMethodSysPhysicalized) + { + Metric rSum = 0.0; + for (int i = 0; i < NUM_METHODS; i++) + { + rSum += rAdj[i]; + } + + if (rSum == 0.0) + SetScour(1.0); + else + { + for (int i = 0; i < NUM_METHODS; i++) + { + rAdj[i] = rAdj[i] / rSum; + } + } + } + // WMD "ratio" is left as a level, we so dont need to process it + + return true; + } + +// Miscellaneous functions --------------------------------------------------- CString AppendModifiers (const CString &sModifierList1, const CString &sModifierList2)