添加跳伞逻辑
This commit is contained in:
parent
fc1ce18681
commit
f4c23562c1
@ -156,6 +156,9 @@ void AndroidNewAI::DoMoveOldAI()
|
||||
if (hum->room->IsWaitingStart()) {
|
||||
return;
|
||||
}
|
||||
if (hum->HasBuffEffect(kBET_Jump)) {
|
||||
return;
|
||||
}
|
||||
if (owner->UpdatedTimes() % 2 == 0) {
|
||||
Human* hum = (Human*)owner;
|
||||
int speed = std::max(1, (int)hum->GetSpeed());
|
||||
@ -185,6 +188,9 @@ void AndroidNewAI::DoAttackOldAI()
|
||||
if (hum->room->IsWaitingStart()) {
|
||||
return;
|
||||
}
|
||||
if (hum->HasBuffEffect(kBET_Jump)) {
|
||||
return;
|
||||
}
|
||||
if (hum->room->GetGasData().gas_mode == GasInactive) {
|
||||
return;
|
||||
}
|
||||
@ -466,12 +472,18 @@ void AndroidNewAI::UpdateThinking()
|
||||
{
|
||||
Human* hum = (Human*)owner;
|
||||
if (hum->room->GetGasData().gas_mode == GasInactive ||
|
||||
hum->room->IsWaitingStart()) {
|
||||
hum->room->IsWaitingStart() ||
|
||||
hum->HasBuffEffect(kBET_Jump)
|
||||
) {
|
||||
#if 1
|
||||
if (hum->room->IsWaitingStart()) {
|
||||
ChangeToStateNewAI(ASE_Idle);
|
||||
} else {
|
||||
ChangeToStateNewAI(ASE_RandomWalk);
|
||||
}
|
||||
#else
|
||||
ChangeToStateNewAI(ASE_RandomWalk);
|
||||
#endif
|
||||
} else {
|
||||
Human* target = GetTarget();
|
||||
if (target) {
|
||||
@ -607,7 +619,8 @@ void AndroidNewAI::ChangeToStateNewAI(AndroidStateEx_e to_state)
|
||||
node_.shot_times = 0;
|
||||
moving_ = false;
|
||||
if (hum->room->GetGasData().gas_mode == GasInactive ||
|
||||
hum->room->IsWaitingStart()) {
|
||||
hum->room->IsWaitingStart() ||
|
||||
hum->HasBuffEffect(kBET_Jump)) {
|
||||
node_.param1 = rand() % (3 * SERVER_FRAME_RATE);
|
||||
} else {
|
||||
node_.param1 = rand() % (2 * SERVER_FRAME_RATE);
|
||||
|
@ -140,6 +140,8 @@ enum BuffEffectType_e
|
||||
kBET_CliEffect3 = 21, //僵尸被动光环地震(客户端表现用)
|
||||
kBET_CliEffect4 = 22, //被拖拽(客户端表现用)
|
||||
kBET_HunLuan = 23, //混乱,在烟雾弹中不自动瞄准
|
||||
kBET_Jump = 24, //跳伞中
|
||||
kBET_ThroughWall = 25, //穿墙
|
||||
kBET_End
|
||||
};
|
||||
|
||||
@ -372,7 +374,7 @@ const int DEFAULT_BORN_POINT_Y = 3000;
|
||||
|
||||
const int ADPLAY_BUFFID = 1006;
|
||||
|
||||
const int FIXED_OBJECT_MAXID = 1024;
|
||||
const int FIXED_OBJECT_MAXID = 2014;
|
||||
|
||||
const int MAX_ROOM_IDX = 2018;
|
||||
|
||||
@ -386,3 +388,5 @@ const int ZOMBIE_RACE_META_START_ID = 6001;
|
||||
const int TERMINATOR_BUFF_ID = 1033;
|
||||
|
||||
const int TURN_OVER_SKILL_ID = 41001;
|
||||
|
||||
const int HUNLUAN_BUFFID = 6001;
|
||||
|
@ -3054,10 +3054,12 @@ bool Human::IsImmuneBuffEffect(int buff_effect)
|
||||
void Human::RemoveBuffById(int buff_id)
|
||||
{
|
||||
for (auto itr = buff_list_.begin(); itr != buff_list_.end(); ++itr) {
|
||||
if (itr->meta->i->buff_id() == buff_id) {
|
||||
if (buff_effect_[itr->meta->i->buff_effect()] == &(*itr)) {
|
||||
buff_effect_[itr->meta->i->buff_effect()] = nullptr;
|
||||
const Buff& buff = *itr;
|
||||
if (buff.meta->i->buff_id() == buff_id) {
|
||||
if (buff_effect_[buff.meta->i->buff_effect()] == &(*itr)) {
|
||||
buff_effect_[buff.meta->i->buff_effect()] = nullptr;
|
||||
}
|
||||
OnBuffRemove(buff);
|
||||
buff_list_.erase(itr);
|
||||
room->frame_event.RemoveBuff(this, buff_id);
|
||||
break;
|
||||
@ -4157,3 +4159,52 @@ void Human::ProcReloadAction()
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void Human::OnBuffRemove(const Buff& buff)
|
||||
{
|
||||
switch (buff.meta->i->buff_effect()) {
|
||||
case kBET_Jump:
|
||||
{
|
||||
//跳伞结束
|
||||
room->xtimer.AddDeadLineTimerAndAttach
|
||||
(1,
|
||||
a8::XParams()
|
||||
.SetSender(this),
|
||||
[] (const a8::XParams& param)
|
||||
{
|
||||
Human* hum = (Human*)param.sender.GetUserData();
|
||||
hum->OnLand();
|
||||
},
|
||||
&xtimer_attacher.timer_list_
|
||||
);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void Human::OnLand()
|
||||
{
|
||||
//着陆
|
||||
RemoveBuffByEffectId(kBET_ThroughWall);
|
||||
if (IsCollisionInMapService()) {
|
||||
a8::Vec2 old_pos = GetPos();
|
||||
std::vector<a8::Vec2> dirs;
|
||||
{
|
||||
dirs.push_back(a8::Vec2::UP);
|
||||
dirs.push_back(a8::Vec2::DOWN);
|
||||
dirs.push_back(a8::Vec2::LEFT);
|
||||
dirs.push_back(a8::Vec2::RIGHT);
|
||||
}
|
||||
for (int i = 0; i < 10000000; i += 5) {
|
||||
for (const a8::Vec2& dir : dirs) {
|
||||
SetPos(old_pos + dir * i);
|
||||
if (!IsCollisionInMapService()) {
|
||||
room->grid_service->MoveHuman(this);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -340,6 +340,8 @@ private:
|
||||
void OnMetaChange();
|
||||
void OnChgToTerminator();
|
||||
void ProcReloadAction();
|
||||
void OnBuffRemove(const Buff& buff);
|
||||
void OnLand();
|
||||
|
||||
protected:
|
||||
int level_ = 0;
|
||||
|
@ -38,6 +38,13 @@ namespace MetaData
|
||||
airdrops.push_back(a8::XValue(str).GetInt());
|
||||
}
|
||||
}
|
||||
{
|
||||
std::vector<std::string> strings;
|
||||
a8::Split(i->game_start_buff_list(), strings, '|');
|
||||
for (auto& str : strings) {
|
||||
buff_list.push_back(a8::XValue(str).GetInt());
|
||||
}
|
||||
}
|
||||
{
|
||||
std::vector<std::string> strings;
|
||||
a8::Split(i->refresh_robot(), strings, '|');
|
||||
@ -73,7 +80,7 @@ namespace MetaData
|
||||
abort();
|
||||
}
|
||||
}
|
||||
if (i->player() < 20) {
|
||||
if (i->player() < 10) {
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ namespace MetaData
|
||||
int refresh_robot_max_num = 0;
|
||||
int refresh_robot_min_time = 0;
|
||||
int refresh_robot_max_time = 0;
|
||||
std::vector<int> buff_list;
|
||||
|
||||
void Init();
|
||||
std::string RandTemplate();
|
||||
|
@ -161,7 +161,8 @@ void Player::UpdateShot()
|
||||
{
|
||||
if (dead ||
|
||||
downed ||
|
||||
room->IsWaitingStart()) {
|
||||
room->IsWaitingStart() ||
|
||||
HasBuffEffect(kBET_Jump)) {
|
||||
shot_start = false;
|
||||
shot_hold = false;
|
||||
series_shot_frames = 0;
|
||||
|
@ -1985,6 +1985,17 @@ void Room::NotifyGameStart()
|
||||
for (auto& pair : accountid_hash_) {
|
||||
pair.second->SendNotifyMsg(msg);
|
||||
}
|
||||
for (int buff_id : map_meta_->buff_list) {
|
||||
MetaData::Buff* buff_meta = MetaMgr::Instance()->GetBuff(buff_id);
|
||||
if (buff_meta) {
|
||||
for (auto& pair : human_hash_) {
|
||||
pair.second->AddBuff(pair.second,
|
||||
buff_meta,
|
||||
1,
|
||||
nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
waiting_start_ = true;
|
||||
xtimer.AddDeadLineTimerAndAttach
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
#include "microtask.h"
|
||||
|
||||
const int HUNLUAN_BUFFID = 6001;
|
||||
namespace MetaData
|
||||
{
|
||||
struct Buff;
|
||||
|
@ -32,6 +32,7 @@ message Map
|
||||
optional string refresh_robot = 9;
|
||||
optional int32 map_mode = 10;
|
||||
optional int32 safearea = 11;
|
||||
optional string game_start_buff_list = 12;
|
||||
}
|
||||
|
||||
message MapThing
|
||||
|
Loading…
x
Reference in New Issue
Block a user