1
This commit is contained in:
commit
d1f2e6d581
@ -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;
|
||||
@ -3646,6 +3651,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());
|
||||
|
@ -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);
|
||||
|
@ -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()
|
||||
@ -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) {
|
||||
|
@ -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)
|
||||
|
@ -625,7 +625,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)
|
||||
@ -2641,6 +2641,9 @@ long long Room::GetGasInactiveTime()
|
||||
if (IsNewerMap()) {
|
||||
inactive_time = 10;
|
||||
}
|
||||
if (IsNewBieBattle()) {
|
||||
inactive_time = 10;
|
||||
}
|
||||
return inactive_time;
|
||||
}
|
||||
|
||||
@ -4018,6 +4021,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 +4043,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());
|
||||
@ -4325,3 +4330,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;
|
||||
|
@ -181,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;
|
||||
}
|
||||
|
@ -274,6 +274,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());
|
||||
|
Loading…
x
Reference in New Issue
Block a user