Fix IDE0028, IDE0300, IDE0301, IDE0302, IDE0303, IDE0304.

Silence IDE0305.
This commit is contained in:
RoosterDragon
2025-03-03 17:29:45 +00:00
committed by Pavel Penev
parent 0740991c12
commit 79454d8fd2
559 changed files with 1661 additions and 1751 deletions

View File

@@ -20,17 +20,17 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads
{
sealed class AttackOrFleeFuzzy
{
static readonly string[] DefaultRulesNormalOwnHealth = new[]
{
static readonly string[] DefaultRulesNormalOwnHealth =
[
"if ((OwnHealth is Normal) " +
"and ((EnemyHealth is NearDead) or (EnemyHealth is Injured) or (EnemyHealth is Normal)) " +
"and ((RelativeAttackPower is Weak) or (RelativeAttackPower is Equal) or (RelativeAttackPower is Strong)) " +
"and ((RelativeSpeed is Slow) or (RelativeSpeed is Equal) or (RelativeSpeed is Fast))) " +
"then AttackOrFlee is Attack"
};
];
static readonly string[] DefaultRulesInjuredOwnHealth = new[]
{
static readonly string[] DefaultRulesInjuredOwnHealth =
[
"if ((OwnHealth is Injured) " +
"and (EnemyHealth is NearDead) " +
"and ((RelativeAttackPower is Weak) or (RelativeAttackPower is Equal) or (RelativeAttackPower is Strong)) " +
@@ -60,10 +60,10 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads
"and ((RelativeAttackPower is Weak) or (RelativeAttackPower is Equal) or (RelativeAttackPower is Strong)) " +
"and (RelativeSpeed is Slow)) " +
"then AttackOrFlee is Attack"
};
];
static readonly string[] DefaultRulesNearDeadOwnHealth = new[]
{
static readonly string[] DefaultRulesNearDeadOwnHealth =
[
"if ((OwnHealth is NearDead) " +
"and ((EnemyHealth is NearDead) or (EnemyHealth is Injured)) " +
"and ((RelativeAttackPower is Equal) or (RelativeAttackPower is Strong)) " +
@@ -93,11 +93,11 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads
"and (RelativeAttackPower is Equal) " +
"and (RelativeSpeed is Fast) " +
"then AttackOrFlee is Flee"
};
];
public static readonly AttackOrFleeFuzzy Default = new(null, null, null);
public static readonly AttackOrFleeFuzzy Rush = new(new[]
{
public static readonly AttackOrFleeFuzzy Rush = new(
[
"if ((OwnHealth is Normal) " +
"and ((EnemyHealth is NearDead) or (EnemyHealth is Injured) or (EnemyHealth is Normal)) " +
"and (RelativeAttackPower is Strong) " +
@@ -109,7 +109,7 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads
"and ((RelativeAttackPower is Weak) or (RelativeAttackPower is Equal)) " +
"and ((RelativeSpeed is Slow) or (RelativeSpeed is Equal) or (RelativeSpeed is Fast))) " +
"then AttackOrFlee is Flee"
}, null, null);
], null, null);
readonly MamdaniFuzzySystem fuzzyEngine = new();

View File

@@ -20,7 +20,7 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads
public class Squad
{
public HashSet<Actor> Units = new();
public HashSet<Actor> Units = [];
public SquadType Type;
internal IBot Bot;
@@ -114,7 +114,7 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads
// e.g. a ship targeting a land unit, but the land unit moved north.
// We need to update our location to move north as well.
// If we can reach the actor directly, we'll just target it directly.
var target = SquadManager.FindEnemies(new[] { TargetActor }, squadUnit).FirstOrDefault();
var target = SquadManager.FindEnemies([TargetActor], squadUnit).FirstOrDefault();
SetActorToTarget(target);
return target.Actor != null;
}