diff --git a/mods/d2k/maps/ordos-01b/map.bin b/mods/d2k/maps/ordos-01b/map.bin new file mode 100644 index 0000000000..6860a00464 Binary files /dev/null and b/mods/d2k/maps/ordos-01b/map.bin differ diff --git a/mods/d2k/maps/ordos-01b/map.png b/mods/d2k/maps/ordos-01b/map.png new file mode 100644 index 0000000000..117259736a Binary files /dev/null and b/mods/d2k/maps/ordos-01b/map.png differ diff --git a/mods/d2k/maps/ordos-01b/map.yaml b/mods/d2k/maps/ordos-01b/map.yaml new file mode 100644 index 0000000000..29deeaf184 --- /dev/null +++ b/mods/d2k/maps/ordos-01b/map.yaml @@ -0,0 +1,104 @@ +MapFormat: 11 + +RequiresMod: d2k + +Title: Ordos 01b + +Author: Westwood Studios + +Tileset: ARRAKIS + +MapSize: 32,28 + +Bounds: 2,2,28,24 + +Visibility: MissionSelector + +Categories: Campaign + +LockPreview: True + +Players: + PlayerReference@Neutral: + Name: Neutral + OwnsWorld: True + NonCombatant: True + Faction: Random + PlayerReference@Creeps: + Name: Creeps + NonCombatant: True + Faction: Random + Enemies: Ordos, Harkonnen + PlayerReference@Ordos: + Name: Ordos + Playable: True + LockFaction: True + Faction: ordos + LockColor: True + Color: B3EAA5 + Enemies: Harkonnen, Creeps + PlayerReference@Harkonnen: + Name: Harkonnen + LockFaction: True + Faction: harkonnen + LockColor: True + Color: FE0000 + Enemies: Ordos + +Actors: + Actor0: light_inf + Location: 2,2 + Owner: Harkonnen + Actor1: light_inf + Location: 21,2 + Owner: Harkonnen + Actor2: wormspawner + Location: 3,3 + Owner: Creeps + Actor3: light_inf + Location: 16,9 + Owner: Ordos + Actor4: light_inf + Location: 20,10 + Owner: Ordos + Actor5: light_inf + Location: 14,11 + Owner: Ordos + OrdosConyard: construction_yard + Location: 17,11 + Owner: Ordos + Actor7: light_inf + Location: 22,13 + Owner: Ordos + Actor8: raider + Location: 15,14 + Owner: Ordos + Actor9: raider + Location: 18,15 + Owner: Ordos + Actor10: light_inf + Location: 29,23 + Owner: Harkonnen + Actor11: light_inf + Location: 6,25 + Owner: Harkonnen + OrdosWaypoint: waypoint + Owner: Neutral + Location: 29,12 + OrdosRally: waypoint + Owner: Neutral + Location: 12,9 + HarkonnenWaypoint1: waypoint + Owner: Neutral + Location: 26,25 + HarkonnenWaypoint2: waypoint + Owner: Neutral + Location: 2,21 + HarkonnenWaypoint3: waypoint + Owner: Neutral + Location: 2,5 + HarkonnenWaypoint4: waypoint + Owner: Neutral + Location: 24,2 + +Rules: d2k|rules/campaign-rules.yaml, rules.yaml diff --git a/mods/d2k/maps/ordos-01b/ordos01b.lua b/mods/d2k/maps/ordos-01b/ordos01b.lua new file mode 100644 index 0000000000..7c7b428f9d --- /dev/null +++ b/mods/d2k/maps/ordos-01b/ordos01b.lua @@ -0,0 +1,157 @@ + +HarkonnenReinforcements = { } +HarkonnenReinforcements["easy"] = +{ + { "light_inf", "light_inf" } +} + +HarkonnenReinforcements["normal"] = +{ + { "light_inf", "light_inf" }, + { "light_inf", "light_inf", "light_inf" }, + { "light_inf", "trike" }, +} + +HarkonnenReinforcements["hard"] = +{ + { "light_inf", "light_inf" }, + { "trike", "trike" }, + { "light_inf", "light_inf", "light_inf" }, + { "light_inf", "trike" }, + { "trike", "trike" } +} + +HarkonnenEntryWaypoints = { HarkonnenWaypoint1.Location, HarkonnenWaypoint2.Location, HarkonnenWaypoint3.Location, HarkonnenWaypoint4.Location } +HarkonnenAttackDelay = DateTime.Seconds(30) + +HarkonnenAttackWaves = { } +HarkonnenAttackWaves["easy"] = 1 +HarkonnenAttackWaves["normal"] = 5 +HarkonnenAttackWaves["hard"] = 12 + +ToHarvest = { } +ToHarvest["easy"] = 2500 +ToHarvest["normal"] = 3000 +ToHarvest["hard"] = 3500 + +OrdosReinforcements = { "light_inf", "light_inf", "light_inf", "light_inf", "raider" } +OrdosEntryPath = { OrdosWaypoint.Location, OrdosRally.Location } + +Messages = +{ + "Build a concrete foundation before placing your buildings.", + "Build a Wind Trap for power.", + "Build a Refinery to collect Spice.", + "Build a Silo to store additional Spice." +} + + +IdleHunt = function(actor) + if not actor.IsDead then + Trigger.OnIdle(actor, actor.Hunt) + end +end + +Tick = function() + if HarkonnenArrived and harkonnen.HasNoRequiredUnits() then + player.MarkCompletedObjective(KillHarkonnen) + end + + if player.Resources > ToHarvest[Map.LobbyOption("difficulty")] - 1 then + player.MarkCompletedObjective(GatherSpice) + end + + -- player has no Wind Trap + if (player.PowerProvided <= 20 or player.PowerState ~= "Normal") and DateTime.GameTime % DateTime.Seconds(32) == 0 then + HasPower = false + Media.DisplayMessage(Messages[2], "Mentat") + else + HasPower = true + end + + -- player has no Refinery and no Silos + if HasPower and player.ResourceCapacity == 0 and DateTime.GameTime % DateTime.Seconds(32) == 0 then + Media.DisplayMessage(Messages[3], "Mentat") + end + + if HasPower and player.Resources > player.ResourceCapacity * 0.8 and DateTime.GameTime % DateTime.Seconds(32) == 0 then + Media.DisplayMessage(Messages[4], "Mentat") + end + + UserInterface.SetMissionText("Harvested resources: " .. player.Resources .. "/" .. ToHarvest[Map.LobbyOption("difficulty")], player.Color) +end + +WorldLoaded = function() + player = Player.GetPlayer("Ordos") + harkonnen = Player.GetPlayer("Harkonnen") + + InitObjectives() + + Trigger.OnRemovedFromWorld(OrdosConyard, function() + local refs = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "refinery" end) + + if #refs == 0 then + harkonnen.MarkCompletedObjective(KillAtreides) + else + Trigger.OnAllRemovedFromWorld(refs, function() + harkonnen.MarkCompletedObjective(KillAtreides) + end) + end + end) + + Media.DisplayMessage(Messages[1], "Mentat") + + Trigger.AfterDelay(DateTime.Seconds(25), function() + Media.PlaySpeechNotification(player, "Reinforce") + Reinforcements.Reinforce(player, OrdosReinforcements, OrdosEntryPath) + end) + + WavesLeft = HarkonnenAttackWaves[Map.LobbyOption("difficulty")] + SendReinforcements() +end + +SendReinforcements = function() + local units = HarkonnenReinforcements[Map.LobbyOption("difficulty")] + local delay = Utils.RandomInteger(HarkonnenAttackDelay - DateTime.Seconds(2), HarkonnenAttackDelay) + HarkonnenAttackDelay = HarkonnenAttackDelay - (#units * 3 - 3 - WavesLeft) * DateTime.Seconds(1) + if HarkonnenAttackDelay < 0 then HarkonnenAttackDelay = 0 end + + Trigger.AfterDelay(delay, function() + Reinforcements.Reinforce(harkonnen, Utils.Random(units), { Utils.Random(HarkonnenEntryWaypoints) }, 10, IdleHunt) + + WavesLeft = WavesLeft - 1 + if WavesLeft == 0 then + Trigger.AfterDelay(DateTime.Seconds(1), function() HarkonnenArrived = true end) + else + SendReinforcements() + end + end) +end + +InitObjectives = function() + Trigger.OnObjectiveAdded(player, function(p, id) + Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") + end) + + KillAtreides = harkonnen.AddPrimaryObjective("Kill all Ordos units.") + GatherSpice = player.AddPrimaryObjective("Harvest " .. tostring(ToHarvest[Map.LobbyOption("difficulty")]) .. " Solaris worth of Spice.") + KillHarkonnen = player.AddSecondaryObjective("Eliminate all Harkonnen units and reinforcements\nin the area.") + + Trigger.OnObjectiveCompleted(player, function(p, id) + Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") + end) + Trigger.OnObjectiveFailed(player, function(p, id) + Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") + end) + + Trigger.OnPlayerLost(player, function() + Trigger.AfterDelay(DateTime.Seconds(1), function() + Media.PlaySpeechNotification(player, "Lose") + end) + end) + Trigger.OnPlayerWon(player, function() + Trigger.AfterDelay(DateTime.Seconds(1), function() + Media.PlaySpeechNotification(player, "Win") + end) + end) +end diff --git a/mods/d2k/maps/ordos-01b/rules.yaml b/mods/d2k/maps/ordos-01b/rules.yaml new file mode 100644 index 0000000000..3937cacdc6 --- /dev/null +++ b/mods/d2k/maps/ordos-01b/rules.yaml @@ -0,0 +1,48 @@ +Player: + PlayerResources: + DefaultCash: 2300 + +World: + LuaScript: + Scripts: ordos01b.lua + MissionData: + Briefing: Spice is wealth. Serve the Ordos by harvesting Spice in the Imperial Basin. If Harkonnen forces attempt to interrupt the flow of the Spice - neutralize them.\n\nEfficiency dictates that Silos must be built to avoid loss of Spice. Build concrete foundations to avoid unnecessary damage from the elements. To do otherwise is wasteful. + BriefingVideo: O_BR01_E.VQA + MapOptions: + TechLevel: low + ScriptLobbyDropdown@difficulty: + ID: difficulty + Label: Difficulty + Values: + easy: Easy + normal: Normal + hard: Hard + Default: easy + +construction_yard: + Production: + Produces: Building + +concreteb: + Buildable: + Prerequisites: ~disabled + +barracks: + Buildable: + Prerequisites: ~disabled + +light_factory: + Buildable: + Prerequisites: ~disabled + +heavy_factory: + Buildable: + Prerequisites: ~disabled + +medium_gun_turret: + Buildable: + Prerequisites: ~disabled + +wall: + Buildable: + Prerequisites: ~disabled diff --git a/mods/d2k/missions.yaml b/mods/d2k/missions.yaml index aa09c0c8e8..c10b6460ee 100644 --- a/mods/d2k/missions.yaml +++ b/mods/d2k/missions.yaml @@ -7,4 +7,5 @@ Atreides Campaign: ./mods/d2k/maps/atreides-03b Ordos Campaign: - ./mods/d2k/maps/ordos-01a \ No newline at end of file + ./mods/d2k/maps/ordos-01a + ./mods/d2k/maps/ordos-01b \ No newline at end of file