add coexist_num
This commit is contained in:
parent
8364eeb6f6
commit
c56483e85d
@ -163,16 +163,27 @@ Buff* Creature::GetBuffById(int buff_id)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int Creature::GetBuffNum(int buff_id)
|
||||
{
|
||||
int num = 0;
|
||||
for (Buff& buff : buff_list_) {
|
||||
if (buff.meta->i->buff_id() == buff_id) {
|
||||
++num;
|
||||
}
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
void Creature::AddBuff(Creature* caster,
|
||||
MetaData::Buff* buff_meta,
|
||||
int skill_lv,
|
||||
MetaData::Skill* buff_skill_meta)
|
||||
{
|
||||
#if 0
|
||||
if (GetBuffById(buff_meta->i->buff_id())) {
|
||||
return;
|
||||
if (buff_meta->i->coexist_num() > 0){
|
||||
if (GetBuffNum(buff_meta->i->buff_id()) >= buff_meta->i->coexist_num()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (IsImmuneBuffEffect(buff_meta->i->buff_effect())) {
|
||||
return;
|
||||
}
|
||||
@ -345,6 +356,13 @@ void Creature::RemoveBuffById(int buff_id)
|
||||
#endif
|
||||
}
|
||||
|
||||
void Creature::ClearBuffById(int buff_id)
|
||||
{
|
||||
while (GetBuffById(buff_id)) {
|
||||
RemoveBuffById(buff_id);
|
||||
}
|
||||
}
|
||||
|
||||
void Creature::SendDebugMsg(const std::string& debug_msg)
|
||||
{
|
||||
|
||||
|
@ -93,6 +93,7 @@ class Creature : public MoveableEntity
|
||||
bool HasBuffEffect(int buff_effect_id);
|
||||
Buff* GetBuffByEffectId(int effect_id);
|
||||
Buff* GetBuffById(int buff_id);
|
||||
int GetBuffNum(int buff_id);
|
||||
void AddBuff(Creature* caster,
|
||||
MetaData::Buff* buff_meta,
|
||||
int skill_lv,
|
||||
@ -101,6 +102,7 @@ class Creature : public MoveableEntity
|
||||
void MustBeAddBuff(Creature* caster, int buff_id);
|
||||
void TryAddBuff(Creature* caster, int buff_id);
|
||||
void RemoveBuffById(int buff_id);
|
||||
void ClearBuffById(int buff_id);
|
||||
void RecalcBuffAttr();
|
||||
void RemoveBuffByEffectId(int buff_effect_id);
|
||||
void ClearBuffList();
|
||||
|
@ -247,6 +247,7 @@ message Buff
|
||||
optional int32 only_self = 15;
|
||||
optional int32 depend_effect = 16;
|
||||
optional string child_buff = 17;
|
||||
optional int32 coexist_num = 18;
|
||||
}
|
||||
|
||||
message Drop
|
||||
|
Loading…
x
Reference in New Issue
Block a user