This commit is contained in:
aozhiwei 2020-07-15 13:15:19 +08:00
parent 7af787519a
commit 15816af295
2 changed files with 8 additions and 1 deletions

View File

@ -696,7 +696,11 @@ void AndroidNewAI::DoShotNewAI()
}
bool shot_ok = false;
a8::Vec2 shot_dir = node_.target->GetPos() - myself->GetPos();
a8::Vec2 shot_dir = myself->attack_dir;
if (node_.total_shot_times >= node_.next_total_shot_times) {
shot_dir = node_.target->GetPos() - myself->GetPos();
node_.next_total_shot_times += 7 + (rand() % 6);
}
if (std::abs(shot_dir.x) > FLT_EPSILON ||
std::abs(shot_dir.y) > FLT_EPSILON) {
shot_dir.Normalize();
@ -714,6 +718,7 @@ void AndroidNewAI::DoShotNewAI()
node_.start_shot_frameno = myself->room->GetFrameNo();
}
++node_.shot_times;
++node_.total_shot_times;
}
}
}

View File

@ -20,6 +20,8 @@ public:
long long exec_frame_num = 0;
long long start_shot_frameno = 0;
int shot_times = 0;
int total_shot_times = 0;
int next_total_shot_times = 0;
long long param1 = 0;
Human* target = nullptr;