1
This commit is contained in:
parent
33e5342666
commit
7c0f51f73d
@ -7,10 +7,12 @@
|
||||
#include "movement.h"
|
||||
#include "glmhelper.h"
|
||||
#include "trigger.h"
|
||||
#include "skill.h"
|
||||
|
||||
#include "f8/btmgr.h"
|
||||
|
||||
#include "mt/Equip.h"
|
||||
#include "mt/Skill.h"
|
||||
|
||||
void DumpBt(BaseAgent* agent)
|
||||
{
|
||||
@ -286,16 +288,100 @@ bool BaseAgent::CanUseSkill(int skill_id)
|
||||
|
||||
int BaseAgent::GetUseableSkill(Creature* target)
|
||||
{
|
||||
if (GetOwner()->IsHuman()) {
|
||||
Skill* skill = GetOwner()->GetMainSkill();
|
||||
if (skill && CanUseSkill(skill->GetSkillId())) {
|
||||
return skill->GetSkillId();
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
behaviac::EBTStatus BaseAgent::DoUseSkill(int skill_id)
|
||||
{
|
||||
|
||||
return behaviac::BT_SUCCESS;
|
||||
}
|
||||
|
||||
bool BaseAgent::InternalUseSkill(int skill_id, CreatureWeakPtr target, int& wait_time)
|
||||
{
|
||||
if (GlmHelper::IsEqual2D(GetOwner()->GetPos().ToGlmVec3(),
|
||||
target.Get()->GetPos().ToGlmVec3())) {
|
||||
return false;
|
||||
}
|
||||
Skill* skill = GetOwner()->GetSkill(skill_id);
|
||||
if (skill) {
|
||||
wait_time = 0;
|
||||
glm::vec3 skill_dir = target.Get()->GetPos().ToGlmVec3() - GetOwner()->GetPos().ToGlmVec3();
|
||||
float skill_distance = GlmHelper::Norm(skill_dir);
|
||||
GlmHelper::Normalize(skill_dir);
|
||||
|
||||
switch (skill->GetCurrSkillMeta()->GetMagicId()) {
|
||||
case MAGIC_20101_HL:
|
||||
{
|
||||
GetOwner()->DoSkill(skill->GetSkillId(), target.Get()->GetUniId(), skill_dir, skill_distance);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case MAGIC_20701_BAO:
|
||||
{
|
||||
GetOwner()->DoSkill(skill->GetSkillId(), target.Get()->GetUniId(), skill_dir, skill_distance);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case MAGIC_20801_LONG:
|
||||
{
|
||||
GetOwner()->DoSkill(skill->GetSkillId(), target.Get()->GetUniId(), skill_dir, skill_distance);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case MAGIC_20901_XIONG:
|
||||
{
|
||||
GetOwner()->DoSkill(skill->GetSkillId(), target.Get()->GetUniId(), skill_dir, skill_distance);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case MAGIC_21001_NIU:
|
||||
{
|
||||
GetOwner()->DoSkill(skill->GetSkillId(), target.Get()->GetUniId(), skill_dir, skill_distance);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case MAGIC_20201_HX:
|
||||
{
|
||||
GetOwner()->DoSkill(skill->GetSkillId(), target.Get()->GetUniId(), skill_dir, skill_distance);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case MAGIC_20401_MAO:
|
||||
{
|
||||
GetOwner()->DoSkill(skill->GetSkillId(), target.Get()->GetUniId(), skill_dir, skill_distance);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case MAGIC_20601_DJS:
|
||||
{
|
||||
GetOwner()->DoSkill(skill->GetSkillId(), target.Get()->GetUniId(), skill_dir, skill_distance);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case MAGIC_20301_XL:
|
||||
{
|
||||
GetOwner()->DoSkill(skill->GetSkillId(), target.Get()->GetUniId(), skill_dir, skill_distance);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case MAGIC_20501_TZ:
|
||||
{
|
||||
GetOwner()->DoSkill(skill->GetSkillId(), target.Get()->GetUniId(), skill_dir, skill_distance);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -558,3 +558,9 @@ const mt::Skill* Skill::GetCurrSkillMeta()
|
||||
return meta;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int Skill::GetSkillId()
|
||||
{
|
||||
return meta->skill_id();
|
||||
}
|
||||
|
@ -52,6 +52,7 @@ class Skill
|
||||
void Clear();
|
||||
void Reset();
|
||||
const mt::Skill* GetCurrSkillMeta();
|
||||
int GetSkillId();
|
||||
|
||||
private:
|
||||
void InitActiveSkill();
|
||||
|
Loading…
x
Reference in New Issue
Block a user