This commit is contained in:
aozhiwei 2023-03-30 10:17:43 +08:00
parent 6de9cb4a0d
commit 4f4c1262d6
4 changed files with 18 additions and 21 deletions

View File

@ -1663,11 +1663,12 @@ void Creature::ResetAllSkillCd()
} }
} }
void Creature::SummonHero(Buff* buff, Hero* Creature::SummonHero(Buff* buff,
const Position& pos, const glm::vec3& pos,
const glm::vec3& dir const glm::vec3& dir
) )
{ {
#if 0
const mt::Hero* hero_meta = mt::Hero::GetById(buff->meta->_int_buff_param1); const mt::Hero* hero_meta = mt::Hero::GetById(buff->meta->_int_buff_param1);
if (hero_meta) { if (hero_meta) {
int life_time = 10000; int life_time = 10000;
@ -1680,6 +1681,7 @@ void Creature::SummonHero(Buff* buff,
1, 1,
life_time); life_time);
} }
#endif
} }
bool Creature::FreezeOperate() bool Creature::FreezeOperate()
@ -1699,12 +1701,14 @@ void Creature::SlaveOnRemove(Entity* slave)
switch (slave->GetEntityType()) { switch (slave->GetEntityType()) {
case ET_Hero: case ET_Hero:
{ {
#if 0
for (auto itr = slave_heros_.begin(); itr != slave_heros_.end(); ++itr) { for (auto itr = slave_heros_.begin(); itr != slave_heros_.end(); ++itr) {
if ((Entity*)std::get<1>(*itr) == slave) { if ((Entity*)std::get<1>(*itr) == slave) {
slave_heros_.erase(itr); slave_heros_.erase(itr);
break; break;
} }
} }
#endif
} }
break; break;
case ET_Obstacle: case ET_Obstacle:
@ -1726,8 +1730,9 @@ void Creature::SlaveOnRemove(Entity* slave)
} }
} }
void Creature::RemoveSurplusHero(int buff_id, int id, int num) void Creature::RemoveSurplusHero(int hero_id, int num)
{ {
#if 0
if (slave_heros_.size() >= num && num > 0) { if (slave_heros_.size() >= num && num > 0) {
std::vector<Hero*> matched_heros; std::vector<Hero*> matched_heros;
for (auto& itr : slave_heros_) { for (auto& itr : slave_heros_) {
@ -1741,6 +1746,7 @@ void Creature::RemoveSurplusHero(int buff_id, int id, int num)
matched_heros.erase(matched_heros.begin()); matched_heros.erase(matched_heros.begin());
} }
} }
#endif
} }
void Creature::RemoveSurplusObstacle(int buff_id, int id, int num) void Creature::RemoveSurplusObstacle(int buff_id, int id, int num)
@ -1954,18 +1960,9 @@ void Creature::TraverseSkill(std::function<void (Skill*, bool&)> func)
} }
} }
bool Creature::TrySummonHero(const mt::Hero* hero_meta, glm::vec3 dir, Position born_pos, bool through_wall) Hero* Creature::InternalSummonHero(Buff* buff, const mt::Hero* hero_meta, glm::vec3 dir, const glm::vec3 born_pos)
{
#if 1
return true;
#else
abort();
#endif
}
Hero* Creature::InternalSummonHero(Buff* buff, const mt::Hero* hero_meta, glm::vec3 dir, Position born_pos,
bool through_wall, int num, int life_time)
{ {
#if 0
struct SummonHeroInfo struct SummonHeroInfo
{ {
const mt::Hero* hero_meta = nullptr; const mt::Hero* hero_meta = nullptr;
@ -2039,6 +2036,7 @@ Hero* Creature::InternalSummonHero(Buff* buff, const mt::Hero* hero_meta, glm::v
&xtimer_attacher); &xtimer_attacher);
} }
return nullptr; return nullptr;
#endif
} }
std::string Creature::DebugOutBuffList() std::string Creature::DebugOutBuffList()

View File

@ -268,7 +268,8 @@ class Creature : public MoveableEntity
void CheckSpecObject(int new_poly_flags); void CheckSpecObject(int new_poly_flags);
void SummonObstacle(Buff* buff, int id, const Position& target_pos); void SummonObstacle(Buff* buff, int id, const Position& target_pos);
void SummonHero(Buff* buff, const Position& pos, const glm::vec3& dir); Hero* SummonHero(Buff* buff, const glm::vec3& pos, const glm::vec3& dir);
void RemoveSurplusHero(int hero_id, int num);
void FillSkillCasterState(SkillCasterState* caster_state); void FillSkillCasterState(SkillCasterState* caster_state);
void RecoverSkillCasterState(SkillCasterState* caster_state); void RecoverSkillCasterState(SkillCasterState* caster_state);
CreatureWeakPtr AllocWeakPtr(); CreatureWeakPtr AllocWeakPtr();
@ -352,15 +353,11 @@ private:
void ProcSkillPhase(const mt::SkillPhase* phase); void ProcSkillPhase(const mt::SkillPhase* phase);
void TriggerOneObjectBuff(Skill* skill, Creature* target, BuffTriggerType_e trigger_type); void TriggerOneObjectBuff(Skill* skill, Creature* target, BuffTriggerType_e trigger_type);
Hero* InternalSummonHero(Buff* buff, const mt::Hero* hero_meta, glm::vec3 dir, const glm::vec3 born_pos);
Skill* GetPassiveSkill(int skill_id); Skill* GetPassiveSkill(int skill_id);
void RemovePassiveSkill(int skill_id); void RemovePassiveSkill(int skill_id);
void RemoveSurplusHero(int buff_id, int id, int num);
void RemoveSurplusObstacle(int buff_id, int id, int num); void RemoveSurplusObstacle(int buff_id, int id, int num);
void CheckAbilityUsed(); void CheckAbilityUsed();
bool TrySummonHero(const mt::Hero* hero_meta, glm::vec3 dir, Position born_pos, bool through_wall);
Hero* InternalSummonHero(Buff* buff, const mt::Hero* hero_meta, glm::vec3 dir, Position born_pos,
bool through_wall, int num, int life_time);
void AutoSwitchWeapon(); void AutoSwitchWeapon();
void CheckLoadingBullet(); void CheckLoadingBullet();
void OnLand(); void OnLand();
@ -402,7 +399,7 @@ private:
std::array<list_head, kEventBuffEnd> cond_buffs_ = {}; std::array<list_head, kEventBuffEnd> cond_buffs_ = {};
std::list<std::shared_ptr<Buff>> buff_list_; std::list<std::shared_ptr<Buff>> buff_list_;
std::map<int, std::shared_ptr<Effect>> effect_hash_; std::map<int, std::shared_ptr<Effect>> effect_hash_;
std::list<std::tuple<int, Hero*>> slave_heros_; std::map<int, list_head> slave_heros_;
std::list<std::tuple<int, RoomObstacleWeakPtr>> slave_things_; std::list<std::tuple<int, RoomObstacleWeakPtr>> slave_things_;
a8::XTimerWp auto_switch_weapon_timer_; a8::XTimerWp auto_switch_weapon_timer_;
a8::XTimerWp reload_delay_timer_; a8::XTimerWp reload_delay_timer_;

View File

@ -29,6 +29,7 @@
Hero::Hero():Creature() Hero::Hero():Creature()
{ {
++PerfMonitor::Instance()->entity_num[ET_Hero]; ++PerfMonitor::Instance()->entity_num[ET_Hero];
INIT_LIST_HEAD(&entry);
agent_ = behaviac::Agent::Create<HeroAgent>(); agent_ = behaviac::Agent::Create<HeroAgent>();
if (!agent_) { if (!agent_) {
abort(); abort();

View File

@ -15,6 +15,7 @@ public:
CreatureWeakPtr master; CreatureWeakPtr master;
const mt::Hero* meta = nullptr; const mt::Hero* meta = nullptr;
bool is_pve_boss = false; bool is_pve_boss = false;
list_head entry;
Hero(); Hero();
virtual ~Hero() override; virtual ~Hero() override;