Merge pull request #6488 from jonathanmiles/support-power-targetability
AI no longer calls support power on things it can't target
This commit is contained in:
@@ -74,7 +74,7 @@ namespace OpenRA.Mods.RA
|
|||||||
|
|
||||||
var checkActors = world.FindActorsInCircle(pos, radiusToUse);
|
var checkActors = world.FindActorsInCircle(pos, radiusToUse);
|
||||||
foreach (var scrutinized in checkActors)
|
foreach (var scrutinized in checkActors)
|
||||||
answer += consideration.GetAttractiveness(scrutinized, firedBy.Stances[scrutinized.Owner]);
|
answer += consideration.GetAttractiveness(scrutinized, firedBy.Stances[scrutinized.Owner], firedBy);
|
||||||
}
|
}
|
||||||
|
|
||||||
return answer;
|
return answer;
|
||||||
@@ -87,7 +87,7 @@ namespace OpenRA.Mods.RA
|
|||||||
|
|
||||||
foreach (var consideration in Considerations)
|
foreach (var consideration in Considerations)
|
||||||
foreach (var scrutinized in actors)
|
foreach (var scrutinized in actors)
|
||||||
answer += consideration.GetAttractiveness(scrutinized, firedBy.Stances[scrutinized.Owner]);
|
answer += consideration.GetAttractiveness(scrutinized, firedBy.Stances[scrutinized.Owner], firedBy);
|
||||||
|
|
||||||
return answer;
|
return answer;
|
||||||
}
|
}
|
||||||
@@ -120,7 +120,7 @@ namespace OpenRA.Mods.RA
|
|||||||
}
|
}
|
||||||
|
|
||||||
///<summary>Evaluates a single actor according to the rules defined in this consideration</summary>
|
///<summary>Evaluates a single actor according to the rules defined in this consideration</summary>
|
||||||
public int GetAttractiveness(Actor a, Stance stance)
|
public int GetAttractiveness(Actor a, Stance stance, Player firedBy)
|
||||||
{
|
{
|
||||||
if (stance != Against)
|
if (stance != Against)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -132,6 +132,9 @@ namespace OpenRA.Mods.RA
|
|||||||
if (targetable == null)
|
if (targetable == null)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
if (!targetable.TargetableBy(a, firedBy.PlayerActor))
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (Types.Intersect(targetable.TargetTypes).Any())
|
if (Types.Intersect(targetable.TargetTypes).Any())
|
||||||
{
|
{
|
||||||
switch (TargetMetric)
|
switch (TargetMetric)
|
||||||
|
|||||||
Reference in New Issue
Block a user