This commit is contained in:
aozhiwei 2024-03-27 17:39:22 +08:00
parent cb6c906504
commit 510894045a
9 changed files with 39 additions and 38 deletions

View File

@ -66,6 +66,7 @@
#include "mt/MergeItem.h" #include "mt/MergeItem.h"
#include "mt/BattleBasicAttribute.h" #include "mt/BattleBasicAttribute.h"
#include "mt/BattleHeroGrow.h" #include "mt/BattleHeroGrow.h"
#include "mt/MobaRoom.h"
#include "pbutils.h" #include "pbutils.h"
@ -3472,10 +3473,11 @@ void Human::InternalBeKill(int killer_id, const std::string& killer_name, int we
GetTrigger()->Die(killer_id, weapon_id); GetTrigger()->Die(killer_id, weapon_id);
OnDie(); OnDie();
KillMgr::Instance()->OnHumanDead(this, &info); KillMgr::Instance()->OnHumanDead(this, &info);
room->frame_event.AddDead(GetWeakPtrRef(), mt::Param::s().moba_revive_time * 1000); room->frame_event.AddDead(GetWeakPtrRef(),
room->GetMapMeta()->GetMobaRoomMeta()->revive_time() * 1000);
a8::SetBitFlag(status, CS_Reviving); a8::SetBitFlag(status, CS_Reviving);
dead_timer = room->xtimer.SetTimeoutWpEx dead_timer = room->xtimer.SetTimeoutWpEx
(mt::Param::s().moba_revive_time * SERVER_FRAME_RATE, (room->GetMapMeta()->GetMobaRoomMeta()->revive_time() * SERVER_FRAME_RATE,
[this] (int event, const a8::Args* args) [this] (int event, const a8::Args* args)
{ {
if (a8::TIMER_EXEC_EVENT == event) { if (a8::TIMER_EXEC_EVENT == event) {

View File

@ -4,6 +4,7 @@
#include "mt/MapCollider.h" #include "mt/MapCollider.h"
#include "mt/SafeArea.h" #include "mt/SafeArea.h"
#include "mt/MetaMgr.h" #include "mt/MetaMgr.h"
#include "mt/MobaRoom.h"
IMPL_TABLE(mt::Map) IMPL_TABLE(mt::Map)
@ -243,6 +244,12 @@ namespace mt
if (is_open() && !IsPveMap() && !is_moba() && player() < 10) { if (is_open() && !IsPveMap() && !is_moba() && player() < 10) {
A8_ABORT(); A8_ABORT();
} }
if (is_moba()) {
moba_room_meta_ = mt::MobaRoom::GetById(map_id());
if (!moba_room_meta_) {
abort();
}
}
collider_info = MapCollider::GetByName(map_collider()); collider_info = MapCollider::GetByName(map_collider());
LoadWorldObjects(world_object_file(), LoadWorldObjects(world_object_file(),
_world_objects, _world_objects,

View File

@ -46,12 +46,14 @@ namespace mt
bool IsPveMap() const; bool IsPveMap() const;
bool IsOpen() const; bool IsOpen() const;
glm::vec3 GroundSamplingPos() const; glm::vec3 GroundSamplingPos() const;
const MobaRoom* GetMobaRoomMeta() const { return moba_room_meta_; }
void Init1(); void Init1();
void Init2(); void Init2();
private: private:
glm::vec3 sampling_pos_; glm::vec3 sampling_pos_;
const MobaRoom* moba_room_meta_ = nullptr;
void PostProcess(); void PostProcess();
}; };

View File

@ -10,6 +10,23 @@ namespace mt
void MobaRoom::Init1() void MobaRoom::Init1()
{ {
std::vector<std::string> strings;
a8::Split(towers(), strings, '|');
if (strings.size() != 2) {
abort();
}
for (auto& str : strings) {
std::vector<std::string> strings2;
a8::Split(str, strings2, ':');
if (strings2.size() != 4) {
abort();
}
glm::vec3 center = glm::vec3((float)a8::XValue(strings2[0]).GetDouble(),
(float)a8::XValue(strings2[1]).GetDouble(),
(float)a8::XValue(strings2[2]).GetDouble());
float radius = (float)a8::XValue(strings2[3]).GetDouble();
moba_towers.push_back(std::make_tuple(center, radius));
}
} }
void MobaRoom::Init2() void MobaRoom::Init2()

View File

@ -13,6 +13,7 @@ namespace mt
void Init1(); void Init1();
void Init2(); void Init2();
std::vector<std::tuple<glm::vec3, float>> moba_towers;
private: private:
}; };

View File

@ -56,11 +56,6 @@ namespace mt
s_.bullet_through_wall_check = GetIntParam("bullet_through_wall_check", 1); s_.bullet_through_wall_check = GetIntParam("bullet_through_wall_check", 1);
s_.revive_count = GetIntParam("revive_count", 1); s_.revive_count = GetIntParam("revive_count", 1);
s_.pvp_revive_time = GetIntParam("pvp_revive_time", 10); s_.pvp_revive_time = GetIntParam("pvp_revive_time", 10);
s_.moba_kill_times = GetIntParam("moba_kill_times", 12);
s_.moba_revive_time = GetIntParam("moba_revive_time", 5);
s_.moba_room_time = GetIntParam("moba_room_time", 60 * 3);
s_.moba_tower_interval = GetIntParam("moba_tower_interval", 1);
s_.moba_tower_recover_hp_rate = GetFloatParam("moba_tower_recover_hp_rate", 0.5);
s_.battle_gain_exp_radium = GetFloatParam("battle_gain_exp_radium", 2000); s_.battle_gain_exp_radium = GetFloatParam("battle_gain_exp_radium", 2000);
s_.battle_gain_exp_rate_killer = GetFloatParam("battle_gain_exp_rate_killer", 0.5); s_.battle_gain_exp_rate_killer = GetFloatParam("battle_gain_exp_rate_killer", 0.5);
@ -252,25 +247,6 @@ namespace mt
abort(); abort();
} }
} }
{
std::vector<std::string> strings;
a8::Split(GetStringParam("moba_towers"), strings, '|');
if (strings.size() != 2) {
abort();
}
for (auto& str : strings) {
std::vector<std::string> strings2;
a8::Split(str, strings2, ':');
if (strings2.size() != 4) {
abort();
}
glm::vec3 center = glm::vec3((float)a8::XValue(strings2[0]).GetDouble(),
(float)a8::XValue(strings2[1]).GetDouble(),
(float)a8::XValue(strings2[2]).GetDouble());
float radius = (float)a8::XValue(strings2[3]).GetDouble();
s_.moba_towers.push_back(std::make_tuple(center, radius));
}
}
{ {
std::vector<std::string> strings; std::vector<std::string> strings;
a8::Split(GetStringParam("boss_skill_order"), strings, '|'); a8::Split(GetStringParam("boss_skill_order"), strings, '|');

View File

@ -130,13 +130,6 @@ namespace mt
int revive_count = 1; int revive_count = 1;
int pvp_revive_time = 10; int pvp_revive_time = 10;
int moba_kill_times = 12;
int moba_revive_time = 2;
int moba_room_time = 60 * 3;
std::vector<std::tuple<glm::vec3, float>> moba_towers;
int moba_tower_interval = 1;
float moba_tower_recover_hp_rate = 0.5;
int nature_recover_hp_idletime = 3; int nature_recover_hp_idletime = 3;
int nature_recover_hp_interval = 1; int nature_recover_hp_interval = 1;
float nature_recover_hp_rate = 0.1f; float nature_recover_hp_rate = 0.1f;

View File

@ -69,6 +69,7 @@
#include "mt/Robot.h" #include "mt/Robot.h"
#include "mt/SafeAreaPos.h" #include "mt/SafeAreaPos.h"
#include "mt/MapThingGroup.h" #include "mt/MapThingGroup.h"
#include "mt/MobaRoom.h"
const int SHUA_RANGE = 580; const int SHUA_RANGE = 580;
@ -127,7 +128,7 @@ void Room::Init()
#endif #endif
if (IsMobaModeRoom()) { if (IsMobaModeRoom()) {
moba_over_timer = xtimer.SetTimeoutWpEx moba_over_timer = xtimer.SetTimeoutWpEx
(SERVER_FRAME_RATE * mt::Param::s().moba_room_time, (SERVER_FRAME_RATE * GetMapMeta()->GetMobaRoomMeta()->game_time(),
[this] (int event, const a8::Args* args) [this] (int event, const a8::Args* args)
{ {
if (a8::TIMER_EXEC_EVENT == event) { if (a8::TIMER_EXEC_EVENT == event) {
@ -157,9 +158,9 @@ void Room::Init()
} }
}, },
&xtimer_attacher_); &xtimer_attacher_);
if (mt::Param::s().moba_towers.size() == 2) { if (GetMapMeta()->GetMobaRoomMeta()->moba_towers.size() == 2) {
xtimer.SetIntervalWpEx xtimer.SetIntervalWpEx
(SERVER_FRAME_RATE * mt::Param::s().moba_tower_interval, (SERVER_FRAME_RATE * GetMapMeta()->GetMobaRoomMeta()->tower_interval(),
[this] (int event, const a8::Args* args) [this] (int event, const a8::Args* args)
{ {
if (a8::TIMER_EXEC_EVENT == event) { if (a8::TIMER_EXEC_EVENT == event) {
@ -169,7 +170,7 @@ void Room::Init()
if (i == 1) { if (i == 1) {
team = GetMobaTeamB(); team = GetMobaTeamB();
} }
auto tuple = mt::Param::s().moba_towers.at(i); auto tuple = GetMapMeta()->GetMobaRoomMeta()->moba_towers.at(i);
team->TraverseMembers team->TraverseMembers
( (
[&tuple] (Human* hum) -> bool [&tuple] (Human* hum) -> bool
@ -179,7 +180,7 @@ void Room::Init()
if (!hum->dead && !hum->poisoning && !hum->downed) { if (!hum->dead && !hum->poisoning && !hum->downed) {
if (hum->GetHP() + 1 < hum->GetMaxHP()) { if (hum->GetHP() + 1 < hum->GetMaxHP()) {
hum->AddHp(hum->GetMaxHP() * hum->AddHp(hum->GetMaxHP() *
mt::Param::s().moba_tower_recover_hp_rate); hum->room->GetMapMeta()->GetMobaRoomMeta()->tower_recover_hp_rate());
hum->TryAddBuff(hum, kRecoverHpEffectBuffId); hum->TryAddBuff(hum, kRecoverHpEffectBuffId);
} }
} }

View File

@ -531,6 +531,7 @@ void Team::IncKillCount()
return; return;
} }
} }
#if 0
if (room->IsMobaModeRoom() && kill_count_ + 1 >= mt::Param::s().moba_kill_times) { if (room->IsMobaModeRoom() && kill_count_ + 1 >= mt::Param::s().moba_kill_times) {
room->SetVictoryTeam(this); room->SetVictoryTeam(this);
room->xtimer.SetTimeoutWpEx room->xtimer.SetTimeoutWpEx
@ -547,6 +548,7 @@ void Team::IncKillCount()
}, },
&room->xtimer_attacher_); &room->xtimer_attacher_);
} }
#endif
++kill_count_; ++kill_count_;
last_kill_frameno_ = room->GetFrameNo(); last_kill_frameno_ = room->GetFrameNo();
} }