Cuberite
A lightweight, fast and extensible game server for Minecraft
Wolf.h
Go to the documentation of this file.
1 
2 #pragma once
3 
5 #include "../UUID.h"
6 
7 
8 class cEntity;
9 
10 
11 
12 class cWolf :
14 {
16 
17 public:
18  cWolf(void);
19 
21 
22  void NotifyAlliesOfFight(cPawn * a_Opponent);
23  virtual bool DoTakeDamage(TakeDamageInfo & a_TDI) override;
24  virtual void OnRightClicked(cPlayer & a_Player) override;
25  virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
26  virtual void TickFollowPlayer();
27  virtual bool Attack(std::chrono::milliseconds a_Dt) override;
28 
29  // Get functions
30  bool IsSitting (void) const override { return m_IsSitting; }
31  bool IsTame (void) const override { return m_IsTame; }
32  bool IsBegging (void) const { return m_IsBegging; }
33  bool IsAngry (void) const { return m_IsAngry; }
34  AString GetOwnerName (void) const { return m_OwnerName; }
35  cUUID GetOwnerUUID (void) const { return m_OwnerUUID; }
36  int GetCollarColor(void) const { return m_CollarColor; }
37 
38  // Set functions
39  void SetIsSitting (bool a_IsSitting) { m_IsSitting = a_IsSitting; }
40  void SetIsTame (bool a_IsTame) { m_IsTame = a_IsTame; }
41  void SetIsBegging (bool a_IsBegging) { m_IsBegging = a_IsBegging; }
42  void SetIsAngry (bool a_IsAngry) { m_IsAngry = a_IsAngry; }
43  void SetCollarColor(int a_CollarColor) { m_CollarColor = a_CollarColor; }
44  void SetOwner (const AString & a_NewOwnerName, const cUUID & a_NewOwnerUUID)
45  {
46  m_OwnerName = a_NewOwnerName;
47  m_OwnerUUID = a_NewOwnerUUID;
48  }
49 
57  void ReceiveNearbyFightInfo(const cUUID & a_PlayerUUID, cPawn * a_Opponent, bool a_IsPlayerInvolved);
58 
59  virtual void InStateIdle(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
60 
61 protected:
62 
64  bool m_IsTame;
66  bool m_IsAngry;
71 } ;
72 
73 
74 
75 
void SetIsBegging(bool a_IsBegging)
Definition: Wolf.h:41
Definition: FastNBT.h:131
void SetIsTame(bool a_IsTame)
Definition: Wolf.h:40
virtual void Tick(std::chrono::milliseconds a_Dt, cChunk &a_Chunk) override
Definition: Wolf.cpp:251
bool IsAngry(void) const
Definition: Wolf.h:33
bool m_IsBegging
Definition: Wolf.h:65
Definition: Player.h:27
AString GetOwnerName(void) const
Definition: Wolf.h:34
AString m_OwnerName
Definition: Wolf.h:67
cUUID m_OwnerUUID
Definition: Wolf.h:68
Definition: Chunk.h:49
cWolf(void)
Definition: Wolf.cpp:13
virtual void TickFollowPlayer()
Definition: Wolf.cpp:346
void SetCollarColor(int a_CollarColor)
Definition: Wolf.h:43
void NotifyAlliesOfFight(cPawn *a_Opponent)
Definition: Wolf.cpp:75
Definition: UUID.h:10
bool m_IsAngry
Definition: Wolf.h:66
bool m_IsTame
Definition: Wolf.h:64
bool IsBegging(void) const
Definition: Wolf.h:32
int GetCollarColor(void) const
Definition: Wolf.h:36
void SetIsAngry(bool a_IsAngry)
Definition: Wolf.h:42
bool IsSitting(void) const override
Definition: Wolf.h:30
bool m_IsSitting
Definition: Wolf.h:63
virtual void InStateIdle(std::chrono::milliseconds a_Dt, cChunk &a_Chunk) override
Definition: Wolf.cpp:394
cUUID GetOwnerUUID(void) const
Definition: Wolf.h:35
void SetOwner(const AString &a_NewOwnerName, const cUUID &a_NewOwnerUUID)
Definition: Wolf.h:44
Definition: Pawn.h:15
virtual void OnRightClicked(cPlayer &a_Player) override
Called when the specified player right-clicks this entity.
Definition: Wolf.cpp:167
int m_NotificationCooldown
Definition: Wolf.h:70
void SetIsSitting(bool a_IsSitting)
Definition: Wolf.h:39
std::string AString
Definition: StringUtils.h:13
virtual bool Attack(std::chrono::milliseconds a_Dt) override
Try to perform attack returns true if attack was deemed successful (hit player, fired projectile...
Definition: Wolf.cpp:95
Definition: Entity.h:73
int m_CollarColor
Definition: Wolf.h:69
Definition: Wolf.h:12
#define CLASS_PROTODEF(classname)
Definition: Entity.h:11
bool IsTame(void) const override
Definition: Wolf.h:31
void ReceiveNearbyFightInfo(const cUUID &a_PlayerUUID, cPawn *a_Opponent, bool a_IsPlayerInvolved)
Notfies the wolf of a nearby fight.
Definition: Wolf.cpp:117
virtual bool DoTakeDamage(TakeDamageInfo &a_TDI) override
Makes this entity take damage specified in the a_TDI.
Definition: Wolf.cpp:30
cPassiveAggressiveMonster super
Definition: Wolf.h:15