TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
TemporarySummon.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
3  * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License as published by the
7  * Free Software Foundation; either version 2 of the License, or (at your
8  * option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13  * more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef TRINITYCORE_TEMPSUMMON_H
20 #define TRINITYCORE_TEMPSUMMON_H
21 
22 #include "Creature.h"
23 
25 {
29 };
30 
33 {
38 };
39 
41 {
42  public:
43  explicit TempSummon(SummonPropertiesEntry const* properties, Unit* owner, bool isWorldObject);
44  virtual ~TempSummon() { }
45  void Update(uint32 time) override;
46  virtual void InitStats(uint32 lifetime);
47  virtual void InitSummon();
48  virtual void UnSummon(uint32 msTime = 0);
49  void RemoveFromWorld() override;
50  void SetTempSummonType(TempSummonType type);
51  void SaveToDB(uint32 /*mapid*/, uint32 /*spawnMask*/, uint32 /*phaseMask*/) override { }
52  Unit* GetSummoner() const;
53  Creature* GetSummonerCreatureBase() const;
54  ObjectGuid GetSummonerGUID() const { return m_summonerGUID; }
55  TempSummonType const& GetSummonType() { return m_type; }
56  uint32 GetTimer() const { return m_timer; }
57 
59  private:
64 };
65 
67 {
68  public:
69  Minion(SummonPropertiesEntry const* properties, Unit* owner, bool isWorldObject);
70  void InitStats(uint32 duration) override;
71  void RemoveFromWorld() override;
72  Unit* GetOwner() const { return m_owner; }
73  float GetFollowAngle() const override { return m_followAngle; }
74  void SetFollowAngle(float angle) { m_followAngle = angle; }
75  bool IsPetGhoul() const {return GetEntry() == 26125;} // Ghoul may be guardian or pet
76  bool IsSpiritWolf() const {return GetEntry() == 29264;} // Spirit wolf from feral spirits
77  bool IsGuardianPet() const;
78  protected:
79  Unit* const m_owner;
81 };
82 
83 class TC_GAME_API Guardian : public Minion
84 {
85  public:
86  Guardian(SummonPropertiesEntry const* properties, Unit* owner, bool isWorldObject);
87  void InitStats(uint32 duration) override;
88  bool InitStatsForLevel(uint8 level);
89  void InitSummon() override;
90 
91  bool UpdateStats(Stats stat) override;
92  bool UpdateAllStats() override;
93  void UpdateResistances(uint32 school) override;
94  void UpdateArmor() override;
95  void UpdateMaxHealth() override;
96  void UpdateMaxPower(Powers power) override;
97  void UpdateAttackPowerAndDamage(bool ranged = false) override;
98  void UpdateDamagePhysical(WeaponAttackType attType) override;
99 
100  int32 GetBonusDamage() const { return m_bonusSpellDamage; }
101  void SetBonusDamage(int32 damage);
102  protected:
104  float m_statFromOwner[MAX_STATS];
105 };
106 
107 class TC_GAME_API Puppet : public Minion
108 {
109  public:
110  Puppet(SummonPropertiesEntry const* properties, Unit* owner);
111  void InitStats(uint32 duration) override;
112  void InitSummon() override;
113  void Update(uint32 time) override;
114  void RemoveFromWorld() override;
115 };
116 
118 {
119 public:
120  ForcedUnsummonDelayEvent(TempSummon& owner) : BasicEvent(), m_owner(owner) { }
121  bool Execute(uint64 e_time, uint32 p_time) override;
122 
123 private:
125 };
126 #endif
void RemoveFromWorld() override
Definition: TemporarySummon.cpp:268
Definition: TemporarySummon.h:83
float m_followAngle
Definition: TemporarySummon.h:80
bool IsPetGhoul() const
Definition: TemporarySummon.h:75
TempSummonType type
Summon type, see TempSummonType for available types.
Definition: TemporarySummon.h:36
ObjectGuid m_summonerGUID
Definition: TemporarySummon.h:63
Definition: TemporarySummon.h:40
Definition: TemporarySummon.h:28
uint32 GetTimer() const
Definition: TemporarySummon.h:56
ForcedUnsummonDelayEvent(TempSummon &owner)
Definition: TemporarySummon.h:120
void SetFollowAngle(float angle)
Definition: TemporarySummon.h:74
void InitStats(uint32 duration) override
Definition: TemporarySummon.cpp:298
Definition: TemporarySummon.h:107
void UpdateResistances(uint32 school) override
Definition: StatSystem.cpp:847
int32 m_bonusSpellDamage
Definition: TemporarySummon.h:103
Stores data for temp summons.
Definition: TemporarySummon.h:32
virtual ~TempSummon()
Definition: TemporarySummon.h:44
Stats
Definition: SharedDefines.h:235
Definition: TemporarySummon.h:27
void UpdateAttackPowerAndDamage(bool ranged=false) override
Definition: StatSystem.cpp:878
Definition: Creature.h:467
SummonerType
Definition: TemporarySummon.h:24
bool UpdateAllStats() override
Definition: StatSystem.cpp:833
TempSummon & m_owner
Definition: TemporarySummon.h:124
TempSummonType
Definition: Object.h:52
void UpdateMaxHealth() override
Definition: StatSystem.cpp:864
bool IsSpiritWolf() const
Definition: TemporarySummon.h:76
#define MAX_STATS
Definition: SharedDefines.h:244
Unit * GetOwner() const
Definition: TemporarySummon.h:72
Definition: TemporarySummon.h:66
int32 GetBonusDamage() const
Definition: TemporarySummon.h:100
Powers
Definition: SharedDefines.h:246
bool UpdateStats(Stats stat) override
Definition: StatSystem.cpp:828
Definition: TemporarySummon.h:117
int32_t int32
Definition: Define.h:146
uint32_t uint32
Definition: Define.h:150
uint64_t uint64
Definition: Define.h:149
void UpdateArmor() override
Definition: StatSystem.cpp:858
const SummonPropertiesEntry *const m_Properties
Definition: TemporarySummon.h:58
ObjectGuid GetSummonerGUID() const
Definition: TemporarySummon.h:54
Unit *const m_owner
Definition: TemporarySummon.h:79
void RemoveFromWorld() override
Definition: TemporarySummon.cpp:310
virtual bool Execute(uint64, uint32)
Definition: EventProcessor.h:42
uint32 m_lifetime
Definition: TemporarySummon.h:62
Definition: EventProcessor.h:28
TempSummonType m_type
Definition: TemporarySummon.h:60
virtual void InitSummon()
Definition: TemporarySummon.cpp:220
void RemoveFromWorld() override
Definition: Creature.cpp:238
virtual void UpdateDamagePhysical(WeaponAttackType attType)
Definition: StatSystem.cpp:60
uint32 time
Despawn time, usable only with certain temp summon types.
Definition: TemporarySummon.h:37
#define TC_GAME_API
Definition: Define.h:134
uint32 entry
Entry of summoned creature.
Definition: TemporarySummon.h:34
uint8_t uint8
Definition: Define.h:152
Definition: Position.h:27
float GetFollowAngle() const override
Definition: TemporarySummon.h:73
void UpdateMaxPower(Powers power) override
Definition: StatSystem.cpp:870
void Update(uint32 time) override
Definition: Creature.cpp:494
Definition: TemporarySummon.h:26
virtual void InitStats(uint32 lifetime)
Definition: TemporarySummon.cpp:176
uint32 GetEntry() const
Definition: Object.h:107
void Update(uint32 time) override
Definition: TemporarySummon.cpp:47
Definition: ObjectGuid.h:189
TempSummonType const & GetSummonType()
Definition: TemporarySummon.h:55
WeaponAttackType
Definition: Unit.h:615
Definition: Unit.h:1305
Position pos
Position, where should be creature spawned.
Definition: TemporarySummon.h:35
uint32 m_timer
Definition: TemporarySummon.h:61
void SaveToDB(uint32, uint32, uint32) override
Definition: TemporarySummon.h:51
Definition: DBCStructure.h:1242