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

View File

@ -438,9 +438,14 @@ A8_DECLARE_ENUM(MagicType_e,
MAGIC_30801_LONG, //30801 龙-救援防护 MAGIC_30801_LONG, //30801 龙-救援防护
MAGIC_30901_XIONG, //30901 熊-复活 MAGIC_30901_XIONG, //30901 熊-复活
MAGIC_31001_NIU, //31001 牛-此面向敌 MAGIC_31001_NIU, //31001 牛-此面向敌
MAGIC_END 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 enum PolyExtDataFlag_e
{ {
kWater1ExtFlag = 1, //能打出水坑 kWater1ExtFlag = 1, //能打出水坑

View File

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

View File

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

View File

@ -12,6 +12,7 @@
#include "human.h" #include "human.h"
#include "mt/Map.h" #include "mt/Map.h"
#include "mt/Hero.h"
HeroAgent::HeroAgent():BaseAgent() HeroAgent::HeroAgent():BaseAgent()
{ {
@ -89,7 +90,6 @@ behaviac::EBTStatus HeroAgent::DoRandomWalk()
context->last_attacked_frameno); context->last_attacked_frameno);
} }
}; };
return StartCoroutine(co); return StartCoroutine(co);
} }
@ -344,10 +344,39 @@ behaviac::EBTStatus HeroAgent::DoPursuit()
is_shot = true; is_shot = true;
} }
if (is_shot) { if (is_shot) {
bool shot_ok = false; bool use_skill_ok = false;
glm::vec3 shot_dir = dir; if (context->target.Get() &&
GetOwner()->SetAttackDir(dir); !context->target.Get()->dead) {
GetOwner()->Shot(shot_dir, shot_ok, 0, 0); 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; return behaviac::BT_RUNNING;

View File

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