1
This commit is contained in:
parent
f3250e450c
commit
78399a1199
@ -264,8 +264,6 @@ void GridService::ComputeDiff(int old_grid_id, int new_grid_id,
|
||||
std::set<GridCell*>& inc_grid_list,
|
||||
std::set<GridCell*>& dec_grid_list)
|
||||
{
|
||||
int diff_grid = new_grid_id - old_grid_id;
|
||||
#if 1
|
||||
{
|
||||
std::set<GridCell*> new_grid_list;
|
||||
GetAllCells(new_grid_id, new_grid_list);
|
||||
@ -280,7 +278,6 @@ void GridService::ComputeDiff(int old_grid_id, int new_grid_id,
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
grid_list.clear();
|
||||
GetAllCells(new_grid_id, grid_list);
|
||||
|
@ -22,6 +22,8 @@
|
||||
#include "framework/cpp/utils.h"
|
||||
#include "framework/cpp/httpclientpool.h"
|
||||
|
||||
const int HIDE_BUFF_ID = 1010;
|
||||
|
||||
Human::Human():Entity()
|
||||
{
|
||||
default_weapon.weapon_idx = 0;
|
||||
@ -247,6 +249,7 @@ void Human::DirectShot(MetaData::Equip* bullet_meta)
|
||||
}
|
||||
}
|
||||
}
|
||||
OnAttack();
|
||||
}
|
||||
|
||||
void Human::RecalcSelfCollider()
|
||||
@ -697,6 +700,7 @@ void Human::DoSkill()
|
||||
} else {
|
||||
playing_skill = false;
|
||||
}
|
||||
OnAttack();
|
||||
}
|
||||
use_skill = false;
|
||||
}
|
||||
@ -1504,6 +1508,91 @@ void Human::ProcBuffEffect(Buff* buff)
|
||||
}
|
||||
}
|
||||
|
||||
void Human::OnAttack()
|
||||
{
|
||||
if (a8::HasBitFlag(status, HS_InGrass)) {
|
||||
if (HasBuffEffect(BET_Hide)) {
|
||||
RemoveBuff(buff_effect_[BET_Hide]->meta->i->buff_id());
|
||||
}
|
||||
if (grass_hide_timer_list_) {
|
||||
room->xtimer.ModifyTimer(grass_hide_timer_list_,
|
||||
MetaMgr::Instance()->grass_invisible_time2 * SERVER_FRAME_RATE);
|
||||
} else {
|
||||
auto hide_func =
|
||||
[] (const a8::XParams& param)
|
||||
{
|
||||
Human* hum = (Human*)param.sender.GetUserData();
|
||||
hum->grass_hide_timer_list_ = nullptr;
|
||||
MetaData::Buff* buff_meta = MetaMgr::Instance()->GetBuff(HIDE_BUFF_ID);
|
||||
if (buff_meta) {
|
||||
hum->AddBuff(buff_meta);
|
||||
}
|
||||
};
|
||||
grass_hide_timer_list_ =
|
||||
room->xtimer.AddDeadLineTimerAndAttach(MetaMgr::Instance()->grass_invisible_time2 * SERVER_FRAME_RATE,
|
||||
a8::XParams()
|
||||
.SetSender(this),
|
||||
hide_func,
|
||||
&xtimer_attacher.timer_list_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Human::OnEnterGrass()
|
||||
{
|
||||
if (a8::HasBitFlag(status, HS_InGrass)) {
|
||||
return;
|
||||
}
|
||||
a8::SetBitFlag(status, HS_InGrass);
|
||||
if (leave_grass_timer_list_) {
|
||||
room->xtimer.DeleteTimer(leave_grass_timer_list_);
|
||||
leave_grass_timer_list_ = nullptr;
|
||||
}
|
||||
if (grass_hide_timer_list_) {
|
||||
room->xtimer.DeleteTimer(grass_hide_timer_list_);
|
||||
grass_hide_timer_list_ = nullptr;
|
||||
}
|
||||
auto hide_func =
|
||||
[] (const a8::XParams& param)
|
||||
{
|
||||
Human* hum = (Human*)param.sender.GetUserData();
|
||||
hum->grass_hide_timer_list_ = nullptr;
|
||||
MetaData::Buff* buff_meta = MetaMgr::Instance()->GetBuff(HIDE_BUFF_ID);
|
||||
if (buff_meta) {
|
||||
hum->AddBuff(buff_meta);
|
||||
}
|
||||
};
|
||||
grass_hide_timer_list_ =
|
||||
room->xtimer.AddDeadLineTimerAndAttach(MetaMgr::Instance()->grass_invisible_time * SERVER_FRAME_RATE,
|
||||
a8::XParams()
|
||||
.SetSender(this),
|
||||
hide_func,
|
||||
&xtimer_attacher.timer_list_);
|
||||
}
|
||||
|
||||
void Human::OnLeaveGrass()
|
||||
{
|
||||
a8::UnSetBitFlag(status, HS_InGrass);
|
||||
if (grass_hide_timer_list_) {
|
||||
room->xtimer.DeleteTimer(grass_hide_timer_list_);
|
||||
grass_hide_timer_list_ = nullptr;
|
||||
}
|
||||
if (leave_grass_timer_list_) {
|
||||
room->xtimer.DeleteTimer(leave_grass_timer_list_);
|
||||
leave_grass_timer_list_ =
|
||||
room->xtimer.AddDeadLineTimerAndAttach(MetaMgr::Instance()->grass_show_time * SERVER_FRAME_RATE,
|
||||
a8::XParams()
|
||||
.SetSender(this),
|
||||
[] (const a8::XParams& param)
|
||||
{
|
||||
Human* hum = (Human*)param.sender.GetUserData();
|
||||
hum->leave_grass_timer_list_ = nullptr;
|
||||
hum->RemoveBuff(HIDE_BUFF_ID);
|
||||
},
|
||||
&xtimer_attacher.timer_list_);
|
||||
}
|
||||
}
|
||||
|
||||
void Human::_UpdateMove(int speed)
|
||||
{
|
||||
for (int i = 0; i < speed; ++i) {
|
||||
|
@ -17,14 +17,7 @@ namespace MetaData
|
||||
|
||||
enum HumanStatus
|
||||
{
|
||||
HS_Hide = 4,
|
||||
HS_Accelerate = 5,
|
||||
HS_DamageAdd = 6,
|
||||
HS_DefAdd = 7,
|
||||
HS_RecoverHP = 8,
|
||||
HS_ReflectDamage = 9,
|
||||
HS_SummonHero = 10,
|
||||
HS_Invincible = 11,
|
||||
HS_InGrass = 1,
|
||||
HS_End
|
||||
};
|
||||
|
||||
@ -84,7 +77,7 @@ class Human : public Entity
|
||||
int lethal_weapon = 0;
|
||||
long long dead_frameno = 0;
|
||||
long long join_frameno = 0;
|
||||
int status = 0;
|
||||
long long status = 0;
|
||||
|
||||
Weapon default_weapon;
|
||||
std::vector<Weapon> weapons;
|
||||
@ -213,6 +206,9 @@ class Human : public Entity
|
||||
Buff* GetBuffByEffectId(int effect_id);
|
||||
void RecalcBuffAttr();
|
||||
void ProcBuffEffect(Buff* buff);
|
||||
void OnAttack();
|
||||
void OnEnterGrass();
|
||||
void OnLeaveGrass();
|
||||
|
||||
protected:
|
||||
void _UpdateMove(int speed);
|
||||
@ -272,6 +268,9 @@ private:
|
||||
|
||||
Skin skin;
|
||||
|
||||
xtimer_list* grass_hide_timer_list_ = nullptr;
|
||||
xtimer_list* leave_grass_timer_list_ = nullptr;
|
||||
|
||||
friend class FrameMaker;
|
||||
friend class FrameEvent;
|
||||
};
|
||||
|
@ -113,6 +113,9 @@ public:
|
||||
MetaMgr::Instance()->fighting_mode = MetaMgr::Instance()->GetSysParamAsInt("fighting_mode", 1);
|
||||
MetaMgr::Instance()->revive_time = MetaMgr::Instance()->GetSysParamAsInt("revive_time", 5);
|
||||
MetaMgr::Instance()->game_duration = MetaMgr::Instance()->GetSysParamAsInt("revive_time", 60 * 2);
|
||||
MetaMgr::Instance()->grass_invisible_time = MetaMgr::Instance()->GetSysParamAsInt("grass_invisible_time", 0.5f);
|
||||
MetaMgr::Instance()->grass_show_time = MetaMgr::Instance()->GetSysParamAsInt("grass_show_time", 0.5f);
|
||||
MetaMgr::Instance()->grass_invisible_time2 = MetaMgr::Instance()->GetSysParamAsInt("grass_invisible_time2", 2.0f);
|
||||
if (MetaMgr::Instance()->K < 0.01f) {
|
||||
abort();
|
||||
}
|
||||
|
@ -47,6 +47,9 @@ class MetaMgr : public a8::Singleton<MetaMgr>
|
||||
int fighting_mode = 0;
|
||||
int revive_time = 5;
|
||||
int game_duration = 60 * 2;
|
||||
float grass_invisible_time = 0.5;
|
||||
float grass_show_time = 0.5f;
|
||||
float grass_invisible_time2 = 2.0f;
|
||||
|
||||
private:
|
||||
MetaDataLoader* loader_ = nullptr;
|
||||
|
@ -259,6 +259,7 @@ message BuildingJson
|
||||
repeated DropObjJson dropObj = 5;
|
||||
repeated StaticObjJson staticObj = 6;
|
||||
repeated LootObjJson lootObj = 7;
|
||||
repeated StaticObjJson grassObj = 8;
|
||||
|
||||
required int32 mapId = 20;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user