1
This commit is contained in:
parent
6a4131726f
commit
ecf8ddc264
@ -27,6 +27,7 @@
|
||||
#include "aicomponent.h"
|
||||
#include "jsondatamgr.h"
|
||||
#include "skill.h"
|
||||
#include "incubator.h"
|
||||
|
||||
#include "framework/cpp/utils.h"
|
||||
#include "framework/cpp/httpclientpool.h"
|
||||
@ -937,6 +938,10 @@ void Human::DecHP(float dec_hp, int killer_id, const std::string& killer_name, i
|
||||
&xtimer_attacher.timer_list_
|
||||
);
|
||||
SyncAroundPlayers(__FILE__, __LINE__, __func__);
|
||||
if (GetNearbyTeammateNum(MetaMgr::Instance()->refresh_ai_downed_nearby_range) <
|
||||
MetaMgr::Instance()->refresh_ai_downed_nearby_teammate_num) {
|
||||
room->GetIncubator()->AllocAndroid(this, 1 + rand() % 2);
|
||||
}
|
||||
} else {
|
||||
BeKill(killer_id, killer_name, weapon_id);
|
||||
}
|
||||
@ -1042,6 +1047,21 @@ bool Human::HasNoDownedTeammate()
|
||||
return false;
|
||||
}
|
||||
|
||||
int Human::GetNearbyTeammateNum(float range)
|
||||
{
|
||||
int num = 0;
|
||||
if (team_members) {
|
||||
for (auto& hum : *team_members) {
|
||||
if (hum != this && !hum->dead && !hum->downed) {
|
||||
if (hum->GetPos().Distance(GetPos()) <= range) {
|
||||
++num;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
bool Human::CanUseSkill(int skill_id)
|
||||
{
|
||||
return !downed && Creature::CanUseSkill(skill_id);
|
||||
@ -2709,6 +2729,20 @@ void Human::DropItems(Obstacle* obstacle)
|
||||
} else {
|
||||
++normal_drop_times_;
|
||||
}
|
||||
{
|
||||
if (behavior.curr_start_destory_box_frameno <= 0 ||
|
||||
behavior.curr_destory_box_times >= MetaMgr::Instance()->refresh_ai_destory_box_times ||
|
||||
(room->GetFrameNo() - behavior.curr_start_destory_box_frameno >
|
||||
MetaMgr::Instance()->refresh_ai_destory_box_time * SERVER_FRAME_RATE)){
|
||||
behavior.curr_start_destory_box_frameno = room->GetFrameNo();
|
||||
behavior.curr_destory_box_times = 0;
|
||||
}
|
||||
behavior.curr_destory_box_times++;
|
||||
behavior.total_destory_box_times++;
|
||||
if (behavior.curr_destory_box_times >= MetaMgr::Instance()->refresh_ai_destory_box_times) {
|
||||
room->GetIncubator()->AllocAndroid(this, 1 + rand() % 2);
|
||||
}
|
||||
}
|
||||
#ifdef DEBUG
|
||||
#if 0
|
||||
a8::UdpLog::Instance()->Debug("DropItems normal:%d box:%d drop_id:%d is_treasure_box:%d",
|
||||
|
@ -171,6 +171,7 @@ class Human : public Creature
|
||||
void RemoveOutObjects(Entity* entity);
|
||||
bool HasLiveTeammate();
|
||||
bool HasNoDownedTeammate();
|
||||
int GetNearbyTeammateNum(float range);
|
||||
void DoJump();
|
||||
virtual bool CanUseSkill(int skill_id) override;
|
||||
virtual Skill* SelectSkill();
|
||||
|
@ -16,7 +16,9 @@ void Incubator::UnInit()
|
||||
|
||||
void Incubator::AllocAndroid(Human* target, int num)
|
||||
{
|
||||
if (num > 0) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void Incubator::RecycleAndroid(Human* hum)
|
||||
|
@ -237,6 +237,10 @@ public:
|
||||
METAMGR_READ(teammate_bekill_color, 0x00FF00);
|
||||
METAMGR_READ(self_kill_color, 0xFFFF00);
|
||||
METAMGR_READ(self_bekill_color, 0x00FF00);
|
||||
METAMGR_READ(refresh_ai_destory_box_time, 30);
|
||||
METAMGR_READ(refresh_ai_destory_box_times, 5);
|
||||
METAMGR_READ(refresh_ai_downed_nearby_teammate_num, 1);
|
||||
METAMGR_READ(refresh_ai_downed_nearby_range, 580);
|
||||
{
|
||||
METAMGR_READ_STR(level0room_spec_things, "");
|
||||
std::vector<std::string> tmpstrings;
|
||||
|
@ -139,6 +139,11 @@ class MetaMgr : public a8::Singleton<MetaMgr>
|
||||
float ice_show_time = 0.5f;
|
||||
float ice_invisible_time2 = 2.0f;
|
||||
|
||||
int refresh_ai_destory_box_time = 30;
|
||||
int refresh_ai_destory_box_times = 5;
|
||||
int refresh_ai_downed_nearby_teammate_num = 1;
|
||||
int refresh_ai_downed_nearby_range = 580;
|
||||
|
||||
#if 0
|
||||
int refresh_robot_min_num = 0;
|
||||
int refresh_robot_max_num = 0;
|
||||
|
@ -133,10 +133,9 @@ struct HumanAbility
|
||||
|
||||
struct HumanBehavior
|
||||
{
|
||||
long long last_destory_box_frameno = 0;
|
||||
int total_destory_box_times = 0;
|
||||
long long curr_start_destory_box_frameno = 0;
|
||||
int curr_destory_box_times = 0;
|
||||
int total_destory_box_times = 0;
|
||||
};
|
||||
|
||||
struct ObstacleData
|
||||
|
Loading…
x
Reference in New Issue
Block a user