game2006/server/gameserver/roomobstacle.h
aozhiwei 0ab3a0a8a4 1
2023-04-02 17:54:55 +08:00

81 lines
2.2 KiB
C++

#pragma once
#include "weakptr.h"
#include "gridservice.h"
#include "obstacle.h"
#include "weakptr.h"
class Ability;
class RoomObstacle : public Obstacle
{
public:
Room* room = nullptr;
a8::Attacher xtimer_attacher;
CreatureWeakPtr master;
int real_object_uniid = 0;
std::shared_ptr<Ability> context_ability;
bool sweep_lock = false;
const mt::Buff* buff_meta = nullptr;
const mt::Skill* skill_meta = nullptr;
long long born_frameno = 0;
a8::XTimerWp life_time_timer;
std::shared_ptr<a8::Args> init_args;
list_head entry;
virtual ~RoomObstacle() override;
virtual void Initialize() override;
virtual bool DoInteraction(Human* sender) override;
virtual void OnBattleStart(Room* room) override;
void ActiveTimerFunc();
void UpdateTimerFunc();
void Active();
virtual void Die(Room* room) override;
Entity* GetRealObject(Room* room);
RoomObstacleWeakPtrChunk* GetWeakPtrChunk() { return &weak_ptr_chunk_; };
RoomObstacleWeakPtr AllocWeakPtr();
RoomObstacleWeakPtr& GetWeakPtrRef();
void Destory();
void PushCollisionObjects();
void DestoryAt(int time);
private:
void SpecExplosion(int delay_time = 0);
void ActiveSelfExplosion();
void ActiveMine();
void ActiveTrap();
void ActivePosionGas();
void ActiveSpring();
void ActiveHideHouse();
void ActiveGully();
void ActiveAirDrop();
void ActiveKeepRangeBuff();
void ActiveStrengthenWall();
void ActiveMedicalStation();
void SummonAirDropBox(int box_id);
void ProcKeepRangeBuff();
void DetachFromMaster();
void InstallPreExplostionSummonTimer();
void CalcTempPassObjects();
void ForceGridList();
void RemoveSameSkillObstacle();
protected:
RoomObstacleWeakPtr weak_ptr_;
RoomObstacleWeakPtrChunk weak_ptr_chunk_;
std::set<GridCell*>* grid_list_ = nullptr;
int explosion_times_ = 0;
bool detached_ = false;
std::map<int, CreatureWeakPtr>* hit_objects_ = nullptr;
std::shared_ptr<std::vector<Position>> pos_list;
int total_explosion_times_ = 0;
std::map<int, CreatureWeakPtr>* temp_pass_objects_ = nullptr;
RoomObstacle();
friend class EntityFactory;
};