1
This commit is contained in:
parent
67a954d0db
commit
b3a3888fb3
@ -482,16 +482,18 @@ A8_DECLARE_ENUM(TimerUserEvent_e,
|
|||||||
kDeactiveDjsSkillTimerEvent
|
kDeactiveDjsSkillTimerEvent
|
||||||
);
|
);
|
||||||
|
|
||||||
A8_DECLARE_CLASS_ENUM(GraspBuffTrigger, int,
|
A8_DECLARE_CLASS_ENUM(GraspBuffTrigger_e, int,
|
||||||
kHit = 1,
|
kHit = 1,
|
||||||
kKill = 2,
|
kKill = 2,
|
||||||
kTakeOn = 3,
|
kTakeOn = 3,
|
||||||
kCond = 4,
|
kCond = 4,
|
||||||
kHitAndEnd = 5
|
kHitAndEnd = 5,
|
||||||
|
kEnd
|
||||||
);
|
);
|
||||||
|
|
||||||
A8_DECLARE_CLASS_ENUM(GraspBuffTriggerCond, int,
|
A8_DECLARE_CLASS_ENUM(GraspBuffTriggerCond_e, int,
|
||||||
kImprint = 1
|
kImprint = 1,
|
||||||
|
kEnd
|
||||||
);
|
);
|
||||||
|
|
||||||
const char* const PROJ_NAME_FMT = "game%d_gameserver";
|
const char* const PROJ_NAME_FMT = "game%d_gameserver";
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include "buff.h"
|
#include "buff.h"
|
||||||
#include "mapinstance.h"
|
#include "mapinstance.h"
|
||||||
#include "collision.h"
|
#include "collision.h"
|
||||||
|
#include "gungrasp.h"
|
||||||
|
|
||||||
#include "mt/Param.h"
|
#include "mt/Param.h"
|
||||||
#include "mt/Hero.h"
|
#include "mt/Hero.h"
|
||||||
@ -59,6 +60,7 @@ Creature::Creature():MoveableEntity()
|
|||||||
|
|
||||||
inventory_[IS_1XSCOPE].num = 1;
|
inventory_[IS_1XSCOPE].num = 1;
|
||||||
movement_ = std::make_shared<Movement>(this);
|
movement_ = std::make_shared<Movement>(this);
|
||||||
|
gun_grasp_ = std::make_shared<GunGrasp>(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
Creature::~Creature()
|
Creature::~Creature()
|
||||||
@ -1601,7 +1603,6 @@ void Creature::SetCurrWeapon(Weapon* weapon)
|
|||||||
room->xtimer.Delete(auto_switch_weapon_timer_);
|
room->xtimer.Delete(auto_switch_weapon_timer_);
|
||||||
}
|
}
|
||||||
if (curr_weapon_ != weapon) {
|
if (curr_weapon_ != weapon) {
|
||||||
GetCurrWeapon()->CalcGraspBuffList(this);
|
|
||||||
GetTrigger()->TakeonWeapon(curr_weapon_, weapon);
|
GetTrigger()->TakeonWeapon(curr_weapon_, weapon);
|
||||||
}
|
}
|
||||||
curr_weapon_ = weapon;
|
curr_weapon_ = weapon;
|
||||||
|
@ -62,6 +62,7 @@ class Trigger;
|
|||||||
class DelayAddBuffHandle;
|
class DelayAddBuffHandle;
|
||||||
class Movement;
|
class Movement;
|
||||||
class Player;
|
class Player;
|
||||||
|
class GunGrasp;
|
||||||
class Creature : public MoveableEntity
|
class Creature : public MoveableEntity
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -378,6 +379,8 @@ private:
|
|||||||
std::map<int, long long> buff_interval_hash_;
|
std::map<int, long long> buff_interval_hash_;
|
||||||
std::array<Inventory, IS_END> inventory_ = {};
|
std::array<Inventory, IS_END> inventory_ = {};
|
||||||
|
|
||||||
|
std::shared_ptr<GunGrasp> gun_grasp_;
|
||||||
|
|
||||||
friend class Buff;
|
friend class Buff;
|
||||||
friend class AddInventoryBuff;
|
friend class AddInventoryBuff;
|
||||||
friend class BePullBuff;
|
friend class BePullBuff;
|
||||||
@ -390,4 +393,5 @@ private:
|
|||||||
friend class Skill;
|
friend class Skill;
|
||||||
friend class Trigger;
|
friend class Trigger;
|
||||||
friend class PBUtils;
|
friend class PBUtils;
|
||||||
|
friend class GunGrasp;
|
||||||
};
|
};
|
||||||
|
11
server/gameserver/gungrasp.cc
Normal file
11
server/gameserver/gungrasp.cc
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#include "precompile.h"
|
||||||
|
|
||||||
|
#include "gungrasp.h"
|
||||||
|
|
||||||
|
GunGrasp::GunGrasp(Creature* owner)
|
||||||
|
{
|
||||||
|
owner_ = owner;
|
||||||
|
for (auto& node : grasp_triggers_) {
|
||||||
|
INIT_LIST_HEAD(&node);
|
||||||
|
}
|
||||||
|
}
|
12
server/gameserver/gungrasp.h
Normal file
12
server/gameserver/gungrasp.h
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
class Creature;
|
||||||
|
class GunGrasp
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GunGrasp(Creature* owner);
|
||||||
|
|
||||||
|
private:
|
||||||
|
Creature* owner_ = nullptr;
|
||||||
|
std::array<list_head, (int)GraspBuffTrigger_e::kEnd> grasp_triggers_ = {};
|
||||||
|
};
|
@ -15,7 +15,6 @@ void Weapon::Clear()
|
|||||||
meta = nullptr;
|
meta = nullptr;
|
||||||
bullet_meta = nullptr;
|
bullet_meta = nullptr;
|
||||||
skill_meta = nullptr;
|
skill_meta = nullptr;
|
||||||
grasp_buff_list.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Weapon::Recalc()
|
void Weapon::Recalc()
|
||||||
@ -49,8 +48,3 @@ int Weapon::GetReloadTime(Creature* c)
|
|||||||
return meta ? meta->reload_time() :0;
|
return meta ? meta->reload_time() :0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Weapon::CalcGraspBuffList(Creature* c)
|
|
||||||
{
|
|
||||||
grasp_buff_list.clear();
|
|
||||||
}
|
|
||||||
|
@ -17,7 +17,6 @@ class Weapon
|
|||||||
const mt::Equip* meta = nullptr;
|
const mt::Equip* meta = nullptr;
|
||||||
const mt::Equip* bullet_meta = nullptr;
|
const mt::Equip* bullet_meta = nullptr;
|
||||||
const mt::Skill* skill_meta = nullptr;
|
const mt::Skill* skill_meta = nullptr;
|
||||||
std::vector<const mt::GraspBuff*> grasp_buff_list;
|
|
||||||
|
|
||||||
void Clear();
|
void Clear();
|
||||||
void ToPB(Creature* c, cs::MFWeapon* pb_obj);
|
void ToPB(Creature* c, cs::MFWeapon* pb_obj);
|
||||||
@ -25,7 +24,8 @@ class Weapon
|
|||||||
int GetClipVolume(Creature* c);
|
int GetClipVolume(Creature* c);
|
||||||
int GetFireRate(Creature* c);
|
int GetFireRate(Creature* c);
|
||||||
int GetReloadTime(Creature* c);
|
int GetReloadTime(Creature* c);
|
||||||
void CalcGraspBuffList(Creature* c);
|
|
||||||
|
private:
|
||||||
|
|
||||||
friend class PBUtils;
|
friend class PBUtils;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user