添加射击锁定buff
This commit is contained in:
parent
72e0139859
commit
22ef2e0301
@ -29,6 +29,7 @@ struct xtimer_list;
|
|||||||
class Buff
|
class Buff
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
int buff_uniid = 0;
|
||||||
Creature* owner = nullptr;
|
Creature* owner = nullptr;
|
||||||
MetaData::Buff* meta = nullptr;
|
MetaData::Buff* meta = nullptr;
|
||||||
MetaData::Skill* skill_meta = nullptr;
|
MetaData::Skill* skill_meta = nullptr;
|
||||||
|
@ -15,6 +15,7 @@ const int kInMountainTopBuffId = 7014;
|
|||||||
const int kDownBuffId = 7015;
|
const int kDownBuffId = 7015;
|
||||||
const int kPoisioningBuffId = 7016;
|
const int kPoisioningBuffId = 7016;
|
||||||
const int kRescueBuffId = 7017;
|
const int kRescueBuffId = 7017;
|
||||||
|
const int kVertigoBuffId = 7018;
|
||||||
|
|
||||||
enum BuffEffectType_e
|
enum BuffEffectType_e
|
||||||
{
|
{
|
||||||
|
@ -25,6 +25,7 @@ struct BulletInfo
|
|||||||
bool is_tank_skin = false;
|
bool is_tank_skin = false;
|
||||||
int weapon_lv = 0;
|
int weapon_lv = 0;
|
||||||
int delay_time = 0;
|
int delay_time = 0;
|
||||||
|
int invincible_buff_uniid = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void InternalCreateBullet(BulletInfo& bullet_info)
|
static void InternalCreateBullet(BulletInfo& bullet_info)
|
||||||
@ -124,6 +125,14 @@ void InternalShot(Creature* c,
|
|||||||
if (skill_id == 0) {
|
if (skill_id == 0) {
|
||||||
c->room->frame_event.AddShot(c->GetWeakPtrRef());
|
c->room->frame_event.AddShot(c->GetWeakPtrRef());
|
||||||
}
|
}
|
||||||
|
int invincible_buff_uniid = 0;
|
||||||
|
if (weapon_meta->lock_time > 0) {
|
||||||
|
int buff_uniid = c->TryAddBuff(c, kVertigoBuffId);
|
||||||
|
Buff* buff = c->GetBuffByUniId(buff_uniid);
|
||||||
|
if (buff && buff->remover_timer) {
|
||||||
|
c->room->xtimer.ModifyTimer(buff->remover_timer, weapon_meta->lock_time / FRAME_RATE_MS);
|
||||||
|
}
|
||||||
|
}
|
||||||
for (auto& tuple : weapon_meta->bullet_born_offset) {
|
for (auto& tuple : weapon_meta->bullet_born_offset) {
|
||||||
a8::Vec2 bullet_born_offset = a8::Vec2(std::get<0>(tuple), std::get<1>(tuple));
|
a8::Vec2 bullet_born_offset = a8::Vec2(std::get<0>(tuple), std::get<1>(tuple));
|
||||||
bullet_born_offset.Rotate(c->GetAttackDir().CalcAngle(a8::Vec2::UP));
|
bullet_born_offset.Rotate(c->GetAttackDir().CalcAngle(a8::Vec2::UP));
|
||||||
@ -149,6 +158,7 @@ void InternalShot(Creature* c,
|
|||||||
bullet_info.is_tank_skin = is_tank_skin;
|
bullet_info.is_tank_skin = is_tank_skin;
|
||||||
bullet_info.weapon_lv = weapon_lv;
|
bullet_info.weapon_lv = weapon_lv;
|
||||||
bullet_info.delay_time = std::get<3>(tuple);
|
bullet_info.delay_time = std::get<3>(tuple);
|
||||||
|
bullet_info.invincible_buff_uniid = invincible_buff_uniid;
|
||||||
InternalCreateBullet(bullet_info);
|
InternalCreateBullet(bullet_info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -236,6 +246,16 @@ Buff* Creature::GetBuffById(int buff_id)
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Buff* Creature::GetBuffByUniId(int buff_uniid)
|
||||||
|
{
|
||||||
|
for (Buff& buff : buff_list_) {
|
||||||
|
if (buff.buff_uniid == buff_uniid) {
|
||||||
|
return &buff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
int Creature::GetBuffNum(int buff_id)
|
int Creature::GetBuffNum(int buff_id)
|
||||||
{
|
{
|
||||||
int num = 0;
|
int num = 0;
|
||||||
@ -247,14 +267,14 @@ int Creature::GetBuffNum(int buff_id)
|
|||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Creature::AddBuff(Creature* caster,
|
int Creature::AddBuff(Creature* caster,
|
||||||
MetaData::Buff* buff_meta,
|
MetaData::Buff* buff_meta,
|
||||||
int skill_lv,
|
int skill_lv,
|
||||||
MetaData::Skill* buff_skill_meta)
|
MetaData::Skill* buff_skill_meta)
|
||||||
{
|
{
|
||||||
if (buff_meta->i->buff_interval() > 0) {
|
if (buff_meta->i->buff_interval() > 0) {
|
||||||
if (buff_interval_hash_.find(buff_meta->i->buff_id()) != buff_interval_hash_.end()) {
|
if (buff_interval_hash_.find(buff_meta->i->buff_id()) != buff_interval_hash_.end()) {
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
buff_interval_hash_[buff_meta->i->buff_id()] = room->GetFrameNo();
|
buff_interval_hash_[buff_meta->i->buff_id()] = room->GetFrameNo();
|
||||||
room->xtimer.AddDeadLineTimerAndAttach
|
room->xtimer.AddDeadLineTimerAndAttach
|
||||||
@ -272,14 +292,14 @@ void Creature::AddBuff(Creature* caster,
|
|||||||
}
|
}
|
||||||
if (buff_meta->i->coexist_num() > 0){
|
if (buff_meta->i->coexist_num() > 0){
|
||||||
if (GetBuffNum(buff_meta->i->buff_id()) >= buff_meta->i->coexist_num()) {
|
if (GetBuffNum(buff_meta->i->buff_id()) >= buff_meta->i->coexist_num()) {
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (IsImmuneBuffEffect(buff_meta->i->buff_effect())) {
|
if (IsImmuneBuffEffect(buff_meta->i->buff_effect())) {
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
if (buff_meta->i->depend_effect() != 0 && !HasBuffEffect(buff_meta->i->depend_effect())) {
|
if (buff_meta->i->depend_effect() != 0 && !HasBuffEffect(buff_meta->i->depend_effect())) {
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
if (!buff_meta->EffectCanStack()) {
|
if (!buff_meta->EffectCanStack()) {
|
||||||
Buff* buff = GetBuffByEffectId(buff_meta->i->buff_effect());
|
Buff* buff = GetBuffByEffectId(buff_meta->i->buff_effect());
|
||||||
@ -290,7 +310,10 @@ void Creature::AddBuff(Creature* caster,
|
|||||||
if (buff_meta->i->buff_effect() == kBET_OnceChgAttr) {
|
if (buff_meta->i->buff_effect() == kBET_OnceChgAttr) {
|
||||||
ProcOnceChgAttrBuff(buff_meta);
|
ProcOnceChgAttrBuff(buff_meta);
|
||||||
}
|
}
|
||||||
|
++buff_uniid_;
|
||||||
|
int new_buff_uniid = buff_uniid_;
|
||||||
Buff* buff = &a8::FastAppend(buff_list_);
|
Buff* buff = &a8::FastAppend(buff_list_);
|
||||||
|
buff->buff_uniid = new_buff_uniid;
|
||||||
buff->SetCaster(caster);
|
buff->SetCaster(caster);
|
||||||
buff->skill_lv = skill_lv;
|
buff->skill_lv = skill_lv;
|
||||||
buff->owner = this;
|
buff->owner = this;
|
||||||
@ -340,6 +363,7 @@ void Creature::AddBuff(Creature* caster,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return new_buff_uniid;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
SendDebugMsg(a8::Format("添加buff_id:%d effect:%d %s params:%d,%d,%d,%d,%d",
|
SendDebugMsg(a8::Format("添加buff_id:%d effect:%d %s params:%d,%d,%d,%d,%d",
|
||||||
{
|
{
|
||||||
@ -365,21 +389,22 @@ bool Creature::IsImmuneBuffEffect(int buff_effect)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Creature::MustBeAddBuff(Creature* caster, int buff_id)
|
int Creature::MustBeAddBuff(Creature* caster, int buff_id)
|
||||||
{
|
{
|
||||||
MetaData::Buff* buff_meta = MetaMgr::Instance()->GetBuff(buff_id);
|
MetaData::Buff* buff_meta = MetaMgr::Instance()->GetBuff(buff_id);
|
||||||
if (!buff_meta) {
|
if (!buff_meta) {
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
AddBuff(caster, buff_meta, 1);
|
return AddBuff(caster, buff_meta, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Creature::TryAddBuff(Creature* caster, int buff_id)
|
int Creature::TryAddBuff(Creature* caster, int buff_id)
|
||||||
{
|
{
|
||||||
MetaData::Buff* buff_meta = MetaMgr::Instance()->GetBuff(buff_id);
|
MetaData::Buff* buff_meta = MetaMgr::Instance()->GetBuff(buff_id);
|
||||||
if (buff_meta) {
|
if (buff_meta) {
|
||||||
AddBuff(caster, buff_meta, 1);
|
return AddBuff(caster, buff_meta, 1);
|
||||||
}
|
}
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Creature::RemoveBuffById(int buff_id)
|
void Creature::RemoveBuffById(int buff_id)
|
||||||
|
@ -92,14 +92,15 @@ class Creature : public MoveableEntity
|
|||||||
bool HasBuffEffect(int buff_effect_id);
|
bool HasBuffEffect(int buff_effect_id);
|
||||||
Buff* GetBuffByEffectId(int effect_id);
|
Buff* GetBuffByEffectId(int effect_id);
|
||||||
Buff* GetBuffById(int buff_id);
|
Buff* GetBuffById(int buff_id);
|
||||||
|
Buff* GetBuffByUniId(int buff_uniid);
|
||||||
int GetBuffNum(int buff_id);
|
int GetBuffNum(int buff_id);
|
||||||
void AddBuff(Creature* caster,
|
int AddBuff(Creature* caster,
|
||||||
MetaData::Buff* buff_meta,
|
MetaData::Buff* buff_meta,
|
||||||
int skill_lv,
|
int skill_lv,
|
||||||
MetaData::Skill* buff_skill_meta = nullptr);
|
MetaData::Skill* buff_skill_meta = nullptr);
|
||||||
bool IsImmuneBuffEffect(int buff_effect);
|
bool IsImmuneBuffEffect(int buff_effect);
|
||||||
void MustBeAddBuff(Creature* caster, int buff_id);
|
int MustBeAddBuff(Creature* caster, int buff_id);
|
||||||
void TryAddBuff(Creature* caster, int buff_id);
|
int TryAddBuff(Creature* caster, int buff_id);
|
||||||
void RemoveBuffById(int buff_id);
|
void RemoveBuffById(int buff_id);
|
||||||
void ClearBuffById(int buff_id);
|
void ClearBuffById(int buff_id);
|
||||||
void RecalcBuffAttr();
|
void RecalcBuffAttr();
|
||||||
@ -252,6 +253,7 @@ private:
|
|||||||
CreatureWeakPtrChunk weak_ptr_chunk_;
|
CreatureWeakPtrChunk weak_ptr_chunk_;
|
||||||
HumanAbility ability;
|
HumanAbility ability;
|
||||||
std::shared_ptr<Ability> ability_;
|
std::shared_ptr<Ability> ability_;
|
||||||
|
int buff_uniid_ = 1000;
|
||||||
std::array<list_head, kBET_End> buff_effect_ = {};
|
std::array<list_head, kBET_End> buff_effect_ = {};
|
||||||
std::array<list_head, kBET_End> depend_effect_ = {};
|
std::array<list_head, kBET_End> depend_effect_ = {};
|
||||||
std::array<list_head, kCondBuffEnd> cond_buffs_ = {};
|
std::array<list_head, kCondBuffEnd> cond_buffs_ = {};
|
||||||
|
@ -197,6 +197,7 @@ namespace MetaData
|
|||||||
strings2.size() > 3 ? a8::XValue(strings2[3]).GetInt() : 0
|
strings2.size() > 3 ? a8::XValue(strings2[3]).GetInt() : 0
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
lock_time += strings2.size() > 3 ? a8::XValue(strings2[3]).GetInt() : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
@ -72,6 +72,7 @@ namespace MetaData
|
|||||||
{
|
{
|
||||||
const metatable::Equip* i = nullptr;
|
const metatable::Equip* i = nullptr;
|
||||||
|
|
||||||
|
int lock_time = 0;
|
||||||
std::vector<std::tuple<float, float, float, int>> bullet_born_offset;
|
std::vector<std::tuple<float, float, float, int>> bullet_born_offset;
|
||||||
std::vector<std::tuple<int, a8::Vec2>> shoot_offsets;
|
std::vector<std::tuple<int, a8::Vec2>> shoot_offsets;
|
||||||
std::array<int, IS_END> volume = {};
|
std::array<int, IS_END> volume = {};
|
||||||
|
@ -137,6 +137,8 @@ message Equip
|
|||||||
optional float average_oil = 58;
|
optional float average_oil = 58;
|
||||||
optional float atk_mech = 59;
|
optional float atk_mech = 59;
|
||||||
optional int32 use_scene = 60;
|
optional int32 use_scene = 60;
|
||||||
|
optional int32 ispenetrate = 61;
|
||||||
|
optional int32 is_penetrate_thing = 62;
|
||||||
|
|
||||||
optional string inventory_slot = 31; //库存槽位
|
optional string inventory_slot = 31; //库存槽位
|
||||||
optional int32 _inventory_slot = 32; //库存槽位
|
optional int32 _inventory_slot = 32; //库存槽位
|
||||||
|
Loading…
x
Reference in New Issue
Block a user