Compare commits
103 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
0312ec3d93 | ||
![]() |
d5dbf1aca6 | ||
![]() |
39a4603107 | ||
![]() |
98c5e62384 | ||
![]() |
b17d8dde24 | ||
![]() |
f6710fac16 | ||
![]() |
7b69517946 | ||
![]() |
765e88b3c3 | ||
![]() |
c2a08526c7 | ||
![]() |
d0ab84e164 | ||
![]() |
571fc0f58c | ||
![]() |
7129bcb4be | ||
![]() |
ce050856f8 | ||
![]() |
73e25cc10d | ||
![]() |
5d63784212 | ||
![]() |
bcaa24b095 | ||
![]() |
aa353e9318 | ||
![]() |
d8447a90c5 | ||
![]() |
bc9aab25c6 | ||
![]() |
718886e247 | ||
![]() |
5bee4f9d1d | ||
![]() |
4cc2cec970 | ||
![]() |
dc6c86ac24 | ||
![]() |
72ead02eec | ||
![]() |
da73a1f622 | ||
![]() |
b6344aa461 | ||
![]() |
943e2b989e | ||
![]() |
e0373b472c | ||
![]() |
0b89e71303 | ||
![]() |
528318d3ce | ||
![]() |
f47a6d4132 | ||
![]() |
1ee1f7ca6d | ||
![]() |
52b00f81f2 | ||
![]() |
ea392f0003 | ||
![]() |
3dde0c2bf8 | ||
![]() |
c282e3158e | ||
![]() |
72dad82547 | ||
![]() |
ce02b947ac | ||
![]() |
857f3ef773 | ||
![]() |
6fc087a1fd | ||
![]() |
d8d8b73c27 | ||
![]() |
e9f4ed77cf | ||
![]() |
744299bea0 | ||
![]() |
76354312ae | ||
![]() |
d1a289b78d | ||
![]() |
0c7047a18b | ||
![]() |
8b81dc8c0d | ||
![]() |
7b2031a64e | ||
![]() |
6b7b6be707 | ||
![]() |
638961c5ed | ||
![]() |
e5e2430047 | ||
![]() |
a4cee4dfa2 | ||
![]() |
fce35159dd | ||
![]() |
1c6d10574c | ||
![]() |
60df47fa29 | ||
![]() |
d1f2e6d581 | ||
![]() |
3f5d6baad9 | ||
![]() |
73e7669ab5 | ||
![]() |
f64cda608d | ||
![]() |
c0570832a6 | ||
![]() |
ebf168a525 | ||
![]() |
4a7ac10d23 | ||
![]() |
782022e6d6 | ||
![]() |
aa4ff18785 | ||
![]() |
f0f3e82cfa | ||
![]() |
c8cf48e45c | ||
![]() |
b5d13dcb6c | ||
![]() |
e1c92ba5a9 | ||
![]() |
ed49e8c193 | ||
![]() |
d0442a0d30 | ||
![]() |
959b922454 | ||
![]() |
5e186ae2ac | ||
![]() |
1d02970da1 | ||
![]() |
028c03ac5a | ||
![]() |
c003a4839d | ||
![]() |
4f3795648e | ||
![]() |
1341bc0c31 | ||
![]() |
8e8eda2591 | ||
![]() |
e6a0186c3e | ||
![]() |
23e78c98ee | ||
![]() |
c66d5db158 | ||
![]() |
f4f0120da6 | ||
![]() |
2b9e89a002 | ||
![]() |
2ff4981c39 | ||
![]() |
0a039944b2 | ||
![]() |
48de22c611 | ||
![]() |
04506acb20 | ||
![]() |
48c994270f | ||
![]() |
f47f1c769e | ||
![]() |
4781e964d3 | ||
![]() |
b85c6026ca | ||
![]() |
363c6977f5 | ||
![]() |
2cd65abce7 | ||
![]() |
6f46958b5b | ||
![]() |
6495be8f92 | ||
![]() |
2412079864 | ||
![]() |
3d6c8ce264 | ||
![]() |
e301be3dc1 | ||
![]() |
0e2ac2bb59 | ||
![]() |
7c3edc1074 | ||
![]() |
3e424d81aa | ||
![]() |
72abfd9f94 | ||
![]() |
aa5e6661fc |
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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,22 +312,26 @@ void Ability::RecalcAttrAddition(int attr_id)
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
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,
|
||||
AttrAddition,
|
||||
entry);
|
||||
if (IsMulCalc(attr_id)) {
|
||||
if (!inited) {
|
||||
new_val = 1;
|
||||
inited = true;
|
||||
if (attr_id == kHAT_vSpeedRateIn) {
|
||||
new_val = CalcSpeedRateIn(head);
|
||||
} else {
|
||||
list_head* pos = nullptr;
|
||||
list_head* next = nullptr;
|
||||
bool inited = false;
|
||||
list_for_each_safe(pos, next, head) {
|
||||
AttrAddition* e = list_entry(pos,
|
||||
AttrAddition,
|
||||
entry);
|
||||
if (IsMulCalc(attr_id)) {
|
||||
if (!inited) {
|
||||
new_val = 1;
|
||||
inited = true;
|
||||
}
|
||||
new_val *= 1 + e->value;
|
||||
} else {
|
||||
new_val += e->value;
|
||||
}
|
||||
new_val *= 1 + e->value;
|
||||
} else {
|
||||
new_val += e->value;
|
||||
}
|
||||
}
|
||||
if (IsValidHumanAttr(attr_id)) {
|
||||
@ -289,22 +356,26 @@ void Ability::RecalcAttrRuduce(int attr_id)
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
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,
|
||||
AttrAddition,
|
||||
entry);
|
||||
if (IsMulCalc(attr_id)) {
|
||||
if (!inited) {
|
||||
new_val = 1;
|
||||
inited = true;
|
||||
if (attr_id == kHAT_vSpeedRateIn) {
|
||||
new_val = CalcSpeedRateIn(head);
|
||||
} else {
|
||||
list_head* pos = nullptr;
|
||||
list_head* next = nullptr;
|
||||
bool inited = false;
|
||||
list_for_each_safe(pos, next, head) {
|
||||
AttrAddition* e = list_entry(pos,
|
||||
AttrAddition,
|
||||
entry);
|
||||
if (IsMulCalc(attr_id)) {
|
||||
if (!inited) {
|
||||
new_val = 1;
|
||||
inited = true;
|
||||
}
|
||||
new_val *= 1 + e->value;
|
||||
} else {
|
||||
new_val += e->value;
|
||||
}
|
||||
new_val *= 1 + e->value;
|
||||
} else {
|
||||
new_val += e->value;
|
||||
}
|
||||
}
|
||||
if (IsValidHumanAttr(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;
|
||||
|
@ -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);
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "tracemgr.h"
|
||||
|
||||
#include "mt/Map.h"
|
||||
#include "mt/MapMode.h"
|
||||
|
||||
Position BornPoint::RandPoint(Room* room) const
|
||||
{
|
||||
@ -43,9 +44,13 @@ Position BornPoint::RandPoint(Room* room) const
|
||||
return pos;
|
||||
}
|
||||
|
||||
int BornPoint::GetNum()
|
||||
int BornPoint::GetNum(Room* room)
|
||||
{
|
||||
return 4;
|
||||
if (room->GetMapModeMeta()->mapMode() == mt::kCircuitMatchMode) {
|
||||
return 1;
|
||||
} else {
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
|
||||
Position BornPoint::GetSrcPoint(Room* room) const
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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") {
|
||||
|
@ -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);
|
||||
}
|
||||
GetTrigger()->LeaveBattleMode();
|
||||
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);
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -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_;
|
||||
|
@ -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;
|
||||
|
@ -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());
|
||||
|
@ -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;
|
||||
|
@ -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,11 +117,13 @@ void Incubator::AllocAndroid(Human* target, int num, std::vector<Human*>* androi
|
||||
if (hold_humans_.size() < 1) {
|
||||
return;
|
||||
}
|
||||
if (hold_humans_.size() <= 6) {
|
||||
if (room->GetGasData().new_area_meta->GetSmallRingCount() < 4) {
|
||||
ShowHand();
|
||||
if (!room->IsNewBieBattle()) {
|
||||
if (hold_humans_.size() <= CHIJI_HIDE_HUMANS) {
|
||||
if (room->GetGasData().new_area_meta->GetSmallRingCount() < 4) {
|
||||
ShowHand();
|
||||
}
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
#ifdef MYDEBUG
|
||||
a8::XPrintf("SmallRingCount:%d \n", {room->GetGasData().new_area_meta->GetSmallRingCount()});
|
||||
@ -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,7 +309,11 @@ void Incubator::AutoAllocAndroid()
|
||||
return;
|
||||
}
|
||||
hold_humans_.erase(hold_humans_.begin());
|
||||
room->xtimer.ModifyTime(alloc_timer_, SERVER_FRAME_RATE * (30 + rand() % 5));
|
||||
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;
|
||||
@ -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_);
|
||||
}
|
||||
|
@ -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);
|
||||
|
14
server/gameserver/mt/CircuitTime.cc
Normal file
14
server/gameserver/mt/CircuitTime.cc
Normal file
@ -0,0 +1,14 @@
|
||||
#include "precompile.h"
|
||||
|
||||
#include "mt/CircuitTime.h"
|
||||
|
||||
IMPL_TABLE(mt::CircuitTime)
|
||||
|
||||
namespace mt
|
||||
{
|
||||
|
||||
void CircuitTime::Init1()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
21
server/gameserver/mt/CircuitTime.h
Normal file
21
server/gameserver/mt/CircuitTime.h
Normal 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;
|
||||
};
|
||||
|
||||
}
|
@ -10,6 +10,11 @@ namespace mt
|
||||
|
||||
void MapMode::Init1()
|
||||
{
|
||||
#ifdef MYDEBUG
|
||||
if (mapMode() == 201) {
|
||||
mapMode_ = kCircuitMatchMode;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool MapMode::IsOpen() const
|
||||
|
@ -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",
|
||||
|
@ -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()
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
40
server/gameserver/mtb/CircuitTime.h
Normal file
40
server/gameserver/mtb/CircuitTime.h
Normal 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__;
|
||||
};
|
||||
|
||||
};
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -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, ¬ify_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)
|
||||
|
@ -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)
|
||||
|
@ -540,10 +540,14 @@ void Room::CreateAndroid(int robot_num, std::shared_ptr<Team> team)
|
||||
hum->Initialize();
|
||||
AddToEntityHash(hum);
|
||||
AddToHumanHash(hum);
|
||||
if (team) {
|
||||
team->AddMember(hum);
|
||||
} else {
|
||||
if (GetMapModeMeta()->mapMode() != mt::kCircuitMatchMode) {
|
||||
MatchTeam(hum);
|
||||
} else {
|
||||
if (team) {
|
||||
team->AddMember(hum);
|
||||
} else {
|
||||
MatchTeam(hum);
|
||||
}
|
||||
}
|
||||
if (!hum->IsOb()) {
|
||||
IncAliveCount();
|
||||
@ -597,10 +601,14 @@ Human* Room::CreateAndroidWithCustomMember(std::shared_ptr<CustomMember> custom_
|
||||
hum->Initialize();
|
||||
AddToEntityHash(hum);
|
||||
AddToHumanHash(hum);
|
||||
if (team) {
|
||||
team->AddMember(hum);
|
||||
} else {
|
||||
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());
|
||||
@ -4270,12 +4287,22 @@ void Room::CalcMvp()
|
||||
}
|
||||
battle_score = std::round((kill_sco + assist_sco + damage_sco + recover_sco + level_sco) * 100.0f) / 100.0f;
|
||||
} else {
|
||||
if (mt::Param::s().performance_score_weight_BR.size() >= 5) {
|
||||
kill_sco *= mt::Param::s().performance_score_weight_BR.at(0);
|
||||
assist_sco *= mt::Param::s().performance_score_weight_BR.at(1);
|
||||
damage_sco *= mt::Param::s().performance_score_weight_BR.at(2);
|
||||
recover_sco *= mt::Param::s().performance_score_weight_BR.at(3);
|
||||
alive_sco *= mt::Param::s().performance_score_weight_BR.at(4);
|
||||
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);
|
||||
assist_sco *= mt::Param::s().performance_score_weight_BR.at(1);
|
||||
damage_sco *= mt::Param::s().performance_score_weight_BR.at(2);
|
||||
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;
|
||||
}
|
||||
@ -4325,3 +4352,8 @@ void Room::MobaOver()
|
||||
OnGameOver();
|
||||
}
|
||||
}
|
||||
|
||||
void Room::SetNewBieBattle(int is_newbie_battle)
|
||||
{
|
||||
is_newbie_battle_ = is_newbie_battle;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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());
|
||||
|
@ -738,3 +738,8 @@ void Trigger::BulletDmgEnd(Creature* target)
|
||||
{
|
||||
DispatchEvent(kBulletDmgEndEvent, {target});
|
||||
}
|
||||
|
||||
void Trigger::OnBattleStart()
|
||||
{
|
||||
DispatchEvent(kBattleStartEvent, {});
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -75,4 +75,6 @@ enum SMMessageId_e
|
||||
_SMTeamFullNotify = 1032;
|
||||
_SMTeamPartNotify = 1033;
|
||||
_SMBattlePreInfoUpdate = 1034;
|
||||
_SMAddBattleHint = 1035;
|
||||
_SMDelBattleHint = 1036;
|
||||
}
|
||||
|
@ -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伤害总量
|
||||
@ -2130,4 +2133,18 @@ message SMTeamPartNotify
|
||||
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
|
||||
}
|
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user