修复隐身问题
This commit is contained in:
parent
8df475806c
commit
cd0d0726ae
@ -24,7 +24,7 @@
|
||||
#include "framework/cpp/utils.h"
|
||||
#include "framework/cpp/httpclientpool.h"
|
||||
|
||||
const int HIDE_BUFF_ID = 1010;
|
||||
const int GRASS_HIDE_BUFF_ID = 1016;
|
||||
|
||||
Human::Human():Entity()
|
||||
{
|
||||
@ -570,7 +570,7 @@ void Human::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
|
||||
room->OnHumanDie(this);
|
||||
{
|
||||
OnLeaveGrass();
|
||||
RemoveBuff(HIDE_BUFF_ID);
|
||||
RemoveBuffById(GRASS_HIDE_BUFF_ID);
|
||||
}
|
||||
SyncAroundPlayers();
|
||||
}
|
||||
@ -1403,7 +1403,7 @@ void Human::AddBuff(MetaData::Buff* buff_meta)
|
||||
if (!buff_meta->EffectCanStack()) {
|
||||
Buff* buff = GetBuffByEffectId(buff_meta->i->buff_effect());
|
||||
if (buff) {
|
||||
RemoveBuff(buff->meta->i->buff_id());
|
||||
RemoveBuffById(buff->meta->i->buff_id());
|
||||
}
|
||||
}
|
||||
Buff* buff = &a8::FastAppend(buff_list_);
|
||||
@ -1423,7 +1423,7 @@ void Human::AddBuff(MetaData::Buff* buff_meta)
|
||||
[] (const a8::XParams& param)
|
||||
{
|
||||
Human* hum = (Human*)param.sender.GetUserData();
|
||||
hum->RemoveBuff(param.param1);
|
||||
hum->RemoveBuffById(param.param1);
|
||||
},
|
||||
&buff->xtimer_attacher.timer_list_
|
||||
);
|
||||
@ -1431,7 +1431,7 @@ void Human::AddBuff(MetaData::Buff* buff_meta)
|
||||
ProcBuffEffect(buff);
|
||||
}
|
||||
|
||||
void Human::RemoveBuff(int buff_id)
|
||||
void Human::RemoveBuffById(int buff_id)
|
||||
{
|
||||
for (auto itr = buff_list_.begin(); itr != buff_list_.end(); ++itr) {
|
||||
if (itr->meta->i->buff_id() == buff_id) {
|
||||
@ -1445,6 +1445,14 @@ void Human::RemoveBuff(int buff_id)
|
||||
}
|
||||
}
|
||||
|
||||
void Human::RemoveBuffByEffectId(int buff_effect_id)
|
||||
{
|
||||
Buff* buff = GetBuffByEffectId(buff_effect_id);
|
||||
if (buff) {
|
||||
RemoveBuffById(buff->meta->i->buff_id());
|
||||
}
|
||||
}
|
||||
|
||||
bool Human::HasBuffEffect(int buff_effect_id)
|
||||
{
|
||||
return GetBuffByEffectId(buff_effect_id) != nullptr;
|
||||
@ -1535,7 +1543,7 @@ void Human::OnAttack()
|
||||
{
|
||||
if (a8::HasBitFlag(status, HS_InGrass)) {
|
||||
if (HasBuffEffect(BET_Hide)) {
|
||||
RemoveBuff(buff_effect_[BET_Hide]->meta->i->buff_id());
|
||||
RemoveBuffByEffectId(BET_Hide);
|
||||
}
|
||||
if (grass_hide_timer_list_) {
|
||||
room->xtimer.ModifyTimer(grass_hide_timer_list_,
|
||||
@ -1546,7 +1554,7 @@ void Human::OnAttack()
|
||||
{
|
||||
Human* hum = (Human*)param.sender.GetUserData();
|
||||
hum->grass_hide_timer_list_ = nullptr;
|
||||
MetaData::Buff* buff_meta = MetaMgr::Instance()->GetBuff(HIDE_BUFF_ID);
|
||||
MetaData::Buff* buff_meta = MetaMgr::Instance()->GetBuff(GRASS_HIDE_BUFF_ID);
|
||||
if (buff_meta) {
|
||||
hum->AddBuff(buff_meta);
|
||||
}
|
||||
@ -1580,7 +1588,7 @@ void Human::OnEnterGrass()
|
||||
{
|
||||
Human* hum = (Human*)param.sender.GetUserData();
|
||||
hum->grass_hide_timer_list_ = nullptr;
|
||||
MetaData::Buff* buff_meta = MetaMgr::Instance()->GetBuff(HIDE_BUFF_ID);
|
||||
MetaData::Buff* buff_meta = MetaMgr::Instance()->GetBuff(GRASS_HIDE_BUFF_ID);
|
||||
if (buff_meta) {
|
||||
hum->AddBuff(buff_meta);
|
||||
}
|
||||
@ -1611,7 +1619,7 @@ void Human::OnLeaveGrass()
|
||||
{
|
||||
Human* hum = (Human*)param.sender.GetUserData();
|
||||
hum->leave_grass_timer_list_ = nullptr;
|
||||
hum->RemoveBuff(HIDE_BUFF_ID);
|
||||
hum->RemoveBuffById(GRASS_HIDE_BUFF_ID);
|
||||
},
|
||||
&xtimer_attacher.timer_list_);
|
||||
}
|
||||
@ -1766,7 +1774,7 @@ void Human::_UpdateAssaultMove()
|
||||
room->frame_event.AddExplosion(0, pos, 2);
|
||||
room->grid_service.MoveHuman(this);
|
||||
}
|
||||
RemoveBuff(buff->meta->i->buff_id());
|
||||
RemoveBuffById(buff->meta->i->buff_id());
|
||||
a8::UnSetBitFlag(status, HS_Assaulting);
|
||||
}
|
||||
}
|
||||
|
@ -201,7 +201,8 @@ class Human : public Entity
|
||||
int GetSkillCd();
|
||||
void TriggerBuff(std::set<Entity*>& target_list, BuffTriggerType_e trigger_type);
|
||||
void AddBuff(MetaData::Buff* buff_meta);
|
||||
void RemoveBuff(int buff_id);
|
||||
void RemoveBuffById(int buff_id);
|
||||
void RemoveBuffByEffectId(int buff_effect_id);
|
||||
bool HasBuffEffect(int buff_effect_id);
|
||||
Buff* GetBuffByEffectId(int effect_id);
|
||||
void RecalcBuffAttr();
|
||||
|
Loading…
x
Reference in New Issue
Block a user