diff --git a/server/gameserver/aicomponent.cc b/server/gameserver/aicomponent.cc index 3f71c4b..a8f6c68 100644 --- a/server/gameserver/aicomponent.cc +++ b/server/gameserver/aicomponent.cc @@ -21,3 +21,4 @@ int AIComponent::GetAiLevel() { return ai_level_; } + diff --git a/server/gameserver/android_new.ai.cc b/server/gameserver/android_new.ai.cc index 2842045..70e8154 100644 --- a/server/gameserver/android_new.ai.cc +++ b/server/gameserver/android_new.ai.cc @@ -544,7 +544,15 @@ void AndroidNewAI::UpdateRandomWalk() void AndroidNewAI::UpdatePursuit() { - + Human* myself = (Human*)owner; + float distance = myself->GetPos().Distance(node_.target->GetPos()); + if (distance < GetAttackRange()) { + ChangeToStateNewAI(ASE_Attack); + } else { + if (node_.exec_frame_num > 100) { + ChangeToStateNewAI(ASE_RandomWalk); + } + } } void AndroidNewAI::DoMoveNewAI() @@ -676,7 +684,7 @@ float AndroidNewAI::GetAttackRange() if (myself->curr_weapon && myself->curr_weapon->meta) { attack_range = myself->curr_weapon->meta->i->range(); } - attack_range = std::min(500.0f, attack_range); + attack_range = std::min(300.0f, attack_range); return attack_range; } @@ -692,8 +700,14 @@ void AndroidNewAI::DoShotNewAI() if (std::abs(shot_dir.x) > FLT_EPSILON || std::abs(shot_dir.y) > FLT_EPSILON) { shot_dir.Normalize(); + if (ai_meta->i->shot_offset_angle() > 0) { + if (rand() % 10 < 3) { + shot_dir.Rotate(ai_meta->i->shot_offset_angle() / 180.0f); + } else { + shot_dir.Rotate(ai_meta->i->shot_offset_angle() / -180.0f); + } + } myself->attack_dir = shot_dir; - shot_dir.Rotate(ai_meta->i->shot_offset_angle() / 180.0f); myself->Shot(shot_dir, shot_ok); if (shot_ok) { if (node_.shot_times <= 0) { diff --git a/server/gameserver/human.cc b/server/gameserver/human.cc index 8313101..7046936 100644 --- a/server/gameserver/human.cc +++ b/server/gameserver/human.cc @@ -1005,6 +1005,11 @@ void Human::BeKill(int killer_id, const std::string& killer_name, int weapon_id) void Human::DecHP(float dec_hp, int killer_id, const std::string& killer_name, int weapon_id) { + #ifdef DEBUG + if (IsPlayer()) { + return; + } + #endif auto downed_func = [] (const a8::XParams& param) { Human* hum = (Human*)param.sender.GetUserData(); diff --git a/server/gameserver/room.cc b/server/gameserver/room.cc index 04a21c6..fa05f86 100644 --- a/server/gameserver/room.cc +++ b/server/gameserver/room.cc @@ -2913,7 +2913,8 @@ void Room::InitAndroidAI() } for (Android* hum : androids) { #if 1 - hum->SetAiLevel(2); + hum->SetAiLevel(5); + continue; #endif if (IsMiniRoom()) { int rnd = rand() % MetaMgr::Instance()->mini_room_ai_weights_space; @@ -2940,3 +2941,5 @@ void Room::InitAndroidAI() } } } + +