1
This commit is contained in:
parent
db139bbcb6
commit
7f0895f9e2
@ -999,30 +999,47 @@ bool HeroAgent::TargetInRange(float range)
|
|||||||
|
|
||||||
float HeroAgent::GetNewAttackerHPRate()
|
float HeroAgent::GetNewAttackerHPRate()
|
||||||
{
|
{
|
||||||
|
return owner_->GetLastAttacker().Get()->GetHP() /
|
||||||
|
std::max(1.0f, owner_->GetLastAttacker().Get()->GetMaxHP());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HeroAgent::GetNewAttackerInRange(float range)
|
bool HeroAgent::GetNewAttackerInRange(float range)
|
||||||
{
|
{
|
||||||
|
if (!HasNewAttacker()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return Collision::InSquare
|
||||||
|
(owner_->GetLastAttacker().Get()->GetPos().ToGlmVec3(),
|
||||||
|
owner_->GetPos().ToGlmVec3(),
|
||||||
|
range);
|
||||||
}
|
}
|
||||||
|
|
||||||
int HeroAgent::GetNewAttackerPassTime()
|
int HeroAgent::GetNewAttackerPassTime()
|
||||||
{
|
{
|
||||||
|
return (owner_->room->GetFrameNo() - owner_->GetLastBeAttackFrameNo()) * FRAME_RATE_MS;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HeroAgent::HasNewAttacker()
|
bool HeroAgent::HasNewAttacker()
|
||||||
{
|
{
|
||||||
|
if (!current_target_agent->IsValid()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!owner_->GetLastAttacker().Get()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return current_target_agent->GetUniId() != owner_->GetLastAttacker().Get()->GetUniId() &&
|
||||||
|
owner_->GetLastAttacker().Get()->revive_count == owner_->GetLastAttackerReviveTimes();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HeroAgent::NewAttackerIsHuman()
|
bool HeroAgent::NewAttackerIsHuman()
|
||||||
{
|
{
|
||||||
|
return owner_->GetLastAttacker().Get()->IsHuman();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HeroAgent::SwitchToNewAttacker()
|
bool HeroAgent::SwitchToNewAttacker()
|
||||||
{
|
{
|
||||||
|
if (HasNewAttacker()) {
|
||||||
|
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user