This commit is contained in:
aozhiwei 2021-04-09 20:39:33 +08:00
parent c59716b96d
commit 6e5e733174
6 changed files with 38 additions and 0 deletions

View File

@ -374,6 +374,8 @@ void Bullet::ProcPosionGasBomb(int delay_time)
{
if (sender.Get()) {
#if 1
a8::Vec2 old_buff_vec2_param1 = sender.Get()->buff_vec2_param1;
sender.Get()->buff_vec2_param1 = GetPos();
MetaData::Buff * buff_meta = MetaMgr::Instance()->GetBuff(gun_meta->i->buffid());
if (buff_meta) {
sender.Get()->AddBuff(sender.Get(),
@ -381,6 +383,7 @@ void Bullet::ProcPosionGasBomb(int delay_time)
1
);
}
sender.Get()->buff_vec2_param1 = old_buff_vec2_param1;
#else
PosionGasMiTask* task = new PosionGasMiTask();
task->room = room;

View File

@ -383,6 +383,7 @@ enum ObstacleType_e
kObstacleSelfExplosion = 1,
kObstacleMine = 2,
kObstacleTrap = 3,
kObstaclePosionGas = 4,
};
const char* const PROJ_NAME_FMT = "game%d_gameserver";

View File

@ -21,6 +21,8 @@ void InternalShot(Creature* c,
{
if (weapon_meta->i->_inventory_slot() == IS_TRAP ||
weapon_meta->i->_inventory_slot() == IS_MINE) {
a8::Vec2 old_buff_vec2_param1 = c->buff_vec2_param1;
c->buff_vec2_param1 = c->GetPos();
MetaData::Buff * buff_meta = MetaMgr::Instance()->GetBuff(bullet_meta->i->buffid());
if (buff_meta) {
c->AddBuff(c,
@ -28,6 +30,7 @@ void InternalShot(Creature* c,
1
);
}
c->buff_vec2_param1 = old_buff_vec2_param1;
return;
}
for (auto& tuple : weapon_meta->bullet_born_offset) {
@ -843,6 +846,7 @@ void Creature::ProcBuffEffect(Creature* caster, Buff* buff)
case kBET_SummonObstacle:
{
a8::Vec2 target_pos = caster->GetPos() + caster->skill_dir_ * caster->skill_distance_;
target_pos = buff_vec2_param1;
SummonObstacle(buff->meta->param1, target_pos);
}
break;

View File

@ -47,6 +47,7 @@ class Creature : public MoveableEntity
long long poisoning_time = 0;
Weapon car_weapon;
a8::Vec2 buff_vec2_param1;
bool need_sync_active_player = false;
std::function<void ()> on_loading_bullet;

View File

@ -330,6 +330,11 @@ void RoomObstacle::Active()
ActiveTrap();
}
break;
case kObstaclePosionGas:
{
ActivePosionGas();
}
break;
default:
break;
}
@ -393,3 +398,26 @@ void RoomObstacle::ActiveTrap()
&xtimer_attacher.timer_list_
);
}
void RoomObstacle::ActivePosionGas()
{
room->frame_event.AddExplosionEx
(master,
0,//task->meta->i->id(),
GetPos(),
meta->i->explosion_effect());
room->xtimer.AddDeadLineTimerAndAttach
(
SERVER_FRAME_RATE,
a8::XParams()
.SetSender(this),
[] (const a8::XParams& param)
{
RoomObstacle* obstacle = (RoomObstacle*)param.sender.GetUserData();
obstacle->Die(obstacle->room);
obstacle->BroadcastFullState(obstacle->room);
},
&xtimer_attacher.timer_list_
);
}

View File

@ -28,6 +28,7 @@ private:
void ActiveSelfExplosion();
void ActiveMine();
void ActiveTrap();
void ActivePosionGas();
protected:
bool temp_through_ = false;