summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Behaviors/BehaviorAttackerMelee.cpp
blob: 3d25f34b4295e43e46d3dcaec9b2f6398feba158 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include "Globals.h"  // NOTE: MSVC stupidness requires this to be the same across all modules

#include "BehaviorAttackerMelee.h"
#include "../Monster.h"
#include "../../Entities/Pawn.h"
#include "../../BlockID.h"

cBehaviorAttackerMelee::cBehaviorAttackerMelee(PostAttackFunction a_PostAttackFunction)
	: m_PostAttackFunction(a_PostAttackFunction)
{

}





bool cBehaviorAttackerMelee::DoStrike(int a_StrikeTickCnt)
{
	UNUSED(a_StrikeTickCnt);
	GetTarget()->TakeDamage(dtMobAttack, m_Parent, m_AttackDamage, 0);
	if (m_PostAttackFunction != nullptr)
	{
		m_PostAttackFunction(*this, *m_Parent, *GetTarget());
	}
	return true; // Finish the strike. It only takes 1 tick.
}