This commit is contained in:
aozhiwei 2023-10-18 14:38:10 +08:00
parent 7cc0c7e840
commit 63101cb762
3 changed files with 10 additions and 1 deletions

View File

@ -712,7 +712,7 @@ bool HeroAgent::InTargetShotRange()
if (!current_target_agent->IsValid()) {
return false;
}
float shot_range = GetShotRange();
float shot_range = current_target_agent->GetShotRange();
bool in_square = Collision::InSquare
(GetPos(),
current_target_agent->GetPos(),

View File

@ -86,3 +86,11 @@ Room* TargetAgent::GetRoom()
{
return owner_->room;
}
float TargetAgent::GetShotRange()
{
if (target_.Get() && target_.Get()->GetCurrWeapon()) {
return target_.Get()->GetCurrWeapon()->meta->range();
}
return 0.0f;
}

View File

@ -22,6 +22,7 @@ public:
int GetHeroId();
int GetLevel();
void Abandon();
float GetShotRange();
void SetOwner(Creature* owner);
virtual Room* GetRoom() override;