This commit is contained in:
aozhiwei 2020-07-31 11:08:20 +08:00
parent c7d7222519
commit 417813f2d5
5 changed files with 32 additions and 0 deletions

View File

@ -2831,6 +2831,9 @@ void Human::AddBuff(Human* caster,
if (GetBuffById(buff_meta->i->buff_id())) {
return;
}
if (IsImmuneBuffEffect(buff_meta->i->buff_effect())) {
return;
}
if (!buff_meta->EffectCanStack()) {
Buff* buff = GetBuffByEffectId(buff_meta->i->buff_effect());
if (buff) {
@ -2877,6 +2880,16 @@ void Human::AddBuff(Human* caster,
ProcBuffEffect(caster, buff);
}
bool Human::IsImmuneBuffEffect(int buff_effect)
{
for (auto itr = buff_list_.begin(); itr != buff_list_.end(); ++itr) {
if (itr->meta->IsImmuneBuffEffect(buff_effect)) {
return true;
}
}
return false;
}
void Human::RemoveBuffById(int buff_id)
{
for (auto itr = buff_list_.begin(); itr != buff_list_.end(); ++itr) {

View File

@ -253,6 +253,7 @@ class Human : public MoveableEntity
MetaData::Buff* buff_meta,
int skill_lv,
MetaData::Skill* buff_skill_meta = nullptr);
bool IsImmuneBuffEffect(int buff_effect);
void RemoveBuffById(int buff_id);
void RemoveBuffByEffectId(int buff_effect_id);
void ClearBuffList();

View File

@ -450,6 +450,13 @@ namespace MetaData
param2 = a8::XValue(i->buff_param2()).GetDouble();
param3 = a8::XValue(i->buff_param3()).GetDouble();
param4 = a8::XValue(i->buff_param4()).GetDouble();
{
std::vector<std::string> strings;
a8::Split(i->immune_buffeffect_list(), strings, '|');
for (auto& str : strings) {
immune_buffeffect.insert(a8::XValue(str));
}
}
}
bool Buff::EffectCanStack()
@ -457,6 +464,11 @@ namespace MetaData
return i->buff_effect() == kBET_ChgAttr;
}
bool Buff::IsImmuneBuffEffect(int buff_effect)
{
return immune_buffeffect.find(buff_effect) != immune_buffeffect.end();
}
void Dress::Init()
{
for (int j = 0; j < i->max_lv(); ++j) {

View File

@ -152,11 +152,13 @@ namespace MetaData
void Init();
bool EffectCanStack();
bool IsImmuneBuffEffect(int buff_effect);
float param1 = 0.0f;
float param2 = 0.0f;
float param3 = 0.0f;
float param4 = 0.0f;
std::set<int> immune_buffeffect;
};
struct SkillPhase

View File

@ -141,6 +141,9 @@ message Robot
optional int32 skin = 3;
optional int32 weapon_id = 4;
optional int32 weapon_lv = 5;
optional int32 zbmode_weapon_id = 6;
optional int32 zbmode_weapon_lv = 7;
}
message Skill
@ -185,6 +188,7 @@ message Buff
required string buff_param4 = 9;
required float duration_time = 10;
optional float buff_valueup = 11;
required string immune_buffeffect_list = 12;
}
message Drop