1
This commit is contained in:
parent
7fc1233628
commit
27564fa261
@ -19,9 +19,11 @@
|
|||||||
#include "team.h"
|
#include "team.h"
|
||||||
#include "master_agent.h"
|
#include "master_agent.h"
|
||||||
#include "team_agent.h"
|
#include "team_agent.h"
|
||||||
|
#include "skill.h"
|
||||||
|
|
||||||
#include "mt/Hero.h"
|
#include "mt/Hero.h"
|
||||||
#include "mt/Equip.h"
|
#include "mt/Equip.h"
|
||||||
|
#include "mt/Skill.h"
|
||||||
|
|
||||||
HeroAgent::HeroAgent():BaseAgent()
|
HeroAgent::HeroAgent():BaseAgent()
|
||||||
{
|
{
|
||||||
@ -619,9 +621,11 @@ behaviac::EBTStatus HeroAgent::CoSleep(int time)
|
|||||||
|
|
||||||
behaviac::EBTStatus HeroAgent::CoUseSkill(int skill_id)
|
behaviac::EBTStatus HeroAgent::CoUseSkill(int skill_id)
|
||||||
{
|
{
|
||||||
if (!current_target_agent->IsValid()) {
|
int wait_time = 0;
|
||||||
return behaviac::BT_FAILURE;
|
if (InternalUseSkill(skill_id, wait_time)) {
|
||||||
|
return behaviac::BT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
return behaviac::BT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Room* HeroAgent::GetRoom()
|
Room* HeroAgent::GetRoom()
|
||||||
@ -848,3 +852,100 @@ bool HeroAgent::HasUseableSkill()
|
|||||||
{
|
{
|
||||||
return owner_->HasUseableSkill();
|
return owner_->HasUseableSkill();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool HeroAgent::InternalUseSkill(int skill_id, int& wait_time)
|
||||||
|
{
|
||||||
|
if (!current_target_agent->IsValid()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (GlmHelper::IsEqual2D(owner_->GetPos().ToGlmVec3(),
|
||||||
|
current_target_agent->GetPos())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Skill* skill = owner_->GetSkill(skill_id);
|
||||||
|
if (skill) {
|
||||||
|
wait_time = 500;
|
||||||
|
glm::vec3 skill_dir = current_target_agent->GetPos() - owner_->GetPos().ToGlmVec3();
|
||||||
|
float skill_distance = GlmHelper::Norm(skill_dir);
|
||||||
|
GlmHelper::Normalize(skill_dir);
|
||||||
|
|
||||||
|
switch (skill->GetCurrSkillMeta()->GetMagicId()) {
|
||||||
|
case MAGIC_20101_HL:
|
||||||
|
{
|
||||||
|
owner_->DoSkill(skill->GetSkillId(), current_target_agent->GetUniId(), skill_dir, skill_distance);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case MAGIC_20701_BAO:
|
||||||
|
{
|
||||||
|
owner_->DoSkill(skill->GetSkillId(), current_target_agent->GetUniId(), skill_dir, skill_distance);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case MAGIC_20801_LONG:
|
||||||
|
{
|
||||||
|
owner_->DoSkill(skill->GetSkillId(), current_target_agent->GetUniId(), skill_dir, skill_distance);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case MAGIC_20901_XIONG:
|
||||||
|
{
|
||||||
|
owner_->DoSkill(skill->GetSkillId(), current_target_agent->GetUniId(), skill_dir, skill_distance);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case MAGIC_21001_NIU:
|
||||||
|
{
|
||||||
|
#if 0
|
||||||
|
owner_->DoSkill(skill->GetSkillId(), current_target_agent->GetUniId(), skill_dir, skill_distance);
|
||||||
|
return true;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case MAGIC_20201_HX:
|
||||||
|
{
|
||||||
|
owner_->DoSkill(skill->GetSkillId(), current_target_agent->GetUniId(), skill_dir, skill_distance);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case MAGIC_20401_MAO:
|
||||||
|
{
|
||||||
|
owner_->DoSkill(skill->GetSkillId(), current_target_agent->GetUniId(), skill_dir, skill_distance);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case MAGIC_20601_DJS:
|
||||||
|
{
|
||||||
|
owner_->DoSkill(skill->GetSkillId(), current_target_agent->GetUniId(), skill_dir, skill_distance);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case MAGIC_20301_XL:
|
||||||
|
{
|
||||||
|
skill_distance = 30;
|
||||||
|
owner_->DoSkill(skill->GetSkillId(), current_target_agent->GetUniId(), skill_dir, skill_distance);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case MAGIC_20501_TZ:
|
||||||
|
{
|
||||||
|
owner_->DoSkill(skill->GetSkillId(), current_target_agent->GetUniId(), skill_dir, skill_distance);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case MAGIC_60100_1_BOSS:
|
||||||
|
case MAGIC_60100_2_BOSS:
|
||||||
|
case MAGIC_60100_3_BOSS:
|
||||||
|
{
|
||||||
|
owner_->DoSkill(skill->GetSkillId(), current_target_agent->GetUniId(), skill_dir, skill_distance);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
@ -142,6 +142,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
behaviac::EBTStatus DoRunningCb();
|
behaviac::EBTStatus DoRunningCb();
|
||||||
behaviac::EBTStatus StartCoroutine(std::shared_ptr<BtCoroutine> coroutine);
|
behaviac::EBTStatus StartCoroutine(std::shared_ptr<BtCoroutine> coroutine);
|
||||||
|
bool InternalUseSkill(int skill_id, int& wait_time);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Creature* owner_ = nullptr;
|
Creature* owner_ = nullptr;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user