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