From b691c43c44ff180d10e7d4a9afc83b98551ff586 Mon Sep 17 00:00:00 2001 From: daoge_cmd <3523206925@qq.com> Date: Sun, 1 Mar 2026 12:16:08 +0800 Subject: Initial commit --- Minecraft.World/TargetGoal.h | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 Minecraft.World/TargetGoal.h (limited to 'Minecraft.World/TargetGoal.h') diff --git a/Minecraft.World/TargetGoal.h b/Minecraft.World/TargetGoal.h new file mode 100644 index 00000000..3bb9da09 --- /dev/null +++ b/Minecraft.World/TargetGoal.h @@ -0,0 +1,44 @@ +#pragma once + +#include "Goal.h" + +class TargetGoal : public Goal +{ + +public: + static const int TargetFlag = 1; + +private: + static const int EmptyReachCache = 0; + static const int CanReachCache = 1; + static const int CantReachCache = 2; + static const int UnseenMemoryTicks = 60; + +protected: + Mob *mob; // Owner of this goal + float within; + bool mustSee; + +private: + bool mustReach; + int reachCache; + int reachCacheTime; + int unseenTicks; + + void _init(Mob *mob, float within, bool mustSee, bool mustReach); + +public: + TargetGoal(Mob *mob, float within, bool mustSee); + TargetGoal(Mob *mob, float within, bool mustSee, bool mustReach); + virtual ~TargetGoal() {} + + virtual bool canContinueToUse(); + virtual void start(); + virtual void stop(); + +protected: + virtual bool canAttack(shared_ptr target, bool allowInvulnerable); + +private: + bool canReach(shared_ptr target); +}; \ No newline at end of file -- cgit v1.2.3