添加驱散逻辑
This commit is contained in:
parent
8dc0473d4d
commit
3522bb307a
@ -529,3 +529,22 @@ void Buff::ProcOnceChgAttr()
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Buff::ProcDisperse()
|
||||||
|
{
|
||||||
|
std::vector<int> del_buffs;
|
||||||
|
owner->TraverseBuff
|
||||||
|
(
|
||||||
|
[this, &del_buffs] (Buff* buff, bool& stop)
|
||||||
|
{
|
||||||
|
for (int tag : meta->param1_int_set) {
|
||||||
|
if (buff->meta->tags.find(tag) != buff->meta->tags.end()) {
|
||||||
|
del_buffs.push_back(buff->buff_uniid);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
for (int buff_uniid : del_buffs) {
|
||||||
|
owner->RemoveBuffByUniId(buff_uniid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -69,6 +69,7 @@ class Buff
|
|||||||
void ProcSeletTargetWithSelfPos();
|
void ProcSeletTargetWithSelfPos();
|
||||||
void ProcTurnOver();
|
void ProcTurnOver();
|
||||||
void ProcPullToWalkable();
|
void ProcPullToWalkable();
|
||||||
|
void ProcDisperse();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void InternalTimerAddBuff();
|
void InternalTimerAddBuff();
|
||||||
|
@ -86,6 +86,9 @@ enum BuffEffectType_e
|
|||||||
kBET_MountainTop = 63, //在山顶
|
kBET_MountainTop = 63, //在山顶
|
||||||
kBET_UseSkill = 64, //使用技能
|
kBET_UseSkill = 64, //使用技能
|
||||||
kBET_CamouflageAddition = 65, //对抗伪装
|
kBET_CamouflageAddition = 65, //对抗伪装
|
||||||
|
kBET_AutoShot = 66, //自动射击
|
||||||
|
kBET_BeatBack = 67, //击退
|
||||||
|
kBET_Disperse = 68, //驱散
|
||||||
|
|
||||||
kBET_End
|
kBET_End
|
||||||
};
|
};
|
||||||
|
@ -409,10 +409,27 @@ int Creature::TryAddBuff(Creature* caster, int buff_id)
|
|||||||
|
|
||||||
void Creature::RemoveBuffById(int buff_id)
|
void Creature::RemoveBuffById(int buff_id)
|
||||||
{
|
{
|
||||||
std::vector<std::tuple<MetaData::Buff*, Creature*>> removed_buffs;
|
int buff_uniid = 0;
|
||||||
for (auto itr = buff_list_.begin(); itr != buff_list_.end(); ++itr) {
|
for (auto itr = buff_list_.begin(); itr != buff_list_.end(); ++itr) {
|
||||||
Buff& buff = *itr;
|
Buff& buff = *itr;
|
||||||
if (buff.meta->i->buff_id() == buff_id) {
|
if (buff.meta->i->buff_id() == buff_id) {
|
||||||
|
buff_uniid = buff.buff_uniid;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (buff_uniid != 0) {
|
||||||
|
RemoveBuffByUniId(buff_uniid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Creature::RemoveBuffByUniId(int buff_uniid)
|
||||||
|
{
|
||||||
|
int buff_id = 0;
|
||||||
|
std::vector<std::tuple<MetaData::Buff*, Creature*>> removed_buffs;
|
||||||
|
for (auto itr = buff_list_.begin(); itr != buff_list_.end(); ++itr) {
|
||||||
|
Buff& buff = *itr;
|
||||||
|
if (buff.buff_uniid == buff_uniid) {
|
||||||
|
buff_id = buff.meta->i->buff_id();
|
||||||
removed_buffs.push_back(std::make_tuple(buff.meta, buff.GetCaster().Get()));
|
removed_buffs.push_back(std::make_tuple(buff.meta, buff.GetCaster().Get()));
|
||||||
OnBuffRemove(buff);
|
OnBuffRemove(buff);
|
||||||
buff.UnInit();
|
buff.UnInit();
|
||||||
@ -472,7 +489,7 @@ void Creature::RemoveBuffById(int buff_id)
|
|||||||
SendDebugMsg(a8::Format("移除buff_id:%d",
|
SendDebugMsg(a8::Format("移除buff_id:%d",
|
||||||
{
|
{
|
||||||
buff_id
|
buff_id
|
||||||
}));
|
}));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -912,6 +929,7 @@ Skill* Creature::CurrentSkill()
|
|||||||
|
|
||||||
void Creature::ProcBuffEffect(Creature* caster, Buff* buff)
|
void Creature::ProcBuffEffect(Creature* caster, Buff* buff)
|
||||||
{
|
{
|
||||||
|
MetaData::Buff* buff_meta = buff->meta;
|
||||||
switch (buff->meta->i->buff_effect()) {
|
switch (buff->meta->i->buff_effect()) {
|
||||||
case kBET_ChgAttr:
|
case kBET_ChgAttr:
|
||||||
case kBET_Car:
|
case kBET_Car:
|
||||||
@ -1209,6 +1227,11 @@ void Creature::ProcBuffEffect(Creature* caster, Buff* buff)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case kBET_Disperse:
|
||||||
|
{
|
||||||
|
buff->ProcDisperse();
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -2418,3 +2441,14 @@ void Creature::ProcOnceChgAttrBuff(MetaData::Buff* buff_meta)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Creature::TraverseBuff(std::function<void (Buff*, bool&)> func)
|
||||||
|
{
|
||||||
|
bool stop = false;
|
||||||
|
for (auto& buff : buff_list_) {
|
||||||
|
func(&buff, stop);
|
||||||
|
if (stop) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -103,6 +103,7 @@ class Creature : public MoveableEntity
|
|||||||
int MustBeAddBuff(Creature* caster, int buff_id);
|
int MustBeAddBuff(Creature* caster, int buff_id);
|
||||||
int TryAddBuff(Creature* caster, int buff_id);
|
int TryAddBuff(Creature* caster, int buff_id);
|
||||||
void RemoveBuffById(int buff_id);
|
void RemoveBuffById(int buff_id);
|
||||||
|
void RemoveBuffByUniId(int buff_uniid);
|
||||||
void ClearBuffById(int buff_id);
|
void ClearBuffById(int buff_id);
|
||||||
void RecalcBuffAttr();
|
void RecalcBuffAttr();
|
||||||
void RemoveBuffByEffectId(int buff_effect_id);
|
void RemoveBuffByEffectId(int buff_effect_id);
|
||||||
@ -207,6 +208,7 @@ class Creature : public MoveableEntity
|
|||||||
Trigger* GetTrigger() { return trigger_; };
|
Trigger* GetTrigger() { return trigger_; };
|
||||||
std::shared_ptr<Ability>& GetAbility() { return ability_; };
|
std::shared_ptr<Ability>& GetAbility() { return ability_; };
|
||||||
void RefreshHP();
|
void RefreshHP();
|
||||||
|
void TraverseBuff(std::function<void (Buff*, bool&)> func);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
@ -822,6 +822,7 @@ namespace MetaData
|
|||||||
a8::Split(i->buff_param1(), strings, '|');
|
a8::Split(i->buff_param1(), strings, '|');
|
||||||
for (auto& str : strings) {
|
for (auto& str : strings) {
|
||||||
param1_int_list.push_back(a8::XValue(str).GetInt());
|
param1_int_list.push_back(a8::XValue(str).GetInt());
|
||||||
|
param1_int_set.insert(a8::XValue(str).GetInt());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
@ -849,6 +850,13 @@ namespace MetaData
|
|||||||
param4_int_list.push_back(a8::XValue(str).GetInt());
|
param4_int_list.push_back(a8::XValue(str).GetInt());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
std::vector<std::string> strings;
|
||||||
|
a8::Split(i->tag(), strings, '|');
|
||||||
|
for (auto& str : strings) {
|
||||||
|
tags.insert(a8::XValue(str).GetInt());
|
||||||
|
}
|
||||||
|
}
|
||||||
{
|
{
|
||||||
std::vector<std::string> strings;
|
std::vector<std::string> strings;
|
||||||
a8::Split(i->post_remove_action(), strings, '|');
|
a8::Split(i->post_remove_action(), strings, '|');
|
||||||
|
@ -213,6 +213,7 @@ namespace MetaData
|
|||||||
int int_param5 = 0;
|
int int_param5 = 0;
|
||||||
std::vector<int> param1_int_list;
|
std::vector<int> param1_int_list;
|
||||||
std::vector<int> param2_int_list;
|
std::vector<int> param2_int_list;
|
||||||
|
std::set<int> param1_int_set;
|
||||||
std::set<int> param2_int_set;
|
std::set<int> param2_int_set;
|
||||||
std::vector<int> param3_int_list;
|
std::vector<int> param3_int_list;
|
||||||
std::vector<int> param4_int_list;
|
std::vector<int> param4_int_list;
|
||||||
@ -220,6 +221,7 @@ namespace MetaData
|
|||||||
std::vector<std::tuple<int, std::vector<int>>> post_remove_action;
|
std::vector<std::tuple<int, std::vector<int>>> post_remove_action;
|
||||||
std::set<int> immune_buffeffect;
|
std::set<int> immune_buffeffect;
|
||||||
std::vector<std::tuple<int, float, float, int, int>> hero_infos;
|
std::vector<std::tuple<int, float, float, int, int>> hero_infos;
|
||||||
|
std::set<int> tags;
|
||||||
|
|
||||||
std::vector<int> child_buff_list;
|
std::vector<int> child_buff_list;
|
||||||
};
|
};
|
||||||
|
@ -258,6 +258,7 @@ message Buff
|
|||||||
optional int32 coexist_num = 18;
|
optional int32 coexist_num = 18;
|
||||||
optional int32 dead_valid = 23;
|
optional int32 dead_valid = 23;
|
||||||
optional int32 buff_interval = 24;
|
optional int32 buff_interval = 24;
|
||||||
|
optional string tag = 25;
|
||||||
}
|
}
|
||||||
|
|
||||||
message Drop
|
message Drop
|
||||||
|
Loading…
x
Reference in New Issue
Block a user