EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Damage Class Reference

#include "Damage.h"

Collaboration diagram for Damage:

Public Member Functions

 Damage (SystemEntity *pSE, InventoryItemRef wRef, float mod, uint16 eID)
 
 Damage (SystemEntity *pSE, InventoryItemRef wRef, InventoryItemRef cRef, uint16 eID)
 
 Damage (SystemEntity *pSE, InventoryItemRef wRef, float kin, float ther, float emp, float exp, float mod, uint16 eID)
 
 Damage (SystemEntity *pSE, bool fatal_blow=false)
 
 ~Damage ()
 
float GetThermal ()
 
float GetEM ()
 
float GetKinetic ()
 
float GetExplosive ()
 
float GetModifier ()
 
float GetTotal () const
 
Damage MultiplyDup (float kinetic_multiplier, float thermal_multiplier, float em_multiplier, float explosive_multiplier) const
 
Damageoperator*= (float factor)
 

Public Attributes

SystemEntitysrcSE
 
uint16 effectID
 
InventoryItemRef weaponRef
 
InventoryItemRef chargeRef
 

Private Attributes

float kinetic
 
float thermal
 
float em
 
float explosive
 
float modifier
 

Detailed Description

Definition at line 33 of file Damage.h.

Constructor & Destructor Documentation

Damage::Damage ( SystemEntity pSE,
InventoryItemRef  wRef,
float  mod,
uint16  eID 
)

Definition at line 68 of file Damage.cpp.

References _log, AttrEmDamage, AttrExplosiveDamage, AttrKineticDamage, AttrThermalDamage, em, explosive, EvilNumber::get_float(), InventoryItem::GetAttribute(), SystemEntity::GetID(), SystemEntity::GetName(), InventoryItem::itemID(), kinetic, modifier, InventoryItem::name(), srcSE, and thermal.

Referenced by MultiplyDup().

69 : srcSE(pSE), effectID(eID), weaponRef(wRef), chargeRef(InventoryItemRef(nullptr))
70 {
71  modifier = mod;
72 
77 
78  _log(DAMAGE__WARNING, "Damage:C'tor - Called by source %s(%u) with weapon %s(%u).",
79  srcSE->GetName(), srcSE->GetID(), wRef->name(), wRef->itemID() );
80 }
float modifier
Definition: Damage.h:94
float kinetic
Definition: Damage.h:90
#define _log(type, fmt,...)
Definition: logsys.h:124
float explosive
Definition: Damage.h:93
InventoryItemRef chargeRef
Definition: Damage.h:87
SystemEntity * srcSE
Definition: Damage.h:84
const char * name()
float em
Definition: Damage.h:92
uint32 GetID()
Definition: SystemEntity.h:207
const char * GetName() const
Definition: SystemEntity.h:210
RefPtr< InventoryItem > InventoryItemRef
Definition: ItemRef.h:52
EvilNumber GetAttribute(const uint16 attrID) const
float get_float()
Definition: EvilNumber.cpp:184
InventoryItemRef weaponRef
Definition: Damage.h:86
float thermal
Definition: Damage.h:91
uint32 itemID() const
Definition: InventoryItem.h:98
uint16 effectID
Definition: Damage.h:85

Here is the call graph for this function:

Here is the caller graph for this function:

Damage::Damage ( SystemEntity pSE,
InventoryItemRef  wRef,
InventoryItemRef  cRef,
uint16  eID 
)

Definition at line 83 of file Damage.cpp.

References _log, AttrEmDamage, AttrExplosiveDamage, AttrKineticDamage, AttrThermalDamage, em, explosive, EvilNumber::get_float(), InventoryItem::GetAttribute(), SystemEntity::GetID(), SystemEntity::GetName(), InventoryItem::itemID(), kinetic, modifier, InventoryItem::name(), srcSE, and thermal.

84 : srcSE(pSE), effectID(eID), weaponRef(wRef), chargeRef(cRef)
85 {
86  modifier = 1;
87 
92 
93  _log(DAMAGE__WARNING, "Damage:C'tor - Called by source %s(%u) with weapon %s(%u) using charge %s(%u).",
94  srcSE->GetName(), srcSE->GetID(), wRef->name(), wRef->itemID(), cRef->name(), cRef->itemID() );
95 }
float modifier
Definition: Damage.h:94
float kinetic
Definition: Damage.h:90
#define _log(type, fmt,...)
Definition: logsys.h:124
float explosive
Definition: Damage.h:93
InventoryItemRef chargeRef
Definition: Damage.h:87
SystemEntity * srcSE
Definition: Damage.h:84
const char * name()
float em
Definition: Damage.h:92
uint32 GetID()
Definition: SystemEntity.h:207
const char * GetName() const
Definition: SystemEntity.h:210
EvilNumber GetAttribute(const uint16 attrID) const
float get_float()
Definition: EvilNumber.cpp:184
InventoryItemRef weaponRef
Definition: Damage.h:86
float thermal
Definition: Damage.h:91
uint32 itemID() const
Definition: InventoryItem.h:98
uint16 effectID
Definition: Damage.h:85

Here is the call graph for this function:

Damage::Damage ( SystemEntity pSE,
InventoryItemRef  wRef,
float  kin,
float  ther,
float  emp,
float  exp,
float  mod,
uint16  eID 
)

Definition at line 57 of file Damage.cpp.

References em, explosive, kinetic, modifier, and thermal.

58 : srcSE(pSE), effectID(eID), weaponRef(wRef), chargeRef(InventoryItemRef(nullptr))
59 {
60  em = emp;
61  kinetic = kin;
62  thermal = ther;
63  explosive = exp;
64  modifier = mod;
65 }
float modifier
Definition: Damage.h:94
float kinetic
Definition: Damage.h:90
float explosive
Definition: Damage.h:93
InventoryItemRef chargeRef
Definition: Damage.h:87
SystemEntity * srcSE
Definition: Damage.h:84
float em
Definition: Damage.h:92
RefPtr< InventoryItem > InventoryItemRef
Definition: ItemRef.h:52
InventoryItemRef weaponRef
Definition: Damage.h:86
float thermal
Definition: Damage.h:91
uint16 effectID
Definition: Damage.h:85
Damage::Damage ( SystemEntity pSE,
bool  fatal_blow = false 
)

Definition at line 98 of file Damage.cpp.

References chargeRef, em, explosive, kinetic, thermal, and weaponRef.

100 {
101  assert(fatal_blow and "Damage() fatal_blow called without 2nd param being true!");
102 
103  em = kinetic = thermal = explosive = 0.0f;
104  weaponRef = InventoryItemRef(nullptr);
105  chargeRef = InventoryItemRef(nullptr);
106 }
float kinetic
Definition: Damage.h:90
float explosive
Definition: Damage.h:93
InventoryItemRef chargeRef
Definition: Damage.h:87
SystemEntity * srcSE
Definition: Damage.h:84
float em
Definition: Damage.h:92
RefPtr< InventoryItem > InventoryItemRef
Definition: ItemRef.h:52
InventoryItemRef weaponRef
Definition: Damage.h:86
float thermal
Definition: Damage.h:91
uint16 effectID
Definition: Damage.h:85
Damage::~Damage ( )
inline

Definition at line 41 of file Damage.h.

41 { /* do nothing here */ }

Member Function Documentation

float Damage::GetEM ( )
inline

Definition at line 44 of file Damage.h.

References em.

Referenced by SystemEntity::ApplyDamage().

44 { return em; }
float em
Definition: Damage.h:92

Here is the caller graph for this function:

float Damage::GetExplosive ( )
inline

Definition at line 46 of file Damage.h.

References explosive.

Referenced by SystemEntity::ApplyDamage().

46 { return explosive; }
float explosive
Definition: Damage.h:93

Here is the caller graph for this function:

float Damage::GetKinetic ( )
inline

Definition at line 45 of file Damage.h.

References kinetic.

Referenced by SystemEntity::ApplyDamage().

45 { return kinetic; }
float kinetic
Definition: Damage.h:90

Here is the caller graph for this function:

float Damage::GetModifier ( )
inline

Definition at line 47 of file Damage.h.

References modifier.

Referenced by SystemEntity::ApplyDamage().

47 { return modifier; }
float modifier
Definition: Damage.h:94

Here is the caller graph for this function:

float Damage::GetThermal ( )
inline

Definition at line 43 of file Damage.h.

References thermal.

Referenced by SystemEntity::ApplyDamage().

43 { return thermal; }
float thermal
Definition: Damage.h:91

Here is the caller graph for this function:

float Damage::GetTotal ( ) const
inline

Definition at line 48 of file Damage.h.

References em, explosive, kinetic, and thermal.

Referenced by SystemEntity::ApplyDamage(), CustomsSE::Killed(), StructureSE::Killed(), and ShipSE::Killed().

48 { return (kinetic + thermal + em + explosive); }
float kinetic
Definition: Damage.h:90
float explosive
Definition: Damage.h:93
float em
Definition: Damage.h:92
float thermal
Definition: Damage.h:91

Here is the caller graph for this function:

Damage Damage::MultiplyDup ( float  kinetic_multiplier,
float  thermal_multiplier,
float  em_multiplier,
float  explosive_multiplier 
) const
inline

Definition at line 50 of file Damage.h.

References Damage(), effectID, em, explosive, kinetic, modifier, srcSE, thermal, and weaponRef.

Referenced by SystemEntity::ApplyDamage().

54  { // NOTE: remember, these come in BACKWARD from 'normal' fuzzy logic.. 0=full and 1=none
55  // added checks here for > 95% resists, and < 1% to avoid crazy damage shit.
56  // also added checks for missing resists (some npcs have no hull resist in db which = 100% resist)
57  if (kinetic_multiplier > 1.0) kinetic_multiplier = 1.0;
58  if (kinetic_multiplier < 0.01) kinetic_multiplier = 0.01;
59  if (thermal_multiplier > 1.0) thermal_multiplier = 1.0;
60  if (thermal_multiplier < 0.01) thermal_multiplier = 0.01;
61  if (em_multiplier > 1.0) em_multiplier = 1.0;
62  if (em_multiplier < 0.01) em_multiplier = 0.01;
63  if (explosive_multiplier > 1.0) explosive_multiplier = 1.0;
64  if (explosive_multiplier < 0.01) explosive_multiplier = 0.01;
65  return Damage( srcSE, weaponRef,
66  kinetic * kinetic_multiplier,
67  thermal * thermal_multiplier,
68  em * em_multiplier,
69  explosive * explosive_multiplier,
70  modifier,
71  effectID );
72  }
float modifier
Definition: Damage.h:94
float kinetic
Definition: Damage.h:90
float explosive
Definition: Damage.h:93
SystemEntity * srcSE
Definition: Damage.h:84
float em
Definition: Damage.h:92
Damage(SystemEntity *pSE, InventoryItemRef wRef, float mod, uint16 eID)
Definition: Damage.cpp:68
InventoryItemRef weaponRef
Definition: Damage.h:86
float thermal
Definition: Damage.h:91
uint16 effectID
Definition: Damage.h:85

Here is the call graph for this function:

Here is the caller graph for this function:

Damage& Damage::operator*= ( float  factor)
inline

Definition at line 74 of file Damage.h.

References em, explosive, kinetic, and thermal.

75  {
76  kinetic *= factor;
77  thermal *= factor;
78  em *= factor;
79  explosive *= factor;
80 
81  return *this;
82  }
float kinetic
Definition: Damage.h:90
float explosive
Definition: Damage.h:93
float em
Definition: Damage.h:92
float thermal
Definition: Damage.h:91

Member Data Documentation

InventoryItemRef Damage::chargeRef

Definition at line 87 of file Damage.h.

Referenced by SystemEntity::ApplyDamage(), and Damage().

uint16 Damage::effectID

Definition at line 85 of file Damage.h.

Referenced by MultiplyDup().

float Damage::em
private

Definition at line 92 of file Damage.h.

Referenced by Damage(), GetEM(), GetTotal(), MultiplyDup(), and operator*=().

float Damage::explosive
private

Definition at line 93 of file Damage.h.

Referenced by Damage(), GetExplosive(), GetTotal(), MultiplyDup(), and operator*=().

float Damage::kinetic
private

Definition at line 90 of file Damage.h.

Referenced by Damage(), GetKinetic(), GetTotal(), MultiplyDup(), and operator*=().

float Damage::modifier
private

Definition at line 94 of file Damage.h.

Referenced by Damage(), GetModifier(), and MultiplyDup().

float Damage::thermal
private

Definition at line 91 of file Damage.h.

Referenced by Damage(), GetThermal(), GetTotal(), MultiplyDup(), and operator*=().


The documentation for this class was generated from the following files: