Skip to content

Commit

Permalink
扩散没目标的时候重新看一眼原目标
Browse files Browse the repository at this point in the history
  • Loading branch information
CrimRecya committed Feb 19, 2025
1 parent 240efea commit b420e13
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Ext/Bullet/Trajectories/DisperseTrajectory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,8 @@ bool DisperseTrajectory::PrepareDisperseWeapon(BulletClass* pBullet)
if (!pOwner || pOwner->Defeated)
pOwner = HouseClass::FindNeutral();

const auto pTarget = pBullet->Target ? pBullet->Target : MapClass::Instance->TryGetCellAt(pBullet->TargetCoords);
const auto pTarget = pBullet->Target ? pBullet->Target
: (this->TargetInTheAir ? nullptr : MapClass::Instance->TryGetCellAt(pBullet->TargetCoords));

for (size_t weaponNum = 0; weaponNum < validWeapons; weaponNum++)
{
Expand Down Expand Up @@ -1192,6 +1193,9 @@ bool DisperseTrajectory::PrepareDisperseWeapon(BulletClass* pBullet)
}
}

if (validTargets.empty() && pTarget)
validTargets.push_back(pTarget);

for (const auto& pNewTarget : validTargets)
{
this->CreateDisperseBullets(pBullet, pWeapon, pNewTarget, pOwner, burstNow, burstCount);
Expand Down

0 comments on commit b420e13

Please sign in to comment.