This commit is contained in:
aozhiwei 2023-10-24 17:38:12 +08:00
parent 7bc227b4ab
commit 41f38f3b11
3 changed files with 2 additions and 64 deletions

View File

@ -355,6 +355,7 @@ void Player::_CMExecCommand(f8::MsgHdr& hdr, const cs::CMExecCommand& msg)
if (cmds.size() >= 2 && GetCar() && GetCar()->IsDriver(this)) {
int skill_id = a8::XValue(cmds[1]);
Skill* skill = GetCar()->GetSkill(skill_id);
#if 0
Human* enemy = room->FindEnemy(this, 300);
if (enemy && skill) {
if (GetCar()->CanUseSkill(skill_id) && enemy->GetPos().Distance2D2(GetPos()) > 0.0001f) {
@ -365,6 +366,7 @@ void Player::_CMExecCommand(f8::MsgHdr& hdr, const cs::CMExecCommand& msg)
GetCar()->DoSkill(skill_id, enemy->GetUniId(), skill_dir, skill_distance);
}
}
#endif
}
} else if (cmd == "show_hand") {
room->xtimer.SetTimeoutEx

View File

@ -485,68 +485,6 @@ void Room::CreateAndroid(int robot_num)
NotifyUiUpdate();
}
Human* Room::FindEnemy(Human* hum, float range)
{
Human* myself = hum;
Human* target = nullptr;
float last_distance = range + 1;
TraverseHumanList
(
[&target, myself, range, &last_distance] (Human* hum)
{
if (!hum->dead &&
!a8::HasBitFlag(hum->status, CS_Disable) &&
!hum->HasBuffEffect(kBET_Hide) &&
!hum->HasBuffEffect(kBET_Invincible) &&
hum->team_id != myself->team_id) {
if (a8::HasBitFlag(myself->status, CS_DisableAttackAndroid) &&
hum->IsAndroid()) {
} else {
float distance = hum->GetPos().Distance2D2(myself->GetPos());
if (distance <= range) {
if (distance < last_distance) {
target = hum;
last_distance = distance;
}
}
}
}
return true;
});
return target;
}
Creature* Room::FindEnemy(Creature* c, float range)
{
Creature* myself = c;
Creature* target = nullptr;
float last_distance = range + 1;
TraverseHumanList
(
[&target, myself, range, &last_distance] (Human* hum)
{
if (!hum->dead &&
!a8::HasBitFlag(hum->status, CS_Disable) &&
!hum->HasBuffEffect(kBET_Hide) &&
!hum->HasBuffEffect(kBET_Invincible) &&
hum->team_id != myself->team_id) {
if (a8::HasBitFlag(myself->status, CS_DisableAttackAndroid) &&
hum->IsAndroid()) {
} else {
float distance = hum->GetPos().Distance2D2(myself->GetPos());
if (distance <= range) {
if (distance < last_distance) {
target = hum;
last_distance = distance;
}
}
}
}
return true;
});
return target;
}
void Room::FillSMJoinedNotify(Player* self_hum, cs::SMJoinedNotify& msg)
{
msg.set_team_mode(msg.team_mode());

View File

@ -144,8 +144,6 @@ public:
Player* NewPlayer();
void AddPlayer(Player* hum, std::shared_ptr<BornPoint> init_born_point = nullptr, bool no_matchteam = false);
Human* FindEnemy(Human* hum, float range);
Creature* FindEnemy(Creature* c, float range);
void AddTeam(class MatchTeam* team);