Refactor Soviet 01 Classic objectives code
This commit is contained in:
@@ -27,15 +27,11 @@ namespace OpenRA.Mods.RA.Missions
|
||||
{
|
||||
public event Action<bool> OnObjectivesUpdated = notify => { };
|
||||
|
||||
public IEnumerable<Objective> Objectives { get { return objectives.Values; } }
|
||||
public IEnumerable<Objective> Objectives { get { return new[] { destroy }; } }
|
||||
|
||||
Dictionary<int, Objective> objectives = new Dictionary<int, Objective>
|
||||
{
|
||||
{ DestroyID, new Objective(ObjectiveType.Primary, Destroy, ObjectiveStatus.InProgress) }
|
||||
};
|
||||
Objective destroy = new Objective(ObjectiveType.Primary, DestroyText, ObjectiveStatus.InProgress);
|
||||
|
||||
const int DestroyID = 0;
|
||||
const string Destroy = "A pitiful excuse for resistance has blockaded itself in this village."
|
||||
const string DestroyText = "A pitiful excuse for resistance has blockaded itself in this village."
|
||||
+ " Stalin has decided to make an example of them. Kill them all and destroy their homes."
|
||||
+ " You will have Yak aircraft to use in teaching these rebels a lesson.";
|
||||
|
||||
@@ -80,12 +76,12 @@ namespace OpenRA.Mods.RA.Missions
|
||||
var unitsAndBuildings = world.Actors.Where(a => !a.IsDead() && a.IsInWorld && (a.HasTrait<Mobile>() || (a.HasTrait<Building>() && !a.HasTrait<Wall>())));
|
||||
if (!unitsAndBuildings.Any(a => a.Owner == france))
|
||||
{
|
||||
objectives[DestroyID].Status = ObjectiveStatus.Completed;
|
||||
destroy.Status = ObjectiveStatus.Completed;
|
||||
MissionAccomplished("We destroyed the resistance.");
|
||||
}
|
||||
else if (!unitsAndBuildings.Any(a => a.Owner == ussr))
|
||||
{
|
||||
objectives[DestroyID].Status = ObjectiveStatus.Failed;
|
||||
destroy.Status = ObjectiveStatus.Failed;
|
||||
MissionFailed("We were destroyed by the resistance.");
|
||||
}
|
||||
if (!startJeepParadropped && startJeep.IsDead())
|
||||
|
||||
Reference in New Issue
Block a user