EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
SentryAI.h
Go to the documentation of this file.
1 
8 #ifndef __NPC_SENTRY_AI_H
9 #define __NPC_SENTRY_AI_H
10 
12 #include "system/SystemEntity.h"
13 
14 class Sentry;
15 class SystemEntity;
16 class Timer;
17 class EvilNumber;
18 
19 class SentryAI {
20 protected:
21  enum State {
22  Idle = 1, // not doing anything....idle.
23  Engaged = 2, // actively fighting
24  Signaling = 3 // calling for help
25  };
26 
27 public:
28  SentryAI(Sentry *who);
29  ~SentryAI() { /* do nothing here */ }
30 
31  void Process();
32 
33  void Target(SystemEntity *by_who);
34  void Targeted(SystemEntity *by_who);
35  void TargetLost(SystemEntity *by_who);
36 
37  void ClearTargets();
38  void ClearAllTargets();
39 
40  void DisableRepTimers();
41 
42  // public methods to enable calls from other classes (namely, TurretFormulas.cpp)
43  bool IsIdle() { return (m_state == State::Idle); }
44  bool IsFighting() { return (m_state != State::Idle); }
46  uint32 GetFalloff() { return m_falloff; }
48  double GetTrackingSpeed() { return m_trackingSpeed; }
49 
50 protected:
51  void SetIdle();
52  void Attack(SystemEntity* pTarget);
53  void SetEngaged(SystemEntity* pTarget);
54  void ClearTarget(SystemEntity* pTarget);
55  void AttackTarget(SystemEntity* pTarget);
56  void SetSignaling(SystemEntity* pTarget);
57  void CheckDistance(SystemEntity* pTarget);
58 
59  double GetTargetTime();
60 
62 
63  std::string GetStateName(State name);
64 
65 private:
66  bool m_webber : 1;
67  bool m_warpScram : 1;
68  bool m_useSigRadius : 1;
71  float m_switchTargChance; //fuzzy logic
73  //these attributes are cached to reduce access times. (much faster but uses more memory)
75  uint16 m_targetRange; // max targeting range default: m_maxAttackRange (unused)
78 
80  uint32 m_falloff;// distance past maximum range at which accuracy has fallen by half
82  uint32 m_maxAttackRange;// max firing range default:15000
83 
85 
87 
89 
95 };
96 
97 #endif
bool m_webber
Definition: SentryAI.h:66
double m_trackingSpeed
Definition: SentryAI.h:84
bool m_useTargSwitching
Definition: SentryAI.h:69
void TargetLost(SystemEntity *by_who)
Definition: SentryAI.cpp:258
uint32 m_maxAttackRange
Definition: SentryAI.h:82
State m_state
Definition: SentryAI.h:61
uint32 m_sigRadius
Definition: SentryAI.h:79
float m_switchTargChance
Definition: SentryAI.h:71
std::string GetStateName(State name)
Definition: SentryAI.cpp:350
void SetEngaged(SystemEntity *pTarget)
Definition: SentryAI.cpp:159
uint16 m_preferedSigRadius
Definition: SentryAI.h:72
void Target(SystemEntity *by_who)
Definition: SentryAI.cpp:213
uint16 m_optimalRange
Definition: SentryAI.h:76
Timer m_processTimer
Definition: SentryAI.h:90
uint16 GetOptimalRange()
Definition: SentryAI.h:45
void SetIdle()
Definition: SentryAI.cpp:146
this is a class that kinda mimics how python polymorph's numbers.
Definition: EvilNumber.h:59
Definition: Sentry.h:20
void DisableRepTimers()
bool IsFighting()
Definition: SentryAI.h:44
TurretFormulas m_formula
Definition: SentryAI.h:88
double GetTargetTime()
Definition: SentryAI.cpp:328
void SetSignaling(SystemEntity *pTarget)
Definition: SentryAI.cpp:168
~SentryAI()
Definition: SentryAI.h:29
void ClearAllTargets()
Definition: SentryAI.cpp:208
uint16 m_attackSpeed
Definition: SentryAI.h:74
uint32 m_sightRange
Definition: SentryAI.h:81
uint32 GetFalloff()
Definition: SentryAI.h:46
uint32 m_falloff
Definition: SentryAI.h:80
bool m_useSigRadius
Definition: SentryAI.h:68
uint32 GetAttackRange()
Definition: SentryAI.h:47
Timer m_warpScramblerTimer
Definition: SentryAI.h:93
bool IsIdle()
Definition: SentryAI.h:43
bool m_warpScram
Definition: SentryAI.h:67
uint16 m_damageMultiplier
Definition: SentryAI.h:77
unsigned __int32 uint32
Definition: eve-compat.h:50
Timer m_beginFindTarget
Definition: SentryAI.h:92
Sentry * m_npc
Definition: SentryAI.h:86
double GetTrackingSpeed()
Definition: SentryAI.h:48
void Attack(SystemEntity *pTarget)
Definition: SentryAI.cpp:272
void ClearTargets()
void Process()
Definition: SentryAI.cpp:83
uint16 m_targetRange
Definition: SentryAI.h:75
bool m_useSecondTarget
Definition: SentryAI.h:70
void CheckDistance(SystemEntity *pTarget)
Definition: SentryAI.cpp:177
Definition: timer.h:30
void AttackTarget(SystemEntity *pTarget)
Definition: SentryAI.cpp:304
Timer m_mainAttackTimer
Definition: SentryAI.h:91
unsigned __int16 uint16
Definition: eve-compat.h:48
void Targeted(SystemEntity *by_who)
Definition: SentryAI.cpp:229
Timer m_webifierTimer
Definition: SentryAI.h:94
SentryAI(Sentry *who)
Definition: SentryAI.cpp:20
void ClearTarget(SystemEntity *pTarget)
Definition: SentryAI.cpp:200