184 lines
5.7 KiB
C++
184 lines
5.7 KiB
C++
#pragma once
|
|
|
|
#include "base_agent.h"
|
|
|
|
namespace a8
|
|
{
|
|
template<typename T>
|
|
static auto SpToWp(std::shared_ptr<T> sp)
|
|
{
|
|
return std::weak_ptr<T>(sp);
|
|
}
|
|
}
|
|
|
|
class Hero;
|
|
class RoomAgent;
|
|
class TeamAgent;
|
|
class TargetAgent;
|
|
class MasterAgent;
|
|
class TeammateAgent;
|
|
class HeroAgent : public BaseAgent
|
|
{
|
|
public:
|
|
HeroAgent();
|
|
|
|
virtual ~HeroAgent() override;
|
|
|
|
BEHAVIAC_DECLARE_AGENTTYPE(HeroAgent, BaseAgent)
|
|
|
|
void SetOwner(Creature* owner);
|
|
|
|
int GetUniId();
|
|
int GetAgentType();
|
|
bool IsMoving();
|
|
glm::vec3 GetPos();
|
|
bool IsDead();
|
|
glm::vec3 GetSafeAreaCenter();
|
|
float GetSafeAreaRadius();
|
|
float GetHp();
|
|
float GetMaxHp();
|
|
void OpenBulletTraceMode();
|
|
void CloseBulletTraceMode();
|
|
float CalcDistance(const glm::vec3& target_pos);
|
|
int GetHeroId();
|
|
int GetLevel();
|
|
bool CanShot();
|
|
bool CanUseSkill(int skill_id);
|
|
void SendEmote(int emote);
|
|
int GetBattleTimes();
|
|
int GetTodayBattleTimes();
|
|
void SetMoveDir(const glm::vec3& dir);
|
|
void SetAttackDir(const glm::vec3& dir);
|
|
void ShotNormal(const glm::vec3& dir);
|
|
void ShotTrace();
|
|
glm::vec3 GetRandomDir();
|
|
glm::vec3 GetTargetDir();
|
|
glm::vec3 RandomPoint(const glm::vec3& center, float range);
|
|
float GetShotRange();
|
|
void SetV(int id, int val);
|
|
int GetV(int id);
|
|
int IncV(int id, int val);
|
|
int DecV(int id, int val);
|
|
bool HasBuffEffect(int effect_id);
|
|
bool IsNearGas(float anti_range);
|
|
bool MasterInRange(float anti_range);
|
|
bool HasFlag(int tag);
|
|
void SetFlag(int tag);
|
|
void UnSetFlag(int tag);
|
|
bool TargetInShotRange();
|
|
bool InTargetShotRange();
|
|
void ResetShotTimes();
|
|
void ResetUseSkillTimes();
|
|
int GetShotTimes();
|
|
int GetUseSkillTimes();
|
|
float GetTargetManhattanDistance();
|
|
std::string GetSkillBtFile();
|
|
void Abort(behaviac::string msg, behaviac::vector<int> args);
|
|
bool HasUseableSkill();
|
|
bool HasObserver();
|
|
int GetAliveEnemyNum();
|
|
int GetLastShotPassTime();
|
|
int GetLastUseSkillPassTime();
|
|
int GetLastAttackPassTime();
|
|
float GetHPRate();
|
|
bool TargetInRange(float range);
|
|
float GetNewAttackerHPRate();
|
|
bool GetNewAttackerInRange(float range);
|
|
int GetNewAttackerPassTime();
|
|
bool HasNewAttacker();
|
|
bool NewAttackerIsHuman();
|
|
bool SwitchToNewAttacker();
|
|
int GetReviveCount();
|
|
void SetBulletAngleOffset(int min_val, int max_val);
|
|
int SearchPickupObj();
|
|
bool PickupObjIsValid();
|
|
void AbandonPickup(int min_time, int max_time);
|
|
bool CanThrowItem(int slot);
|
|
float GetTeammateManhattanDistance();
|
|
bool TeammateIsValid();
|
|
void GetDown();
|
|
void SwitchSeat(int seat);
|
|
bool CarHasOil();
|
|
float GetCarCurOil();
|
|
float GetCarMaxOil();
|
|
bool IsSingleCar();
|
|
bool CarHasBuffEffect(int effect_id);
|
|
bool CanAttack();
|
|
|
|
behaviac::EBTStatus RegisterEvents(behaviac::vector<BtEvent_e> events);
|
|
behaviac::EBTStatus ClearEvents();
|
|
behaviac::EBTStatus SearchEnemy(float range);
|
|
behaviac::EBTStatus SearchHumanEnemy(float range);
|
|
behaviac::EBTStatus TrySearchEnemy(float range, int min_interval, int max_interval);
|
|
behaviac::EBTStatus DebugOut(std::string msg, int arg0, int arg1, int arg2);
|
|
behaviac::EBTStatus RandomSafeZonePoint(int try_count, int step_len);
|
|
behaviac::EBTStatus Pickup();
|
|
behaviac::EBTStatus ThrowItem(int slot);
|
|
behaviac::EBTStatus SearchTeammate(int range);
|
|
behaviac::EBTStatus TrySearchTeammate(int range);
|
|
|
|
behaviac::EBTStatus CoIdle(int min_val, int max_val);
|
|
behaviac::EBTStatus CoMoveCurrentTargetRaycast();
|
|
behaviac::EBTStatus CoShotCurrentTargetRaycast();
|
|
behaviac::EBTStatus CoMoveMasterRaycast();
|
|
behaviac::EBTStatus CoFindPath(const glm::vec3& pos);
|
|
behaviac::EBTStatus CoFindPathEx(const glm::vec3& pos, float distance);
|
|
behaviac::EBTStatus CoStartMove(int min_val, int max_val);
|
|
behaviac::EBTStatus CoMoveForward(int min_val, int max_val);
|
|
behaviac::EBTStatus CoSleep(int time);
|
|
behaviac::EBTStatus CoUseSkill(int skill_id);
|
|
behaviac::EBTStatus CoGetRunAwayPoint();
|
|
behaviac::EBTStatus CoGetNextMobaModeRoadPoint();
|
|
|
|
virtual Room* GetRoom() override;
|
|
|
|
public:
|
|
|
|
RoomAgent* room_agent = nullptr;
|
|
TeamAgent* team_agent = nullptr;
|
|
MasterAgent* master_agent = nullptr;
|
|
TargetAgent* current_target_agent = nullptr;
|
|
TeammateAgent* current_teammate_agent = nullptr;
|
|
float task_param0 = 0.0f;
|
|
float task_param1 = 0.0f;
|
|
float task_param2 = 0.0f;
|
|
float task_param3 = 0.0f;
|
|
float task_param4 = 0.0f;
|
|
float tmp_val0 = 0.0f;
|
|
float tmp_val1 = 0.0f;
|
|
float tmp_val2 = 0.0f;
|
|
float tmp_val3 = 0.0f;
|
|
float tmp_val4 = 0.0f;
|
|
glm::vec3 tmp_point0 = glm::vec3(0.0f, 0.0f, 0.0f);
|
|
glm::vec3 tmp_point1 = glm::vec3(0.0f, 0.0f, 0.0f);
|
|
glm::vec3 tmp_point2 = glm::vec3(0.0f, 0.0f, 0.0f);
|
|
int out_errno = 0;
|
|
float out_val0 = 0.0;
|
|
float out_val1 = 0.0;
|
|
float out_val2 = 0.0;
|
|
float out_val3 = 0.0;
|
|
float out_val4 = 0.0;
|
|
glm::vec3 out_point0 = glm::vec3(0.0f, 0.0f, 0.0f);
|
|
glm::vec3 out_point1 = glm::vec3(0.0f, 0.0f, 0.0f);
|
|
glm::vec3 out_point2 = glm::vec3(0.0f, 0.0f, 0.0f);
|
|
|
|
protected:
|
|
bool InternalUseSkill(int skill_id, int& wait_time);
|
|
|
|
Creature* owner_ = nullptr;
|
|
private:
|
|
EntityWeakPtr curr_pickup_obj_;
|
|
bool bullet_trace_mode_ = false;
|
|
long long flags_ = 0;
|
|
int shot_times_ = 0;
|
|
int useskill_times_ = 0;
|
|
long long last_shot_frameno_ = 0;
|
|
long long last_useskill_frameno_ = 0;
|
|
std::map<int, int> dyn_hash_;
|
|
int bullet_angle_offset_min_ = 0;
|
|
int bullet_angle_offset_max_ = 0;
|
|
long long last_try_search_enemy_frameno_ = 0;
|
|
long long last_throw_item_frameno_ = 0;
|
|
std::map<int, int> abandon_pickup_hash_;
|
|
};
|