This commit is contained in:
aozhiwei 2023-08-16 18:57:55 +08:00
parent 06ff506672
commit 35d3ae5343
3 changed files with 26 additions and 9 deletions

View File

@ -45,13 +45,8 @@ bool AndroidAgent::IsCrazeModePrepareMode()
if (!IsCrazeMode()) { if (!IsCrazeMode()) {
return false; return false;
} }
#ifdef DEBUG
if (GetOwner()->room->GetFrameNo() - GetOwner()->AsHuman()->enable_frameno > SERVER_FRAME_RATE * 5) {
return false;
#else
if (GetOwner()->room->GetFrameNo() - GetOwner()->AsHuman()->enable_frameno > SERVER_FRAME_RATE * 20) { if (GetOwner()->room->GetFrameNo() - GetOwner()->AsHuman()->enable_frameno > SERVER_FRAME_RATE * 20) {
return false; return false;
#endif
} else { } else {
if (GetSafeAreaRadius() < 200) { if (GetSafeAreaRadius() < 200) {
return false; return false;

View File

@ -370,7 +370,7 @@ behaviac::EBTStatus BaseAgent::CoMoveToCurrentTarget(float distance)
return behaviac::BT_FAILURE; return behaviac::BT_FAILURE;
} }
float target_distance = GetOwner()->GetPos().Distance2D2(current_target_.Get()->GetPos()); float target_distance = GetOwner()->GetPos().Distance2D2(current_target_.Get()->GetPos());
if (target_distance > 2) { if (target_distance > 1 && target_distance < 2) {
return behaviac::BT_SUCCESS; return behaviac::BT_SUCCESS;
} }
/* /*
@ -384,7 +384,7 @@ behaviac::EBTStatus BaseAgent::CoMoveToCurrentTarget(float distance)
); );
context->target = current_target_; context->target = current_target_;
if (target_distance < 2) { if (target_distance < 1) {
GetOwner()->GetMovement()->CalcTargetPos(60); GetOwner()->GetMovement()->CalcTargetPos(60);
} else { } else {
glm::vec3 dir = GetOwner()->GetPos().CalcDir(context->target.Get()->GetPos()); glm::vec3 dir = GetOwner()->GetPos().CalcDir(context->target.Get()->GetPos());
@ -512,6 +512,9 @@ behaviac::EBTStatus BaseAgent::CoShot()
} }
glm::vec3 dir = GetOwner()->GetPos().CalcDir(current_target_.Get()->GetPos()); glm::vec3 dir = GetOwner()->GetPos().CalcDir(current_target_.Get()->GetPos());
if (GlmHelper::Norm(dir) > GetAttackRange()) { if (GlmHelper::Norm(dir) > GetAttackRange()) {
#ifdef DEBUG
a8::XPrintf("CoShot Failed %f\n", {GlmHelper::Norm(dir)});
#endif
return behaviac::BT_FAILURE; return behaviac::BT_FAILURE;
} }
bool shot_ok = false; bool shot_ok = false;

View File

@ -824,9 +824,28 @@ void Creature::TriggerOneObjectBuff(Skill* skill, Creature* target, BuffTriggerT
Skill* Creature::GetSkill(int skill_id) Skill* Creature::GetSkill(int skill_id)
{ {
if (skill_id < 10) {
switch (skill_id) {
case 0:
{
return GetMainSkill();
}
break;
case 1:
{
return GetMainSkill();
}
break;
default:
{
return nullptr;
}
}
} else {
auto itr = skill_hash_.find(skill_id); auto itr = skill_hash_.find(skill_id);
return itr != skill_hash_.end() ? itr->second.get() : nullptr; return itr != skill_hash_.end() ? itr->second.get() : nullptr;
} }
}
bool Creature::CanUseSkill(int skill_id) bool Creature::CanUseSkill(int skill_id)
{ {