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 void SetVisibleBySummonerOnly(bool visibleBySummonerOnly
) { m_visibleBySummonerOnly
= visibleBySummonerOnly
; }
64 bool IsVisibleBySummonerOnly() const { return m_visibleBySummonerOnly
; }
66 const SummonPropertiesEntry
* const m_Properties
;
68 TempSummonType m_type
;
71 ObjectGuid m_summonerGUID
;
72 bool m_visibleBySummonerOnly
;
75 class TC_GAME_API Minion
: public TempSummon
78 Minion(SummonPropertiesEntry
const* properties
, Unit
* owner
, bool isWorldObject
);
79 void InitStats(uint32 duration
) override
;
80 void RemoveFromWorld() override
;
81 Unit
* GetOwner() const { return m_owner
; }
82 float GetFollowAngle() const override
{ return m_followAngle
; }
83 void SetFollowAngle(float angle
) { m_followAngle
= angle
; }
86 bool IsPetImp() const { return GetEntry() == PET_IMP
; }
87 bool IsPetFelhunter() const { return GetEntry() == PET_FEL_HUNTER
; }
88 bool IsPetVoidwalker() const { return GetEntry() == PET_VOID_WALKER
; }
89 bool IsPetSuccubus() const { return GetEntry() == PET_SUCCUBUS
; }
90 bool IsPetDoomguard() const { return GetEntry() == PET_DOOMGUARD
; }
91 bool IsPetFelguard() const { return GetEntry() == PET_FELGUARD
; }
94 bool IsPetGhoul() const { return GetEntry() == PET_GHOUL
; } // Ghoul may be guardian or pet
95 bool IsPetAbomination() const { return GetEntry() == PET_ABOMINATION
; } // Sludge Belcher dk talent
98 bool IsSpiritWolf() const { return GetEntry() == PET_SPIRIT_WOLF
; } // Spirit wolf from feral spirits
100 bool IsGuardianPet() const;
106 class TC_GAME_API Guardian
: public Minion
109 Guardian(SummonPropertiesEntry
const* properties
, Unit
* owner
, bool isWorldObject
);
110 void InitStats(uint32 duration
) override
;
111 bool InitStatsForLevel(uint8 level
);
112 void InitSummon() override
;
114 bool UpdateStats(Stats stat
) override
;
115 bool UpdateAllStats() override
;
116 void UpdateResistances(uint32 school
) override
;
117 void UpdateArmor() override
;
118 void UpdateMaxHealth() override
;
119 void UpdateMaxPower(Powers power
) override
;
120 void UpdateAttackPowerAndDamage(bool ranged
= false) override
;
121 void UpdateDamagePhysical(WeaponAttackType attType
) override
;
123 int32
GetBonusDamage() const { return m_bonusSpellDamage
; }
124 void SetBonusDamage(int32 damage
);
126 int32 m_bonusSpellDamage
;
127 float m_statFromOwner
[MAX_STATS
];
130 class TC_GAME_API Puppet
: public Minion
133 Puppet(SummonPropertiesEntry
const* properties
, Unit
* owner
);
134 void InitStats(uint32 duration
) override
;
135 void InitSummon() override
;
136 void Update(uint32 time
) override
;
137 void RemoveFromWorld() override
;
140 class TC_GAME_API ForcedUnsummonDelayEvent
: public BasicEvent
143 ForcedUnsummonDelayEvent(TempSummon
& owner
) : BasicEvent(), m_owner(owner
) { }
144 bool Execute(uint64 e_time
, uint32 p_time
) override
;