Add easy mode to Allies 01 which is like the classic mission

This commit is contained in:
Scott_NZ
2013-01-02 02:08:10 +13:00
parent 11c45e4388
commit c836d69385
3 changed files with 43 additions and 23 deletions

View File

@@ -76,6 +76,8 @@ namespace OpenRA.Mods.RA.Missions
const string TanyaName = "e7";
const string SignalFlareName = "flare";
string difficulty;
void MissionFailed(string text)
{
if (allies.WinState != WinState.Undefined)
@@ -122,6 +124,10 @@ namespace OpenRA.Mods.RA.Missions
SendShips();
objectives[FindEinsteinID].Status = ObjectiveStatus.Completed;
objectives[ExtractEinsteinID].Status = ObjectiveStatus.InProgress;
if (difficulty == "Easy")
{
ExtractEinsteinAtLZ();
}
OnObjectivesUpdated(true);
currentAttackWaveFrameNumber = world.FrameNumber;
}
@@ -133,6 +139,8 @@ namespace OpenRA.Mods.RA.Missions
}
}
if (objectives[ExtractEinsteinID].Status == ObjectiveStatus.InProgress)
{
if (difficulty != "Easy")
{
SendAttackWave();
if (world.FrameNumber >= currentAttackWaveFrameNumber + 600)
@@ -150,6 +158,7 @@ namespace OpenRA.Mods.RA.Missions
ExtractEinsteinAtLZ();
}
}
}
if (einsteinChinook != null)
{
if (einsteinChinook.Destroyed)
@@ -306,8 +315,13 @@ namespace OpenRA.Mods.RA.Missions
public void WorldLoaded(World w)
{
world = w;
difficulty = w.LobbyInfo.GlobalSettings.Difficulty;
Game.Debug("{0} difficulty selected".F(difficulty));
allies = w.Players.Single(p => p.InternalName == "Allies");
soviets = w.Players.Single(p => p.InternalName == "Soviets");
var actors = w.WorldActor.Trait<SpawnMapActors>().Actors;
insertionLZ = actors["InsertionLZ"];
extractionLZ = actors["ExtractionLZ"];
@@ -320,9 +334,11 @@ namespace OpenRA.Mods.RA.Missions
attackEntryPoint1 = actors["SovietAttackEntryPoint1"];
attackEntryPoint2 = actors["SovietAttackEntryPoint2"];
SetAlliedUnitsToDefensiveStance();
var alliesRes = allies.PlayerActor.Trait<PlayerResources>();
alliesRes.TakeCash(alliesRes.Cash);
alliesRes.TakeOre(alliesRes.Ore);
Game.MoveViewport(insertionLZ.Location.ToFloat2());
Media.PlayFMVFullscreen(w, "ally1.vqa", () =>
{

View File

@@ -168,9 +168,7 @@ namespace OpenRA.Mods.RA.Missions
OnObjectivesUpdated(true);
MissionFailed("The remaining Allied forces in the area have been wiped out.");
}
else if (!world.Actors.Any(a => a.Owner == soviets && a.IsInWorld && !a.IsDead()
&& a.HasTrait<Building>() && !a.HasTrait<Wall>() && !a.HasTrait<Allies04TrivialBuilding>() && a != lab)
&& objectives[InfiltrateID].Status == ObjectiveStatus.Completed)
else if (SovietBaseDestroyed() && objectives[InfiltrateID].Status == ObjectiveStatus.Completed)
{
objectives[DestroyID].Status = ObjectiveStatus.Completed;
OnObjectivesUpdated(true);
@@ -178,11 +176,15 @@ namespace OpenRA.Mods.RA.Missions
}
}
bool SovietBaseDestroyed()
{
return !world.Actors.Any(a => a.Owner == soviets && a.IsInWorld && !a.IsDead()
&& a.HasTrait<Building>() && !a.HasTrait<Wall>() && !a.HasTrait<Allies04TrivialBuilding>() && a != lab);
}
void OnDestroyBaseTimerExpired(CountdownTimer t)
{
if (!world.Actors.Any(a => a.Owner == soviets && a.IsInWorld && !a.IsDead()
&& a.HasTrait<Building>() && !a.HasTrait<Wall>() && !a.HasTrait<Allies04TrivialBuilding>() && a != lab)
&& objectives[InfiltrateID].Status == ObjectiveStatus.Completed)
if (SovietBaseDestroyed() && objectives[InfiltrateID].Status == ObjectiveStatus.Completed)
{
return;
}

View File

@@ -20,6 +20,8 @@ UseAsShellmap: False
Type: Campaign
Difficulties: Easy, Normal
Players:
PlayerReference@Neutral:
Name: Neutral