This commit is contained in:
aozhiwei 2023-10-24 10:42:31 +08:00
parent 7b8c2f71d7
commit d2f6636635
8 changed files with 83 additions and 9 deletions

View File

@ -633,7 +633,7 @@ namespace behaviac
virtual bool load()
{
AgentMeta::SetTotalSignature(2045821862u);
AgentMeta::SetTotalSignature(11432057u);
AgentMeta* meta = NULL;
BEHAVIAC_UNUSED_VAR(meta);
@ -708,12 +708,13 @@ namespace behaviac
meta->RegisterMethod(502968959u, BEHAVIAC_NEW CMethod_behaviac_Agent_VectorRemove());
// TargetAgent
meta = BEHAVIAC_NEW AgentMeta(3502735268u);
meta = BEHAVIAC_NEW AgentMeta(3584474458u);
AgentMeta::GetAgentMetas()[498664641u] = meta;
meta->RegisterMethod(347903289u, BEHAVIAC_NEW CAgentMethodVoid_1<int>(FunctionPointer_TargetAgent_Abandon));
meta->RegisterMethod(97826769u, BEHAVIAC_NEW CAgentMethodVoid(FunctionPointer_TargetAgent_ClearAbandon));
meta->RegisterMethod(2524021140u, BEHAVIAC_NEW CAgentMethod< int >(FunctionPointer_TargetAgent_GetHeroId));
meta->RegisterMethod(3358849663u, BEHAVIAC_NEW CAgentMethod< float >(FunctionPointer_TargetAgent_GetHp));
meta->RegisterMethod(3597666367u, BEHAVIAC_NEW CAgentMethod< float >(FunctionPointer_TargetAgent_GetHPRate));
meta->RegisterMethod(3451565888u, BEHAVIAC_NEW CAgentMethod< int >(FunctionPointer_TargetAgent_GetLevel));
meta->RegisterMethod(3311091192u, BEHAVIAC_NEW CAgentMethod< float >(FunctionPointer_TargetAgent_GetMaxHp));
meta->RegisterMethod(3533946671u, BEHAVIAC_NEW CAgentMethod< glm::vec3 >(FunctionPointer_TargetAgent_GetPos));
@ -733,7 +734,7 @@ namespace behaviac
meta->RegisterMethod(502968959u, BEHAVIAC_NEW CMethod_behaviac_Agent_VectorRemove());
// HeroAgent
meta = BEHAVIAC_NEW AgentMeta(2121418526u);
meta = BEHAVIAC_NEW AgentMeta(1984263157u);
AgentMeta::GetAgentMetas()[2270112014u] = meta;
meta->RegisterMemberProperty(2706111800u, BEHAVIAC_NEW CMemberProperty< TargetAgent* >("current_target_agent", Set_HeroAgent_current_target_agent, Get_HeroAgent_current_target_agent));
meta->RegisterMemberProperty(1530109714u, BEHAVIAC_NEW CMemberProperty< MasterAgent* >("master_agent", Set_HeroAgent_master_agent, Get_HeroAgent_master_agent));
@ -787,6 +788,7 @@ namespace behaviac
meta->RegisterMethod(755433673u, BEHAVIAC_NEW CAgentMethod< int >(FunctionPointer_HeroAgent_GetBattleTimes));
meta->RegisterMethod(2524021140u, BEHAVIAC_NEW CAgentMethod< int >(FunctionPointer_HeroAgent_GetHeroId));
meta->RegisterMethod(3358849663u, BEHAVIAC_NEW CAgentMethod< float >(FunctionPointer_HeroAgent_GetHp));
meta->RegisterMethod(3597666367u, BEHAVIAC_NEW CAgentMethod< float >(FunctionPointer_HeroAgent_GetHPRate));
meta->RegisterMethod(667805456u, BEHAVIAC_NEW CAgentMethod< int >(FunctionPointer_HeroAgent_GetLastAttackPassTime));
meta->RegisterMethod(3354832405u, BEHAVIAC_NEW CAgentMethod< int >(FunctionPointer_HeroAgent_GetLastShotPassTime));
meta->RegisterMethod(829569018u, BEHAVIAC_NEW CAgentMethod< int >(FunctionPointer_HeroAgent_GetLastUseSkillPassTime));
@ -862,7 +864,7 @@ namespace behaviac
meta->RegisterMethod(502968959u, BEHAVIAC_NEW CMethod_behaviac_Agent_VectorRemove());
// AndroidAgent
meta = BEHAVIAC_NEW AgentMeta(1763976988u);
meta = BEHAVIAC_NEW AgentMeta(210764546u);
AgentMeta::GetAgentMetas()[2475098143u] = meta;
meta->RegisterMemberProperty(2706111800u, BEHAVIAC_NEW CMemberProperty< TargetAgent* >("current_target_agent", Set_HeroAgent_current_target_agent, Get_HeroAgent_current_target_agent));
meta->RegisterMemberProperty(1530109714u, BEHAVIAC_NEW CMemberProperty< MasterAgent* >("master_agent", Set_HeroAgent_master_agent, Get_HeroAgent_master_agent));
@ -917,6 +919,7 @@ namespace behaviac
meta->RegisterMethod(755433673u, BEHAVIAC_NEW CAgentMethod< int >(FunctionPointer_AndroidAgent_GetBattleTimes));
meta->RegisterMethod(2524021140u, BEHAVIAC_NEW CAgentMethod< int >(FunctionPointer_AndroidAgent_GetHeroId));
meta->RegisterMethod(3358849663u, BEHAVIAC_NEW CAgentMethod< float >(FunctionPointer_AndroidAgent_GetHp));
meta->RegisterMethod(3597666367u, BEHAVIAC_NEW CAgentMethod< float >(FunctionPointer_AndroidAgent_GetHPRate));
meta->RegisterMethod(667805456u, BEHAVIAC_NEW CAgentMethod< int >(FunctionPointer_AndroidAgent_GetLastAttackPassTime));
meta->RegisterMethod(3354832405u, BEHAVIAC_NEW CAgentMethod< int >(FunctionPointer_AndroidAgent_GetLastShotPassTime));
meta->RegisterMethod(829569018u, BEHAVIAC_NEW CAgentMethod< int >(FunctionPointer_AndroidAgent_GetLastUseSkillPassTime));

View File

@ -45,6 +45,7 @@ namespace behaviac
inline void FunctionPointer_TargetAgent_ClearAbandon(Agent* self) { ((TargetAgent*)self)->ClearAbandon(); }
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_GetHPRate(Agent* self) { return ((TargetAgent*)self)->GetHPRate(); }
inline int FunctionPointer_TargetAgent_GetLevel(Agent* self) { return ((TargetAgent*)self)->GetLevel(); }
inline float FunctionPointer_TargetAgent_GetMaxHp(Agent* self) { return ((TargetAgent*)self)->GetMaxHp(); }
inline glm::vec3 FunctionPointer_TargetAgent_GetPos(Agent* self) { return ((TargetAgent*)self)->GetPos(); }
@ -159,6 +160,7 @@ namespace behaviac
inline int FunctionPointer_HeroAgent_GetBattleTimes(Agent* self) { return ((HeroAgent*)self)->GetBattleTimes(); }
inline int FunctionPointer_HeroAgent_GetHeroId(Agent* self) { return ((HeroAgent*)self)->GetHeroId(); }
inline float FunctionPointer_HeroAgent_GetHp(Agent* self) { return ((HeroAgent*)self)->GetHp(); }
inline float FunctionPointer_HeroAgent_GetHPRate(Agent* self) { return ((HeroAgent*)self)->GetHPRate(); }
inline int FunctionPointer_HeroAgent_GetLastAttackPassTime(Agent* self) { return ((HeroAgent*)self)->GetLastAttackPassTime(); }
inline int FunctionPointer_HeroAgent_GetLastShotPassTime(Agent* self) { return ((HeroAgent*)self)->GetLastShotPassTime(); }
inline int FunctionPointer_HeroAgent_GetLastUseSkillPassTime(Agent* self) { return ((HeroAgent*)self)->GetLastUseSkillPassTime(); }
@ -247,6 +249,7 @@ namespace behaviac
inline int FunctionPointer_AndroidAgent_GetBattleTimes(Agent* self) { return ((AndroidAgent*)self)->GetBattleTimes(); }
inline int FunctionPointer_AndroidAgent_GetHeroId(Agent* self) { return ((AndroidAgent*)self)->GetHeroId(); }
inline float FunctionPointer_AndroidAgent_GetHp(Agent* self) { return ((AndroidAgent*)self)->GetHp(); }
inline float FunctionPointer_AndroidAgent_GetHPRate(Agent* self) { return ((AndroidAgent*)self)->GetHPRate(); }
inline int FunctionPointer_AndroidAgent_GetLastAttackPassTime(Agent* self) { return ((AndroidAgent*)self)->GetLastAttackPassTime(); }
inline int FunctionPointer_AndroidAgent_GetLastShotPassTime(Agent* self) { return ((AndroidAgent*)self)->GetLastShotPassTime(); }
inline int FunctionPointer_AndroidAgent_GetLastUseSkillPassTime(Agent* self) { return ((AndroidAgent*)self)->GetLastUseSkillPassTime(); }

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--EXPORTED BY TOOL, DON'T MODIFY IT!-->
<agents version="1" signature="2045821862">
<agent type="HeroAgent" base="BaseAgent" signature="2121418526">
<agents version="1" signature="11432057">
<agent type="HeroAgent" base="BaseAgent" signature="1984263157">
<properties>
<property name="current_target_agent" type="TargetAgent*" member="false" static="false" defaultvalue="null" />
<property name="master_agent" type="MasterAgent*" member="false" static="false" defaultvalue="null" />
@ -31,7 +31,7 @@
<property name="tmp_val4" type="float" member="false" static="false" defaultvalue="0" />
</properties>
</agent>
<agent type="AndroidAgent" base="HeroAgent" signature="1763976988">
<agent type="AndroidAgent" base="HeroAgent" signature="210764546">
<properties>
<property name="current_target_agent" type="TargetAgent*" member="false" static="false" defaultvalue="null" />
<property name="master_agent" type="MasterAgent*" member="false" static="false" defaultvalue="null" />

View File

@ -127,11 +127,67 @@
</node>
</node>
<node class="IfElse" id="23">
<node class="True" id="39" />
<node class="Noop" id="40" />
<attachment class="Precondition" id="45" flag="precondition">
<property BinaryOperator="And" />
<property Operator="Equal" />
<property Opl="Self.HeroAgent::IsDead()" />
<property Opr2="const bool false" />
<property Phase="Both" />
</attachment>
<attachment class="Precondition" id="46" flag="precondition">
<property BinaryOperator="And" />
<property Operator="Equal" />
<property Opl="current_target_agent.TargetAgent::IsValid()" />
<property Opr2="const bool true" />
<property Phase="Both" />
</attachment>
<node class="Sequence" id="39">
<attachment class="Precondition" id="51" flag="precondition">
<property BinaryOperator="And" />
<property Operator="LessEqual" />
<property Opl="Self.HeroAgent::GetHPRate()" />
<property Opr2="const float 0.3" />
<property Phase="Both" />
</attachment>
<attachment class="Precondition" id="52" flag="precondition">
<property BinaryOperator="And" />
<property Operator="GreaterEqual" />
<property Opl="current_target_agent.TargetAgent::GetHPRate()" />
<property Opr2="const float 0.33" />
<property Phase="Both" />
</attachment>
<node class="Condition" id="49">
<property Operator="Greater" />
<property Opl="Self.HeroAgent::GetAliveEnemyNum()" />
<property Opr="const int 1" />
</node>
<node class="Condition" id="50">
<property Operator="Greater" />
<property Opl="Self.HeroAgent::GetSafeAreaRadius()" />
<property Opr="const float 500" />
</node>
</node>
<node class="ReferencedBehavior" id="40">
<property ReferenceBehavior="const string &quot;task/RunAway&quot;" />
<property Task="Self.HeroAgent::RunAway()" />
</node>
<node class="Noop" id="41" />
</node>
<node class="IfElse" id="25">
<attachment class="Precondition" id="47" flag="precondition">
<property BinaryOperator="And" />
<property Operator="Equal" />
<property Opl="Self.HeroAgent::IsDead()" />
<property Opr2="const bool false" />
<property Phase="Both" />
</attachment>
<attachment class="Precondition" id="48" flag="precondition">
<property BinaryOperator="And" />
<property Operator="Equal" />
<property Opl="current_target_agent.TargetAgent::IsValid()" />
<property Opr2="const bool true" />
<property Phase="Both" />
</attachment>
<node class="True" id="42" />
<node class="Noop" id="43" />
<node class="Noop" id="44" />

View File

@ -922,3 +922,8 @@ int HeroAgent::GetLastAttackPassTime()
{
return std::min(GetLastShotPassTime(), GetLastUseSkillPassTime());
}
float HeroAgent::GetHPRate()
{
return GetHp() / std::max(1.0f, GetMaxHp());
}

View File

@ -78,6 +78,7 @@ public:
int GetLastShotPassTime();
int GetLastUseSkillPassTime();
int GetLastAttackPassTime();
float GetHPRate();
behaviac::EBTStatus RegisterEvents(behaviac::vector<BtEvent_e> events);
behaviac::EBTStatus SearchEnemy(float range);

View File

@ -104,3 +104,8 @@ void TargetAgent::ClearAbandon()
{
}
float TargetAgent::GetHPRate()
{
return GetHp() / std::max(1.0f, GetMaxHp());
}

View File

@ -24,6 +24,7 @@ public:
void Abandon(int time);
float GetShotRange();
void ClearAbandon();
float GetHPRate();
void SetOwner(Creature* owner);
void SetTarget(Creature* target);