OregonCore  revision be9e804-git
Your Favourite TBC server
TemporarySummon.h
Go to the documentation of this file.
1 /*
2  * This file is part of the OregonCore Project. See AUTHORS file for Copyright information
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License as published by the
6  * Free Software Foundation; either version 2 of the License, or (at your
7  * option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12  * more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef OREGONCORE_TEMPSUMMON_H
19 #define OREGONCORE_TEMPSUMMON_H
20 
21 #include "Creature.h"
22 
24 {
28 };
29 
32 {
37 };
38 
39 class TempSummon : public Creature
40 {
41  public:
42  explicit TempSummon(SummonPropertiesEntry const* properties, Unit* owner, bool isWorldObject);
43  ~TempSummon() override {};
44  void Update(uint32 time) override;
45  virtual void InitStats(uint32 lifetime);
46  virtual void InitSummon();
47  void UnSummon(uint32 msTime = 0);
48  void RemoveFromWorld() override;
49  void SetTempSummonType(TempSummonType type);
51  {
52  return m_type;
53  }
54  void SaveToDB() override;
55  Unit* GetSummoner() const;
56  void SetSummoner(Unit* summoner) { m_summonerGUID = summoner->GetGUID(); }
57 
59  private:
64 };
65 
66 class Minion : public TempSummon
67 {
68  public:
69  Minion(SummonPropertiesEntry const* properties, Unit* owner, bool isWorldObject);
70  void InitStats(uint32 duration) override;
71  void RemoveFromWorld() override;
73  {
74  return m_owner;
75  }
76  float GetFollowAngle() const override
77  {
78  return m_followAngle;
79  }
80  void SetFollowAngle(float angle)
81  {
82  m_followAngle = angle;
83  }
84  bool IsGuardianPet() const;
85  protected:
86  Unit* const m_owner;
88 };
89 
90 class Guardian : public Minion
91 {
92  public:
93  Guardian(SummonPropertiesEntry const* properties, Unit* owner, bool isWorldObject);
94  void InitStats(uint32 duration) override;
95  bool InitStatsForLevel(uint32 level);
96  void InitSummon() override;
97 
98  bool UpdateStats(Stats stat) override;
99  bool UpdateAllStats() override;
100  void UpdateResistances(uint32 school) override;
101  void UpdateArmor() override;
102  void UpdateMaxHealth() override;
103  void UpdateMaxPower(Powers power) override;
104  void UpdateAttackPowerAndDamage(bool ranged = false) override;
105  void UpdateDamagePhysical(WeaponAttackType attType) override;
106 
108  {
109  return m_bonusdamage;
110  }
111  void SetBonusDamage(int32 damage)
112  {
113  m_bonusdamage = damage;
114  }
115  protected:
117 };
118 
119 class Puppet : public Minion
120 {
121  public:
122  Puppet(SummonPropertiesEntry const* properties, Unit* owner);
123  void InitStats(uint32 duration) override;
124  void InitSummon() override;
125  void Update(uint32 time) override;
126  void RemoveFromWorld() override;
127  protected:
129 };
130 
132 {
133 public:
134  UnsummonDelayEvent(Creature& owner) : BasicEvent(), m_owner(owner) { }
135  bool Execute(uint64 e_time, uint32 p_time) override;
136 
137 private:
139 };
140 
141 #endif
142 
float m_followAngle
TempSummonType type
Summon type, see TempSummonType for available types.
void SetSummoner(Unit *summoner)
uint64 m_summonerGUID
void SetFollowAngle(float angle)
WeaponAttackType
Definition: Unit.h:498
int32 GetBonusDamage()
float GetFollowAngle() const override
Stores data for temp summons.
ACE_INT32 int32
Definition: Define.h:67
~TempSummon() override
SummonerType
TempSummonType GetTempSummonType() const
uint64 GetGUID() const
Definition: Object.h:177
Powers
SummonPropertiesEntry const * m_Properties
Stats
TempSummonType
Unit *const m_owner
ACE_UINT64 uint64
Definition: Define.h:70
uint32 m_lifetime
Player * m_owner
TempSummonType m_type
uint32 time
Despawn time, usable only with certain temp summon types.
int32 m_bonusdamage
uint32 entry
Entry of summoned creature.
void SetBonusDamage(int32 damage)
ACE_UINT32 uint32
Definition: Define.h:71
Definition: Unit.h:908
Position pos
Position, where should be creature spawned.
Definition: Player.h:923
uint32 m_timer
UnsummonDelayEvent(Creature &owner)
Unit * GetOwner()