TrinityCore
Loading...
Searching...
No Matches
TemporarySummon.h
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore 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 <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef TRINITYCORE_TEMPSUMMON_H
19#define TRINITYCORE_TEMPSUMMON_H
20
21#include "Creature.h"
22
24{
25 // Warlock pets
26 PET_IMP = 416,
31 PET_FELGUARD = 30146,
32 PET_INCUBUS = 184600,
33
34 // Death Knight pets
35 PET_GHOUL = 26125,
37
38 // Shaman pet
39 PET_SPIRIT_WOLF = 29264
40};
41
43
45{
46 public:
47 explicit TempSummon(SummonPropertiesEntry const* properties, WorldObject* owner, bool isWorldObject);
48 virtual ~TempSummon();
49 void Update(uint32 diff) override;
50 virtual void InitStats(WorldObject* summoner, Milliseconds duration);
51 virtual void InitSummon(WorldObject* summoner);
52 void UpdateObjectVisibilityOnCreate() override;
53 void UpdateObjectVisibilityOnDestroy() override;
54 virtual void UnSummon(uint32 msTime = 0);
55 void RemoveFromWorld() override;
56 void SetTempSummonType(TempSummonType type);
57 void SaveToDB(uint32 /*mapid*/, std::vector<Difficulty> const& /*spawnDifficulties*/) override { }
58 WorldObject* GetSummoner() const;
59 Unit* GetSummonerUnit() const;
60 Creature* GetSummonerCreatureBase() const;
61 GameObject* GetSummonerGameObject() const;
62 ObjectGuid GetSummonerGUID() const { return m_summonerGUID; }
63 TempSummonType GetSummonType() const { return m_type; }
64 Milliseconds GetTimer() const { return m_timer; }
65 void RefreshTimer() { m_timer = m_lifetime; }
66 void ModifyTimer(Milliseconds mod) { m_timer += mod; m_lifetime += mod; }
67 Optional<uint32> GetCreatureIdVisibleToSummoner() const { return m_creatureIdVisibleToSummoner; }
68 Optional<uint32> GetDisplayIdVisibleToSummoner() const { return m_displayIdVisibleToSummoner; }
69 bool CanFollowOwner() const { return m_canFollowOwner; }
70 void SetCanFollowOwner(bool can) { m_canFollowOwner = can; }
71
73
74 std::string GetDebugInfo() const override;
75
76 protected:
77 std::ptrdiff_t FindUsableTotemSlot(Unit const* summoner) const;
78
79 private:
80 bool IsSharingTotemSlotWith(ObjectGuid objectGuid) const;
88};
89
91{
92 public:
93 Minion(SummonPropertiesEntry const* properties, Unit* owner, bool isWorldObject);
94 void InitStats(WorldObject* summoner, Milliseconds duration) override;
95 void RemoveFromWorld() override;
96 void setDeathState(DeathState s) override;
97 Unit* GetOwner() const { return m_owner; }
98 float GetFollowAngle() const override { return m_followAngle; }
99 void SetFollowAngle(float angle) { m_followAngle = angle; }
100
101 // Warlock pets
102 bool IsPetImp() const { return GetEntry() == PET_IMP; }
103 bool IsPetFelhunter() const { return GetEntry() == PET_FEL_HUNTER; }
104 bool IsPetVoidwalker() const { return GetEntry() == PET_VOID_WALKER; }
105 bool IsPetSayaad() const { return GetEntry() == PET_SUCCUBUS || GetEntry() == PET_INCUBUS; }
106 bool IsPetDoomguard() const { return GetEntry() == PET_DOOMGUARD; }
107 bool IsPetFelguard() const { return GetEntry() == PET_FELGUARD; }
108 bool IsWarlockPet() const { return IsPetImp() || IsPetFelhunter() || IsPetVoidwalker() || IsPetSayaad() || IsPetDoomguard() || IsPetFelguard(); }
109
110 // Death Knight pets
111 bool IsPetGhoul() const { return GetEntry() == PET_GHOUL; } // Ghoul may be guardian or pet
112 bool IsPetAbomination() const { return GetEntry() == PET_ABOMINATION; } // Sludge Belcher dk talent
113
114 // Shaman pet
115 bool IsSpiritWolf() const { return GetEntry() == PET_SPIRIT_WOLF; } // Spirit wolf from feral spirits
116
117 bool IsGuardianPet() const;
118
119 std::string GetDebugInfo() const override;
120 protected:
121 Unit* const m_owner;
123};
124
126{
127 public:
128 Guardian(SummonPropertiesEntry const* properties, Unit* owner, bool isWorldObject);
129 void InitStats(WorldObject* summoner, Milliseconds duration) override;
130 bool InitStatsForLevel(uint8 level);
131 void InitSummon(WorldObject* summoner) override;
132
133 bool UpdateStats(Stats stat) override;
134 bool UpdateAllStats() override;
135 void UpdateResistances(uint32 school) override;
136 void UpdateArmor() override;
137 void UpdateMaxHealth() override;
138 void UpdateMaxPower(Powers power) override;
139 void UpdateAttackPowerAndDamage(bool ranged = false) override;
140 void UpdateDamagePhysical(WeaponAttackType attType) override;
141
142 int32 GetBonusDamage() const { return m_bonusSpellDamage; }
143 float GetBonusStatFromOwner(Stats stat) const { return m_statFromOwner[stat]; }
144 void SetBonusDamage(int32 damage);
145 std::string GetDebugInfo() const override;
146 protected:
148 float m_statFromOwner[MAX_STATS];
149};
150
152{
153 public:
154 Puppet(SummonPropertiesEntry const* properties, Unit* owner);
155 void InitStats(WorldObject* summoner, Milliseconds duration) override;
156 void InitSummon(WorldObject* summoner) override;
157 void Update(uint32 time) override;
158};
159
161{
162public:
163 ForcedUnsummonDelayEvent(TempSummon& owner) : BasicEvent(), m_owner(owner) { }
164 bool Execute(uint64 e_time, uint32 p_time) override;
165
166private:
168};
169#endif
#define TC_GAME_API
Definition: Define.h:124
uint8_t uint8
Definition: Define.h:145
int32_t int32
Definition: Define.h:139
uint64_t uint64
Definition: Define.h:142
uint32_t uint32
Definition: Define.h:143
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
Definition: Duration.h:29
TempSummonType
Definition: ObjectDefines.h:62
std::optional< T > Optional
Optional helper class to wrap optional values within.
Definition: Optional.h:25
#define MAX_STATS
WeaponAttackType
Powers
Stats
PetEntry
@ PET_FEL_HUNTER
@ PET_ABOMINATION
@ PET_GHOUL
@ PET_SUCCUBUS
@ PET_SPIRIT_WOLF
@ PET_DOOMGUARD
@ PET_VOID_WALKER
@ PET_IMP
@ PET_FELGUARD
@ PET_INCUBUS
DeathState
Definition: Unit.h:242
void setDeathState(DeathState s) override
Definition: Creature.cpp:2176
bool UpdateAllStats() override
Definition: StatSystem.cpp:902
void Update(uint32 time) override
Definition: Creature.cpp:704
bool UpdateStats(Stats stat) override
Definition: StatSystem.cpp:897
void RemoveFromWorld() override
Definition: Creature.cpp:351
void UpdateAttackPowerAndDamage(bool ranged=false) override
Definition: StatSystem.cpp:966
void UpdateArmor() override
Definition: StatSystem.cpp:916
void UpdateMaxPower(Powers power) override
Definition: StatSystem.cpp:951
std::string GetDebugInfo() const override
Definition: Creature.cpp:3587
void UpdateMaxHealth() override
Definition: StatSystem.cpp:923
ForcedUnsummonDelayEvent(TempSummon &owner)
float GetBonusStatFromOwner(Stats stat) const
int32 m_bonusSpellDamage
int32 GetBonusDamage() const
float m_followAngle
bool IsPetDoomguard() const
bool IsPetImp() const
void SetFollowAngle(float angle)
Unit * GetOwner() const
bool IsPetFelhunter() const
bool IsSpiritWolf() const
Unit *const m_owner
bool IsPetSayaad() const
bool IsWarlockPet() const
float GetFollowAngle() const override
bool IsPetFelguard() const
bool IsPetAbomination() const
bool IsPetVoidwalker() const
bool IsPetGhoul() const
uint32 GetEntry() const
Definition: Object.h:160
Optional< uint32 > GetCreatureIdVisibleToSummoner() const
Milliseconds m_timer
Optional< uint32 > GetDisplayIdVisibleToSummoner() const
TempSummonType GetSummonType() const
ObjectGuid GetSummonerGUID() const
void SaveToDB(uint32, std::vector< Difficulty > const &) override
void SetCanFollowOwner(bool can)
bool CanFollowOwner() const
SummonPropertiesEntry const *const m_Properties
Optional< uint32 > m_displayIdVisibleToSummoner
ObjectGuid m_summonerGUID
TempSummonType m_type
Optional< uint32 > m_creatureIdVisibleToSummoner
void RefreshTimer()
Milliseconds GetTimer() const
bool m_canFollowOwner
virtual ~TempSummon()
void ModifyTimer(Milliseconds mod)
Milliseconds m_lifetime
Definition: Unit.h:747
virtual void UpdateResistances(uint32 school)
Definition: Unit.cpp:9102
virtual void UpdateDamagePhysical(WeaponAttackType attType)
Definition: StatSystem.cpp:64
virtual void UpdateObjectVisibilityOnDestroy()
Definition: Object.h:704
virtual void UpdateObjectVisibilityOnCreate()
Definition: Object.h:703