blob: 2bdb81ec1bd88db2522d16ba15ede37dde1629fb (
plain)
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
#pragma once
#include "TargetGoal.h"
#include "EntitySelector.h"
class NearestAttackableTargetGoal;
// Anonymous class from NearestAttackableTargetGoal
class SubselectEntitySelector : public EntitySelector
{
private:
EntitySelector *m_subselector;
NearestAttackableTargetGoal *m_parent;
public:
SubselectEntitySelector(NearestAttackableTargetGoal *parent, EntitySelector *subselector);
~SubselectEntitySelector();
bool matches(shared_ptr<Entity> entity) const;
};
class NearestAttackableTargetGoal : public TargetGoal
{
friend class SubselectEntitySelector;
public:
class DistComp
{
private:
Entity *source;
public:
DistComp(Entity *source);
bool operator() (shared_ptr<Entity> e1, shared_ptr<Entity> e2);
};
private:
const type_info& targetType;
int randomInterval;
DistComp *distComp;
EntitySelector *selector;
weak_ptr<LivingEntity> target;
public:
NearestAttackableTargetGoal(PathfinderMob *mob, const type_info& targetType, int randomInterval, bool mustSee, bool mustReach = false, EntitySelector *entitySelector = nullptr);
virtual ~NearestAttackableTargetGoal();
virtual bool canUse();
void start();
};
|