EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Damage.h
Go to the documentation of this file.
1 /*
2  ------------------------------------------------------------------------------------
3  LICENSE:
4  ------------------------------------------------------------------------------------
5  This file is part of EVEmu: EVE Online Server Emulator
6  Copyright 2006 - 2021 The EVEmu Team
7  For the latest information visit https://evemu.dev
8  ------------------------------------------------------------------------------------
9  This program is free software; you can redistribute it and/or modify it under
10  the terms of the GNU Lesser General Public License as published by the Free Software
11  Foundation; either version 2 of the License, or (at your option) any later
12  version.
13 
14  This program is distributed in the hope that it will be useful, but WITHOUT
15  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16  FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public License along with
19  this program; if not, write to the Free Software Foundation, Inc., 59 Temple
20  Place - Suite 330, Boston, MA 02111-1307, USA, or go to
21  http://www.gnu.org/copyleft/lesser.txt.
22  ------------------------------------------------------------------------------------
23  Author: Zhur
24  Updates: Allan
25 */
26 #ifndef __DAMAGE_H_INCL__
27 #define __DAMAGE_H_INCL__
28 
29 #include "PyServiceMgr.h"
31 #include "system/SystemManager.h"
32 
33 class Damage {
34 public:
35  Damage(SystemEntity* pSE, InventoryItemRef wRef, float mod, uint16 eID);
37  Damage(SystemEntity* pSE, InventoryItemRef wRef, float kin, float ther, float emp, float exp, float mod, uint16 eID);
38  // constructor for Killed() methods of derived SystemEntity objects with no weapon
39  Damage(SystemEntity *pSE, bool fatal_blow=false);
40 
41  ~Damage() { /* do nothing here */ }
42 
43  float GetThermal() { return thermal; }
44  float GetEM() { return em; }
45  float GetKinetic() { return kinetic; }
46  float GetExplosive() { return explosive; }
47  float GetModifier() { return modifier; }
48  float GetTotal() const { return (kinetic + thermal + em + explosive); }
49 
50  Damage MultiplyDup( float kinetic_multiplier,
51  float thermal_multiplier,
52  float em_multiplier,
53  float explosive_multiplier ) const
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  }
73 
74  Damage &operator *=(float factor)
75  {
76  kinetic *= factor;
77  thermal *= factor;
78  em *= factor;
79  explosive *= factor;
80 
81  return *this;
82  }
83 
84  SystemEntity* srcSE; //we do not own this.
85  uint16 effectID; // why is this here?
87  InventoryItemRef chargeRef; // May be null.
88 
89 private:
90  float kinetic;
91  float thermal;
92  float em;
93  float explosive;
94  float modifier;
95 };
96 
97 #endif
float modifier
Definition: Damage.h:94
float kinetic
Definition: Damage.h:90
float explosive
Definition: Damage.h:93
InventoryItemRef chargeRef
Definition: Damage.h:87
Damage & operator*=(float factor)
Definition: Damage.h:74
SystemEntity * srcSE
Definition: Damage.h:84
~Damage()
Definition: Damage.h:41
float em
Definition: Damage.h:92
float GetKinetic()
Definition: Damage.h:45
Definition: Damage.h:33
float GetEM()
Definition: Damage.h:44
float GetModifier()
Definition: Damage.h:47
Damage(SystemEntity *pSE, InventoryItemRef wRef, float mod, uint16 eID)
Definition: Damage.cpp:68
float GetThermal()
Definition: Damage.h:43
float GetTotal() const
Definition: Damage.h:48
Damage MultiplyDup(float kinetic_multiplier, float thermal_multiplier, float em_multiplier, float explosive_multiplier) const
Definition: Damage.h:50
float GetExplosive()
Definition: Damage.h:46
unsigned __int16 uint16
Definition: eve-compat.h:48
InventoryItemRef weaponRef
Definition: Damage.h:86
float thermal
Definition: Damage.h:91
uint16 effectID
Definition: Damage.h:85