1
This commit is contained in:
parent
ae4a083fe3
commit
eca4f8f95e
@ -408,8 +408,4 @@ const int HUNLUAN_BUFFID = 6001;
|
||||
const int DRIVER_BUFFID = 6003;
|
||||
const int PASSENGER_BUFFID = 6004;
|
||||
|
||||
const int GRASS_HIDE_BUFF_ID = 6005;
|
||||
const int WATER_BUFF_ID = 6006;
|
||||
const int ICE_BUFF_ID = 6007;
|
||||
|
||||
const long long SPEC_MAP_OBJECT_FLAGS = A8_DEFINE_RANGE_BIT(long long, kColliderSpecTag_Begin, kColliderSpecTag_End);
|
||||
|
@ -4322,13 +4322,16 @@ void Human::OnEnterSpecMapArea(int tag, SpecMapObject& map_obj)
|
||||
{
|
||||
ClearSpecMapAreaTimer(map_obj);
|
||||
map_obj.enter_timer = room->xtimer.AddDeadLineTimerAndAttach
|
||||
(MetaMgr::Instance()->ice_invisible_time * SERVER_FRAME_RATE,
|
||||
(MetaMgr::Instance()->GetSpecMapAreaEnterTime(tag) * SERVER_FRAME_RATE,
|
||||
a8::XParams()
|
||||
.SetSender(this),
|
||||
.SetSender(this)
|
||||
.SetParam1(&map_obj)
|
||||
.SetParam2(tag),
|
||||
[] (const a8::XParams& param)
|
||||
{
|
||||
Human* hum = (Human*)param.sender.GetUserData();
|
||||
MetaData::Buff* buff_meta = MetaMgr::Instance()->GetBuff(ICE_BUFF_ID);
|
||||
MetaData::Buff* buff_meta = MetaMgr::Instance()->GetBuff
|
||||
(MetaMgr::Instance()->GetSpecMapAreaBuffId(param.param2));
|
||||
if (buff_meta) {
|
||||
hum->AddBuff(hum, buff_meta, 1);
|
||||
}
|
||||
@ -4336,27 +4339,33 @@ void Human::OnEnterSpecMapArea(int tag, SpecMapObject& map_obj)
|
||||
&xtimer_attacher.timer_list_,
|
||||
[] (const a8::XParams& param)
|
||||
{
|
||||
Human* hum = (Human*)param.sender.GetUserData();
|
||||
SpecMapObject* map_obj = (SpecMapObject*)param.param1.GetUserData();
|
||||
map_obj->enter_timer = nullptr;
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
void Human::OnLeaveSpecMapArea(int tag, SpecMapObject& map_obj)
|
||||
{
|
||||
ClearSpecMapAreaTimer(map_obj);
|
||||
map_obj.leave_timer = room->xtimer.AddDeadLineTimerAndAttach
|
||||
(MetaMgr::Instance()->ice_show_time * SERVER_FRAME_RATE,
|
||||
(MetaMgr::Instance()->GetSpecMapAreaLeaveTime(tag) * SERVER_FRAME_RATE,
|
||||
a8::XParams()
|
||||
.SetSender(this),
|
||||
.SetSender(this)
|
||||
.SetParam1(&map_obj)
|
||||
.SetParam2(tag),
|
||||
[] (const a8::XParams& param)
|
||||
{
|
||||
Human* hum = (Human*)param.sender.GetUserData();
|
||||
hum->RemoveBuffById(ICE_BUFF_ID);
|
||||
hum->RemoveBuffById((MetaMgr::Instance()->GetSpecMapAreaBuffId(param.param2)));
|
||||
},
|
||||
&xtimer_attacher.timer_list_,
|
||||
[] (const a8::XParams& param)
|
||||
{
|
||||
Human* hum = (Human*)param.sender.GetUserData();
|
||||
SpecMapObject* map_obj = (SpecMapObject*)param.param1.GetUserData();
|
||||
map_obj->leave_timer = nullptr;
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
void Human::ClearSpecMapAreaTimer(SpecMapObject& map_obj)
|
||||
|
@ -871,3 +871,45 @@ std::string MetaMgr::GetText(const std::string& textid, const std::string& def_t
|
||||
auto itr = loader_->text_hash.find(textid);
|
||||
return itr != loader_->text_hash.end() ? itr->second : def_text;
|
||||
}
|
||||
|
||||
int MetaMgr::GetSpecMapAreaBuffId(int tag)
|
||||
{
|
||||
switch (tag) {
|
||||
case kColliderTag_Grass:
|
||||
return 6005;
|
||||
case kColliderTag_Water:
|
||||
return 6006;
|
||||
case kColliderTag_Ice:
|
||||
return 6007;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int MetaMgr::GetSpecMapAreaEnterTime(int tag)
|
||||
{
|
||||
switch (tag) {
|
||||
case kColliderTag_Grass:
|
||||
return grass_invisible_time;
|
||||
case kColliderTag_Water:
|
||||
return water_invisible_time;
|
||||
case kColliderTag_Ice:
|
||||
return ice_invisible_time;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int MetaMgr::GetSpecMapAreaLeaveTime(int tag)
|
||||
{
|
||||
switch (tag) {
|
||||
case kColliderTag_Grass:
|
||||
return grass_show_time;
|
||||
case kColliderTag_Water:
|
||||
return water_show_time;
|
||||
case kColliderTag_Ice:
|
||||
return ice_show_time;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -52,6 +52,9 @@ class MetaMgr : public a8::Singleton<MetaMgr>
|
||||
MetaData::Robot* RandRobot(std::set<int>& refreshed_robot_set);
|
||||
MetaData::AI* GetAI(int ai_level, int ai_mode);
|
||||
std::string GetText(const std::string& textid, const std::string& def_text="");
|
||||
int GetSpecMapAreaBuffId(int tag);
|
||||
int GetSpecMapAreaEnterTime(int tag);
|
||||
int GetSpecMapAreaLeaveTime(int tag);
|
||||
|
||||
int gas_inactive_time = 10;
|
||||
int newbie_gas_inactive_time = 5;
|
||||
|
Loading…
x
Reference in New Issue
Block a user