Rehti MMORPG  1.0.0
Rehti MMORPG is a free and open source MMORPG game.
AttackAction Class Reference

Action used for attacks. More...

#include <AttackAction.hpp>

Inheritance diagram for AttackAction:
Inheritance graph
Collaboration diagram for AttackAction:
Collaboration graph

Public Member Functions

 AttackAction (std::chrono::system_clock::time_point startTime, std::shared_ptr< Entity > pTarget, std::shared_ptr< Entity > pEntity)
 
 ~AttackAction ()=default
 
std::shared_ptr< Entity > & getTarget ()
 Get the target Entity of the action. More...
 
void act ()
 Attack functionality, which performs attacks against target and moves closer to the target if not in range. Implementation of pure virtual method act() of the base class. More...
 
CurrentAction getActionInfo ()
 Returns information about the current action. More...
 
- Public Member Functions inherited from Action
 Action (std::chrono::system_clock::time_point startTime, std::shared_ptr< Entity > pEntity)
 
 ~Action ()=default
 
std::chrono::system_clock::time_point getStartTime ()
 Get the time when the action started. More...
 
std::chrono::milliseconds getActionTime ()
 Get the time how long a single iteration of the action takes. More...
 
ActionType getActionType ()
 Get the ActionType object. More...
 
bool isCompleted ()
 Returns true if the action is completed. More...
 

Private Member Functions

std::vector< std::pair< int, int > > findPathToTarget ()
 Finds a path to the target. More...
 

Private Attributes

std::shared_ptr< EntitypTargetM
 
std::chrono::milliseconds actionTimeM
 
std::chrono::milliseconds moveTimeM
 
ActionType actionTypeM = ActionType::Attack
 
std::vector< std::pair< int, int > > pathToTargetM
 Path to the target. More...
 
std::optional< CoordinatesnextMoveM
 The next move to be taken, is defined if the target is not in range. More...
 
bool targetInRangeM = false
 True if the target is in range. More...
 

Additional Inherited Members

- Protected Attributes inherited from Action
std::chrono::system_clock::time_point startTimeM
 
std::chrono::milliseconds actionTimeM = std::chrono::milliseconds(0)
 
ActionType actionTypeM = ActionType::None
 
std::shared_ptr< EntitypEntityM
 
bool completedM = false
 

Detailed Description

Action used for attacks.

Constructor & Destructor Documentation

◆ AttackAction()

AttackAction::AttackAction ( std::chrono::system_clock::time_point  startTime,
std::shared_ptr< Entity pTarget,
std::shared_ptr< Entity pEntity 
)

◆ ~AttackAction()

AttackAction::~AttackAction ( )
default

Member Function Documentation

◆ act()

void AttackAction::act ( )
virtual

Attack functionality, which performs attacks against target and moves closer to the target if not in range. Implementation of pure virtual method act() of the base class.

Implements Action.

Here is the call graph for this function:

◆ findPathToTarget()

std::vector< std::pair< int, int > > AttackAction::findPathToTarget ( )
private

Finds a path to the target.

Returns
List of x,y pairs. Empty if no path is found
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getActionInfo()

CurrentAction AttackAction::getActionInfo ( )
virtual

Returns information about the current action.

Returns
CurrentAction

Reimplemented from Action.

◆ getTarget()

std::shared_ptr< Entity > & AttackAction::getTarget ( )

Get the target Entity of the action.

Returns
std::shared_ptr<Entity>

Member Data Documentation

◆ actionTimeM

std::chrono::milliseconds AttackAction::actionTimeM
private

◆ actionTypeM

ActionType AttackAction::actionTypeM = ActionType::Attack
private

◆ moveTimeM

std::chrono::milliseconds AttackAction::moveTimeM
private

◆ nextMoveM

std::optional<Coordinates> AttackAction::nextMoveM
private

The next move to be taken, is defined if the target is not in range.

◆ pathToTargetM

std::vector<std::pair<int, int> > AttackAction::pathToTargetM
private

Path to the target.

◆ pTargetM

std::shared_ptr<Entity> AttackAction::pTargetM
private

◆ targetInRangeM

bool AttackAction::targetInRangeM = false
private

True if the target is in range.


The documentation for this class was generated from the following files: