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
21 changes: 19 additions & 2 deletions Mammoth/Include/TSETypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,26 @@ extern Metric g_TimeScale;
extern Metric g_SecondsPerUpdate;

// Damage Types ---------------------------------------------------------------

//
// There are several classes of damage types:
//
// Listed damage: the standard damage types in the game
// These are subjected to ingame resistances and bonuses like
// damageAdj
//
// Unlisted damage: special purpose damage types
// Generic: deals true damage that ignores normal damageAdj
// Null: does not deal damage and is not treated as hostile, but
// activates on hit events and applies status effects
//
// Invalid damage: these are not real damage types
// Error: this is applied when an invalid damage type is selected, or
// a parsing error was encountered
// Unknown: this is applied to unknown virtual items for UI purposes
//
enum DamageTypes
{
damageUnknown = -101, // unknown damage
damageError = -100, // invalid damage
damageNull = -2, // null damage
damageGeneric = -1, // generic damage
Expand All @@ -238,7 +255,7 @@ enum DamageTypes
damageParticle = 2, // charged particle beam
damageBlast = 3, // chemical explosives
damageIonRadiation = 4, // ionizing radiation
damageThermonuclear = 5, // hydrogen bomb
damageThermonuclear = 5, // fission bomb
damagePositron = 6, // anti-matter charged particles
damagePlasma = 7, // fusion weapons
damageAntiMatter = 8, // anti-matter torpedo
Expand Down
1 change: 1 addition & 0 deletions Mammoth/TSE/CDamageAdjDesc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ int CDamageAdjDesc::GetAdj (DamageTypes iDamageType) const
case damageGeneric:
return 100;
case damageNull:
case damageUnknown:
case damageError:
return 0;
default:
Expand Down
9 changes: 7 additions & 2 deletions Mammoth/TSE/CWeaponClass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3735,8 +3735,13 @@ bool CWeaponClass::GetReferenceDamageType (CItemCtx &Ctx, const CItem &Ammo, Dam
CString sFireRate = GetReferenceFireRate(mathRound(rShotDelay));

// Compute the damage string and special string

if (IsLauncherWithAmmo() && Ammo.IsEmpty())

if (!Item.IsKnown())
{
sReference = CONSTLIT("Unknown ? hp/sec (? hp/shot) � ? ls range � ? shots/sec");
iDamageType = damageUnknown;
}
else if (IsLauncherWithAmmo() && Ammo.IsEmpty())
{
sReference = CONSTLIT("missile launcher");

Expand Down
25 changes: 19 additions & 6 deletions Mammoth/TSE/Damage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ CString GetDamageName (DamageTypes iType)
return CONSTLIT("generic");
else if (iType == damageNull)
return CONSTLIT("null");
else if (iType == damageUnknown)
return CONSTLIT("unknown");
else
return CString(DAMAGE_TYPE_DATA[iType].pszName);
}
Expand All @@ -136,6 +138,8 @@ CString GetDamageShortName (DamageTypes iType)
return CONSTLIT("generic");
else if (iType == damageNull)
return CONSTLIT("null");
else if (iType == damageUnknown)
return CONSTLIT("unknown");
else
return CString(DAMAGE_TYPE_DATA[iType].pszShortName);
}
Expand All @@ -151,6 +155,11 @@ CString GetDamageType (DamageTypes iType)
return CONSTLIT("generic");
else if (iType == damageNull)
return CONSTLIT("null");
// unknownDamage is a special case:
// It cant normally be set, but exists on unknown virtual items for UI
// If you try to query it, you get generic damage back as a placeholder
else if (iType == damageUnknown)
return CONSTLIT("generic");
else
return CString(DAMAGE_TYPE_DATA[iType].pszID);
}
Expand Down Expand Up @@ -187,6 +196,8 @@ DamageTypes LoadDamageTypeFromXML (const CString &sAttrib)
else if (strEquals(sAttrib, CONSTLIT("dark fire")))
return damageDarkFire;

// Invalid damage types

return damageError;
}

Expand Down Expand Up @@ -397,27 +408,29 @@ bool DamageDesc::IsHostile () const
);
}

int DamageDesc::GetDamageLevel (DamageTypes iType)

// GetDamageTier
//
// Returns the damage tier based on damage type.
// Intended to be used for default balance stats
//
int DamageDesc::GetDamageLevel (DamageTypes iType)

{
if (iType == damageGeneric || iType == damageNull)
if (iType < damageMinListed || iType > damageMaxListed)
return 1;
else
return DAMAGE_TYPE_DATA[iType].iLevel;
}

int DamageDesc::GetDamageTier (DamageTypes iType)

// GetDamageTier
//
// Returns the damage tier based on damage type.
// Intended to be used for default balance stats
//
int DamageDesc::GetDamageTier (DamageTypes iType)

{
if (iType == damageGeneric || iType == damageNull)
if (iType < damageMinListed || iType > damageMaxListed)
return 1;
else
return DAMAGE_TYPE_DATA[iType].iTier;
Expand Down