This commit is contained in:
aozhiwei 2020-07-30 19:45:11 +08:00
parent 5209acac55
commit 14c9b86832
4 changed files with 35 additions and 37 deletions

View File

@ -260,11 +260,19 @@ void FrameEvent::AddItemChg(Human* hum, int item_id, int item_num)
hum->chged_items_.push_back(idx);
}
void FrameEvent::AddZombieIdChg(Human* hum)
void FrameEvent::AddZombieIdChg(Human* sender)
{
chged_zombieids_.push_back(hum);
chged_zombieids_.push_back(sender);
int idx = chged_zombieids_.size() - 1;
{
sender->TouchAllLayerHumanList
(
[idx] (Human* hum, bool& stop)
{
hum->chged_zombieid_.push_back(idx);
});
}
}
void FrameEvent::AddDead(Human* sender, int revive_time)

View File

@ -199,11 +199,12 @@ cs::SMUpdate* FrameMaker::MakeUpdateMsg(const Human* hum)
}
for (size_t idx : hum->chged_zombieid_) {
if (idx < room->frame_event.chged_zombieids_.size()) {
auto& chg_hum = room->frame_event.chged_zombieids_[idx];
{
auto p = msg->add_chged_property_list();
p->set_obj_id(hum->GetEntityUniId());
p->set_obj_id(chg_hum->GetEntityUniId());
p->set_property_type(kPropZombieId);
p->set_value(hum->meta->i->id());
p->set_value(chg_hum->meta->i->id());
}
}
}

View File

@ -260,7 +260,7 @@ class Human : public MoveableEntity
Buff* GetBuffByEffectId(int effect_id);
void RecalcBuffAttr();
void ProcBuffEffect(Human* caster, Buff* buff);
int GetLevel() {return 1;};
int GetLevel() {return level_;};
void OnAttack() {};
void OnHit() {};
int GetItemNum(int item_id);

View File

@ -1118,7 +1118,7 @@ bool Room::GenSmallCircle(a8::Vec2 big_circle_pos, float big_circle_rad, float s
void Room::MatchTeam(Human* hum)
{
if (!hum->team_uuid.empty() && GetRoomMode() != kZombieMode) {
if (!hum->team_uuid.empty()) {
for (auto& pair : human_hash_) {
if (pair.second != hum) {
if (!hum->team_uuid.empty() && pair.second->team_uuid == hum->team_uuid) {
@ -1146,9 +1146,6 @@ void Room::MatchTeam(Human* hum)
void Room::CombineTeam()
{
if (GetRoomMode() != kChiJiMode) {
return;
}
std::map<int, size_t> need_combine_teams;
std::map<int, size_t> need_combine_teams_copy;
@ -1458,24 +1455,6 @@ void Room::AirDrop(int appear_time, int box_id, int airdrop_id)
}
}
void Room::OnZombieAppear(Human* hum)
{
if (hum->GetRace() == kZombieRace && hum->meta->i->level() == 3 && !sent_zombie_boss_notify) {
sent_zombie_boss_notify = true;
TouchPlayerList
(
a8::XParams()
.SetParam1(hum->meta->i->name()),
[] (Player* hum, a8::XParams& param)
{
hum->SendSysPiaoMsg(a8::Format("%s出现了", {param.param1.GetString()}),
a8::MkRgb(255, 0, 0),
3);
}
);
}
}
void Room::AdjustAirDropPos(MetaData::MapThing* thing_meta, a8::Vec2& box_pos)
{
if (room_type_ == RT_NewBrid) {
@ -2682,13 +2661,11 @@ void Room::AddPlayerPostProc(Player* hum)
RandRemoveAndroid();
}
if (GetRoomMode() == kZombieMode) {
#ifdef DEBUG
#if 0
hum->ChangeToRace(kZombieRace, 3);
#else
hum->ChangeToRace(kHumanRace, 1);
#endif
#endif
}
#ifdef DEBUG
xtimer.AddRepeatTimerAndAttach
@ -2901,13 +2878,7 @@ void Room::ZombieModeStart()
human_list.push_back(pair.second);
}
std::random_shuffle(human_list.begin(), human_list.end());
#ifdef DEBUG
#else
{
}
#endif
for (int i = 0; i < MetaMgr::Instance()->zbmode_init_zombie_num; ++i) {
for (size_t i = 0; i < 2; ++i) {
Human* hum = human_list[i];
hum->ChangeToRace(kZombieRace, 1);
}
@ -3231,6 +3202,24 @@ void Room::NotifySysPiao(const std::string& msg, int color, int duration)
}
}
void Room::OnZombieAppear(Human* hum)
{
if (hum->GetRace() == kZombieRace && hum->meta->i->level() == 3 && !sent_zombie_boss_notify) {
sent_zombie_boss_notify = true;
TouchPlayerList
(
a8::XParams()
.SetParam1(hum->meta->i->name()),
[] (Player* hum, a8::XParams& param)
{
hum->SendSysPiaoMsg(a8::Format("%s出现了", {param.param1.GetString()}),
a8::MkRgb(255, 0, 0),
3);
}
);
}
}
size_t Room::GetRoomMaxPlayerNum()
{
if (room_mode_ == kZombieMode) {