添加烟雾弹混乱逻辑判断
This commit is contained in:
parent
a6d0aed3a2
commit
fc1ce18681
@ -207,6 +207,7 @@ void Bullet::ProcSmokeBomb()
|
|||||||
task->room = room;
|
task->room = room;
|
||||||
task->bomb_pos = GetPos();
|
task->bomb_pos = GetPos();
|
||||||
task->buff_meta = buff_meta;
|
task->buff_meta = buff_meta;
|
||||||
|
task->gun_meta = gun_meta;
|
||||||
room->xtimer.AddRepeatTimerAndAttach
|
room->xtimer.AddRepeatTimerAndAttach
|
||||||
(SERVER_FRAME_RATE / 2,
|
(SERVER_FRAME_RATE / 2,
|
||||||
a8::XParams()
|
a8::XParams()
|
||||||
@ -229,6 +230,7 @@ void Bullet::ProcSmokeBomb()
|
|||||||
[] (const a8::XParams& param)
|
[] (const a8::XParams& param)
|
||||||
{
|
{
|
||||||
SmokeMiTask* task = (SmokeMiTask*)param.sender.GetUserData();
|
SmokeMiTask* task = (SmokeMiTask*)param.sender.GetUserData();
|
||||||
|
task->Done();
|
||||||
delete task;
|
delete task;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -237,6 +239,9 @@ void Bullet::ProcSmokeBomb()
|
|||||||
|
|
||||||
bool Bullet::IsBomb()
|
bool Bullet::IsBomb()
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
|
((metatable::Equip*)meta->i)->set__inventory_slot(6);
|
||||||
|
#endif
|
||||||
return
|
return
|
||||||
meta->i->_inventory_slot() == 4 ||
|
meta->i->_inventory_slot() == 4 ||
|
||||||
meta->i->_inventory_slot() == 5 ||
|
meta->i->_inventory_slot() == 5 ||
|
||||||
|
@ -3032,6 +3032,13 @@ void Human::AddBuff(Human* caster,
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
ProcBuffEffect(caster, buff);
|
ProcBuffEffect(caster, buff);
|
||||||
|
#ifdef DEBUG
|
||||||
|
SendDebugMsg(a8::Format("添加buff_id:%d buff_effect:%d",
|
||||||
|
{
|
||||||
|
buff_meta->i->buff_id(),
|
||||||
|
buff_meta->i->buff_effect()
|
||||||
|
}));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Human::IsImmuneBuffEffect(int buff_effect)
|
bool Human::IsImmuneBuffEffect(int buff_effect)
|
||||||
@ -3057,6 +3064,12 @@ void Human::RemoveBuffById(int buff_id)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
RecalcBuffAttr();
|
RecalcBuffAttr();
|
||||||
|
#ifdef DEBUG
|
||||||
|
SendDebugMsg(a8::Format("移除buff_id:%d",
|
||||||
|
{
|
||||||
|
buff_id
|
||||||
|
}));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Human::RemoveBuffByEffectId(int buff_effect_id)
|
void Human::RemoveBuffByEffectId(int buff_effect_id)
|
||||||
|
@ -3,13 +3,14 @@
|
|||||||
#include "smoke_mitask.h"
|
#include "smoke_mitask.h"
|
||||||
#include "room.h"
|
#include "room.h"
|
||||||
#include "player.h"
|
#include "player.h"
|
||||||
|
#include "metadata.h"
|
||||||
|
|
||||||
void SmokeMiTask::Check()
|
void SmokeMiTask::Check()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
std::list<Player*> deleted_hums;
|
std::list<Player*> deleted_hums;
|
||||||
for (auto& hum : player_set) {
|
for (auto& hum : player_set) {
|
||||||
if (bomb_pos.Distance(hum->GetPos()) > 0.0001) {
|
if (bomb_pos.Distance(hum->GetPos()) > gun_meta->i->bullet_rad() + hum->meta->i->radius()) {
|
||||||
hum->RemoveBuffByEffectId(kBET_HunLuan);
|
hum->RemoveBuffByEffectId(kBET_HunLuan);
|
||||||
deleted_hums.push_back(hum);
|
deleted_hums.push_back(hum);
|
||||||
}
|
}
|
||||||
@ -22,11 +23,19 @@ void SmokeMiTask::Check()
|
|||||||
(a8::XParams(),
|
(a8::XParams(),
|
||||||
[this] (Player* hum, a8::XParams&) -> bool
|
[this] (Player* hum, a8::XParams&) -> bool
|
||||||
{
|
{
|
||||||
if (bomb_pos.Distance(hum->GetPos()) < 0.0001) {
|
if (bomb_pos.Distance(hum->GetPos()) < gun_meta->i->bullet_rad() + hum->meta->i->radius()) {
|
||||||
if (!hum->HasBuffEffect(kBET_HunLuan)) {
|
if (!hum->HasBuffEffect(kBET_HunLuan)) {
|
||||||
hum->AddBuff(nullptr, buff_meta, 1, nullptr);
|
hum->AddBuff(nullptr, buff_meta, 1, nullptr);
|
||||||
|
player_set.insert(hum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SmokeMiTask::Done()
|
||||||
|
{
|
||||||
|
for (auto& hum : player_set) {
|
||||||
|
hum->RemoveBuffByEffectId(kBET_HunLuan);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -6,6 +6,7 @@ const int HUNLUAN_BUFFID = 6001;
|
|||||||
namespace MetaData
|
namespace MetaData
|
||||||
{
|
{
|
||||||
struct Buff;
|
struct Buff;
|
||||||
|
struct Equip;
|
||||||
}
|
}
|
||||||
|
|
||||||
class Room;
|
class Room;
|
||||||
@ -17,6 +18,8 @@ class SmokeMiTask : public MicroTask
|
|||||||
a8::Vec2 bomb_pos;
|
a8::Vec2 bomb_pos;
|
||||||
std::set<Player*> player_set;
|
std::set<Player*> player_set;
|
||||||
MetaData::Buff* buff_meta = nullptr;
|
MetaData::Buff* buff_meta = nullptr;
|
||||||
|
MetaData::Equip* gun_meta = nullptr;
|
||||||
|
|
||||||
void Check();
|
void Check();
|
||||||
|
void Done();
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user