#pragma once #include "weakptr.h" #include "weapon.h" namespace cs { class MFBuff; } struct RemoveBuffCbConext { list_head** next; list_head entry; }; class Human; class Creature; class Bullet; class Effect; struct EventHandlerPtr; class Buff { public: int buff_uniid = 0; Creature* owner = nullptr; const mt::Buff* meta = nullptr; const mt::Skill* skill_meta = nullptr; a8::Attacher xtimer_attacher; long long add_frameno = 0; list_head effect_entry; list_head depend_entry; list_head cond_entry; list_head on_remove_contexts; a8::XTimerWp remover_timer; std::shared_ptr init_args; float res_scale = 1; long long res_scale_frameno = 0; Buff(); ~Buff(); void Init(); void UnInit(); int GetLeftTime(); int GetLastingTime(); bool NeedSync(Human* hum); void FillMFBuff(cs::MFBuff* buff_pb); bool FreezeOperate(); CreatureWeakPtr& GetCaster(); void SetCaster(Creature* caster); void CalcPassengerShotOffset(); void PreProcess(); virtual void Activate(); virtual void Deactivate(); protected: void ClearEventHandlers(); void InternalTimerAddBuff(); void RecoverHoldWeapons(); void ProcSputteringFunc(Bullet* bullet); protected: int hold_curr_weapon_idx_ = 0; std::list hold_weapons_; std::list> event_handlers_; CreatureWeakPtr caster_; std::list> effect_list_; friend class PBUtils; };