Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

D2K - Add Harkonnen 5 #14388

Merged
merged 2 commits into from Nov 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions OpenRA.sln
Expand Up @@ -127,6 +127,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Dune 2000 Lua scripts", "Du
mods\d2k\maps\harkonnen-03b\harkonnen03b.lua = mods\d2k\maps\harkonnen-03b\harkonnen03b.lua
mods\d2k\maps\harkonnen-04\harkonnen04-AI.lua = mods\d2k\maps\harkonnen-04\harkonnen04-AI.lua
mods\d2k\maps\harkonnen-04\harkonnen04.lua = mods\d2k\maps\harkonnen-04\harkonnen04.lua
mods\d2k\maps\harkonnen-05\harkonnen05-AI.lua = mods\d2k\maps\harkonnen-05\harkonnen05-AI.lua
mods\d2k\maps\harkonnen-05\harkonnen05.lua = mods\d2k\maps\harkonnen-05\harkonnen05.lua
mods\d2k\maps\harkonnen-06a\harkonnen06a-AI.lua = mods\d2k\maps\harkonnen-06a\harkonnen06a-AI.lua
mods\d2k\maps\harkonnen-06a\harkonnen06a.lua = mods\d2k\maps\harkonnen-06a\harkonnen06a.lua
mods\d2k\maps\harkonnen-06b\harkonnen06b-AI.lua = mods\d2k\maps\harkonnen-06b\harkonnen06b-AI.lua
Expand Down
49 changes: 49 additions & 0 deletions mods/d2k/maps/harkonnen-05/harkonnen05-AI.lua
@@ -0,0 +1,49 @@
--[[
Copyright 2007-2017 The OpenRA Developers (see AUTHORS)
This file is part of OpenRA, which is free software. It is made
available to you under the terms of the GNU General Public License
as published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version. For more
information, see COPYING.
]]

AttackGroupSize =
{
easy = 6,
normal = 8,
hard = 10
}

AttackDelays =
{
easy = { DateTime.Seconds(4), DateTime.Seconds(7) },
normal = { DateTime.Seconds(2), DateTime.Seconds(5) },
hard = { DateTime.Seconds(1), DateTime.Seconds(3) }
}

OrdosInfantryTypes = { "light_inf", "light_inf", "light_inf", "trooper", "trooper" }
OrdosVehicleTypes = { "raider", "raider", "quad" }
OrdosTankType = { "combat_tank_o" }

ActivateAI = function()
IdlingUnits[ordos_main] = Reinforcements.Reinforce(ordos_main, InitialOrdosReinforcements[1], InitialOrdosPaths[1]), Reinforcements.Reinforce(ordos_main, InitialOrdosReinforcements[2], InitialOrdosPaths[2])
IdlingUnits[ordos_small] = Reinforcements.Reinforce(ordos_small, InitialOrdosReinforcements[1], InitialOrdosPaths[3])
IdlingUnits[corrino] = { CSaraukar1, CSaraukar2, CSaraukar3, CSaraukar4, CSaraukar5 }

DefendAndRepairBase(ordos_main, OrdosMainBase, 0.75, AttackGroupSize[Difficulty])
DefendAndRepairBase(ordos_small, OrdosSmallBase, 0.75, AttackGroupSize[Difficulty])
DefendAndRepairBase(corrino, CorrinoBase, 0.75, AttackGroupSize[Difficulty])

local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end
local infantryToBuild = function() return { Utils.Random(OrdosInfantryTypes) } end
local vehilcesToBuild = function() return { Utils.Random(OrdosVehicleTypes) } end
local tanksToBuild = function() return OrdosTankType end
local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5

ProduceUnits(ordos_main, OBarracks1, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(ordos_main, OLightFactory1, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(ordos_main, OHeavyFactory, delay, tanksToBuild, AttackGroupSize[Difficulty], attackThresholdSize)

ProduceUnits(ordos_small, OBarracks3, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(ordos_small, OLightFactory2, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
end
285 changes: 285 additions & 0 deletions mods/d2k/maps/harkonnen-05/harkonnen05.lua
@@ -0,0 +1,285 @@
--[[
Copyright 2007-2017 The OpenRA Developers (see AUTHORS)
This file is part of OpenRA, which is free software. It is made
available to you under the terms of the GNU General Public License
as published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version. For more
information, see COPYING.
]]

OrdosMainBase = { OConYard, OOutpost, ORefinery1, ORefinery2, OHeavyFactory, OLightFactory1, OHiTechFactory, OGunt1, OGunt2, OGunt3, OGunt4, OBarracks1, OBarracks2, OPower1, OPower2, OPower3, OPower4, OPower5, OPower6, OPower7, OPower8, OPower9 }
OrdosSmallBase = { ORefinery3, OBarracks3, OLightFactory2, OGunt5, OGunt6, OPower10, OPower11, OPower12, OPower13, OSilo }
CorrinoBase = { CStarport, CPower1, CPower2 }

BaseAreaTriggers =
{
{ CPos.New(68, 70), CPos.New(69, 70), CPos.New(70, 70), CPos.New(71, 70) },
{ CPos.New(39, 78), CPos.New(39, 79), CPos.New(39, 80), CPos.New(39, 81), CPos.New(43, 68), CPos.New(44, 68), CPos.New(45, 68), CPos.New(46, 68), CPos.New(47, 68), CPos.New(48, 68), CPos.New(49, 68), CPos.New(50, 68), CPos.New(51, 68), CPos.New(52, 68), CPos.New(53, 68), CPos.New(54, 68), CPos.New(55, 68), CPos.New(56, 68), CPos.New(57, 68), CPos.New(58, 68), CPos.New(59, 68), CPos.New(60, 68) }
}

OrdosReinforcements =
{
easy =
{
{ "trooper", "trooper", "trooper", "trooper", "trooper", "trooper", "trooper", "trooper" },
{ "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf" },
{ "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf" },
{ "combat_tank_o", "quad" },
{ "combat_tank_o", "raider", "light_inf", "light_inf" },
{ "siege_tank", "combat_tank_o", "quad" }
},

normal =
{
{ "trooper", "trooper", "trooper", "trooper", "trooper", "trooper", "trooper", "trooper", "trooper", "trooper" },
{ "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf" },
{ "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf" },
{ "combat_tank_o", "combat_tank_o" },
{ "combat_tank_o", "raider", "raider", "light_inf" },
{ "siege_tank", "combat_tank_o", "quad", "quad" },
{ "combat_tank_o", "combat_tank_o", "combat_tank_o", "combat_tank_o" }
},

hard =
{
{ "trooper", "trooper", "trooper", "trooper", "trooper", "trooper", "trooper", "trooper", "trooper", "trooper", "trooper", "trooper" },
{ "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf" },
{ "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf" },
{ "combat_tank_o", "combat_tank_o", "quad" },
{ "combat_tank_o", "raider", "raider", "raider" },
{ "siege_tank", "combat_tank_o", "combat_tank_o", "quad" },
{ "combat_tank_o", "combat_tank_o", "combat_tank_o", "combat_tank_o", "combat_tank_o" },
{ "trooper", "trooper", "trooper", "trooper", "trooper", "trooper", "quad", "quad", "raider" }
}
}

CorrinoStarportReinforcements =
{
easy = { "trooper", "trooper", "quad", "quad", "trike", "trike", "missile_tank", "missile_tank" },
normal = { "trooper", "trooper", "trooper", "quad", "quad", "trike", "trike", "missile_tank", "missile_tank" },
hard = { "trooper", "trooper", "trooper", "quad", "quad", "quad", "trike", "trike", "trike", "missile_tank", "missile_tank" }
}

OrdosAttackDelay =
{
easy = DateTime.Minutes(3),
normal = DateTime.Minutes(2) + DateTime.Seconds(20),
hard = DateTime.Minutes(1)
}

CorrinoStarportDelay =
{
easy = DateTime.Minutes(3),
normal = DateTime.Minutes(2) + DateTime.Seconds(30),
hard = DateTime.Minutes(2)
}

OrdosAttackWaves =
{
easy = 6,
normal = 7,
hard = 8
}

OrdosHunters =
{
{ "combat_tank_o", "combat_tank_o" },
{ "missile_tank" }
}

InitialOrdosReinforcements =
{
{ "trooper", "trooper", "trooper", "trooper", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf", "light_inf" },
{ "combat_tank_o", "combat_tank_o", "quad", "quad", "raider", "raider" }
}

OrdosPaths =
{
{ OrdosEntry1.Location, OrdosRally1.Location },
{ OrdosEntry2.Location, OrdosRally2.Location },
{ OrdosEntry3.Location, OrdosRally3.Location },
{ OrdosEntry4.Location, OrdosRally4.Location },
{ OrdosEntry5.Location, OrdosRally5.Location },
{ OrdosEntry6.Location, OrdosRally6.Location },
{ OrdosEntry7.Location, OrdosRally7.Location }
}

InitialOrdosPaths =
{
{ OrdosEntry8.Location, OrdosRally8.Location },
{ OrdosEntry9.Location, OrdosRally9.Location },
{ OrdosEntry10.Location, OrdosRally10.Location }
}

OrdosHunterPaths =
{
{ OrdosEntry11.Location, OrdosEntry11.Location },
{ OrdosEntry12.Location, OrdosEntry12.Location },
}

HarkonnenReinforcements =
{
{ "trooper", "trooper", "trooper", "trooper" },
{ "combat_tank_h", "combat_tank_h", "combat_tank_h", "combat_tank_h" }
}

HarkonnenPaths =
{
{ HarkonnenEntry1.Location, HarkonnenRally1.Location },
{ HarkonnenEntry2.Location, HarkonnenRally2.Location }
}

SendStarportReinforcements = function()
Trigger.AfterDelay(CorrinoStarportDelay[Difficulty], function()
if CStarport.IsDead or CStarport.Owner ~= corrino then
return
end

local units = Reinforcements.ReinforceWithTransport(corrino, "frigate", CorrinoStarportReinforcements[Difficulty], { CorrinoStarportEntry.Location, CStarport.Location + CVec.New(1, 1) }, { CorrinoStarportExit.Location })[2]
Utils.Do(units, function(unit)
unit.AttackMove(OrdosAttackLocation)
IdleHunt(unit)
end)

SendStarportReinforcements()

if player.IsObjectiveFailed(GuardOutpost) then
return
end

Media.DisplayMessage("Imperial ships penetrating defense grid!", "Mentat")
end)
end

SendHarkonnenReinforcements = function(delay, number)
Trigger.AfterDelay(delay, function()
Reinforcements.ReinforceWithTransport(player, "carryall.reinforce", HarkonnenReinforcements[number], HarkonnenPaths[number], { HarkonnenPaths[number][1] })
Trigger.AfterDelay(DateTime.Seconds(5), function()
Media.PlaySpeechNotification(player, "Reinforce")
end)
end)
end

OrdosReinforcementNotification = function(currentWave, totalWaves)
Trigger.AfterDelay(OrdosAttackDelay[Difficulty], function()
if player.IsObjectiveFailed(GuardOutpost) or player.IsObjectiveCompleted(KillOrdos) then
return
end

currentWave = currentWave + 1
if currentWave > totalWaves then
return
end

Media.DisplayMessage("Enemy carryall drop detected!", "Mentat")

OrdosReinforcementNotification(currentWave, totalWaves)
end)
end


Tick = function()
if player.HasNoRequiredUnits() then
ordos_main.MarkCompletedObjective(KillHarkonnen1)
ordos_small.MarkCompletedObjective(KillHarkonnen2)
corrino.MarkCompletedObjective(KillHarkonnen3)
end

if ordos_main.HasNoRequiredUnits() and ordos_small.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillOrdos) then
Media.DisplayMessage("The Ordos have been annihilated!", "Mentat")
player.MarkCompletedObjective(KillOrdos)
end

if corrino.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillCorrino) then
Media.DisplayMessage("The Emperor has been annihilated!", "Mentat")
player.MarkCompletedObjective(KillCorrino)
end

if player.IsObjectiveCompleted(KillOrdos) and player.IsObjectiveCompleted(KillCorrino) and not player.IsObjectiveCompleted(GuardOutpost) then
player.MarkCompletedObjective(GuardOutpost)
end

if (HOutpost.IsDead or HOutpost.Owner ~= player) and not player.IsObjectiveFailed(GuardOutpost) then
player.MarkFailedObjective(GuardOutpost)
end

if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[ordos_main] then
local units = ordos_main.GetActorsByType("harvester")

if #units > 0 then
LastHarvesterEaten[ordos_main] = false
ProtectHarvester(units[1], ordos_main, AttackGroupSize[Difficulty])
end
end

if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[ordos_small] then
local units = ordos_small.GetActorsByType("harvester")

if #units > 0 then
LastHarvesterEaten[ordos_small] = false
ProtectHarvester(units[1], ordos_small, AttackGroupSize[Difficulty])
end
end
end

WorldLoaded = function()
ordos_main = Player.GetPlayer("Ordos Main Base")
ordos_small = Player.GetPlayer("Ordos Small Base")
corrino = Player.GetPlayer("Corrino")
player = Player.GetPlayer("Harkonnen")

InitObjectives(player)
KillOrdos = player.AddPrimaryObjective("Destroy the Ordos.")
KillCorrino = player.AddPrimaryObjective("Destroy the Imperial Forces.")
GuardOutpost = player.AddSecondaryObjective("Keep the Modified Outpost intact.")
KillHarkonnen1 = ordos_main.AddPrimaryObjective("Kill all Harkonnen units.")
KillHarkonnen2 = ordos_small.AddPrimaryObjective("Kill all Harkonnen units.")
KillHarkonnen3 = corrino.AddPrimaryObjective("Kill all Harkonnen units.")

HOutpost.GrantCondition("modified")

Camera.Position = HConYard.CenterPosition
OrdosAttackLocation = HConYard.Location

Trigger.OnAllKilledOrCaptured(OrdosMainBase, function()
Utils.Do(ordos_main.GetGroundAttackers(), IdleHunt)
end)

Trigger.OnAllKilledOrCaptured(OrdosSmallBase, function()
Utils.Do(ordos_small.GetGroundAttackers(), IdleHunt)
end)

Trigger.OnAllKilledOrCaptured(CorrinoBase, function()
Utils.Do(corrino.GetGroundAttackers(), IdleHunt)
end)

Trigger.AfterDelay(DateTime.Seconds(5), function()
Media.DisplayMessage("Protect the Outpost from attack.", "Mentat")
end)

local path = function() return Utils.Random(OrdosPaths) end
local waveCondition = function() return player.IsObjectiveCompleted(KillOrdos) end
local huntFunction = function(unit)
unit.AttackMove(OrdosAttackLocation)
IdleHunt(unit)
end
SendCarryallReinforcements(ordos_main, 0, OrdosAttackWaves[Difficulty], OrdosAttackDelay[Difficulty], path, OrdosReinforcements[Difficulty], waveCondition, huntFunction)
OrdosReinforcementNotification(0, OrdosAttackWaves[Difficulty])

SendStarportReinforcements()

Actor.Create("upgrade.barracks", true, { Owner = ordos_main })
Actor.Create("upgrade.light", true, { Owner = ordos_main })
Actor.Create("upgrade.heavy", true, { Owner = ordos_main })
Actor.Create("upgrade.barracks", true, { Owner = ordos_small })
Actor.Create("upgrade.light", true, { Owner = ordos_small })
Trigger.AfterDelay(0, ActivateAI)

SendHarkonnenReinforcements(DateTime.Seconds(15), 1)
SendHarkonnenReinforcements(DateTime.Seconds(30), 1)
SendHarkonnenReinforcements(DateTime.Seconds(35), 2)

local ordosCondition = function() return player.IsObjectiveCompleted(KillOrdos) end
TriggerCarryallReinforcements(player, ordos_main, BaseAreaTriggers[1], OrdosHunters[1], OrdosHunterPaths[3], ordosCondition)
TriggerCarryallReinforcements(player, ordos_main, BaseAreaTriggers[2], OrdosHunters[2], OrdosHunterPaths[2], ordosCondition)
end
Binary file added mods/d2k/maps/harkonnen-05/map.bin
Binary file not shown.
Binary file added mods/d2k/maps/harkonnen-05/map.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.