添加地雷处理
This commit is contained in:
parent
733cdd5568
commit
2737a2fc17
@ -1717,6 +1717,24 @@ Buff* Human::GetBuffByEffectId(int effect_id)
|
|||||||
|
|
||||||
void Human::ProcSkillPhase(MetaData::SkillPhase* phase)
|
void Human::ProcSkillPhase(MetaData::SkillPhase* phase)
|
||||||
{
|
{
|
||||||
|
auto frame_check_func =
|
||||||
|
[] (const a8::XParams& param)
|
||||||
|
{
|
||||||
|
Obstacle* obstacle = (Obstacle*)param.sender.GetUserData();
|
||||||
|
if (!obstacle->dead) {
|
||||||
|
obstacle->room->TouchHumanList(a8::XParams(),
|
||||||
|
[obstacle] (Human* hum, a8::XParams&) -> bool
|
||||||
|
{
|
||||||
|
if (obstacle->master->team_id != hum->team_id) {
|
||||||
|
obstacle->dead = true;
|
||||||
|
obstacle->Explosion();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
switch (phase->func_id) {
|
switch (phase->func_id) {
|
||||||
case Skill_Jump:
|
case Skill_Jump:
|
||||||
{
|
{
|
||||||
@ -1732,7 +1750,12 @@ void Human::ProcSkillPhase(MetaData::SkillPhase* phase)
|
|||||||
{
|
{
|
||||||
Obstacle* obstacle = room->CreateObstacle(phase->param1.GetInt(), pos.x, pos.y);
|
Obstacle* obstacle = room->CreateObstacle(phase->param1.GetInt(), pos.x, pos.y);
|
||||||
if (obstacle) {
|
if (obstacle) {
|
||||||
obstacle->master_id = entity_uniid;
|
obstacle->master = this;
|
||||||
|
room->xtimer.AddRepeatTimerAndAttach(2,
|
||||||
|
a8::XParams()
|
||||||
|
.SetSender(obstacle),
|
||||||
|
frame_check_func,
|
||||||
|
&obstacle->xtimer_attacher.timer_list_);
|
||||||
room->xtimer.AddDeadLineTimerAndAttach(SERVER_FRAME_RATE * 5,
|
room->xtimer.AddDeadLineTimerAndAttach(SERVER_FRAME_RATE * 5,
|
||||||
a8::XParams()
|
a8::XParams()
|
||||||
.SetSender(obstacle),
|
.SetSender(obstacle),
|
||||||
|
@ -114,8 +114,8 @@ void Obstacle::FillMFObjectFull(cs::MFObjectFull* full_data)
|
|||||||
p->set_health(health);
|
p->set_health(health);
|
||||||
p->set_dead(dead);
|
p->set_dead(dead);
|
||||||
p->set_dead_at_thisframe(dead ? dead_frameno <= room->frame_no : false);
|
p->set_dead_at_thisframe(dead ? dead_frameno <= room->frame_no : false);
|
||||||
if (master_id != 0) {
|
if (master) {
|
||||||
p->set_master_id(master_id);
|
p->set_master_id(master->entity_uniid);
|
||||||
}
|
}
|
||||||
|
|
||||||
p->set_is_door(is_door);
|
p->set_is_door(is_door);
|
||||||
|
@ -32,7 +32,7 @@ class Obstacle : public Entity
|
|||||||
DoorState_e door_state = DoorStateClose;
|
DoorState_e door_state = DoorStateClose;
|
||||||
Building* building = nullptr;
|
Building* building = nullptr;
|
||||||
int door_house_uniid = 0;
|
int door_house_uniid = 0;
|
||||||
int master_id = 0;
|
Human* master = nullptr;
|
||||||
bool explosioned = false;
|
bool explosioned = false;
|
||||||
const metatable::DoorObjJson* door_state0 = nullptr;
|
const metatable::DoorObjJson* door_state0 = nullptr;
|
||||||
const metatable::DoorObjJson* door_state1 = nullptr;
|
const metatable::DoorObjJson* door_state1 = nullptr;
|
||||||
|
@ -44,7 +44,6 @@ public:
|
|||||||
MapService map_service;
|
MapService map_service;
|
||||||
long long battle_start_frameno_ = 0;
|
long long battle_start_frameno_ = 0;
|
||||||
long long pending_request = 0;
|
long long pending_request = 0;
|
||||||
std::set<Obstacle*> mines_;
|
|
||||||
|
|
||||||
~Room();
|
~Room();
|
||||||
void Init();
|
void Init();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user