add shot_ok

This commit is contained in:
aozhiwei 2020-07-14 15:46:41 +08:00
parent 338f483f60
commit d4cd17eaa8
4 changed files with 20 additions and 10 deletions

View File

@ -164,7 +164,8 @@ void AndroidAI::DoAttack()
shot_dir.Normalize();
shot_dir.Rotate((rand() % 10) / 180.0f);
sender->attack_dir = shot_dir;
sender->Shot(shot_dir);
bool shot_ok = false;
sender->Shot(shot_dir, shot_ok);
}
}
last_target_ = enemy;
@ -198,7 +199,8 @@ void AndroidAI::UpdateNewBieNpc()
shot_dir.Normalize();
shot_dir.Rotate((rand() % 10) / 180.0f);
sender->attack_dir = shot_dir;
sender->Shot(shot_dir);
bool shot_ok = false;
sender->Shot(shot_dir, shot_ok);
}
} else {
a8::UnSetBitFlag(hum->status, HS_NewBieGuideAndroid);
@ -239,7 +241,8 @@ void AndroidAI::UpdateLastNpc()
shot_dir.Normalize();
shot_dir.Rotate((rand() % 10) / 180.0f);
sender->attack_dir = shot_dir;
sender->Shot(shot_dir);
bool shot_ok = false;
sender->Shot(shot_dir, shot_ok);
}
} else {
a8::UnSetBitFlag(hum->status, HS_LastAndroid);
@ -351,7 +354,8 @@ void AndroidAI::UpdateNewBieRoomLogic()
shot_dir.Normalize();
shot_dir.Rotate((rand() % 10) / 180.0f);
sender->attack_dir = shot_dir;
sender->Shot(shot_dir);
bool shot_ok = false;
sender->Shot(shot_dir, shot_ok);
}
}
if (old_last_target && last_target_ && old_last_target == last_target_) {

View File

@ -190,7 +190,8 @@ void AndroidNewAI::DoAttackOldAI()
shot_dir.Normalize();
shot_dir.Rotate((rand() % 10) / 180.0f);
sender->attack_dir = shot_dir;
sender->Shot(shot_dir);
bool shot_ok = false;
sender->Shot(shot_dir, shot_ok);
}
}
old_ai_data_.last_target = enemy;
@ -224,7 +225,8 @@ void AndroidNewAI::UpdateNewBieNpc()
shot_dir.Normalize();
shot_dir.Rotate((rand() % 10) / 180.0f);
sender->attack_dir = shot_dir;
sender->Shot(shot_dir);
bool shot_ok = false;
sender->Shot(shot_dir, shot_ok);
}
} else {
a8::UnSetBitFlag(hum->status, HS_NewBieGuideAndroid);
@ -264,7 +266,8 @@ void AndroidNewAI::UpdateLastNpc()
shot_dir.Normalize();
shot_dir.Rotate((rand() % 10) / 180.0f);
sender->attack_dir = shot_dir;
sender->Shot(shot_dir);
bool shot_ok = false;
sender->Shot(shot_dir, shot_ok);
}
} else {
a8::UnSetBitFlag(hum->status, HS_LastAndroid);
@ -376,7 +379,8 @@ void AndroidNewAI::UpdateNewBieRoomLogic()
shot_dir.Normalize();
shot_dir.Rotate((rand() % 10) / 180.0f);
sender->attack_dir = shot_dir;
sender->Shot(shot_dir);
bool shot_ok = false;
sender->Shot(shot_dir, shot_ok);
}
}
if (old_last_target && old_ai_data_.last_target && old_last_target == old_ai_data_.last_target) {

View File

@ -312,8 +312,9 @@ void Human::FillMFTeamData(cs::MFTeamData* team_data, bool is_game_over)
}
}
void Human::Shot(a8::Vec2& target_dir)
void Human::Shot(a8::Vec2& target_dir, bool& shot_ok)
{
shot_ok = false;
if (!curr_weapon->meta) {
return;
}
@ -410,6 +411,7 @@ void Human::Shot(a8::Vec2& target_dir)
if (!need_sync_active_player) {
room->frame_event.AddBulletNumChg(this);
}
shot_ok = true;
}
void Human::TankShot(a8::Vec2& target_dir)

View File

@ -167,7 +167,7 @@ class Human : public MoveableEntity
virtual long long GetDeadFrameNo(Room* room) override;
long long GetRealDeadFrameNo(Room* room);
void FillMFTeamData(cs::MFTeamData* team_data, bool is_game_over);
void Shot(a8::Vec2& target_dir);
void Shot(a8::Vec2& target_dir, bool& shot_ok);
void TankShot(a8::Vec2& target_dir);
void RecalcSelfCollider();
bool IsCollisionInMapService();