1
This commit is contained in:
parent
342c69dcf3
commit
e1d435da04
@ -633,7 +633,7 @@ namespace behaviac
|
|||||||
|
|
||||||
virtual bool load()
|
virtual bool load()
|
||||||
{
|
{
|
||||||
AgentMeta::SetTotalSignature(1342570378u);
|
AgentMeta::SetTotalSignature(2907398068u);
|
||||||
|
|
||||||
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(3996536000u);
|
meta = BEHAVIAC_NEW AgentMeta(3594818698u);
|
||||||
AgentMeta::GetAgentMetas()[498664641u] = meta;
|
AgentMeta::GetAgentMetas()[498664641u] = meta;
|
||||||
meta->RegisterMethod(347903289u, BEHAVIAC_NEW CAgentMethodVoid(FunctionPointer_TargetAgent_Abandon));
|
meta->RegisterMethod(347903289u, BEHAVIAC_NEW CAgentMethodVoid_1<int>(FunctionPointer_TargetAgent_Abandon));
|
||||||
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));
|
||||||
meta->RegisterMethod(3451565888u, BEHAVIAC_NEW CAgentMethod< int >(FunctionPointer_TargetAgent_GetLevel));
|
meta->RegisterMethod(3451565888u, BEHAVIAC_NEW CAgentMethod< int >(FunctionPointer_TargetAgent_GetLevel));
|
||||||
|
@ -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) { ((TargetAgent*)self)->Abandon(); }
|
inline void FunctionPointer_TargetAgent_Abandon(Agent* self, int time) { ((TargetAgent*)self)->Abandon(time); }
|
||||||
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(); }
|
||||||
inline int FunctionPointer_TargetAgent_GetLevel(Agent* self) { return ((TargetAgent*)self)->GetLevel(); }
|
inline int FunctionPointer_TargetAgent_GetLevel(Agent* self) { return ((TargetAgent*)self)->GetLevel(); }
|
||||||
|
@ -3,15 +3,43 @@
|
|||||||
<!--Source File: hero\standard.xml-->
|
<!--Source File: hero\standard.xml-->
|
||||||
<behavior name="hero/standard" agenttype="HeroAgent" version="5">
|
<behavior name="hero/standard" agenttype="HeroAgent" version="5">
|
||||||
<node class="IfElse" id="4">
|
<node class="IfElse" id="4">
|
||||||
|
<attachment class="Precondition" id="11" 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="12" flag="precondition">
|
||||||
|
<property BinaryOperator="And" />
|
||||||
|
<property Operator="Equal" />
|
||||||
|
<property Opl="Self.BaseAgent::IsGameOver()" />
|
||||||
|
<property Opr2="const bool false" />
|
||||||
|
<property Phase="Both" />
|
||||||
|
</attachment>
|
||||||
<node class="Condition" id="5">
|
<node class="Condition" id="5">
|
||||||
<property Operator="Equal" />
|
<property Operator="Equal" />
|
||||||
<property Opl="room_agent.RoomAgent::GetGasMode()" />
|
<property Opl="room_agent.RoomAgent::GetGasMode()" />
|
||||||
<property Opr="const GasMode_e GasInactive" />
|
<property Opr="const GasMode_e GasInactive" />
|
||||||
</node>
|
</node>
|
||||||
|
<node class="SelectorProbability" id="8">
|
||||||
|
<node class="DecoratorWeight" id="7">
|
||||||
|
<property DecorateWhenChildEnds="false" />
|
||||||
|
<property Weight="const int 30" />
|
||||||
<node class="ReferencedBehavior" id="6">
|
<node class="ReferencedBehavior" id="6">
|
||||||
<property ReferenceBehavior="const string "task/RandomWalk"" />
|
<property ReferenceBehavior="const string "task/RandomWalk"" />
|
||||||
<property Task="Self.HeroAgent::RandomWalk(0,0,{x=0;y=0;z=0;})" />
|
<property Task="Self.HeroAgent::RandomWalk(0,0,{x=0;y=0;z=0;})" />
|
||||||
</node>
|
</node>
|
||||||
|
</node>
|
||||||
|
<node class="DecoratorWeight" id="9">
|
||||||
|
<property DecorateWhenChildEnds="false" />
|
||||||
|
<property Weight="const int 70" />
|
||||||
|
<node class="Action" id="10">
|
||||||
|
<property Method="Self.HeroAgent::CoIdle(2000,4000)" />
|
||||||
|
<property ResultOption="BT_INVALID" />
|
||||||
|
</node>
|
||||||
|
</node>
|
||||||
|
</node>
|
||||||
<node class="IfElse" id="0">
|
<node class="IfElse" id="0">
|
||||||
<node class="Condition" id="1">
|
<node class="Condition" id="1">
|
||||||
<property Operator="Equal" />
|
<property Operator="Equal" />
|
||||||
|
@ -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="1342570378">
|
<agents version="1" signature="2907398068">
|
||||||
<agent type="HeroAgent" base="BaseAgent" signature="995930905">
|
<agent type="HeroAgent" base="BaseAgent" signature="995930905">
|
||||||
<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" />
|
||||||
|
@ -126,6 +126,16 @@
|
|||||||
<property ReferenceBehavior="const string "function/FnFindPathToTarget"" />
|
<property ReferenceBehavior="const string "function/FnFindPathToTarget"" />
|
||||||
</node>
|
</node>
|
||||||
</node>
|
</node>
|
||||||
|
<node class="IfElse" id="23">
|
||||||
|
<node class="True" id="39" />
|
||||||
|
<node class="Noop" id="40" />
|
||||||
|
<node class="Noop" id="41" />
|
||||||
|
</node>
|
||||||
|
<node class="IfElse" id="25">
|
||||||
|
<node class="True" id="42" />
|
||||||
|
<node class="Noop" id="43" />
|
||||||
|
<node class="Noop" id="44" />
|
||||||
|
</node>
|
||||||
</node>
|
</node>
|
||||||
</node>
|
</node>
|
||||||
</node>
|
</node>
|
||||||
|
@ -357,24 +357,25 @@ bool HeroAgent::MasterInRange(float range)
|
|||||||
behaviac::EBTStatus HeroAgent::SearchEnemy(float range)
|
behaviac::EBTStatus HeroAgent::SearchEnemy(float range)
|
||||||
{
|
{
|
||||||
Creature* myself = owner_;
|
Creature* myself = owner_;
|
||||||
Human* target = nullptr;
|
Creature* target = nullptr;
|
||||||
float last_distance = range + 1;
|
float last_distance = range + 1;
|
||||||
owner_->room->TraverseHumanList
|
owner_->room->grid_service->TraverseCreatures
|
||||||
(
|
(owner_->room->GetRoomIdx(),
|
||||||
[myself, &last_distance, &target, range] (Human* hum)
|
owner_->GetGridList(),
|
||||||
|
[myself, &last_distance, &target, range] (Creature* c, bool& stop)
|
||||||
{
|
{
|
||||||
if (!hum->dead &&
|
if (!c->dead &&
|
||||||
!a8::HasBitFlag(hum->status, CS_Disable) &&
|
!a8::HasBitFlag(c->status, CS_Disable) &&
|
||||||
!hum->HasBuffEffect(kBET_Hide) &&
|
!c->HasBuffEffect(kBET_Hide) &&
|
||||||
!hum->HasBuffEffect(kBET_Invincible) &&
|
!c->HasBuffEffect(kBET_Invincible) &&
|
||||||
hum->team_id != myself->team_id) {
|
c->team_id != myself->team_id) {
|
||||||
if (a8::HasBitFlag(myself->status, CS_DisableAttackAndroid) &&
|
if (a8::HasBitFlag(myself->status, CS_DisableAttackAndroid) &&
|
||||||
hum->IsAndroid()) {
|
c->IsAndroid()) {
|
||||||
} else {
|
} else {
|
||||||
float distance = hum->GetPos().Distance2D2(myself->GetPos());
|
float distance = c->GetPos().Distance2D2(myself->GetPos());
|
||||||
if (distance <= range) {
|
if (distance <= range) {
|
||||||
if (distance < last_distance) {
|
if (distance < last_distance) {
|
||||||
target = hum;
|
target = c;
|
||||||
last_distance = distance;
|
last_distance = distance;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ void Incubator::Init()
|
|||||||
if (a8::TIMER_EXEC_EVENT == event) {
|
if (a8::TIMER_EXEC_EVENT == event) {
|
||||||
alloc_timer_ = room->xtimer.SetIntervalWpEx
|
alloc_timer_ = room->xtimer.SetIntervalWpEx
|
||||||
(
|
(
|
||||||
SERVER_FRAME_RATE * (2 + rand() % 3),
|
SERVER_FRAME_RATE * (4 + rand() % 3),
|
||||||
[this] (int event, const a8::Args* args)
|
[this] (int event, const a8::Args* args)
|
||||||
{
|
{
|
||||||
if (a8::TIMER_EXEC_EVENT == event) {
|
if (a8::TIMER_EXEC_EVENT == event) {
|
||||||
@ -255,7 +255,7 @@ void Incubator::AutoAllocAndroid()
|
|||||||
Human* hum = hold_humans_[0];
|
Human* hum = hold_humans_[0];
|
||||||
if (room->GetGasData().GetGasMode() == GasWaiting &&
|
if (room->GetGasData().GetGasMode() == GasWaiting &&
|
||||||
hold_humans_.size() > 1 &&
|
hold_humans_.size() > 1 &&
|
||||||
((rand() % 100) > 40)) {
|
((rand() % 100) > 70)) {
|
||||||
Human* killer = nullptr;
|
Human* killer = nullptr;
|
||||||
if (hold_humans_.size() == 2) {
|
if (hold_humans_.size() == 2) {
|
||||||
killer = hold_humans_[1];
|
killer = hold_humans_[1];
|
||||||
|
@ -72,7 +72,7 @@ int TargetAgent::GetLevel()
|
|||||||
return target_.Get()->level;
|
return target_.Get()->level;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TargetAgent::Abandon()
|
void TargetAgent::Abandon(int time)
|
||||||
{
|
{
|
||||||
target_.Reset();
|
target_.Reset();
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ public:
|
|||||||
float GetMaxHp();
|
float GetMaxHp();
|
||||||
int GetHeroId();
|
int GetHeroId();
|
||||||
int GetLevel();
|
int GetLevel();
|
||||||
void Abandon();
|
void Abandon(int time);
|
||||||
float GetShotRange();
|
float GetShotRange();
|
||||||
|
|
||||||
void SetOwner(Creature* owner);
|
void SetOwner(Creature* owner);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user