From 4f4c1262d6a7daedf1c0ba945b6f68aa9da63b24 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 30 Mar 2023 10:17:43 +0800 Subject: [PATCH] 1 --- server/gameserver/creature.cc | 26 ++++++++++++-------------- server/gameserver/creature.h | 11 ++++------- server/gameserver/hero.cc | 1 + server/gameserver/hero.h | 1 + 4 files changed, 18 insertions(+), 21 deletions(-) diff --git a/server/gameserver/creature.cc b/server/gameserver/creature.cc index 03600c22..72423320 100644 --- a/server/gameserver/creature.cc +++ b/server/gameserver/creature.cc @@ -1663,11 +1663,12 @@ void Creature::ResetAllSkillCd() } } -void Creature::SummonHero(Buff* buff, - const Position& pos, +Hero* Creature::SummonHero(Buff* buff, + const glm::vec3& pos, const glm::vec3& dir ) { + #if 0 const mt::Hero* hero_meta = mt::Hero::GetById(buff->meta->_int_buff_param1); if (hero_meta) { int life_time = 10000; @@ -1680,6 +1681,7 @@ void Creature::SummonHero(Buff* buff, 1, life_time); } + #endif } bool Creature::FreezeOperate() @@ -1699,12 +1701,14 @@ void Creature::SlaveOnRemove(Entity* slave) switch (slave->GetEntityType()) { case ET_Hero: { + #if 0 for (auto itr = slave_heros_.begin(); itr != slave_heros_.end(); ++itr) { if ((Entity*)std::get<1>(*itr) == slave) { slave_heros_.erase(itr); break; } } + #endif } break; 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) { std::vector matched_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()); } } + #endif } void Creature::RemoveSurplusObstacle(int buff_id, int id, int num) @@ -1954,18 +1960,9 @@ void Creature::TraverseSkill(std::function func) } } -bool Creature::TrySummonHero(const mt::Hero* hero_meta, glm::vec3 dir, Position born_pos, bool through_wall) -{ - #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) +Hero* Creature::InternalSummonHero(Buff* buff, const mt::Hero* hero_meta, glm::vec3 dir, const glm::vec3 born_pos) { + #if 0 struct SummonHeroInfo { const mt::Hero* hero_meta = nullptr; @@ -2039,6 +2036,7 @@ Hero* Creature::InternalSummonHero(Buff* buff, const mt::Hero* hero_meta, glm::v &xtimer_attacher); } return nullptr; + #endif } std::string Creature::DebugOutBuffList() diff --git a/server/gameserver/creature.h b/server/gameserver/creature.h index 132920c0..332206f5 100644 --- a/server/gameserver/creature.h +++ b/server/gameserver/creature.h @@ -268,7 +268,8 @@ class Creature : public MoveableEntity void CheckSpecObject(int new_poly_flags); 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 RecoverSkillCasterState(SkillCasterState* caster_state); CreatureWeakPtr AllocWeakPtr(); @@ -352,15 +353,11 @@ private: void ProcSkillPhase(const mt::SkillPhase* phase); 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); void RemovePassiveSkill(int skill_id); - void RemoveSurplusHero(int buff_id, int id, int num); void RemoveSurplusObstacle(int buff_id, int id, int num); 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 CheckLoadingBullet(); void OnLand(); @@ -402,7 +399,7 @@ private: std::array cond_buffs_ = {}; std::list> buff_list_; std::map> effect_hash_; - std::list> slave_heros_; + std::map slave_heros_; std::list> slave_things_; a8::XTimerWp auto_switch_weapon_timer_; a8::XTimerWp reload_delay_timer_; diff --git a/server/gameserver/hero.cc b/server/gameserver/hero.cc index fdc14138..b4366742 100644 --- a/server/gameserver/hero.cc +++ b/server/gameserver/hero.cc @@ -29,6 +29,7 @@ Hero::Hero():Creature() { ++PerfMonitor::Instance()->entity_num[ET_Hero]; + INIT_LIST_HEAD(&entry); agent_ = behaviac::Agent::Create(); if (!agent_) { abort(); diff --git a/server/gameserver/hero.h b/server/gameserver/hero.h index c2ae416b..00874302 100644 --- a/server/gameserver/hero.h +++ b/server/gameserver/hero.h @@ -15,6 +15,7 @@ public: CreatureWeakPtr master; const mt::Hero* meta = nullptr; bool is_pve_boss = false; + list_head entry; Hero(); virtual ~Hero() override;