110 lines
3.5 KiB
C++
110 lines
3.5 KiB
C++
#pragma once
|
|
|
|
#include "moveableentity.h"
|
|
#include "weakptr.h"
|
|
|
|
struct BulletCheckResult;
|
|
class Human;
|
|
class Obstacle;
|
|
class Creature;
|
|
class MovementComponent;
|
|
class Car;
|
|
class Ability;
|
|
class Bullet : public MoveableEntity, public IBullet
|
|
{
|
|
public:
|
|
int shot_uniid = 0;
|
|
long long weapon_uniid = 0;
|
|
int gun_lv = 0;
|
|
int spec_gun_buff_id = 0;
|
|
const mt::Equip* gun_meta = nullptr;
|
|
const mt::Equip* meta = nullptr;
|
|
const mt::Skill* skill_meta = nullptr;
|
|
CreatureWeakPtr sender;
|
|
CreatureWeakPtr passenger;
|
|
glm::vec3 dir = GlmHelper::ZERO;
|
|
Position born_pos;
|
|
glm::vec3 born_dir = GlmHelper::ZERO;
|
|
float fly_distance = 0.0f;
|
|
MovementComponent* movement = nullptr;
|
|
int trace_target_id = 0;
|
|
float strengthen_wall = 0;
|
|
int hand = 0;
|
|
a8::XTimerWp keep_shot_animi_timer_ptr;
|
|
float shot_animi_time = 0.0f;
|
|
std::shared_ptr<std::set<int>> reporter_list;
|
|
bool ignore_original_dmg = false;
|
|
std::function<void(Bullet*)> on_bullet_exit = nullptr;
|
|
|
|
virtual ~Bullet() override;
|
|
virtual void Initialize() override;
|
|
virtual void Update(int delta_time) override;
|
|
float GetAtk();
|
|
float GetExplosionRange();
|
|
bool IsCurrWeapon();
|
|
void ForceRemove();
|
|
void OnHit(std::set<Entity*>& objects);
|
|
void TriggerHitBuff(Entity* e);
|
|
bool IsFlyHook();
|
|
|
|
virtual const glm::vec3& GetDir() override { return dir; };
|
|
virtual float GetStrengthenWall() override { return strengthen_wall; };
|
|
virtual long long GetWeaponUniId() override { return weapon_uniid; };
|
|
virtual const mt::Skill* GetSkillMeta() override;
|
|
virtual const mt::Equip* GetGunMeta() override { return gun_meta; };
|
|
virtual const mt::Equip* GetBulletMeta() override { return meta; };
|
|
virtual CreatureWeakPtr GetSender() override { return sender; };
|
|
virtual bool NoAdjustPos() override;
|
|
virtual CreatureWeakPtr GetPassenger() { return passenger; };
|
|
virtual bool IsBomb();
|
|
virtual bool IsPreBattleBullet();
|
|
virtual Room* GetRoom() { return room; };
|
|
virtual float GetHitRadius() override;
|
|
virtual const Position& GetPos() override;
|
|
virtual void ProcRequestBulletDmg(int shield_hit, int strength_wall_uniid, int target_uniid, const glm::vec3& pos) override;
|
|
|
|
void ReportHookHitPos(int hit_obj_uniid, const glm::vec3& hit_pos);
|
|
|
|
protected:
|
|
Bullet();
|
|
|
|
private:
|
|
|
|
void ProcBomb();
|
|
void ProcNormalBullet(BulletCheckResult& result);
|
|
void ProcSmokeBomb();
|
|
void ProcFragBomb(int delay_time);
|
|
void ProcPosionGasBomb(int delay_time);
|
|
void ProcMolotorCocktailBomb(int delay_time);
|
|
void ProcC4Bomb(Car* target, int delay_time);
|
|
void ProcSignalGunBomb(int delay_time);
|
|
void ProcShieldWallBomb(int delay_time);
|
|
void ProcOilBucketBomb(int delay_time);
|
|
void ProcFlyHook(Entity* target);
|
|
inline void MapServiceUpdate();
|
|
void Check(float distance);
|
|
void AddGunBuff();
|
|
void OnKillTarget(Entity* target);
|
|
void OnStrengthen(Obstacle* ob);
|
|
void ClearBuffList();
|
|
void GetHitThings(BulletCheckResult& result);
|
|
void GetHitCreatures(BulletCheckResult& result);
|
|
void Raycast();
|
|
bool IsClientHook();
|
|
|
|
private:
|
|
bool later_removed_ = false;
|
|
std::shared_ptr<Ability> ability_;
|
|
bool is_curr_weapon = false;
|
|
std::set<int> hit_objects_;
|
|
long long create_frameno_ = 0;
|
|
bool strengthened_ = false;
|
|
std::list<int> buff_list_;
|
|
bool raycasted_ = false;
|
|
bool raycast_hited = false;
|
|
float raycast_len_ = 0.0f;
|
|
glm::vec3 raycast_hit_point_ = glm::vec3(0.0f, 0.0f, 0.0f);
|
|
|
|
friend class EntityFactory;
|
|
};
|