This commit is contained in:
aozhiwei 2023-10-24 10:57:16 +08:00
parent e002dd258d
commit 1ca8cabe49
5 changed files with 15 additions and 8 deletions

View File

@ -633,7 +633,7 @@ namespace behaviac
virtual bool load() virtual bool load()
{ {
AgentMeta::SetTotalSignature(11432057u); AgentMeta::SetTotalSignature(124058712u);
AgentMeta* meta = NULL; AgentMeta* meta = NULL;
BEHAVIAC_UNUSED_VAR(meta); BEHAVIAC_UNUSED_VAR(meta);
@ -708,9 +708,9 @@ namespace behaviac
meta->RegisterMethod(502968959u, BEHAVIAC_NEW CMethod_behaviac_Agent_VectorRemove()); meta->RegisterMethod(502968959u, BEHAVIAC_NEW CMethod_behaviac_Agent_VectorRemove());
// TargetAgent // TargetAgent
meta = BEHAVIAC_NEW AgentMeta(3584474458u); meta = BEHAVIAC_NEW AgentMeta(1611323337u);
AgentMeta::GetAgentMetas()[498664641u] = meta; AgentMeta::GetAgentMetas()[498664641u] = meta;
meta->RegisterMethod(347903289u, BEHAVIAC_NEW CAgentMethodVoid_1<int>(FunctionPointer_TargetAgent_Abandon)); meta->RegisterMethod(347903289u, BEHAVIAC_NEW CAgentMethodVoid_2<int, int>(FunctionPointer_TargetAgent_Abandon));
meta->RegisterMethod(97826769u, BEHAVIAC_NEW CAgentMethodVoid(FunctionPointer_TargetAgent_ClearAbandon)); meta->RegisterMethod(97826769u, BEHAVIAC_NEW CAgentMethodVoid(FunctionPointer_TargetAgent_ClearAbandon));
meta->RegisterMethod(2524021140u, BEHAVIAC_NEW CAgentMethod< int >(FunctionPointer_TargetAgent_GetHeroId)); meta->RegisterMethod(2524021140u, BEHAVIAC_NEW CAgentMethod< int >(FunctionPointer_TargetAgent_GetHeroId));
meta->RegisterMethod(3358849663u, BEHAVIAC_NEW CAgentMethod< float >(FunctionPointer_TargetAgent_GetHp)); meta->RegisterMethod(3358849663u, BEHAVIAC_NEW CAgentMethod< float >(FunctionPointer_TargetAgent_GetHp));

View File

@ -41,7 +41,7 @@ namespace behaviac
inline int FunctionPointer_TeamAgent_GetMemberNum(Agent* self) { return ((TeamAgent*)self)->GetMemberNum(); } inline int FunctionPointer_TeamAgent_GetMemberNum(Agent* self) { return ((TeamAgent*)self)->GetMemberNum(); }
inline int FunctionPointer_TeamAgent_GetPlayerNum(Agent* self) { return ((TeamAgent*)self)->GetPlayerNum(); } inline int FunctionPointer_TeamAgent_GetPlayerNum(Agent* self) { return ((TeamAgent*)self)->GetPlayerNum(); }
inline void FunctionPointer_TeamAgent_LogMessage(char* param0) { TeamAgent::LogMessage(param0); } inline void FunctionPointer_TeamAgent_LogMessage(char* param0) { TeamAgent::LogMessage(param0); }
inline void FunctionPointer_TargetAgent_Abandon(Agent* self, int time) { ((TargetAgent*)self)->Abandon(time); } inline void FunctionPointer_TargetAgent_Abandon(Agent* self, int min_time, int max_time) { ((TargetAgent*)self)->Abandon(min_time, max_time); }
inline void FunctionPointer_TargetAgent_ClearAbandon(Agent* self) { ((TargetAgent*)self)->ClearAbandon(); } inline void FunctionPointer_TargetAgent_ClearAbandon(Agent* self) { ((TargetAgent*)self)->ClearAbandon(); }
inline int FunctionPointer_TargetAgent_GetHeroId(Agent* self) { return ((TargetAgent*)self)->GetHeroId(); } inline int FunctionPointer_TargetAgent_GetHeroId(Agent* self) { return ((TargetAgent*)self)->GetHeroId(); }
inline float FunctionPointer_TargetAgent_GetHp(Agent* self) { return ((TargetAgent*)self)->GetHp(); } inline float FunctionPointer_TargetAgent_GetHp(Agent* self) { return ((TargetAgent*)self)->GetHp(); }

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!--EXPORTED BY TOOL, DON'T MODIFY IT!--> <!--EXPORTED BY TOOL, DON'T MODIFY IT!-->
<agents version="1" signature="11432057"> <agents version="1" signature="124058712">
<agent type="HeroAgent" base="BaseAgent" signature="1984263157"> <agent type="HeroAgent" base="BaseAgent" signature="1984263157">
<properties> <properties>
<property name="current_target_agent" type="TargetAgent*" member="false" static="false" defaultvalue="null" /> <property name="current_target_agent" type="TargetAgent*" member="false" static="false" defaultvalue="null" />

View File

@ -73,8 +73,9 @@ int TargetAgent::GetLevel()
return target_.Get()->level; return target_.Get()->level;
} }
void TargetAgent::Abandon(int time) void TargetAgent::Abandon(int min_time, int max_time)
{ {
int time = a8::RandEx(min_time, max_time);
if (target_.Get()) { if (target_.Get()) {
auto itr = owner_->ignore_target_hash.find(target_.Get()->GetUniId()); auto itr = owner_->ignore_target_hash.find(target_.Get()->GetUniId());
if (itr != owner_->ignore_target_hash.end()) { if (itr != owner_->ignore_target_hash.end()) {
@ -121,7 +122,13 @@ void TargetAgent::SetTarget(Creature* target)
void TargetAgent::ClearAbandon() void TargetAgent::ClearAbandon()
{ {
std::vector<a8::XTimerWp> del_timers;
for (auto pair : owner_->ignore_target_hash) {
del_timers.push_back(pair.second);
}
for (auto t : del_timers) {
owner_->room->xtimer.Delete(t);
}
} }
float TargetAgent::GetHPRate() float TargetAgent::GetHPRate()

View File

@ -21,7 +21,7 @@ public:
float GetMaxHp(); float GetMaxHp();
int GetHeroId(); int GetHeroId();
int GetLevel(); int GetLevel();
void Abandon(int time); void Abandon(int min_time, int max_time);
float GetShotRange(); float GetShotRange();
void ClearAbandon(); void ClearAbandon();
float GetHPRate(); float GetHPRate();