This commit is contained in:
aozhiwei 2023-10-31 21:16:56 +08:00
parent 54b69046d3
commit 640e239b58
3 changed files with 10 additions and 7 deletions

View File

@ -43,6 +43,7 @@
#include "mt/SafeArea.h" #include "mt/SafeArea.h"
#include "mt/MapThing.h" #include "mt/MapThing.h"
#include "mt/Text.h" #include "mt/Text.h"
#include "mt/Map.h"
#include "buff/sprint.h" #include "buff/sprint.h"
@ -3663,5 +3664,8 @@ void Creature::RemoveHideEffect(int reason)
void Creature::InitMobaRoad() void Creature::InitMobaRoad()
{ {
if (room->IsMobaModeRoom()) {
road_idx = rand() % room->GetMapMeta()->moba_path_points.size();
point_idx = 0;
}
} }

View File

@ -3429,8 +3429,7 @@ void Human::InternalBeKill(int killer_id, const std::string& killer_name, int we
room->grid_service->MoveCreature(this); room->grid_service->MoveCreature(this);
Global::Instance()->verify_set_pos = 0; Global::Instance()->verify_set_pos = 0;
GetMovement()->ClearPath(); GetMovement()->ClearPath();
road_idx = rand() % room->GetMapMeta()->moba_path_points.size(); InitMobaRoad();
point_idx = 0;
a8::UnSetBitFlag(status, CS_Reviving); a8::UnSetBitFlag(status, CS_Reviving);
++stats->revive; ++stats->revive;
dead = false; dead = false;

View File

@ -380,13 +380,13 @@ void Room::AddPlayer(Player* hum, std::shared_ptr<BornPoint> init_born_point, bo
} }
Human* leader = hum; Human* leader = hum;
moba_team_a_ = leader->GetTeam(); moba_team_a_ = leader->GetTeam();
leader->road_idx = rand() % GetMapMeta()->moba_path_points.size(); leader->InitMobaRoad();
leader->born_point->wo_meta = std::get<0>(GetMapMeta()->moba_born_points.at(leader->side - 1)); leader->born_point->wo_meta = std::get<0>(GetMapMeta()->moba_born_points.at(leader->side - 1));
{ {
for (size_t i = 0; i < 3; ++i) { for (size_t i = 0; i < 3; ++i) {
Human* a = humans.at(i); Human* a = humans.at(i);
a->side = leader->side; a->side = leader->side;
a->road_idx = rand() % GetMapMeta()->moba_path_points.size(); a->InitMobaRoad();
a->born_point = leader->born_point; a->born_point = leader->born_point;
Team* t = a->GetTeam(); Team* t = a->GetTeam();
leader->GetTeam()->CombineTeam(a->GetTeam()); leader->GetTeam()->CombineTeam(a->GetTeam());
@ -395,15 +395,15 @@ void Room::AddPlayer(Player* hum, std::shared_ptr<BornPoint> init_born_point, bo
} }
} }
leader = humans.at(3); leader = humans.at(3);
leader->road_idx = rand() % GetMapMeta()->moba_path_points.size();
leader->side = hum->side == 1 ? 2 : 1; leader->side = hum->side == 1 ? 2 : 1;
leader->InitMobaRoad();
leader->born_point->wo_meta = std::get<0>(GetMapMeta()->moba_born_points.at(leader->side - 1)); leader->born_point->wo_meta = std::get<0>(GetMapMeta()->moba_born_points.at(leader->side - 1));
moba_team_b_ = leader->GetTeam(); moba_team_b_ = leader->GetTeam();
{ {
for (size_t i = 4; i < 7; ++i) { for (size_t i = 4; i < 7; ++i) {
Human* a = humans.at(i); Human* a = humans.at(i);
a->road_idx = rand() % GetMapMeta()->moba_path_points.size();
a->side = leader->side; a->side = leader->side;
a->InitMobaRoad();
a->born_point = leader->born_point; a->born_point = leader->born_point;
Team* t = a->GetTeam(); Team* t = a->GetTeam();
leader->GetTeam()->CombineTeam(a->GetTeam()); leader->GetTeam()->CombineTeam(a->GetTeam());