Rehti MMORPG  1.0.0
Rehti MMORPG is a free and open source MMORPG game.
AggressiveNpc.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "Npc.hpp"
4 
5 class PlayerCharacter;
6 
10 class AggressiveNpc : public Npc
11 {
12 
13 public:
14  AggressiveNpc(GameWorld* pGameWorld, std::string name, int aggressionRange, int baseDamage, int baseAccuracy, SpawnCoordinateBounds spawnCoordinateBounds, std::vector<std::string> chatResponses, unsigned int id = 0, Coordinates location = Coordinates());
15 
16  ~AggressiveNpc() = default;
17 
23  void update() override;
24 
25 private:
31  std::shared_ptr<PlayerCharacter> findClosestPlayer();
32 
34 };
AggressiveNpc is a type of Npc that attacks the player within its aggression range.
Definition: AggressiveNpc.hpp:11
std::shared_ptr< PlayerCharacter > findClosestPlayer()
Finds the closest player to the AggressiveNpc.
Definition: AggressiveNpc.cpp:44
~AggressiveNpc()=default
int aggressionRangeM
Definition: AggressiveNpc.hpp:33
AggressiveNpc(GameWorld *pGameWorld, std::string name, int aggressionRange, int baseDamage, int baseAccuracy, SpawnCoordinateBounds spawnCoordinateBounds, std::vector< std::string > chatResponses, unsigned int id=0, Coordinates location=Coordinates())
Definition: AggressiveNpc.cpp:7
void update() override
Updates the AggressiveNpc.
Definition: AggressiveNpc.cpp:28
GameWorld class. It contains all the player, npc, object and item instances.
Definition: GameWorld.hpp:16
Base NPC class. It represents a peaceful NPC that does not attack the player under any circumstances.
Definition: Npc.hpp:11
Class for a human player character.
Definition: PlayerCharacter.hpp:12
Struct for coordinates.
Definition: Coordinates.hpp:7
Contains the spawn coordinate bounds for a character.
Definition: CharacterReader.hpp:10