1
This commit is contained in:
parent
c8d0b871ca
commit
a6d0aed3a2
@ -10,6 +10,7 @@
|
|||||||
#include "android.ai.h"
|
#include "android.ai.h"
|
||||||
#include "app.h"
|
#include "app.h"
|
||||||
#include "perfmonitor.h"
|
#include "perfmonitor.h"
|
||||||
|
#include "smoke_mitask.h"
|
||||||
|
|
||||||
Bullet::Bullet():MoveableEntity()
|
Bullet::Bullet():MoveableEntity()
|
||||||
{
|
{
|
||||||
@ -191,12 +192,49 @@ void Bullet::ProcBomb()
|
|||||||
//烟雾弹
|
//烟雾弹
|
||||||
a8::Vec2 bomb_pos = GetPos();
|
a8::Vec2 bomb_pos = GetPos();
|
||||||
room->frame_event.AddSmoke(this, meta->i->id(), bomb_pos);
|
room->frame_event.AddSmoke(this, meta->i->id(), bomb_pos);
|
||||||
|
ProcSmokeBomb();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
room->RemoveObjectLater(this);
|
room->RemoveObjectLater(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Bullet::ProcSmokeBomb()
|
||||||
|
{
|
||||||
|
MetaData::Buff* buff_meta = MetaMgr::Instance()->GetBuff(HUNLUAN_BUFFID);
|
||||||
|
if (buff_meta) {
|
||||||
|
SmokeMiTask* task = new SmokeMiTask();
|
||||||
|
task->room = room;
|
||||||
|
task->bomb_pos = GetPos();
|
||||||
|
task->buff_meta = buff_meta;
|
||||||
|
room->xtimer.AddRepeatTimerAndAttach
|
||||||
|
(SERVER_FRAME_RATE / 2,
|
||||||
|
a8::XParams()
|
||||||
|
.SetSender(task),
|
||||||
|
[] (const a8::XParams& param)
|
||||||
|
{
|
||||||
|
SmokeMiTask* task = (SmokeMiTask*)param.sender.GetUserData();
|
||||||
|
task->Check();
|
||||||
|
},
|
||||||
|
&task->timer_attacher.timer_list_);
|
||||||
|
|
||||||
|
room->xtimer.AddDeadLineTimerAndAttach
|
||||||
|
(SERVER_FRAME_RATE * MetaMgr::Instance()->GetSysParamAsInt("smoke_duration", 10),
|
||||||
|
a8::XParams()
|
||||||
|
.SetSender(task),
|
||||||
|
[] (const a8::XParams& param)
|
||||||
|
{
|
||||||
|
},
|
||||||
|
&room->timer_attacher.timer_list_,
|
||||||
|
[] (const a8::XParams& param)
|
||||||
|
{
|
||||||
|
SmokeMiTask* task = (SmokeMiTask*)param.sender.GetUserData();
|
||||||
|
delete task;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool Bullet::IsBomb()
|
bool Bullet::IsBomb()
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
|
@ -40,6 +40,7 @@ protected:
|
|||||||
|
|
||||||
void OnHit(std::set<Entity*>& objects);
|
void OnHit(std::set<Entity*>& objects);
|
||||||
void ProcBomb();
|
void ProcBomb();
|
||||||
|
void ProcSmokeBomb();
|
||||||
bool IsBomb();
|
bool IsBomb();
|
||||||
inline void MapServiceUpdate();
|
inline void MapServiceUpdate();
|
||||||
float GetAtk();
|
float GetAtk();
|
||||||
|
@ -138,7 +138,8 @@ enum BuffEffectType_e
|
|||||||
kBET_CliEffect1 = 19, //僵尸被动光环减速(客户端表现用)
|
kBET_CliEffect1 = 19, //僵尸被动光环减速(客户端表现用)
|
||||||
kBET_CliEffect2 = 20, //僵尸被动光环毒物(客户端表现用)
|
kBET_CliEffect2 = 20, //僵尸被动光环毒物(客户端表现用)
|
||||||
kBET_CliEffect3 = 21, //僵尸被动光环地震(客户端表现用)
|
kBET_CliEffect3 = 21, //僵尸被动光环地震(客户端表现用)
|
||||||
kBET_CliEffect4 = 22, //被拖拽(客户端表现用)
|
kBET_CliEffect4 = 22, //被拖拽(客户端表现用)
|
||||||
|
kBET_HunLuan = 23, //混乱,在烟雾弹中不自动瞄准
|
||||||
kBET_End
|
kBET_End
|
||||||
};
|
};
|
||||||
|
|
||||||
|
3
server/gameserver/microtask.cc
Normal file
3
server/gameserver/microtask.cc
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#include "precompile.h"
|
||||||
|
|
||||||
|
#include "microtask.h"
|
7
server/gameserver/microtask.h
Normal file
7
server/gameserver/microtask.h
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
class MicroTask
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
a8::TimerAttacher timer_attacher;
|
||||||
|
};
|
32
server/gameserver/smoke_mitask.cc
Normal file
32
server/gameserver/smoke_mitask.cc
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
#include "precompile.h"
|
||||||
|
|
||||||
|
#include "smoke_mitask.h"
|
||||||
|
#include "room.h"
|
||||||
|
#include "player.h"
|
||||||
|
|
||||||
|
void SmokeMiTask::Check()
|
||||||
|
{
|
||||||
|
{
|
||||||
|
std::list<Player*> deleted_hums;
|
||||||
|
for (auto& hum : player_set) {
|
||||||
|
if (bomb_pos.Distance(hum->GetPos()) > 0.0001) {
|
||||||
|
hum->RemoveBuffByEffectId(kBET_HunLuan);
|
||||||
|
deleted_hums.push_back(hum);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (auto& hum : deleted_hums) {
|
||||||
|
player_set.erase(hum);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
room->TouchPlayerList
|
||||||
|
(a8::XParams(),
|
||||||
|
[this] (Player* hum, a8::XParams&) -> bool
|
||||||
|
{
|
||||||
|
if (bomb_pos.Distance(hum->GetPos()) < 0.0001) {
|
||||||
|
if (!hum->HasBuffEffect(kBET_HunLuan)) {
|
||||||
|
hum->AddBuff(nullptr, buff_meta, 1, nullptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
22
server/gameserver/smoke_mitask.h
Normal file
22
server/gameserver/smoke_mitask.h
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "microtask.h"
|
||||||
|
|
||||||
|
const int HUNLUAN_BUFFID = 6001;
|
||||||
|
namespace MetaData
|
||||||
|
{
|
||||||
|
struct Buff;
|
||||||
|
}
|
||||||
|
|
||||||
|
class Room;
|
||||||
|
class Player;
|
||||||
|
class SmokeMiTask : public MicroTask
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Room* room = nullptr;
|
||||||
|
a8::Vec2 bomb_pos;
|
||||||
|
std::set<Player*> player_set;
|
||||||
|
MetaData::Buff* buff_meta = nullptr;
|
||||||
|
|
||||||
|
void Check();
|
||||||
|
};
|
Loading…
x
Reference in New Issue
Block a user