game2006/server/gameserver/explosion.h
aozhiwei 826e7b871d 1
2022-12-12 17:25:13 +08:00

64 lines
2.0 KiB
C++

#pragma once
#include "weakptr.h"
class Room;
class EntityFactory;
class Explosion : public std::enable_shared_from_this<Explosion>
{
public:
~Explosion();
int exclude_uniid = 0;
Room* GetRoom() { return room_; };
CreatureWeakPtr GetSender() { return sender_; };
float GetDmg() { return dmg_; };
long long GetSpecialDamageType() { return special_damage_type_; };
bool IsPreBattleExplosion();
int GetExplosionEffect() { return explosion_effect_; };
void SetDamageDelay(int delay) { explosion_damage_delay_ = delay; };
void SetHitCb(a8::CommonCbProc cb) { hit_cb_ = cb; };
void SetCustomCheckCb(a8::CommonCbProc cb) { custom_check_cb_ = cb; };
void SetThrough(bool through) { through_ = through; };
bool IsThrough() { return through_; };
void SetNoSync() { no_sync_ = true; };
void IndifferenceAttack(Room* room,
const Position& center,
float explosion_range,
int explosion_effect,
float dmg,
long long special_damage_type = 0);
void EnemyAndObstacleAttack(CreatureWeakPtr& sender,
const Position& center,
float explosion_range,
int explosion_effect,
float dmg,
long long special_damage_type = 0);
void AddForceTarget(CreatureWeakPtr force_target);
protected:
Explosion() {};
void InternalAttack();
void ProcDamage();
private:
int type_ = 0;
Room* room_ = nullptr;
CreatureWeakPtr sender_;
CreatureWeakPtr force_target_;
float explosion_range_ = 0;
int explosion_effect_ = 0;
int explosion_damage_delay_ = 0;
float dmg_ = 0;
Position center_;
long long special_damage_type_ = 0;
long long create_frameno_ = 0;
a8::CommonCbProc custom_check_cb_;
a8::CommonCbProc hit_cb_;
bool through_ = false;
bool no_sync_ = false;
friend class EntityFactory;
};