1
This commit is contained in:
commit
465034df64
@ -13,13 +13,20 @@
|
||||
<property ResultOption="BT_INVALID" />
|
||||
</node>
|
||||
</node>
|
||||
<node class="Action" id="5">
|
||||
<property Method="Self.BaseAgent::CoShot()" />
|
||||
<property ResultOption="BT_INVALID" />
|
||||
</node>
|
||||
<node class="Action" id="2">
|
||||
<property Method="Self.BaseAgent::CoMoveToCurrentTarget(60)" />
|
||||
<property ResultOption="BT_INVALID" />
|
||||
<node class="IfElse" id="6">
|
||||
<node class="Condition" id="7">
|
||||
<property Operator="Greater" />
|
||||
<property Opl="Self.BaseAgent::GetAttackRange()" />
|
||||
<property Opr="Self.BaseAgent::GetCurrentTargetDistance()" />
|
||||
</node>
|
||||
<node class="Action" id="5">
|
||||
<property Method="Self.BaseAgent::CoShot()" />
|
||||
<property ResultOption="BT_INVALID" />
|
||||
</node>
|
||||
<node class="Action" id="2">
|
||||
<property Method="Self.BaseAgent::CoMoveToCurrentTarget(60)" />
|
||||
<property ResultOption="BT_INVALID" />
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
</behavior>
|
@ -9,6 +9,11 @@
|
||||
<property Prototype="Self.BaseAgent::ChaseToKill(0)" />
|
||||
<property IsHTN="false" />
|
||||
<node class="Sequence" id="1">
|
||||
<node class="Assignment" id="9">
|
||||
<property CastRight="false" />
|
||||
<property Opl="int Self.AndroidAgent::_$local_task_param_$_0" />
|
||||
<property Opr="int Self.BaseAgent::find_enemy_target_uniid" />
|
||||
</node>
|
||||
<node class="Action" id="2">
|
||||
<property Method="Self.BaseAgent::SetCurrentTarget(int Self.AndroidAgent::_$local_task_param_$_0)" />
|
||||
<property ResultOption="BT_SUCCESS" />
|
||||
|
@ -20,6 +20,12 @@
|
||||
<property TriggeredOnce="false" />
|
||||
<property TriggerMode="Return" />
|
||||
</attachment>
|
||||
<attachment class="Event" id="13" flag="event">
|
||||
<property ReferenceFilename="android_chase_to_kill" />
|
||||
<property Task="Self.BaseAgent::ChaseToKill(0)" />
|
||||
<property TriggeredOnce="false" />
|
||||
<property TriggerMode="Transfer" />
|
||||
</attachment>
|
||||
<node class="IfElse" id="6">
|
||||
<node class="Condition" id="7">
|
||||
<property Operator="Equal" />
|
||||
@ -55,43 +61,27 @@
|
||||
</attachment>
|
||||
<node class="IfElse" id="11">
|
||||
<node class="Condition" id="12">
|
||||
<property Operator="Greater" />
|
||||
<property Opl="Self.BaseAgent::GetSafeAreaRadius()" />
|
||||
<property Opr="const float 300" />
|
||||
<property Operator="Equal" />
|
||||
<property Opl="Self.BaseAgent::FindEnemy(500)" />
|
||||
<property Opr="const behaviac::EBTStatus BT_SUCCESS" />
|
||||
</node>
|
||||
<node class="IfElse" id="13">
|
||||
<node class="Condition" id="14">
|
||||
<property Operator="Equal" />
|
||||
<property Opl="Self.BaseAgent::IsNearGas(50)" />
|
||||
<property Opr="const bool true" />
|
||||
</node>
|
||||
<node class="ReferencedBehavior" id="15">
|
||||
<property ReferenceBehavior="const string "android_run_gas"" />
|
||||
</node>
|
||||
<node class="IfElse" id="16">
|
||||
<node class="Condition" id="17">
|
||||
<property Operator="Equal" />
|
||||
<property Opl="Self.BaseAgent::FindEnemy(300)" />
|
||||
<property Opr="const behaviac::EBTStatus BT_SUCCESS" />
|
||||
</node>
|
||||
<node class="ReferencedBehavior" id="18">
|
||||
<property ReferenceBehavior="const string "android_chase_to_kill"" />
|
||||
<property Task="Self.BaseAgent::ChaseToKill(int Self.BaseAgent::find_enemy_target_uniid)" />
|
||||
</node>
|
||||
<node class="Noop" id="22" />
|
||||
</node>
|
||||
<node class="ReferencedBehavior" id="15">
|
||||
<property ReferenceBehavior="const string "android_chase_to_kill"" />
|
||||
<property Task="Self.BaseAgent::ChaseToKill(int Self.BaseAgent::find_enemy_target_uniid)" />
|
||||
</node>
|
||||
<node class="IfElse" id="19">
|
||||
<node class="Condition" id="20">
|
||||
<property Operator="Equal" />
|
||||
<property Opl="Self.BaseAgent::FindEnemy(300)" />
|
||||
<property Opr="const behaviac::EBTStatus BT_SUCCESS" />
|
||||
<property Opl="Self.BaseAgent::IsNearGas(150)" />
|
||||
<property Opr="const bool true" />
|
||||
</node>
|
||||
<node class="ReferencedBehavior" id="21">
|
||||
<property ReferenceBehavior="const string "android_chase_to_kill"" />
|
||||
<property Task="Self.BaseAgent::ChaseToKill(int Self.BaseAgent::find_enemy_target_uniid)" />
|
||||
<node class="ReferencedBehavior" id="0">
|
||||
<property ReferenceBehavior="const string "android_run_gas"" />
|
||||
</node>
|
||||
<node class="Action" id="14">
|
||||
<property Method="Self.AndroidAgent::DoRandomWalk()" />
|
||||
<property ResultOption="BT_INVALID" />
|
||||
</node>
|
||||
<node class="Noop" id="23" />
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
|
@ -4,9 +4,9 @@
|
||||
<behavior name="android_run_gas" agenttype="AndroidAgent" version="5">
|
||||
<node class="IfElse" id="0">
|
||||
<node class="Condition" id="1">
|
||||
<property Operator="GreaterEqual" />
|
||||
<property Operator="LessEqual" />
|
||||
<property Opl="Self.BaseAgent::GetSafeAreaRadius()" />
|
||||
<property Opr="const float 300" />
|
||||
<property Opr="const float 100" />
|
||||
</node>
|
||||
<node class="Noop" id="3" />
|
||||
<node class="Action" id="2">
|
||||
|
@ -4,7 +4,7 @@
|
||||
<behavior name="boss_40101" agenttype="HeroAgent" version="5">
|
||||
<node class="IfElse" id="0">
|
||||
<node class="Action" id="10">
|
||||
<property Method="Self.BaseAgent::FindEnemy(580)" />
|
||||
<property Method="Self.BaseAgent::FindEnemy(590)" />
|
||||
<property ResultOption="BT_INVALID" />
|
||||
</node>
|
||||
<node class="ReferencedBehavior" id="7">
|
||||
|
@ -9,6 +9,11 @@
|
||||
<property Prototype="Self.BaseAgent::ChaseToKill(0)" />
|
||||
<property IsHTN="false" />
|
||||
<node class="Sequence" id="1">
|
||||
<node class="Assignment" id="10">
|
||||
<property CastRight="true" />
|
||||
<property Opl="int Self.BaseAgent::_$local_task_param_$_0" />
|
||||
<property Opr="int Self.BaseAgent::find_enemy_target_uniid" />
|
||||
</node>
|
||||
<node class="Action" id="2">
|
||||
<property Method="Self.BaseAgent::SetCurrentTarget(int Self.BaseAgent::_$local_task_param_$_0)" />
|
||||
<property ResultOption="BT_SUCCESS" />
|
||||
@ -41,7 +46,7 @@
|
||||
<property ReferenceBehavior="const string "boss_40101_attack"" />
|
||||
</node>
|
||||
<node class="Action" id="8">
|
||||
<property Method="Self.BaseAgent::CoFindPathToCurrentTarget(60)" />
|
||||
<property Method="Self.BaseAgent::CoFindPathToCurrentTarget(0)" />
|
||||
<property ResultOption="BT_INVALID" />
|
||||
</node>
|
||||
</node>
|
||||
|
@ -6,7 +6,7 @@
|
||||
<node class="Condition" id="1">
|
||||
<property Operator="LessEqual" />
|
||||
<property Opl="Self.BaseAgent::GetSafeAreaRadius()" />
|
||||
<property Opr="const float 300" />
|
||||
<property Opr="const float 200" />
|
||||
</node>
|
||||
<node class="Noop" id="3" />
|
||||
<node class="Action" id="2">
|
||||
|
@ -61,9 +61,6 @@ void BaseAgent::Exec()
|
||||
{
|
||||
behaviac::EBTStatus status = f8::BtMgr::Instance()->BtExec(this);
|
||||
if (status == behaviac::BT_RUNNING && coroutine_ && coroutine_->GetContext()->HasEvent()) {
|
||||
#ifdef DEBUG1
|
||||
DumpBt(this);
|
||||
#endif
|
||||
status_= behaviac::BT_INVALID;
|
||||
auto old_coroutine = coroutine_;
|
||||
coroutine_ = nullptr;
|
||||
@ -267,11 +264,19 @@ void BaseAgent::Sleep(int time)
|
||||
|
||||
bool BaseAgent::CurrentTargetMoveCanReach()
|
||||
{
|
||||
bool ret = false;
|
||||
if (!current_target_.Get()) {
|
||||
return false;
|
||||
ret = false;
|
||||
} else {
|
||||
ret = GetOwner()->room->MoveCanReach(GetOwner()->GetPos().ToGlmVec3(),
|
||||
current_target_.Get()->GetPos().ToGlmVec3());
|
||||
}
|
||||
return GetOwner()->room->MoveCanReach(GetOwner()->GetPos().ToGlmVec3(),
|
||||
current_target_.Get()->GetPos().ToGlmVec3());
|
||||
#ifdef DEBUG
|
||||
if (GetOwner()->GetHeroMeta()->id() == 60100) {
|
||||
a8::XPrintf("CurrentTargetMoveCanReach %f\n", {ret});
|
||||
}
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
behaviac::EBTStatus BaseAgent::DoSkill(int skill_id)
|
||||
@ -303,6 +308,9 @@ behaviac::EBTStatus BaseAgent::SelectUseableSkill(const behaviac::vector<int> sk
|
||||
if (!current_target_.Get()) {
|
||||
return behaviac::BT_FAILURE;
|
||||
}
|
||||
if (GlmHelper::IsEqual2D(GetOwner()->GetPos().ToGlmVec3(),
|
||||
current_target_.Get()->GetPos().ToGlmVec3())) {
|
||||
}
|
||||
for (int skill_id : skill_ids) {
|
||||
Skill* skill = GetOwner()->GetSkill(skill_id);
|
||||
if (skill && GetOwner()->CanUseSkill(skill->GetSkillId())) {
|
||||
@ -361,22 +369,30 @@ behaviac::EBTStatus BaseAgent::CoMoveToCurrentTarget(float distance)
|
||||
if (!current_target_.Get()) {
|
||||
return behaviac::BT_FAILURE;
|
||||
}
|
||||
float target_distance = GetOwner()->GetPos().Distance2D2(current_target_.Get()->GetPos());
|
||||
if (target_distance > 1 && target_distance < 2) {
|
||||
return behaviac::BT_SUCCESS;
|
||||
}
|
||||
/*
|
||||
if (GlmHelper::IsEqual2D(GetOwner()->GetPos().ToGlmVec3(),
|
||||
current_target_.Get()->GetPos().ToGlmVec3())) {
|
||||
return behaviac::BT_SUCCESS;
|
||||
}
|
||||
}*/
|
||||
auto context = MAKE_BTCONTEXT
|
||||
(
|
||||
CreatureWeakPtr target;
|
||||
);
|
||||
|
||||
context->target = current_target_;
|
||||
glm::vec3 dir = GetOwner()->GetPos().CalcDir(context->target.Get()->GetPos());
|
||||
GlmHelper::Normalize(dir);
|
||||
GetOwner()->SetMoveDir(dir);
|
||||
GetOwner()->SetAttackDir(dir);
|
||||
GetOwner()->GetMovement()->CalcTargetPos(60);
|
||||
|
||||
if (target_distance < 1) {
|
||||
GetOwner()->GetMovement()->CalcTargetPos(60);
|
||||
} else {
|
||||
glm::vec3 dir = GetOwner()->GetPos().CalcDir(context->target.Get()->GetPos());
|
||||
GlmHelper::Normalize(dir);
|
||||
GetOwner()->SetMoveDir(dir);
|
||||
GetOwner()->SetAttackDir(dir);
|
||||
GetOwner()->GetMovement()->CalcTargetPos(60);
|
||||
}
|
||||
#ifdef DEBUG
|
||||
a8::XPrintf("CoMoveToCurrentTarget %d\n", {current_target_.Get()->GetUniId()});
|
||||
#endif
|
||||
@ -388,6 +404,16 @@ behaviac::EBTStatus BaseAgent::CoMoveToCurrentTarget(float distance)
|
||||
return behaviac::BT_FAILURE;
|
||||
}
|
||||
if (GetOwner()->GetMovement()->GetPathSize() <= 0) {
|
||||
if (context->target.Get()) {
|
||||
if (GlmHelper::IsEqual2D(GetOwner()->GetPos().ToGlmVec3(),
|
||||
context->target.Get()->GetPos().ToGlmVec3())) {
|
||||
} else {
|
||||
glm::vec3 dir = GetOwner()->GetPos().CalcDir(context->target.Get()->GetPos());
|
||||
GlmHelper::Normalize(dir);
|
||||
GetOwner()->SetMoveDir(dir);
|
||||
GetOwner()->SetAttackDir(dir);
|
||||
}
|
||||
}
|
||||
return behaviac::BT_SUCCESS;
|
||||
}
|
||||
return behaviac::BT_RUNNING;
|
||||
@ -397,22 +423,39 @@ behaviac::EBTStatus BaseAgent::CoMoveToCurrentTarget(float distance)
|
||||
|
||||
bool BaseAgent::CurrentTargetIsValid()
|
||||
{
|
||||
return current_target_.Get() && !current_target_.Get()->dead;
|
||||
bool ret = current_target_.Get() && !current_target_.Get()->dead;
|
||||
#ifdef DEBUG
|
||||
if (GetOwner()->GetHeroMeta()->id() == 60100 && !ret) {
|
||||
a8::XPrintf("CurrentTargetIsValid %d\n", {ret});
|
||||
}
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
behaviac::EBTStatus BaseAgent::FindEnemy(float range)
|
||||
{
|
||||
Creature* enemy = GetOwner()->room->FindEnemy(GetOwner(), range);
|
||||
find_enemy_target_uniid = enemy ? enemy->GetUniId() : 0;
|
||||
#ifdef DEBUG
|
||||
if (GetOwner()->GetHeroMeta()->id() == 60100) {
|
||||
a8::XPrintf("FindEnemy %f\n", {find_enemy_target_uniid});
|
||||
}
|
||||
#endif
|
||||
return enemy ? behaviac::BT_SUCCESS : behaviac::BT_FAILURE;
|
||||
}
|
||||
|
||||
float BaseAgent::GetCurrentTargetDistance()
|
||||
{
|
||||
float distance = 0;
|
||||
if (current_target_.Get()) {
|
||||
return current_target_.Get()->GetPos().Distance2D2(GetOwner()->GetPos());
|
||||
distance = current_target_.Get()->GetPos().Distance2D2(GetOwner()->GetPos());
|
||||
}
|
||||
return 0;
|
||||
#ifdef DEBUG1
|
||||
if (GetOwner()->GetHeroMeta()->id() == 60100) {
|
||||
a8::XPrintf("GetCurrentTargetDistance %f\n", {distance});
|
||||
}
|
||||
#endif
|
||||
return distance;
|
||||
}
|
||||
|
||||
float BaseAgent::GetFindEnemyResultTargetDistance()
|
||||
@ -429,6 +472,11 @@ glm::vec3 BaseAgent::GetFindEnemyResultTargetPos()
|
||||
|
||||
void BaseAgent::SetCurrentTarget(int target_uniid)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if (GetOwner()->GetHeroMeta()->id() == 60100) {
|
||||
a8::XPrintf("SetCurrentTarget %f\n", {target_uniid});
|
||||
}
|
||||
#endif
|
||||
current_target_.Reset();
|
||||
Creature* c = GetOwner()->room->GetCreatureByUniId(target_uniid);
|
||||
if (c) {
|
||||
@ -463,7 +511,10 @@ behaviac::EBTStatus BaseAgent::CoShot()
|
||||
return behaviac::BT_FAILURE;
|
||||
}
|
||||
glm::vec3 dir = GetOwner()->GetPos().CalcDir(current_target_.Get()->GetPos());
|
||||
if (GlmHelper::Norm(dir) > 150) {
|
||||
if (GlmHelper::Norm(dir) > GetAttackRange()) {
|
||||
#ifdef DEBUG
|
||||
a8::XPrintf("CoShot Failed %f\n", {GlmHelper::Norm(dir)});
|
||||
#endif
|
||||
return behaviac::BT_FAILURE;
|
||||
}
|
||||
bool shot_ok = false;
|
||||
@ -528,6 +579,7 @@ behaviac::EBTStatus BaseAgent::CoRunGas()
|
||||
}
|
||||
gas_center.y = GetOwner()->GetPos().ToGlmVec3().y;
|
||||
glm::vec3 dir = gas_center - GetOwner()->GetPos().ToGlmVec3();
|
||||
GlmHelper::Normalize(dir);
|
||||
|
||||
glm::vec3 center = GetOwner()->GetPos().ToGlmVec3() +
|
||||
dir * (30.0f + (float)context->try_count * 50.0f);
|
||||
@ -535,7 +587,7 @@ behaviac::EBTStatus BaseAgent::CoRunGas()
|
||||
glm::vec3 point;
|
||||
bool ok = GetOwner()->room->map_instance->FindConnectableNearestPoint(center, 50, point);
|
||||
if (ok) {
|
||||
GetOwner()->room->map_instance->Scale(point);
|
||||
GetOwner()->room->map_instance->UnScale(point);
|
||||
bool ret = GetOwner()->GetMovement()->FindPath(point, 0);
|
||||
if (ret) {
|
||||
context->find_ok = true;
|
||||
|
@ -6,6 +6,8 @@
|
||||
#include <glm/gtc/matrix_transform.hpp>
|
||||
#include <glm/vec2.hpp>
|
||||
|
||||
#include <a8/collision.h>
|
||||
|
||||
#include "creature.h"
|
||||
#include "room.h"
|
||||
#include "skill.h"
|
||||
@ -822,8 +824,27 @@ void Creature::TriggerOneObjectBuff(Skill* skill, Creature* target, BuffTriggerT
|
||||
|
||||
Skill* Creature::GetSkill(int skill_id)
|
||||
{
|
||||
auto itr = skill_hash_.find(skill_id);
|
||||
return itr != skill_hash_.end() ? itr->second.get() : nullptr;
|
||||
if (skill_id < 10) {
|
||||
switch (skill_id) {
|
||||
case 0:
|
||||
{
|
||||
return GetMainSkill();
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
return GetMainSkill();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
auto itr = skill_hash_.find(skill_id);
|
||||
return itr != skill_hash_.end() ? itr->second.get() : nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
bool Creature::CanUseSkill(int skill_id)
|
||||
@ -3007,10 +3028,20 @@ void Creature::NetInitOk()
|
||||
|
||||
bool Creature::IsNearGas(float distance)
|
||||
{
|
||||
Position p;
|
||||
p.FromGlmVec3(glm::vec3(room->GetGasData().pos_new.x, 0, room->GetGasData().pos_new.y));
|
||||
float gas_distance = GetPos().Distance2D2(p);
|
||||
return gas_distance + GetRadius() * 2 + distance > room->GetGasData().rad_new;
|
||||
float radius = GetRadius() + distance;
|
||||
bool b1 = a8::CircleContainCircle
|
||||
(room->GetGasData().pos_old,
|
||||
room->GetGasData().gas_progress,
|
||||
glm::vec2(GetPos().GetX(), GetPos().GetZ()),
|
||||
radius
|
||||
);
|
||||
bool b2 = a8::CircleContainCircle
|
||||
(room->GetGasData().pos_new,
|
||||
room->GetGasData().rad_new,
|
||||
glm::vec2(GetPos().GetX(), GetPos().GetZ()),
|
||||
radius
|
||||
);
|
||||
return !b1 && !b2;
|
||||
}
|
||||
|
||||
float Creature::GetSafeAreaRaidus()
|
||||
|
@ -99,6 +99,7 @@ class Human : public Creature
|
||||
a8::XTimerWp revive_timer;
|
||||
long long dead_frameno = 0;
|
||||
long long real_dead_frameno = 0;
|
||||
int sort_id = 0;
|
||||
|
||||
Weapon default_weapon;
|
||||
|
||||
|
@ -206,6 +206,7 @@ void Incubator::RecycleAndroid(Human* hum)
|
||||
hum->RemoveBuffByEffectId(kBET_BeRecycle);
|
||||
hold_humans_.push_back(hum);
|
||||
room->DisableHuman(hum);
|
||||
Rearrangement();
|
||||
#ifdef DEBUG
|
||||
room->BroadcastDebugMsg(a8::Format("回收机器人 %d:%s:%d 添加到回收列表",
|
||||
{hum->GetUniId(),
|
||||
@ -516,14 +517,11 @@ void Incubator::ShowHand()
|
||||
room->EnableHuman(hum);
|
||||
hum->MustBeAddBuff(hum, kTraceBuffId);
|
||||
a8::SetBitFlag(hum->status, CS_CrazeMode);
|
||||
#if 0
|
||||
a8::SetBitFlag(hum->status, CS_DisableAttackAndroid);
|
||||
#endif
|
||||
}
|
||||
#if 0
|
||||
room->xtimer.SetIntervalEx
|
||||
(
|
||||
SERVER_FRAME_RATE,
|
||||
SERVER_FRAME_RATE * 40,
|
||||
[room = room] (int event, const a8::Args* args) mutable
|
||||
{
|
||||
if (a8::TIMER_EXEC_EVENT == event) {
|
||||
@ -540,7 +538,6 @@ void Incubator::ShowHand()
|
||||
}
|
||||
},
|
||||
&room->xtimer_attacher_);
|
||||
#endif
|
||||
hold_humans_.clear();
|
||||
}
|
||||
|
||||
@ -556,3 +553,72 @@ void Incubator::Clear(int save_num)
|
||||
hold_humans_.erase(hold_humans_.begin());
|
||||
}
|
||||
}
|
||||
|
||||
void Incubator::Rearrangement()
|
||||
{
|
||||
if (hold_humans_.size() < 6) {
|
||||
return;
|
||||
}
|
||||
std::vector<int> teams2;
|
||||
std::vector<int> teams3;
|
||||
std::vector<int> teams4;
|
||||
{
|
||||
std::map<int, int> team_num_hash;
|
||||
int i = 0;
|
||||
for (auto hum : hold_humans_) {
|
||||
if (team_num_hash.find(hum->team_id) != team_num_hash.end()) {
|
||||
++team_num_hash[hum->team_id];
|
||||
} else {
|
||||
team_num_hash[hum->team_id] = 1;
|
||||
}
|
||||
hum->sort_id = i;
|
||||
++i;
|
||||
}
|
||||
for (auto& pair : team_num_hash) {
|
||||
if (pair.second > 1) {
|
||||
teams2.push_back(pair.first);
|
||||
}
|
||||
if (pair.second > 2) {
|
||||
teams3.push_back(pair.first);
|
||||
}
|
||||
if (pair.second > 3) {
|
||||
teams4.push_back(pair.first);
|
||||
}
|
||||
}
|
||||
}
|
||||
int team_id = 0;
|
||||
if (!teams3.empty() || !teams4.empty()) {
|
||||
if (a8::RandEx(1, 99) < 10 && !teams4.empty()) {
|
||||
team_id = teams4.at(rand() % teams4.size());
|
||||
} else {
|
||||
if (!teams3.empty()) {
|
||||
team_id = teams3.at(rand() % teams3.size());
|
||||
} else if (!teams4.empty()) {
|
||||
team_id = teams4.at(rand() % teams4.size());
|
||||
}
|
||||
}
|
||||
} else if (!teams2.empty()) {
|
||||
team_id = teams2.at(rand() % teams2.size());
|
||||
}
|
||||
if (team_id) {
|
||||
for (auto hum : hold_humans_) {
|
||||
if (hum->team_id == team_id) {
|
||||
hum->sort_id = 999999;
|
||||
}
|
||||
}
|
||||
std::sort(hold_humans_.begin(), hold_humans_.end(),
|
||||
[] (Human* a, Human* b) -> bool
|
||||
{
|
||||
return a->sort_id < b->sort_id;
|
||||
});
|
||||
}
|
||||
#ifdef DEBUG
|
||||
{
|
||||
std::string data = "Rearrangement team_id:" + a8::XValue(team_id).GetString() + " ";
|
||||
for (auto hum : hold_humans_) {
|
||||
data += a8::XValue(hum->team_id).GetString() + ",";
|
||||
}
|
||||
a8::XPrintf("%s !%d %d %d\n", {data, teams2.size(), teams3.size(), teams4.size()});
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ private:
|
||||
void AutoAllocAndroid();
|
||||
void OnEnterNewWave(int wave);
|
||||
void SpawnWaveMon(int wave);
|
||||
void Rearrangement();
|
||||
|
||||
private:
|
||||
int wait_alloc_time_ = 0;
|
||||
|
@ -954,6 +954,10 @@ void BattleDataContext::Init(Creature* c)
|
||||
spec_weapon.ammo = spec_weapon.GetClipVolume(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
auto match_conf = owner_.Get()->room->GetRankMatchConf();
|
||||
if (owner_.Get()->IsAndroid() && match_conf) {
|
||||
|
||||
}
|
||||
c->NetInitOk();
|
||||
}
|
||||
|
@ -3424,7 +3424,7 @@ void Room::CloseRoomSwitch(int tag)
|
||||
|
||||
void Room::GMFastForward()
|
||||
{
|
||||
while (GetGasData().new_area_meta->GetSmallRingCount() >= 4) {
|
||||
while (GetGasData().new_area_meta->GetSmallRingCount() >= 3) {
|
||||
ForwardGasRing(1);
|
||||
}
|
||||
TraversePlayerList
|
||||
@ -3452,7 +3452,7 @@ void Room::GMFastForward()
|
||||
}
|
||||
}
|
||||
});
|
||||
GetIncubator()->Clear(1);
|
||||
GetIncubator()->Clear(5);
|
||||
for (auto& pair : human_hash_) {
|
||||
if (pair.second->IsAndroid() &&
|
||||
!a8::HasBitFlag(pair.second->status, CS_Disable)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user