2 * Copyright (C) 2008-2018 TrinityCore <https://www.trinitycore.org/>
3 * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
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.
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
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/>.
19 #ifndef TRINITYCORE_TEMPSUMMON_H
20 #define TRINITYCORE_TEMPSUMMON_H
29 PET_VOID_WALKER
= 1860,
31 PET_DOOMGUARD
= 18540,
36 PET_ABOMINATION
= 106848,
39 PET_SPIRIT_WOLF
= 29264
42 struct SummonPropertiesEntry
;
44 class TC_GAME_API TempSummon
: public Creature
47 explicit TempSummon(SummonPropertiesEntry
const* properties
, Unit
* owner
, bool isWorldObject
);
48 virtual ~TempSummon() { }
49 void Update(uint32 time
) override
;
50 virtual void InitStats(uint32 lifetime
);
51 virtual void InitSummon();
52 void UpdateObjectVisibilityOnCreate() override
;
53 virtual void UnSummon(uint32 msTime
= 0);
54 void RemoveFromWorld() override
;
55 void SetTempSummonType(TempSummonType type
);
56 void SaveToDB(uint32
/*mapid*/, uint64
/*spawnMask*/) override
{ }
57 Unit
* GetSummoner() const;
58 Creature
* GetSummonerCreatureBase() const;
59 ObjectGuid
GetSummonerGUID() const { return m_summonerGUID
; }
60 TempSummonType
const& GetSummonType() { return m_type
; }
61 uint32
GetTimer() const { return m_timer
; }
63 const SummonPropertiesEntry
* const m_Properties
;
65 TempSummonType m_type
;
68 ObjectGuid m_summonerGUID
;
71 class TC_GAME_API Minion
: public TempSummon
74 Minion(SummonPropertiesEntry
const* properties
, Unit
* owner
, bool isWorldObject
);
75 void InitStats(uint32 duration
) override
;
76 void RemoveFromWorld() override
;
77 Unit
* GetOwner() const { return m_owner
; }
78 float GetFollowAngle() const override
{ return m_followAngle
; }
79 void SetFollowAngle(float angle
) { m_followAngle
= angle
; }
82 bool IsPetImp() const { return GetEntry() == PET_IMP
; }
83 bool IsPetFelhunter() const { return GetEntry() == PET_FEL_HUNTER
; }
84 bool IsPetVoidwalker() const { return GetEntry() == PET_VOID_WALKER
; }
85 bool IsPetSuccubus() const { return GetEntry() == PET_SUCCUBUS
; }
86 bool IsPetDoomguard() const { return GetEntry() == PET_DOOMGUARD
; }
87 bool IsPetFelguard() const { return GetEntry() == PET_FELGUARD
; }
90 bool IsPetGhoul() const { return GetEntry() == PET_GHOUL
; } // Ghoul may be guardian or pet
91 bool IsPetAbomination() const { return GetEntry() == PET_ABOMINATION
; } // Sludge Belcher dk talent
94 bool IsSpiritWolf() const { return GetEntry() == PET_SPIRIT_WOLF
; } // Spirit wolf from feral spirits
96 bool IsGuardianPet() const;
102 class TC_GAME_API Guardian
: public Minion
105 Guardian(SummonPropertiesEntry
const* properties
, Unit
* owner
, bool isWorldObject
);
106 void InitStats(uint32 duration
) override
;
107 bool InitStatsForLevel(uint8 level
);
108 void InitSummon() override
;
110 bool UpdateStats(Stats stat
) override
;
111 bool UpdateAllStats() override
;
112 void UpdateResistances(uint32 school
) override
;
113 void UpdateArmor() override
;
114 void UpdateMaxHealth() override
;
115 void UpdateMaxPower(Powers power
) override
;
116 void UpdateAttackPowerAndDamage(bool ranged
= false) override
;
117 void UpdateDamagePhysical(WeaponAttackType attType
) override
;
119 int32
GetBonusDamage() const { return m_bonusSpellDamage
; }
120 void SetBonusDamage(int32 damage
);
122 int32 m_bonusSpellDamage
;
123 float m_statFromOwner
[MAX_STATS
];
126 class TC_GAME_API Puppet
: public Minion
129 Puppet(SummonPropertiesEntry
const* properties
, Unit
* owner
);
130 void InitStats(uint32 duration
) override
;
131 void InitSummon() override
;
132 void Update(uint32 time
) override
;
133 void RemoveFromWorld() override
;
136 class TC_GAME_API ForcedUnsummonDelayEvent
: public BasicEvent
139 ForcedUnsummonDelayEvent(TempSummon
& owner
) : BasicEvent(), m_owner(owner
) { }
140 bool Execute(uint64 e_time
, uint32 p_time
) override
;