Compare commits

...

103 Commits
master ... ty

Author SHA1 Message Date
aozhiwei
0312ec3d93 1 2024-09-19 19:59:25 +08:00
aozhiwei
d5dbf1aca6 1 2024-09-19 19:39:54 +08:00
aozhiwei
39a4603107 1 2024-09-19 19:23:53 +08:00
aozhiwei
98c5e62384 1 2024-09-19 19:10:50 +08:00
aozhiwei
b17d8dde24 1 2024-09-19 17:15:27 +08:00
aozhiwei
f6710fac16 1 2024-09-18 17:07:07 +08:00
aozhiwei
7b69517946 1 2024-09-18 13:58:24 +08:00
aozhiwei
765e88b3c3 1 2024-09-18 11:11:46 +08:00
aozhiwei
c2a08526c7 1 2024-09-14 15:21:25 +08:00
aozhiwei
d0ab84e164 1 2024-09-14 14:18:05 +08:00
aozhiwei
571fc0f58c 1 2024-09-14 14:05:37 +08:00
aozhiwei
7129bcb4be 1 2024-09-14 13:49:23 +08:00
aozhiwei
ce050856f8 1 2024-09-14 13:35:47 +08:00
aozhiwei
73e25cc10d 1 2024-09-14 13:15:01 +08:00
aozhiwei
5d63784212 1 2024-09-13 14:54:32 +08:00
aozhiwei
bcaa24b095 1 2024-09-11 17:25:45 +08:00
aozhiwei
aa353e9318 1 2024-09-11 16:49:41 +08:00
aozhiwei
d8447a90c5 1 2024-09-11 16:45:36 +08:00
aozhiwei
bc9aab25c6 1 2024-09-11 16:41:03 +08:00
aozhiwei
718886e247 1 2024-09-06 16:58:05 +08:00
aozhiwei
5bee4f9d1d 1 2024-09-06 16:57:35 +08:00
aozhiwei
4cc2cec970 1 2024-09-06 16:37:49 +08:00
aozhiwei
dc6c86ac24 1 2024-09-06 15:06:00 +08:00
aozhiwei
72ead02eec 1 2024-09-06 14:44:28 +08:00
aozhiwei
da73a1f622 1 2024-09-06 14:41:19 +08:00
aozhiwei
b6344aa461 1 2024-09-06 14:26:15 +08:00
aozhiwei
943e2b989e 1 2024-09-06 14:22:26 +08:00
aozhiwei
e0373b472c 1 2024-09-06 14:10:17 +08:00
aozhiwei
0b89e71303 1 2024-09-06 13:30:37 +08:00
aozhiwei
528318d3ce 1 2024-09-06 13:10:03 +08:00
aozhiwei
f47a6d4132 1 2024-09-06 11:52:41 +08:00
aozhiwei
1ee1f7ca6d 1 2024-09-06 11:11:30 +08:00
aozhiwei
52b00f81f2 1 2024-09-06 10:59:47 +08:00
aozhiwei
ea392f0003 1 2024-09-06 10:58:49 +08:00
aozhiwei
3dde0c2bf8 1 2024-09-06 10:46:47 +08:00
aozhiwei
c282e3158e 1 2024-09-05 17:49:27 +08:00
aozhiwei
72dad82547 1 2024-09-05 17:47:45 +08:00
aozhiwei
ce02b947ac 1 2024-09-05 17:44:48 +08:00
aozhiwei
857f3ef773 1 2024-09-05 17:42:23 +08:00
aozhiwei
6fc087a1fd 1 2024-09-05 17:32:35 +08:00
aozhiwei
d8d8b73c27 1 2024-09-05 17:23:05 +08:00
aozhiwei
e9f4ed77cf 1 2024-09-05 17:19:59 +08:00
aozhiwei
744299bea0 1 2024-09-05 17:09:39 +08:00
aozhiwei
76354312ae 1 2024-09-05 16:51:09 +08:00
aozhiwei
d1a289b78d 1 2024-09-05 16:46:35 +08:00
aozhiwei
0c7047a18b 1 2024-09-05 16:36:54 +08:00
aozhiwei
8b81dc8c0d 1 2024-09-05 16:19:16 +08:00
aozhiwei
7b2031a64e 1 2024-09-05 16:17:12 +08:00
aozhiwei
6b7b6be707 1 2024-09-05 16:15:10 +08:00
aozhiwei
638961c5ed 1 2024-09-05 16:08:17 +08:00
aozhiwei
e5e2430047 1 2024-09-05 16:03:11 +08:00
aozhiwei
a4cee4dfa2 1 2024-09-05 15:52:29 +08:00
aozhiwei
fce35159dd 1 2024-09-05 15:50:51 +08:00
aozhiwei
1c6d10574c 1 2024-09-05 15:45:05 +08:00
aozhiwei
60df47fa29 1 2024-09-05 13:55:32 +08:00
aozhiwei
d1f2e6d581 1 2024-09-05 13:37:44 +08:00
aozhiwei
3f5d6baad9 1 2024-08-30 14:01:15 +08:00
aozhiwei
73e7669ab5 1 2024-08-30 13:29:39 +08:00
aozhiwei
f64cda608d 1 2024-08-30 11:50:51 +08:00
aozhiwei
c0570832a6 1 2024-08-30 11:05:54 +08:00
aozhiwei
ebf168a525 1 2024-08-30 10:42:13 +08:00
aozhiwei
4a7ac10d23 1 2024-08-30 10:38:17 +08:00
aozhiwei
782022e6d6 1 2024-08-29 19:44:37 +08:00
aozhiwei
aa4ff18785 1 2024-08-29 19:37:27 +08:00
aozhiwei
f0f3e82cfa 1 2024-08-29 19:35:36 +08:00
aozhiwei
c8cf48e45c 1 2024-08-29 19:32:28 +08:00
aozhiwei
b5d13dcb6c 1 2024-08-29 19:29:42 +08:00
aozhiwei
e1c92ba5a9 1 2024-08-29 19:24:51 +08:00
aozhiwei
ed49e8c193 1 2024-08-29 19:23:18 +08:00
aozhiwei
d0442a0d30 1 2024-08-29 19:11:57 +08:00
aozhiwei
959b922454 1 2024-08-29 19:01:36 +08:00
aozhiwei
5e186ae2ac 1 2024-08-29 18:53:46 +08:00
aozhiwei
1d02970da1 1 2024-08-29 17:58:51 +08:00
aozhiwei
028c03ac5a 1 2024-08-29 17:05:58 +08:00
aozhiwei
c003a4839d 1 2024-08-29 16:56:09 +08:00
aozhiwei
4f3795648e 1 2024-08-29 16:23:18 +08:00
aozhiwei
1341bc0c31 1 2024-08-29 16:15:15 +08:00
aozhiwei
8e8eda2591 1 2024-08-29 14:28:31 +08:00
aozhiwei
e6a0186c3e 1 2024-08-29 14:23:01 +08:00
aozhiwei
23e78c98ee 1 2024-08-29 14:20:32 +08:00
aozhiwei
c66d5db158 1 2024-08-29 14:19:04 +08:00
aozhiwei
f4f0120da6 1 2024-08-29 13:15:27 +08:00
aozhiwei
2b9e89a002 1 2024-08-29 11:31:09 +08:00
aozhiwei
2ff4981c39 1 2024-08-29 10:26:51 +08:00
aozhiwei
0a039944b2 1 2024-08-28 19:29:12 +08:00
aozhiwei
48de22c611 1 2024-08-28 17:42:43 +08:00
aozhiwei
04506acb20 1 2024-08-28 17:32:43 +08:00
aozhiwei
48c994270f 1 2024-08-28 17:28:24 +08:00
aozhiwei
f47f1c769e 1 2024-08-28 15:19:37 +08:00
aozhiwei
4781e964d3 1 2024-08-28 15:18:47 +08:00
aozhiwei
b85c6026ca 1 2024-08-28 15:17:40 +08:00
aozhiwei
363c6977f5 1 2024-08-28 13:13:17 +08:00
aozhiwei
2cd65abce7 1 2024-08-28 11:42:15 +08:00
aozhiwei
6f46958b5b 1 2024-08-28 11:22:22 +08:00
aozhiwei
6495be8f92 1 2024-08-28 11:19:47 +08:00
aozhiwei
2412079864 1 2024-08-28 11:05:42 +08:00
aozhiwei
3d6c8ce264 1 2024-08-28 11:05:22 +08:00
aozhiwei
e301be3dc1 1 2024-07-27 15:29:36 +08:00
aozhiwei
0e2ac2bb59 1 2024-06-01 18:26:10 +08:00
aozhiwei
7c3edc1074 1 2024-06-01 17:56:50 +08:00
aozhiwei
3e424d81aa 1 2024-06-01 17:45:01 +08:00
aozhiwei
72abfd9f94 1 2024-06-01 17:35:47 +08:00
aozhiwei
aa5e6661fc 1 2024-06-01 17:23:29 +08:00
38 changed files with 680 additions and 79 deletions

View File

@ -73,6 +73,11 @@ public:
}
}
virtual void OnConnect() override
{
f8::UdpLog::Instance()->Info("OnConnect socket_handle:%d", {socket_handle});
}
virtual void OnRawHttpGet(const std::string& url, const std::string& querystr,
std::string& response) override
{
@ -91,6 +96,7 @@ public:
virtual void OnDisConnect() override
{
f8::UdpLog::Instance()->Warning("OnDisConnect socket_handle:%d", {socket_handle});
f8::MsgQueue::Instance()->PostMsg
(IM_ClientSocketDisconnect,
a8::Args
@ -241,7 +247,7 @@ void GGListener::RemoveSocketDisconnectHandler(std::weak_ptr<SocketDisconnectHan
p->cb = nullptr;
p->holder = nullptr;
#if 1
f8::UdpLog::Instance()->Warning("RemoveSocketDisconnectHandler socket_handle%d time:%d",
f8::UdpLog::Instance()->Warning("RemoveSocketDisconnectHandler socket_handle:%d time:%d",
{
p->socket_handle,
a8::XGetTickCount() - p->add_tick
@ -254,4 +260,19 @@ void GGListener::RemoveSocketDisconnectHandler(std::weak_ptr<SocketDisconnectHan
void GGListener::OnClientDisconnect(int socket_handle)
{
PlayerMgr::Instance()->OnClientDisconnect(socket_handle);
auto itr = disconnect_listener_hash_.find(socket_handle);
if (itr != disconnect_listener_hash_.end()) {
std::vector<std::weak_ptr<SocketDisconnectHandler>> del_handlers;
SocketDisconnectHandler *handle = nullptr, *tmp = nullptr;
list_for_each_entry_safe(handle, tmp, &itr->second, entry) {
del_handlers.push_back(handle->holder);
}
for (auto& handler_wp : del_handlers) {
if (!handler_wp.expired()) {
handler_wp.lock()->cb(a8::Args({socket_handle}));
RemoveSocketDisconnectHandler(handler_wp);
}
}
disconnect_listener_hash_.erase(itr);
}
}

View File

@ -11,6 +11,7 @@
#include "mt/Equip.h"
#include "mt/Buff.h"
#include "mt/Param.h"
struct AttrAddition : public std::enable_shared_from_this<AttrAddition>
{
@ -18,6 +19,8 @@ struct AttrAddition : public std::enable_shared_from_this<AttrAddition>
list_head list_entry;
int attr_id;
float value;
float finaly_value;
int source_type = kAstNone;
std::shared_ptr<AttrAddition> holder;
std::shared_ptr<std::function<std::string()>> get_source;
@ -35,6 +38,62 @@ struct AttrAddition : public std::enable_shared_from_this<AttrAddition>
};
static std::vector<std::shared_ptr<AttrAddition>> s_speed_ratein_list;
static float CalcSpeedRateIn(list_head* head)
{
{
list_head* pos = nullptr;
list_head* next = nullptr;
list_for_each_safe(pos, next, head) {
AttrAddition* e = list_entry(pos,
AttrAddition,
entry);
switch (e->source_type) {
case kAstChip:
{
if (mt::Param::s().spd_eff_fac_vec.size() >= 2) {
e->finaly_value = e->value * mt::Param::s().spd_eff_fac_vec.at(1);
} else {
e->finaly_value = e->value;
}
s_speed_ratein_list.push_back(e->holder);
}
break;
default:
{
e->finaly_value = e->value;
s_speed_ratein_list.push_back(e->holder);
}
break;
}
}
}
{
std::sort(s_speed_ratein_list.begin(), s_speed_ratein_list.end(),
[] (std::shared_ptr<AttrAddition> a, std::shared_ptr<AttrAddition> b) -> bool
{
return std::fabs(a->finaly_value) > std::fabs(b->finaly_value);
});
}
float result = 1.0f;
{
bool inited = false;
for (size_t i = 0; i < s_speed_ratein_list.size(); ++i) {
if (i >= mt::Param::s().spd_pun_fac_vec.size()) {
break;
}
if (!inited) {
result = 1;
inited = true;
}
result *= 1 + (s_speed_ratein_list.at(i)->finaly_value * mt::Param::s().spd_pun_fac_vec.at(i));
}
}
s_speed_ratein_list.clear();
return result - 1.0f;
}
static bool IsMulCalc(int attr_id)
{
switch (attr_id) {
@ -182,13 +241,17 @@ bool Ability::CanImmune(const std::set<int>& tags)
return false;
}
AttrHandle Ability::AddAttr(int attr_id, float val)
AttrHandle Ability::AddAttr(int attr_id, float val, int source_type)
{
float old_max_hp = owner_.Get()->GetMaxHP();
if (IsValidHumanAttr(attr_id) ||
IsValidHumanVirtualAttr(attr_id)) {
if (source_type < kAstNone || source_type >= kAstEnd) {
A8_ABORT();
}
auto p = std::make_shared<AttrAddition>(attr_id, val);
p->holder = p;
p->source_type = source_type;
if (p->IsAdd()) {
if (IsValidHumanAttr(attr_id)) {
list_add_tail(&p->entry, &std::get<1>(attr_add_[attr_id]));
@ -249,9 +312,12 @@ void Ability::RecalcAttrAddition(int attr_id)
} else {
return;
}
float new_val = 0.0f;
if (attr_id == kHAT_vSpeedRateIn) {
new_val = CalcSpeedRateIn(head);
} else {
list_head* pos = nullptr;
list_head* next = nullptr;
float new_val = 0.0f;
bool inited = false;
list_for_each_safe(pos, next, head) {
AttrAddition* e = list_entry(pos,
@ -267,6 +333,7 @@ void Ability::RecalcAttrAddition(int attr_id)
new_val += e->value;
}
}
}
if (IsValidHumanAttr(attr_id)) {
std::get<0>(attr_add_[attr_id]) = new_val;
} else if (IsValidHumanVirtualAttr(attr_id)) {
@ -289,9 +356,12 @@ void Ability::RecalcAttrRuduce(int attr_id)
} else {
return;
}
float new_val = 0.0f;
if (attr_id == kHAT_vSpeedRateIn) {
new_val = CalcSpeedRateIn(head);
} else {
list_head* pos = nullptr;
list_head* next = nullptr;
float new_val = 0.0f;
bool inited = false;
list_for_each_safe(pos, next, head) {
AttrAddition* e = list_entry(pos,
@ -307,6 +377,7 @@ void Ability::RecalcAttrRuduce(int attr_id)
new_val += e->value;
}
}
}
if (IsValidHumanAttr(attr_id)) {
std::get<0>(attr_dec_[attr_id]) = new_val;
} else if (IsValidHumanVirtualAttr(attr_id)) {
@ -384,7 +455,7 @@ std::vector<std::string> Ability::GMShowAttrs()
owner_.Get()->GetNetData()->GetCrit(),
owner_.Get()->GetHeroLevel(),
owner_.Get()->GetHeroExp(),
owner_.Get()->GetSpeed()
owner_.Get()->GetSpeed() * 20
}));
{
std::vector<std::string> tmp_strings;

View File

@ -2,6 +2,14 @@
#include "attrdefine.h"
#include "weakptr.h"
enum AbilitySourceType_e
{
kAstNone,
kAstChip,
kAstOther,
kAstEnd,
};
class Ability
{
public:
@ -16,7 +24,7 @@ class Ability
void DecSwitch(int type);
int GetSwitchTimes(int type);
AttrHandle AddAttr(int attr_id, float val);
AttrHandle AddAttr(int attr_id, float val, int source_type);
void RemoveAttr(AttrHandle handler);
float GetAttr(int attr_id);
bool HasAttr(int attr_id);

View File

@ -10,6 +10,7 @@
#include "tracemgr.h"
#include "mt/Map.h"
#include "mt/MapMode.h"
Position BornPoint::RandPoint(Room* room) const
{
@ -43,10 +44,14 @@ Position BornPoint::RandPoint(Room* room) const
return pos;
}
int BornPoint::GetNum()
int BornPoint::GetNum(Room* room)
{
if (room->GetMapModeMeta()->mapMode() == mt::kCircuitMatchMode) {
return 1;
} else {
return 4;
}
}
Position BornPoint::GetSrcPoint(Room* room) const
{

View File

@ -13,7 +13,7 @@ struct BornPoint
std::shared_ptr<mt::WorldObject> wo_meta;
int side = 0;
int GetNum();
int GetNum(Room* room);
Position RandPoint(Room* room) const;
Position GetSrcPoint(Room* room) const;
Position NewRandPoint(Room* room, int min_radius, int max_radius) const;

View File

@ -1971,9 +1971,9 @@ void CallFuncBuff::BulletDmgCalcProc()
bool match = target->GetHP() / target->GetMaxHP() < cond;
if (match) {
if (target_type == 0) {
context->attr_handle = owner->GetAbility()->AddAttr(attr_id, attr_val);
context->attr_handle = owner->GetAbility()->AddAttr(attr_id, attr_val, kAstOther);
} else if (target_type == 1) {
context->attr_handle = target->GetAbility()->AddAttr(attr_id, attr_val);
context->attr_handle = target->GetAbility()->AddAttr(attr_id, attr_val, kAstOther);
}
}
}

View File

@ -68,6 +68,26 @@ void HideBuff::Deactivate()
if (meta->_int_buff_param6 > 0) {
owner->GetAbility()->DecSwitch(kHideBuffAimingShow);
}
if (!owner->room->IsDestorying() && !owner->room->IsGameOver()) {
owner->room->xtimer.SetTimeoutWpEx
(
SERVER_FRAME_RATE,
[owner = owner]
(int event, const a8::Args* args) mutable
{
if (a8::TIMER_EXEC_EVENT == event) {
if (!owner->nature_recover_hp_idle_timer.expired()) {
owner->room->xtimer.FireEvent
(
owner->nature_recover_hp_idle_timer,
kRemoveNatureRecoverTimerEvent,
nullptr);
}
}
},
&owner->xtimer_attacher
);
}
}
void HideBuff::AddInRangeObject(Creature* target)

View File

@ -16,7 +16,7 @@ void ModifyAttrBuff::Activate()
int attr_id = meta->_int_buff_param1;
float value = meta->GetBuffParam2(this);
if (f8::App::Instance()->GetInstanceId() != 3) {
attr_handle_ = owner->GetAbility()->AddAttr(attr_id, value);
attr_handle_ = owner->GetAbility()->AddAttr(attr_id, value, kAstOther);
#ifdef MYDEBUG
if (!attr_handle_.expired()) {
std::string source_name = a8::Format

View File

@ -337,14 +337,11 @@ void Player::_CMExecCommand(f8::MsgHdr* hdr, const cs::CMExecCommand& msg)
room->GetCreatureByUniId(a8::XValue(cmds[1]).GetInt());
int attr_id = a8::XValue(cmds[2]);
float value = a8::XValue(cmds[3]).GetDouble();
int source_type = cmds.size() > 4 ? a8::XValue(cmds[4]).GetInt() : kAstOther;
if (target) {
auto handle = target->GetAbility()->AddAttr(attr_id, value);
std::vector<std::string> strings = target->GetAbility()->GMShowAttrs();
for (auto& str : strings) {
SendDebugMsg("数值: " + str);
}
auto handle = target->GetAbility()->AddAttr(attr_id, value, source_type);
if (!handle.expired()) {
std::string source_name = "<-gm.self";
std::string source_name = "<-gm.self." + a8::XValue(source_type).GetString();
auto cb = std::make_shared<std::function<std::string()>>
(
[source_name] () -> std::string
@ -353,6 +350,10 @@ void Player::_CMExecCommand(f8::MsgHdr* hdr, const cs::CMExecCommand& msg)
});
target->GetAbility()->SetSource(handle, cb);
}
std::vector<std::string> strings = target->GetAbility()->GMShowAttrs();
for (auto& str : strings) {
SendDebugMsg("数值: " + str);
}
}
}
} else if (cmd == "del_attr") {

View File

@ -1169,10 +1169,18 @@ void Creature::Initialize()
}
if (IsHuman()) {
a8::XTimerWp nature_recover_hp_timer;
auto battling_state = std::make_shared<bool>(true);
GetTrigger()->AddListener
(
kBattleStartEvent,
[battling_state] (const a8::Args& args)
{
*battling_state = true;
});
nature_recover_hp_idle_timer = room->xtimer.SetIntervalWpEx
(
SERVER_FRAME_RATE * mt::Param::s().nature_recover_hp_idletime,
[this, nature_recover_hp_timer] (int event, const a8::Args* args) mutable
[this, nature_recover_hp_timer, battling_state] (int event, const a8::Args* args) mutable
{
if (a8::TIMER_EXEC_EVENT == event) {
if (nature_recover_hp_timer.expired() && !HasBuffEffect(kBET_Dive)) {
@ -1193,7 +1201,10 @@ void Creature::Initialize()
},
&xtimer_attacher);
}
if (*battling_state) {
*battling_state = false;
GetTrigger()->LeaveBattleMode();
}
} else if (kRemoveNatureRecoverTimerEvent == event) {
room->xtimer.ModifyTime
(nature_recover_hp_idle_timer,
@ -1201,6 +1212,7 @@ void Creature::Initialize()
if (!nature_recover_hp_timer.expired()) {
room->xtimer.Delete(nature_recover_hp_timer);
}
*battling_state = true;
GetTrigger()->EnterBattleMode();
}
},
@ -2504,6 +2516,7 @@ void Creature::OnBattleStart(Room* room)
TryAddBuffAndSetTime(this, kInvincibleBuffId, FRAME_RATE_MS * 2);
}
battle_start_time_ = f8::App::Instance()->GetNowTime();
GetTrigger()->OnBattleStart();
}
bool Creature::CanFollow(Creature* follower)
@ -2887,6 +2900,7 @@ void Creature::AutoNavigation(const glm::vec3& target_pos, float speed,
c->DecDisableMoveTimes();
c->DecDisableMoveDirTimes();
c->DecDisableAttackDirTimes();
c->GetMovement()->ClearPath();
room->xtimer.DeleteCurrentTimer();
}
}
@ -4249,7 +4263,7 @@ void Creature::GenLevelAttr()
}
grow_attr_list_.clear();
for (auto tuple : *attrs) {
auto handle = GetAbility()->AddAttr(std::get<0>(tuple), std::get<1>(tuple));
auto handle = GetAbility()->AddAttr(std::get<0>(tuple), std::get<1>(tuple), kAstOther);
if (!handle.expired()) {
grow_attr_list_.push_back(handle);
}

View File

@ -51,6 +51,7 @@ void CustomBattle::ParseResult(a8::XObject& obj)
map_id_ = obj.Get("map_id");
match_mode_ = obj.Get("match_mode");
start_time_ = obj.Get("start_time");
is_newbie_battle_ = obj.Get("is_newbie_battle");
sign_ = obj.Get("sign").GetString();
const mt::Map* map_meta = mt::Map::GetById(map_id_);
if (!map_meta || !map_meta->IsOpen()) {
@ -402,6 +403,9 @@ void CustomBattle::GameStart()
nullptr);
}
}
if (IsNewBieBattle()) {
room->SetNewBieBattle(1);
}
SetRoom(room.get());
room->JoinWithCustomBattle(shared_from_this());
} else {

View File

@ -49,6 +49,7 @@ class CustomBattle : public std::enable_shared_from_this<CustomBattle>
bool IsCustomMode() { return custom_room_type_ == CUSTOM_ROOM_CUSTOM; }
bool IsPvp() { return !is_moba_; }
bool IsMoba() { return is_moba_; }
int IsNewBieBattle() { return is_newbie_battle_; }
void OnEnter(std::shared_ptr<cs::CMJoin> join_msg, long ip_saddr, int socket_handle,
std::weak_ptr<SocketDisconnectHandler> sd_handler);
void OnMemberReady(CustomMember* member);
@ -75,6 +76,7 @@ private:
int map_id_ = 0;
int start_time_ = 0;
int team1_average_hero_lv_ = 0;
int is_newbie_battle_ = 0;
const mt::MapMode* map_mode_meta_ = nullptr;
std::string sign_;
std::shared_ptr<a8::XObject> raw_data_;

View File

@ -418,6 +418,12 @@ behaviac::EBTStatus HeroAgent::SearchEnemy(float range)
c->team_id != myself->team_id &&
!c->IsCar() &&
!myself->IsIgnoreTarget(c->GetUniId())) {
if (myself->room->IsNewBieBattle() &&
myself->GetTeam() &&
!myself->GetTeam()->HasPlayer() &&
!c->IsPlayer()) {
return true;
}
if (a8::HasBitFlag(myself->status, CS_DisableAttackAndroid) &&
c->IsAndroid()) {
} else {
@ -1401,6 +1407,9 @@ int HeroAgent::SearchPickupObj()
});
if (nearest_obj &&
nearest_obj->GetPos().ManhattanDistance2D(owner_->GetPos()) < 200) {
if (GetRoom()->IsNewBieBattle() && nearest_obj->IsCar()) {
return 0;
}
int obj_type = 0;
if (nearest_obj->IsCar()) {
obj_type = 1;

View File

@ -217,6 +217,11 @@ void Human::DecHP(float dec_hp, int killer_id, const std::string killer_name, in
int dmg_type,
int dmg_bp)
{
if (IsPlayer() && room->IsNewBieBattle()) {
if (dec_hp > 10) {
dec_hp = 10;
}
}
real_dmg_out = 0.0f;
if (!room->BattleStarted()) {
return;
@ -407,6 +412,7 @@ void Human::DecHP(float dec_hp, int killer_id, const std::string killer_name, in
killer->GetUniId(),
only_self);
}
BroadcastBattleHint();
} else if (killer->IsHero()) {
if (killer->AsHero()->master.Get() &&
killer->AsHero()->master.Get()->IsPlayer()) {
@ -3646,6 +3652,7 @@ void Human::SendPersonalBattleReport()
params->SetVal("session_id", session_id);
params->SetVal("version", 2023030201);
params->SetVal("is_newbie_battle", a8::XValue(room->IsNewBieBattle()));
params->SetVal("battle_uuid", a8::XValue(GetTeam()->GetBattleUuid()));
params->SetVal("room_uuid", a8::XValue(room->GetRoomUuid()));
params->SetVal("room_mode", room->GetReportRoomMode());

View File

@ -349,6 +349,7 @@ private:
virtual void DoSkillPreProc(int skill_id, int target_id) override;
virtual void DoSkillPostProc(bool used, int skill_id, int target_id) override;
void FillMFSettlement(cs::SMGameOver* msg, cs::MFSettlement* settlement);
void BroadcastBattleHint();
protected:
long long hide_frameno_ = 0;
@ -394,6 +395,8 @@ private:
bool sending_battlereport_ = false;
bool is_game_end_ = false;
bool sent_personal_report_ = false;
long long last_battle_hint_frameno_ = 0;
int last_battle_hint_uniid_ = 0;
long long jump_frameno_ = 0;
float old_sync_speed = 0;

View File

@ -1,5 +1,7 @@
#include "precompile.h"
#include <random>
#include "incubator.h"
#include "room.h"
#include "human.h"
@ -22,6 +24,8 @@
#include "mt/SafeArea.h"
#include "mt/SafeAreaSafePoint.h"
static const int CHIJI_HIDE_HUMANS = 6;
void Incubator::Init()
{
#if 1
@ -47,6 +51,18 @@ void Incubator::Init()
}
},
&xtimer_attacher_);
if (room->IsNewBieBattle()) {
room->xtimer.SetTimeoutEx
(
SERVER_FRAME_RATE * (60),
[this] (int event, const a8::Args* args)
{
if (a8::TIMER_EXEC_EVENT == event) {
StartNewBattleMode();
}
},
&xtimer_attacher_);
}
}
},
&xtimer_attacher_);
@ -85,6 +101,9 @@ void Incubator::UnInit()
void Incubator::AllocAndroid(Human* target, int num, std::vector<Human*>* androids)
{
if (room->IsNewBieBattle() && target->IsAndroid()) {
return;
}
if (!room->xtimer.IsRunning()) {
A8_ABORT();
}
@ -98,12 +117,14 @@ void Incubator::AllocAndroid(Human* target, int num, std::vector<Human*>* androi
if (hold_humans_.size() < 1) {
return;
}
if (hold_humans_.size() <= 6) {
if (!room->IsNewBieBattle()) {
if (hold_humans_.size() <= CHIJI_HIDE_HUMANS) {
if (room->GetGasData().new_area_meta->GetSmallRingCount() < 4) {
ShowHand();
}
return;
}
}
#ifdef MYDEBUG
a8::XPrintf("SmallRingCount:%d \n", {room->GetGasData().new_area_meta->GetSmallRingCount()});
#endif
@ -131,6 +152,7 @@ void Incubator::AllocAndroid(Human* target, int num, std::vector<Human*>* androi
App::Instance()->verify_set_pos = 0;
if (!CanSee(hum, target)) {
room->EnableHuman(hum);
room->grid_service->MoveCreature(hum);
#ifdef MYDEBUG
#if 0
if (!target->InNewObjects(hum)) {
@ -248,19 +270,24 @@ bool Incubator::CanSee(Human* hum, Human* exclude_hum)
void Incubator::AutoAllocAndroid()
{
#ifdef MYDEBUG
{
a8::XPrintf("AutoAllocAndroid hold_humans.size:%d\n", {hold_humans_.size()});
}
#endif
switch (room->GetGasData().GetGasMode()) {
case GasWaiting:
case GasMoving:
{
#if 1
if (!hold_humans_.empty() && hold_humans_.size() > 0) {
#else
if (!hold_humans_.empty() && hold_humans_.size() > 6) {
#endif
int rnd_space = 70;
if (room->IsNewBieBattle()) {
rnd_space = 20;
}
Human* hum = hold_humans_[0];
if (room->GetGasData().GetGasMode() == GasWaiting &&
hold_humans_.size() > 1 &&
((rand() % 100) > 70)) {
((rand() % 100) > rnd_space)) {
Human* killer = nullptr;
if (hold_humans_.size() == 2) {
killer = hold_humans_[1];
@ -282,9 +309,13 @@ void Incubator::AutoAllocAndroid()
return;
}
hold_humans_.erase(hold_humans_.begin());
if (room->IsNewBieBattle()) {
room->xtimer.ModifyTime(alloc_timer_, SERVER_FRAME_RATE * (6 + rand() % 4));
} else {
room->xtimer.ModifyTime(alloc_timer_, SERVER_FRAME_RATE * (30 + rand() % 5));
}
}
}
break;
default:
{
@ -563,7 +594,7 @@ void Incubator::Clear(int save_num)
void Incubator::Rearrangement()
{
if (hold_humans_.size() < 6) {
if (hold_humans_.size() < CHIJI_HIDE_HUMANS) {
return;
}
std::vector<int> teams2;
@ -629,3 +660,112 @@ void Incubator::Rearrangement()
}
#endif
}
void Incubator::StartNewBattleMode()
{
Player* selected_player = nullptr;
room->TraversePlayerList
(
[&selected_player] (Player* hum) -> bool
{
selected_player = hum;
return false;
});
if (!selected_player) {
return;
}
auto startno = std::make_shared<long long>();
*startno = room->GetFrameNo();
auto invisable_humans = std::make_shared<std::vector<Human*>>();
auto invisable_teammates = std::make_shared<std::vector<Human*>>();
room->xtimer.SetIntervalWpEx
(
SERVER_FRAME_RATE * (5 + rand() % 3),
[this, selected_player, invisable_humans, invisable_teammates, startno]
(int event, const a8::Args* args)
{
if (a8::TIMER_EXEC_EVENT == event) {
if (room->IsGameOver()) {
return;
}
invisable_humans->clear();
invisable_teammates->clear();
room->TraverseAliveHumanList
(
[this, selected_player, invisable_humans, invisable_teammates, startno]
(Human* hum) -> bool
{
if (hum == selected_player) {
return true;
}
if (!CanSee(hum, selected_player)) {
if (hum->GetTeam() == selected_player->GetTeam()) {
invisable_teammates->push_back(hum);
} else {
invisable_humans->push_back(hum);
}
}
return true;
});
if (invisable_humans->size() == 1) {
if (room->GetFrameNo() - *startno < SERVER_FRAME_RATE * 30) {
Human *target = invisable_humans->at(0);
glm::vec3 dir = GlmHelper::UP;
GlmHelper::RotateY(dir, a8::RandAngle());
int rand_len = rand() % mt::Param::s().incubator_rand_length;
glm::vec3 center = selected_player->GetPos().ToGlmVec3() + dir * (float)(mt::Param::s().incubator_base_length + rand_len);
room->map_instance->Scale(center);
glm::vec3 point;
if (room->map_instance->FindRandomPointAroundCircle
(
center,
10 * room->GetMapMeta()->scale(),
point
)) {
room->map_instance->UnScale(point);
glm::vec3 old_pos = target->GetPos().ToGlmVec3();
App::Instance()->verify_set_pos = 1;
target->GetMutablePos().FromGlmVec3(point);
App::Instance()->verify_set_pos = 0;
if (CanSee(target, selected_player)) {
App::Instance()->verify_set_pos = 1;
target->GetMutablePos().FromGlmVec3(old_pos);
App::Instance()->verify_set_pos = 0;
} else {
room->grid_service->MoveCreature(target);
}
}
return;
}
}
if (invisable_humans->size() > 0) {
std::shuffle(invisable_humans->begin(),
invisable_humans->end(),
std::default_random_engine(a8::XGetTickCount()));
Human *killer = nullptr;
Human *target = invisable_humans->at(0);
for (size_t i = 0; i < invisable_humans->size(); ++i) {
if (invisable_humans->at(i)->GetTeam() != target->GetTeam()) {
killer = invisable_humans->at(i);
break;
}
}
if (!killer && !invisable_teammates->empty()) {
std::shuffle(invisable_teammates->begin(),
invisable_teammates->end(),
std::default_random_engine(a8::XGetTickCount()));
killer = invisable_teammates->at(0);
}
if (killer) {
target->BeKill(killer->GetUniId(),
killer->name,
killer->GetCurrWeapon()->weapon_id,
killer->GetUniId(),
killer->name);
}
}
}
},
&xtimer_attacher_);
}

View File

@ -20,6 +20,7 @@ class Incubator
void NextWave();
void ShowHand();
void Clear(int save_num);
void StartNewBattleMode();
private:
bool CanSee(Human* hum, Human* exclude_hum);

View File

@ -0,0 +1,14 @@
#include "precompile.h"
#include "mt/CircuitTime.h"
IMPL_TABLE(mt::CircuitTime)
namespace mt
{
void CircuitTime::Init1()
{
}
}

View File

@ -0,0 +1,21 @@
#pragma once
#include "mt/macro.h"
#include "mtb/CircuitTime.h"
namespace mt
{
DECLARE_ID_TABLE(CircuitTime, mtb::CircuitTime,
"CircuitTime@CircuitTime.json",
"id")
public:
void Init1();
private:
int _start_time = 0;
int _end_time = 0;
};
}

View File

@ -10,6 +10,11 @@ namespace mt
void MapMode::Init1()
{
#ifdef MYDEBUG
if (mapMode() == 201) {
mapMode_ = kCircuitMatchMode;
}
#endif
}
bool MapMode::IsOpen() const

View File

@ -7,6 +7,7 @@ namespace mt
{
const int kPvpRankMode = 401;
const int kTreasureBoxMode = 501;
const int kCircuitMatchMode = 601;
DECLARE_ID_TABLE(MapMode, mtb::MapMode,
"mapMode@mapMode.json",

View File

@ -48,6 +48,7 @@
#include "mt/MobaRoom.h"
#include "mt/InGameVoice.h"
#include "mt/MapMode.h"
#include "mt/CircuitTime.h"
#include "app.h"
@ -123,6 +124,7 @@ namespace mt
RegMetaTable<BattleHeroGrow>(res_path_);
RegMetaTable<InGameVoice>(res_path_);
RegMetaTable<MapMode>(res_path_);
RegMetaTable<CircuitTime>(res_path_);
}
void MetaMgr::Load()

View File

@ -92,6 +92,14 @@ namespace mt
s_.performance_score_weight_BR.push_back(a8::XValue(str).GetDouble());
}
}
{
std::string tmp_str = GetStringParam("performance_score_weight_circuit", "");
std::vector<std::string> strings;
a8::Split(tmp_str, strings, '|');
for (auto& str : strings) {
s_.performance_score_weight_circuit.push_back(a8::XValue(str).GetDouble());
}
}
{
std::string tmp_str = GetStringParam("block_effect_range", "");
std::vector<std::string> strings;
@ -100,6 +108,22 @@ namespace mt
s_.block_effect_range.push_back(a8::XValue(str).GetDouble());
}
}
{
std::string tmp_str = GetStringParam("SpdEffFacVec", "");
std::vector<std::string> strings;
a8::Split(tmp_str, strings, '|');
for (auto& str : strings) {
s_.spd_eff_fac_vec.push_back(a8::XValue(str).GetDouble());
}
}
{
std::string tmp_str = GetStringParam("SpdPunFacVec", "");
std::vector<std::string> strings;
a8::Split(tmp_str, strings, '|');
for (auto& str : strings) {
s_.spd_pun_fac_vec.push_back(a8::XValue(str).GetDouble());
}
}
s_.nature_recover_hp_switch = a8::XValue(GetStringParam("nature_recover_hp_switch", "0"));
s_.nature_recover_hp_idletime = a8::XValue(GetStringParam("nature_recover_hp_idletime", "3"));
s_.nature_recover_hp_interval = a8::XValue(GetStringParam("nature_recover_hp_interval1", "1"));
@ -107,6 +131,19 @@ namespace mt
#endif
s_.battle_auto_ready_min_time = GetIntParam("battle_auto_ready_min_time", 5);
s_.battle_auto_ready_max_time = GetIntParam("battle_auto_ready_max_time", 8);
s_.speed_rf = GetIntParam("SpeedRF", 5.0f);
s_.speed_rate_max = GetIntParam("SpeedRateMax", 0.2f);
s_.battle_hint_interval = GetIntParam("battle_hint_interval", s_.battle_hint_interval);
s_.battle_hint_duration = GetIntParam("battle_hint_duration", s_.battle_hint_duration);
s_.battle_hint_view_range = GetIntParam("battle_hint_view_range", s_.battle_hint_view_range);
s_.battle_hint_broadcast_range = GetIntParam("battle_hint_broadcast_range", s_.battle_hint_broadcast_range + 800);
s_.circuit_score_mult_constant = GetIntParam("circuit_score_mult_constant", s_.circuit_score_mult_constant);
s_.circuit_score_shift_constant = GetIntParam("circuit_score_shift_constant", s_.circuit_score_shift_constant);
s_.circuit_battle_cooldown = GetIntParam("circuit_battle_cooldown", s_.circuit_battle_cooldown);
s_.circuit_rank_score_min = GetIntParam("circuit_rank_score_min", s_.circuit_rank_score_min);
#ifdef MYDEBUG
s_.match_team_time = 6;
s_.match_robot_time = 5;

View File

@ -34,6 +34,11 @@ namespace mt
int pickup_weapon_replace_type = 0;
std::vector<float> performance_score_weight_4V4;
std::vector<float> performance_score_weight_BR;
std::vector<float> performance_score_weight_circuit;
float circuit_score_mult_constant = 0.0f;
float circuit_score_shift_constant = 0.0f;
float circuit_battle_cooldown = 0.0f;
float circuit_rank_score_min = 0.0f;
int downed_relive_recover_hp = 0;
@ -164,6 +169,16 @@ namespace mt
float battle_event_end_loss_rate_dead = 0.5f;
float battle_event_end_loss_rate_quit = 1.0f;
float speed_rf = 5.0f;
float speed_rate_max = 0.2f;
std::vector<float> spd_eff_fac_vec;
std::vector<float> spd_pun_fac_vec;
int battle_hint_interval = 10;
int battle_hint_duration = 10;
int battle_hint_view_range = 512;
int battle_hint_broadcast_range = 1600;
std::vector<float> block_effect_range;
std::vector<float> crit_effect_range;

View File

@ -0,0 +1,40 @@
#pragma once
#include <bitset>
namespace mtb
{
class CircuitTime
{
public:
std::shared_ptr<a8::reflect::Class> GetClass() const;
int id() const { return id_; };
int circuit_season() const { return circuit_season_; };
int circuit_time_type() const { return circuit_time_type_; };
const std::string start_time() const { return start_time_; };
const std::string end_time() const { return end_time_; };
int cec_pool() const { return cec_pool_; };
bool has_id() const { return __flags__.test(0);};
bool has_circuit_season() const { return __flags__.test(1);};
bool has_circuit_time_type() const { return __flags__.test(2);};
bool has_start_time() const { return __flags__.test(3);};
bool has_end_time() const { return __flags__.test(4);};
bool has_cec_pool() const { return __flags__.test(5);};
protected:
int id_ = 0;
int circuit_season_ = 0;
int circuit_time_type_ = 0;
std::string start_time_;
std::string end_time_;
int cec_pool_ = 0;
public:
std::bitset<6> __flags__;
};
};

View File

@ -49,6 +49,7 @@
#include "mtb/Distribution.h"
#include "mtb/LootConfig.h"
#include "mtb/BattleHeroGrow.h"
#include "mtb/CircuitTime.h"
namespace mtb
{
@ -1041,4 +1042,19 @@ namespace mtb
return meta_class;
}
std::shared_ptr<a8::reflect::Class> CircuitTime::GetClass() const
{
std::shared_ptr<a8::reflect::Class> meta_class = nullptr;
if (!meta_class) {
meta_class = std::make_shared<a8::reflect::Class>("CircuitTime", 6, 0);
meta_class->SetSimpleField(0, "id", a8::reflect::ET_INT32, my_offsetof2(CircuitTime, id_));
meta_class->SetSimpleField(1, "circuit_season", a8::reflect::ET_INT32, my_offsetof2(CircuitTime, circuit_season_));
meta_class->SetSimpleField(2, "circuit_time_type", a8::reflect::ET_INT32, my_offsetof2(CircuitTime, circuit_time_type_));
meta_class->SetSimpleField(3, "start_time", a8::reflect::ET_STRING, my_offsetof2(CircuitTime, start_time_));
meta_class->SetSimpleField(4, "end_time", a8::reflect::ET_STRING, my_offsetof2(CircuitTime, end_time_));
meta_class->SetSimpleField(5, "cec_pool", a8::reflect::ET_INT32, my_offsetof2(CircuitTime, cec_pool_));
}
return meta_class;
}
}

View File

@ -162,6 +162,9 @@ public:
hp_ = (hero_meta->GetBasicMeta()->vOrigHealth() * (1 + pHealth / hero_meta->GetBasicMeta()->pBaseHealth()) + vHealthAm) *
(1 + vHealthRateSe) * (1 + vHealthRateIn);
if (owner_.Get()->room->IsNewBieBattle() && !owner_.Get()->IsPlayer()) {
hp_ = 50;
}
}
void RecalcAttack()
@ -289,7 +292,7 @@ private:
int attr_id = a8::XValue(attr->Get("attr_id", "0"));
float val = a8::XValue(attr->Get("val", "0")).GetDouble();
if (IsValidHumanAttr(attr_id)) {
auto attr_handle = owner_.Get()->GetAbility()->AddAttr(attr_id, val);
auto attr_handle = owner_.Get()->GetAbility()->AddAttr(attr_id, val, kAstOther);
if (!attr_handle.expired()) {
#ifdef MYDEBUG
std::string source_name = a8::Format
@ -321,7 +324,7 @@ private:
int attr_id = a8::XValue(attr->Get("attr_id", "0"));
float val = a8::XValue(attr->Get("val", "0")).GetDouble();
if (IsValidHumanAttr(attr_id)) {
auto attr_handle = owner_.Get()->GetAbility()->AddAttr(attr_id, val);
auto attr_handle = owner_.Get()->GetAbility()->AddAttr(attr_id, val, kAstChip);
if (!attr_handle.expired()) {
#ifdef MYDEBUG
std::string source_name = a8::Format
@ -1367,6 +1370,9 @@ void BattleDataContext::RecalcCrit()
bool BattleDataContext::HasWing()
{
#ifdef MYDEBUG
return true;
#endif
if (hero_dto) {
long long token_id = hero_dto->Get("token_id", "");
if (token_id > 6240603010001668 && token_id <= 6240603010002168) {

View File

@ -2183,6 +2183,49 @@ void Human::SendViewerUiMemberUpdate(std::vector<int> member_ids)
}
}
void Human::BroadcastBattleHint()
{
if (room->GetFrameNo() - last_battle_hint_frameno_ >=
mt::Param::s().battle_hint_interval * SERVER_FRAME_RATE) {
if (last_battle_hint_uniid_ > 0) {
if (room->GetFrameNo() - last_battle_hint_frameno_ <
mt::Param::s().battle_hint_duration * SERVER_FRAME_RATE + 8) {
cs::SMDelBattleHint notify_msg;
notify_msg.set_uniid(last_battle_hint_uniid_);
SendNotifyMsg(notify_msg);
}
last_battle_hint_uniid_ = 0;
}
last_battle_hint_frameno_ = room->GetFrameNo();
#ifdef MYDEBUG
#endif
std::shared_ptr<cs::SMAddBattleHint> notify_msg;
room->TraversePlayerList
(
[this, &notify_msg] (Player* hum) -> bool
{
if (!hum->dead) {
float distance = hum->GetPos().Distance2D2(GetPos());
if (distance >= mt::Param::s().battle_hint_view_range &&
distance <= mt::Param::s().battle_hint_broadcast_range) {
if (!notify_msg) {
last_battle_hint_uniid_ = room->AllocUniid();
notify_msg = std::make_shared<cs::SMAddBattleHint>();
notify_msg->set_uniid(last_battle_hint_uniid_);
notify_msg->set_duration(mt::Param::s().battle_hint_duration);
TypeConvert::ToPb(GetPos(), notify_msg->mutable_pos());
}
hum->SendNotifyMsg(*notify_msg.get());
#ifdef MYDEBUG
a8::XPrintf("SMAddBattleHint:%s\n", {f8::PbToJson(notify_msg.get())});
#endif
}
}
return true;
});
}
}
void GGListener::SendError(int sockhandle, unsigned int seqid,
int error_code, const std::string& error_msg,
const char* file, int lineno, int error_param)

View File

@ -169,6 +169,13 @@ void Player::Initialize()
},
&xtimer_attacher);
}
if (room->IsNewBieBattle()) {
#if 0
GetAbility()->AddAttr(kHAT_vAttackRateSe, 5.0f);
GetAbility()->AddAttr(kHAT_pDefendRateSe, 2.0f);
GetAbility()->AddAttr(kHAT_vHealthRateSe, 1.0f);
#endif
}
}
void Player::Update(int delta_time)

View File

@ -540,11 +540,15 @@ void Room::CreateAndroid(int robot_num, std::shared_ptr<Team> team)
hum->Initialize();
AddToEntityHash(hum);
AddToHumanHash(hum);
if (GetMapModeMeta()->mapMode() != mt::kCircuitMatchMode) {
MatchTeam(hum);
} else {
if (team) {
team->AddMember(hum);
} else {
MatchTeam(hum);
}
}
if (!hum->IsOb()) {
IncAliveCount();
}
@ -597,11 +601,15 @@ Human* Room::CreateAndroidWithCustomMember(std::shared_ptr<CustomMember> custom_
hum->Initialize();
AddToEntityHash(hum);
AddToHumanHash(hum);
if (GetMapModeMeta()->mapMode() != mt::kCircuitMatchMode) {
MatchTeam(hum);
} else {
if (team) {
team->AddMember(hum);
} else {
MatchTeam(hum);
}
}
if (!hum->IsOb()) {
IncAliveCount();
}
@ -625,7 +633,7 @@ void Room::FillSMJoinedNotify(Human* self_hum, cs::SMJoinedNotify& msg)
{
msg.set_team_mode(msg.team_mode());
msg.set_adjust_bullet(1);
msg.set_is_newbie_room(0);
msg.set_is_newbie_room(IsNewBieBattle());
}
void Room::ScatterDrop(const glm::vec3& center, int drop_id, bool no_adjust, std::vector<int>* items)
@ -1854,7 +1862,8 @@ bool Room::GenSmallCircle()
void Room::MatchTeam(Human* hum)
{
if (!hum->team_uuid.empty()) {
if (!hum->team_uuid.empty() &&
GetMapModeMeta()->mapMode() != mt::kCircuitMatchMode) {
{
bool match_ok = false;
TraverseHumanList
@ -2082,6 +2091,9 @@ void Room::CombineTeam()
void Room::FillTeam()
{
if (GetMapModeMeta()->mapMode() == mt::kCircuitMatchMode) {
return;
}
std::vector<std::shared_ptr<Team>> free_team_list;
TraverseTeams
(
@ -2474,7 +2486,7 @@ std::shared_ptr<BornPoint> Room::AllocBornPoint(Human* hum)
for (auto& pair : born_point_hash_) {
if (pair.second != hum->GetBornPoint()) {
if (pair.second->player_num + pair.second->android_num <
pair.second->GetNum()) {
pair.second->GetNum(this)) {
point_list.push_back(pair.second);
free_point_list.push_back(pair.second);;
}
@ -2504,7 +2516,7 @@ std::shared_ptr<BornPoint> Room::AllocBornPoint(Human* hum)
std::vector<std::shared_ptr<BornPoint>> free_point_list;
for (auto& pair : born_point_hash_) {
if (pair.second->player_num + pair.second->android_num <
pair.second->GetNum()) {
pair.second->GetNum(this)) {
free_point_list.push_back(pair.second);
}
}
@ -2641,6 +2653,9 @@ long long Room::GetGasInactiveTime()
if (IsNewerMap()) {
inactive_time = 10;
}
if (IsNewBieBattle()) {
inactive_time = 10;
}
return inactive_time;
}
@ -4018,6 +4033,7 @@ int Room::GetReportMapMode()
void Room::GenBattleRoomReportData(a8::MutableXObject* params)
{
params->SetVal("version", 2023030201);
params->SetVal("is_newbie_battle", a8::XValue(IsNewBieBattle()));
params->SetVal("room_uuid", a8::XValue(GetRoomUuid()));
params->SetVal("room_mode", GetReportRoomMode());
params->SetVal("map_mode", GetReportMapMode());
@ -4039,6 +4055,7 @@ void Room::GenBattleRoomReportData(a8::MutableXObject* params)
void Room::GenBattleMobaReportData(a8::MutableXObject* params)
{
params->SetVal("version", 2023030201);
params->SetVal("is_newbie_battle", a8::XValue(IsNewBieBattle()));
params->SetVal("room_uuid", a8::XValue(GetRoomUuid()));
params->SetVal("room_mode", GetReportRoomMode());
params->SetVal("map_mode", GetReportMapMode());
@ -4269,6 +4286,15 @@ void Room::CalcMvp()
level_sco *= mt::Param::s().performance_score_weight_4V4.at(4);
}
battle_score = std::round((kill_sco + assist_sco + damage_sco + recover_sco + level_sco) * 100.0f) / 100.0f;
} else {
if (GetMapModeMeta()->mapMode() == mt::kCircuitMatchMode) {
if (mt::Param::s().performance_score_weight_circuit.size() >= 5) {
kill_sco *= mt::Param::s().performance_score_weight_circuit.at(0);
assist_sco *= mt::Param::s().performance_score_weight_circuit.at(1);
damage_sco *= mt::Param::s().performance_score_weight_circuit.at(2);
recover_sco *= mt::Param::s().performance_score_weight_circuit.at(3);
alive_sco *= mt::Param::s().performance_score_weight_circuit.at(4);
}
} else {
if (mt::Param::s().performance_score_weight_BR.size() >= 5) {
kill_sco *= mt::Param::s().performance_score_weight_BR.at(0);
@ -4277,6 +4303,7 @@ void Room::CalcMvp()
recover_sco *= mt::Param::s().performance_score_weight_BR.at(3);
alive_sco *= mt::Param::s().performance_score_weight_BR.at(4);
}
}
battle_score = std::round((kill_sco + assist_sco + damage_sco + recover_sco + alive_sco) * 100.0f) / 100.0f;
}
#ifdef MYDEBUG
@ -4325,3 +4352,8 @@ void Room::MobaOver()
OnGameOver();
}
}
void Room::SetNewBieBattle(int is_newbie_battle)
{
is_newbie_battle_ = is_newbie_battle;
}

View File

@ -308,7 +308,8 @@ public:
long long GetMobaOvertimeRaceFrameNo () { return moba_overtime_race_frameno_; }
void MobaOver();
std::shared_ptr<BoxDrop> GetBoxDrop() { return box_drop_; }
int IsNewBieBattle() { return is_newbie_battle_; }
void SetNewBieBattle(int is_newbie_battle);
std::shared_ptr<InGameVoice> GetInGameVoice() { return ingame_voice_; }
private:
@ -476,6 +477,7 @@ private:
std::shared_ptr<InGameVoice> ingame_voice_;
std::shared_ptr<BoxDrop> box_drop_;
int is_newbie_battle_ = 0;
friend class Incubator;
friend class Team;

View File

@ -87,15 +87,25 @@ void RoomMgr::_CMJoin(f8::MsgHdr* hdr, const cs::CMJoin& msg)
auto member = GetCustomMemberBySocket(hdr->socket_handle);
if (member) {
#if 1
f8::UdpLog::Instance()->Warning("JoinError socket_not_exits socket_handle%d",
f8::UdpLog::Instance()->Warning("JoinError socket_not_exits socket_handle:%d socket_hash_.size:%d",
{
hdr->socket_handle,
socket_hash_.size()
});
#endif
JoinErrorHandle(msg, 100, hdr->socket_handle);
return;
}
}
{
#ifdef MYDEBUG
f8::UdpLog::Instance()->Warning("CMJoin socket_handle%d socket_hash_.size:%d",
{
hdr->socket_handle,
socket_hash_.size()
});
#endif
}
{
cs::CMJoin* mutable_msg = (cs::CMJoin*)&msg;
AdjustCMJoin(mutable_msg);
@ -171,6 +181,9 @@ int RoomMgr::OverRoomNum()
std::shared_ptr<Room> RoomMgr::GetJoinableRoom(std::shared_ptr<CustomBattle> p)
{
if (p->IsNewBieBattle()) {
return nullptr;
}
if (p->IsMoba()) {
return nullptr;
}
@ -517,7 +530,7 @@ void RoomMgr::_CMJoinCustomBattle(f8::MsgHdr* hdr, const cs::CMJoin& msg, int cu
[] (const a8::Args& args)
{
int socket_handle = args.Get<int>(0);
RoomMgr::Instance()->socket_hash_.erase(socket_handle);
RoomMgr::Instance()->UnBindCustomMemberSocket(socket_handle);
});
std::shared_ptr<cs::CMJoin> join_msg = std::make_shared<cs::CMJoin>();
*join_msg = msg;

View File

@ -88,6 +88,10 @@ bool Team::HasAliveMember()
void Team::AddMember(Human* member)
{
if (room->GetMapModeMeta()->mapMode() == mt::kCircuitMatchMode &&
!members_.empty()) {
A8_ABORT();
}
if (!first_member_) {
first_member_ = member;
init_team_member_num_ = member->init_team_member_num;
@ -274,6 +278,7 @@ void Team::SendTeamBattleReport(Human* sender)
void Team::GenBattleReportData(a8::MutableXObject* params)
{
params->SetVal("version", 2023030201);
params->SetVal("is_newbie_battle", a8::XValue(room->IsNewBieBattle()));
params->SetVal("battle_uuid", a8::XValue(battle_uuid_));
params->SetVal("room_uuid", a8::XValue(room->GetRoomUuid()));
params->SetVal("room_mode", room->GetReportRoomMode());

View File

@ -738,3 +738,8 @@ void Trigger::BulletDmgEnd(Creature* target)
{
DispatchEvent(kBulletDmgEndEvent, {target});
}
void Trigger::OnBattleStart()
{
DispatchEvent(kBattleStartEvent, {});
}

View File

@ -39,6 +39,7 @@ enum EventId_e
kBulletDmgStartEvent,
kBulletDmgEndEvent,
kCrazeModeEvent,
kBattleStartEvent
};
class Weapon;
@ -94,6 +95,7 @@ public:
void BeAttack(int attacker_id);
void BulletDmgStart(Creature* target);
void BulletDmgEnd(Creature* target);
void OnBattleStart();
std::weak_ptr<EventHandler> AddListener(int event_id, a8::CommonCbProc cb);
void RemoveEventHandler(std::weak_ptr<EventHandler> handler_ptr);

View File

@ -75,4 +75,6 @@ enum SMMessageId_e
_SMTeamFullNotify = 1032;
_SMTeamPartNotify = 1033;
_SMBattlePreInfoUpdate = 1034;
_SMAddBattleHint = 1035;
_SMDelBattleHint = 1036;
}

View File

@ -1289,6 +1289,9 @@ message MFSettlementMember
optional int32 old_score = 18; //
optional int32 new_score = 19; //
optional int32 old_circuit_score = 31; //
optional int32 new_circuit_score = 32; //
//
optional int32 pvp_kill = 101; //pvp击杀敌人数
optional int32 pvp_damage = 102; //pvp伤害总量
@ -2131,3 +2134,17 @@ message SMBattlePreInfoUpdate
{
optional MFBattlePreInfo info = 1; //
}
//-
message SMAddBattleHint
{
optional int32 uniid = 1; //id
optional MFVec3 pos = 2; //
optional int32 duration = 3; //
}
//-
message SMDelBattleHint
{
optional int32 uniid = 1; //id
}

View File

@ -770,3 +770,13 @@ message BattleHeroGrow
optional int32 currentSkillEffect = 10;
optional string currentSkillDesc = 11;
}
message CircuitTime
{
optional int32 id = 1;
optional int32 circuit_season = 2;
optional int32 circuit_time_type = 3;
optional string start_time = 4;
optional string end_time = 5;
optional int32 cec_pool = 6;
}