This commit is contained in:
aozhiwei 2021-06-28 06:08:21 +00:00
parent e102d4a5ac
commit 3ee4fb2175
6 changed files with 18 additions and 7 deletions

View File

@ -491,8 +491,3 @@ void Buff::ProcPullToWalkable()
owner->FindLocation(); owner->FindLocation();
} }
} }
void Buff::ProcCondAddBuff()
{
}

View File

@ -57,7 +57,6 @@ class Buff
void ProcSeletTargetWithSelfPos(); void ProcSeletTargetWithSelfPos();
void ProcTurnOver(); void ProcTurnOver();
void ProcPullToWalkable(); void ProcPullToWalkable();
void ProcCondAddBuff();
private: private:
void InternalTimerAddBuff(); void InternalTimerAddBuff();

View File

@ -288,6 +288,9 @@ void Creature::RemoveBuffById(int buff_id)
if (!list_empty(&buff.depend_entry)) { if (!list_empty(&buff.depend_entry)) {
list_del_init(&buff.depend_entry); list_del_init(&buff.depend_entry);
} }
if (!list_empty(&buff.cond_entry)) {
list_del_init(&buff.cond_entry);
}
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_list_.erase(itr); buff_list_.erase(itr);
@ -1001,7 +1004,10 @@ void Creature::ProcBuffEffect(Creature* caster, Buff* buff)
break; break;
case kBET_CondAddBuff: case kBET_CondAddBuff:
{ {
buff->ProcCondAddBuff(); if (!IsValidCondBuff(buff->meta->int_param1)) {
abort();
}
list_add_tail(&buff->cond_entry, &cond_buffs_[buff->meta->int_param1]);
} }
break; break;
default: default:

View File

@ -46,3 +46,8 @@ bool IsValidHumanAttr(int attr_type)
{ {
return attr_type > kHAT_Begin && attr_type < kHAT_End; return attr_type > kHAT_Begin && attr_type < kHAT_End;
} }
bool IsValidCondBuff(int cond)
{
return cond >= 0 && cond < kCondBuffEnd;
}

View File

@ -24,3 +24,4 @@ class Global : public a8::Singleton<Global>
bool IsValidSlotId(int slot_id); bool IsValidSlotId(int slot_id);
bool IsValidBuffEffect(int buff_effect); bool IsValidBuffEffect(int buff_effect);
bool IsValidHumanAttr(int attr_type); bool IsValidHumanAttr(int attr_type);
bool IsValidCondBuff(int cond);

View File

@ -888,6 +888,11 @@ namespace MetaData
} }
} }
} }
if (i->buff_effect() == kBET_CondAddBuff) {
if (!IsValidCondBuff(int_param1)) {
abort();
}
}
} }
bool Buff::EffectCanStack() bool Buff::EffectCanStack()