merge dev

This commit is contained in:
aozhiwei 2021-04-12 16:53:53 +08:00
commit d904a3d3d8
12 changed files with 146 additions and 3 deletions

View File

@ -37,7 +37,36 @@ void Buff::ProcIntervalAddBuff(Creature* caster)
void Buff::ProcBatchAddBuff(Creature* caster) void Buff::ProcBatchAddBuff(Creature* caster)
{ {
for (auto& tuple : meta->batch_add_list) {
int rand_space = std::get<0>(tuple);
const auto& items = std::get<1>(tuple);
if (items.empty()) {
abort();
}
int rnd = rand();
if (rand_space == -1) {
//概率
rnd = rnd % 10000;
if (rnd < std::get<1>(items[0])){
MetaData::Buff* buff_meta = MetaMgr::Instance()->GetBuff(std::get<0>(items[0]));
if (buff_meta) {
owner->AddBuff(caster, buff_meta, 1, nullptr);
}
}
} else {
//权重
rnd = rnd % rand_space;
for (const auto& item : items) {
if (rnd <= std::get<1>(item)) {
MetaData::Buff* buff_meta = MetaMgr::Instance()->GetBuff(std::get<0>(item));
if (buff_meta) {
owner->AddBuff(caster, buff_meta, 1, nullptr);
}
break;
}
}
}
}
} }
void Buff::InternalTimerAddBuff(Creature* caster) void Buff::InternalTimerAddBuff(Creature* caster)

View File

@ -373,6 +373,18 @@ void Bullet::ProcFragBomb(int delay_time)
void Bullet::ProcPosionGasBomb(int delay_time) void Bullet::ProcPosionGasBomb(int delay_time)
{ {
if (sender.Get()) { 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(),
buff_meta,
1
);
}
sender.Get()->buff_vec2_param1 = old_buff_vec2_param1;
#else
PosionGasMiTask* task = new PosionGasMiTask(); PosionGasMiTask* task = new PosionGasMiTask();
task->room = room; task->room = room;
task->sender.Attach(sender.Get()); task->sender.Attach(sender.Get());
@ -398,6 +410,7 @@ void Bullet::ProcPosionGasBomb(int delay_time)
}, },
&room->timer_attacher.timer_list_ &room->timer_attacher.timer_list_
); );
#endif
} }
} }

View File

@ -384,6 +384,7 @@ enum ObstacleType_e
kObstacleSelfExplosion = 1, kObstacleSelfExplosion = 1,
kObstacleMine = 2, kObstacleMine = 2,
kObstacleTrap = 3, kObstacleTrap = 3,
kObstaclePosionGas = 4,
}; };
const char* const PROJ_NAME_FMT = "game%d_gameserver"; 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 || if (weapon_meta->i->_inventory_slot() == IS_TRAP ||
weapon_meta->i->_inventory_slot() == IS_MINE) { 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()); MetaData::Buff * buff_meta = MetaMgr::Instance()->GetBuff(bullet_meta->i->buffid());
if (buff_meta) { if (buff_meta) {
c->AddBuff(c, c->AddBuff(c,
@ -28,6 +30,7 @@ void InternalShot(Creature* c,
1 1
); );
} }
c->buff_vec2_param1 = old_buff_vec2_param1;
return; return;
} }
for (auto& tuple : weapon_meta->bullet_born_offset) { for (auto& tuple : weapon_meta->bullet_born_offset) {
@ -843,6 +846,7 @@ void Creature::ProcBuffEffect(Creature* caster, Buff* buff)
case kBET_SummonObstacle: case kBET_SummonObstacle:
{ {
a8::Vec2 target_pos = caster->GetPos() + caster->skill_dir_ * caster->skill_distance_; a8::Vec2 target_pos = caster->GetPos() + caster->skill_dir_ * caster->skill_distance_;
target_pos = buff_vec2_param1;
SummonObstacle(buff->meta->param1, target_pos); SummonObstacle(buff->meta->param1, target_pos);
} }
break; break;

View File

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

View File

@ -836,6 +836,8 @@ void Human::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
RemoveBuffByEffectId(kBET_Camouflage); RemoveBuffByEffectId(kBET_Camouflage);
} }
ClearLordMode(); ClearLordMode();
room->frame_event.AddDead(this,
0);
#ifdef DEBUG #ifdef DEBUG
room->CheckPartObjects(); room->CheckPartObjects();
#endif #endif

View File

@ -555,6 +555,65 @@ namespace MetaData
} }
} }
} }
if (i->buff_effect() == kBET_BatchAddBuff) {
std::vector<std::string> strings1;
a8::Split(i->buff_param1(), strings1, '|');
for (auto& str1 : strings1) {
std::vector<std::string> strings2;
a8::Split(str1, strings2, '|');
for (auto& str2 : strings2) {
if (str2.size() < 1) {
abort();
}
auto& p = a8::FastAppend(batch_add_list);
if (str2[0] != '!') {
//概率
std::vector<std::string> strings3;
a8::Split(str2, strings3, ':');
if (strings3.size() != 2) {
abort();
}
if (a8::XValue(strings3[1]).GetInt() <= 0) {
abort();
}
std::get<0>(p) = -1;
std::get<1>(p).push_back
(
std::make_tuple(a8::XValue(strings3[0]),
a8::XValue(strings3[1]))
);
} else {
//权重
std::vector<std::string> strings3;
a8::Split(str2, strings3, '$');
int rand_space = 0;
for (const std::string& str3 : strings3) {
std::vector<std::string> strings4;
a8::Split(str3, strings4, ':');
if (strings4.size() != 2) {
abort();
}
std::string tmp_str = strings4[0];
a8::ReplaceString(tmp_str, "!", "");
int buff_id = a8::XValue(tmp_str);
int weight = a8::XValue(strings4[1]);
if (weight <= 0) {
abort();
}
rand_space += weight;
std::get<1>(p).push_back
(
std::make_tuple(buff_id,
rand_space)
);
}
std::get<0>(p) = rand_space;
}
}
int i = 0;
}
}
} }
bool Buff::EffectCanStack() bool Buff::EffectCanStack()

View File

@ -170,6 +170,7 @@ namespace MetaData
float param3 = 0.0f; float param3 = 0.0f;
float param4 = 0.0f; float param4 = 0.0f;
std::vector<int> param2_int_list; std::vector<int> param2_int_list;
std::vector<std::tuple<int, std::vector<std::tuple<int, int>>>> batch_add_list;
std::vector<std::tuple<int, std::vector<int>>> post_remove_action; std::vector<std::tuple<int, std::vector<int>>> post_remove_action;
std::set<int> immune_buffeffect; std::set<int> immune_buffeffect;
}; };

View File

@ -2253,7 +2253,7 @@ ObstacleData* Room::GetPermanentObstacleData(int obstacle_uniid)
long long Room::GetGasInactiveTime() long long Room::GetGasInactiveTime()
{ {
#if DEBUG #ifdef DEBUG
return 5; return 5;
#endif #endif
if (room_mode_ == kZombieMode) { if (room_mode_ == kZombieMode) {

View File

@ -330,6 +330,11 @@ void RoomObstacle::Active()
ActiveTrap(); ActiveTrap();
} }
break; break;
case kObstaclePosionGas:
{
ActivePosionGas();
}
break;
default: default:
break; break;
} }
@ -393,3 +398,30 @@ void RoomObstacle::ActiveTrap()
&xtimer_attacher.timer_list_ &xtimer_attacher.timer_list_
); );
} }
void RoomObstacle::ActivePosionGas()
{
room->xtimer.AddDeadLineTimerAndAttach
(
meta->i->time() / FRAME_RATE_MS,
a8::XParams()
.SetSender(this),
[] (const a8::XParams& param)
{
RoomObstacle* obstacle = (RoomObstacle*)param.sender.GetUserData();
obstacle->room->xtimer.AddRepeatTimerAndAttach
(
obstacle->meta->i->explosion_interval() / FRAME_RATE_MS,
a8::XParams()
.SetSender(obstacle),
[] (const a8::XParams& param)
{
RoomObstacle* obstacle = (RoomObstacle*)param.sender.GetUserData();
obstacle->SpecExplosion();
},
&obstacle->xtimer_attacher.timer_list_
);
},
&xtimer_attacher.timer_list_
);
}

View File

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

View File

@ -1038,8 +1038,8 @@ message SMUpdate
repeated MFPropertyChg chged_property_list = 31; //property变更列表 repeated MFPropertyChg chged_property_list = 31; //property变更列表
repeated MFPlaySkill play_skill_list = 32; // repeated MFPlaySkill play_skill_list = 32; //
//
repeated MFTuple dead_alive_objs = 42; //values[0]:objid values[1]: values[2]: 0: 1: repeated MFTuple dead_alive_objs = 42; //values[0]:objid values[1]: values[2]: 0: 1:
//
repeated MFPosition object_positions = 43; //,part_objects则可能不发,part_objects里的左边更新小地图 repeated MFPosition object_positions = 43; //,part_objects则可能不发,part_objects里的左边更新小地图
optional int32 game_left_time = 45; //(, ) optional int32 game_left_time = 45; //(, )
} }