Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 38 additions & 38 deletions Mammoth/Include/TSEAdventureDesc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_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; }
Expand All @@ -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;
Expand All @@ -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;
};
Expand Down Expand Up @@ -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 ();
Expand Down Expand Up @@ -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

Expand Down
8 changes: 4 additions & 4 deletions Mammoth/Include/TSEArmor.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -222,15 +222,15 @@ class CShipArmorSegmentDesc
DWORD dwArmorUNID,
int iLevel,
const CRandomEnhancementGenerator &Enhancement,
SDamageMethodAdj rFortification);
SDamageMethodFortification rFortification);
ALERROR InitFromXML (
SDesignLoadCtx &Ctx,
const CXMLElement &Desc,
DWORD dwDefaultUNID,
int iDefaultLevel,
int iDefaultAngle,
const CRandomEnhancementGenerator &DefaultEnhancement,
SDamageMethodAdj rDefaultFortification,
SDamageMethodFortification rDefaultFortification,
int *retiSpan = NULL);

static const CShipArmorSegmentDesc m_Null;
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Mammoth/Include/TSEDeviceClassesImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions Mammoth/Include/TSEEngineDefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
//
Expand Down
4 changes: 4 additions & 0 deletions Mammoth/Include/TSEItemDefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
};

Expand Down
2 changes: 1 addition & 1 deletion Mammoth/Include/TSEShipSystems.h
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ class CShipInteriorDesc

TArray<SCompartmentDesc> m_Compartments;
TArray<int> 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;
Expand Down
2 changes: 1 addition & 1 deletion Mammoth/Include/TSEStationType.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
113 changes: 100 additions & 13 deletions Mammoth/Include/TSEUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -679,22 +679,55 @@ 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;

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]; }
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
{
Expand All @@ -703,22 +736,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)
{
Expand All @@ -734,21 +780,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
Expand Down
2 changes: 1 addition & 1 deletion Mammoth/Include/TSEWeaponFireDesc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading