aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/ArrowAttackGoal.h
blob: 0dccdb6f8163f1794fde677bf746b825ab1af7e4 (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
#pragma once

#include "Goal.h"

class ArrowAttackGoal : public Goal
{
public:
	static const int ArrowType = 1;
	static const int SnowballType = 2;

	Level *level;
	Mob *mob; // Owner of this goal
	weak_ptr<Mob> target;
	int attackTime;
	float speed;
	int seeTime;
	int projectileType;
	int attackInterval;

	ArrowAttackGoal(Mob *mob, float speed, int projectileType, int attackInterval);

	virtual bool canUse();
	virtual bool canContinueToUse();
	virtual void stop();
	virtual void tick();

private:
	void fireAtTarget();

public:
	// 4J Added override to update ai elements when loading entity from schematics
	virtual void setLevel(Level *level) { this->level = level; }
};