This commit is contained in:
aozhiwei 2023-06-02 17:45:49 +08:00
parent 27d14f8af4
commit d42b92cac1
7 changed files with 75 additions and 12 deletions

View File

@ -13,6 +13,7 @@
#include "mt/Equip.h"
#include "mt/Skill.h"
#include "mt/Hero.h"
void DumpBt(BaseAgent* agent)
{
@ -317,14 +318,17 @@ int BaseAgent::GetUseableSkill(Creature* target)
return -1;
}
#endif
#if 0
if (GetOwner()->IsHuman()) {
Skill* skill = GetOwner()->GetMainSkill();
if (skill && GetOwner()->CanUseSkill(skill->GetSkillId())) {
if (skill->GetMinorType()) {
return -1;
}
return skill->GetSkillId();
return -1;
}
#endif
Skill* skill = GetOwner()->GetMainSkill();
if (skill && GetOwner()->CanUseSkill(skill->GetSkillId())) {
if (skill->GetMinorType()) {
return -1;
}
return skill->GetSkillId();
}
return -1;
}
@ -411,6 +415,14 @@ bool BaseAgent::InternalUseSkill(int skill_id, CreatureWeakPtr target, int& wait
return true;
}
break;
case MAGIC_60100_1_BOSS:
case MAGIC_60100_2_BOSS:
case MAGIC_60100_3_BOSS:
{
GetOwner()->DoSkill(skill->GetSkillId(), target.Get()->GetUniId(), skill_dir, skill_distance);
return true;
}
break;
default:
{
}

View File

@ -438,9 +438,14 @@ A8_DECLARE_ENUM(MagicType_e,
MAGIC_30801_LONG, //30801 龙-救援防护
MAGIC_30901_XIONG, //30901 熊-复活
MAGIC_31001_NIU, //31001 牛-此面向敌
MAGIC_END
);
const int MAGIC_60100_1_BOSS = (int)MagicType_e::MAGIC_END + 1; //60100 boss1
const int MAGIC_60100_2_BOSS = (int)MagicType_e::MAGIC_END + 2; //60100 boss2
const int MAGIC_60100_3_BOSS = (int)MagicType_e::MAGIC_END + 3; //60100 boss3
enum PolyExtDataFlag_e
{
kWater1ExtFlag = 1, //能打出水坑

View File

@ -3031,6 +3031,7 @@ float Creature::GetSpeed()
ruduce += GetHeroMeta()->medicine_speed();
}
} else if (shot_hold &&
GetCurrWeapon() &&
(
GetCurrWeapon()->weapon_idx == GUN_SLOT1 ||
GetCurrWeapon()->weapon_idx == GUN_SLOT2

View File

@ -79,6 +79,13 @@ void Hero::Initialize()
}
SetHP(GetBattleContext()->GetMaxHP());
SetMaxHP(GetHP());
{
std::vector<int> skill_list;
GetBattleContext()->GetSkillList(skill_list);
for (auto& skill_id : skill_list) {
AddSkill(skill_id);
}
}
}
void Hero::Update(int delta_time)
@ -165,6 +172,7 @@ void Hero::OnBulletHit(IBullet* bullet)
}
RemoveBuffByEffectId(kBET_PeaceMode);
GetTrigger()->Attacked(bullet->GetSender().Get());
if (!IsDead(room) && (bullet->IsBomb() || bullet->GetSender().Get()->team_id != team_id)) {
float finaly_dmg = bullet->GetSender().Get()->GetBattleContext()->CalcDmg(this, bullet);
if (bullet->GetSender().Get()->IsHuman()) {

View File

@ -12,6 +12,7 @@
#include "human.h"
#include "mt/Map.h"
#include "mt/Hero.h"
HeroAgent::HeroAgent():BaseAgent()
{
@ -89,7 +90,6 @@ behaviac::EBTStatus HeroAgent::DoRandomWalk()
context->last_attacked_frameno);
}
};
return StartCoroutine(co);
}
@ -344,10 +344,39 @@ behaviac::EBTStatus HeroAgent::DoPursuit()
is_shot = true;
}
if (is_shot) {
bool shot_ok = false;
glm::vec3 shot_dir = dir;
GetOwner()->SetAttackDir(dir);
GetOwner()->Shot(shot_dir, shot_ok, 0, 0);
bool use_skill_ok = false;
if (context->target.Get() &&
!context->target.Get()->dead) {
int skill_id = GetUseableSkill(context->target.Get());
if (skill_id >= 0) {
GetOwner()->shot_hold = false;
int wait_time = 0;
use_skill_ok = InternalUseSkill(skill_id, context->target, wait_time);
if (use_skill_ok) {
Sleep(wait_time);
}
}
}
#ifdef DEBUG1
if (context->target.Get()->IsPlayer()) {
a8::XPrintf("DoPursuit %d use_skill_ok:%d time:%d\n",
{GetOwner()->GetUniId(),
use_skill_ok ? 1 : 0,
GetOwner()->GetMainSkill() ? GetOwner()->GetMainSkill()->GetLeftTime() : 0
});
}
#endif
if (!use_skill_ok) {
bool shot_ok = false;
glm::vec3 shot_dir = dir;
GetOwner()->shot_hold = true;
GetOwner()->SetAttackDir(shot_dir);
#if 0
GetOwner()->Shot(AdjustShotDir(shot_dir), shot_ok, 0, 0);
#endif
}
} else {
GetOwner()->shot_hold = false;
}
}
return behaviac::BT_RUNNING;

View File

@ -26,6 +26,7 @@
#include "mt/SkillNumber.h"
#include "mt/Equip.h"
#include "mt/MergeItem.h"
#include "mt/Hero.h"
static int GetTraceTargetId(Creature* c)
{
@ -257,7 +258,7 @@ void Skill::InitActiveSkill()
},
&xtimer_attacher);
actived_ = !owner->GetBattleContext()->IsMainSkill(this);
if (owner->IsAndroid()) {
if (owner->IsAndroid() || owner->IsHero()) {
actived_ = true;
}
}

View File

@ -38,6 +38,13 @@ void SkillHelper::Init()
}
}
}
magic_skill_hash_[MAGIC_60100_1_BOSS] = 60101;
magic_skill_hash_[MAGIC_60100_2_BOSS] = 60102;
magic_skill_hash_[MAGIC_60100_3_BOSS] = 60103;
skill_magic_hash_[60101] = MAGIC_60100_1_BOSS;
skill_magic_hash_[60102] = MAGIC_60100_2_BOSS;
skill_magic_hash_[60103] = MAGIC_60100_3_BOSS;
}
void SkillHelper::GetMagicIdAndBaseSkillId(int skill_id, int& magic_id, int& base_skill_id)