share/hedgewars/Data/Missions/Scenario/User_Mission_-_The_Great_Escape.lua
changeset 13060 aed0374bbd8a
parent 12933 e65aa3c3d4e6
child 14483 310b167141cc
--- a/share/hedgewars/Data/Missions/Scenario/User_Mission_-_The_Great_Escape.lua	Fri Feb 23 12:48:27 2018 +0100
+++ b/share/hedgewars/Data/Missions/Scenario/User_Mission_-_The_Great_Escape.lua	Fri Feb 23 13:28:07 2018 +0100
@@ -1,121 +1,81 @@
+HedgewarsScriptLoad("/Scripts/SimpleMission.lua")
 HedgewarsScriptLoad("/Scripts/Locale.lua")
-
-local player = nil
-local enemy = nil
-
-function onGameInit()
-
-	Map = "Castle"
-	Theme = "Nature"
-	Seed = 0
-	GameFlags = gfInfAttack
-
-	TurnTime = 45 * 1000
-
-	CaseFreq = 0
-	MinesNum = 0
-	Explosives = 0
-
-	AddTeam(loc("Hero Team"), 14483456, "star", "Island", "Default", "cm_swordshield")
-	player = AddHog(loc("Good Dude"), 0, 80, "NoHat") --NoHat
-
-	AddTeam(loc("Bad Team"), 	1175851, "dragonball", "Island", "Default", "cm_dragonrb")
-	enemy = AddHog(loc("Bad Guy"), 1, 40, "NoHat")
-
-end
-
-function onGameStart()
-
-ShowMission(loc("The Great Escape"), loc("Scenario"), loc("Elimate your captor.") .. "|" .. loc("Mines time: 0 seconds"), -amGrenade, 0)
+SimpleMission({
+	missionTitle = loc("The Great Escape"),
+	goalText = loc("Eliminate your captor.") .."|".. loc("Unlimited Attacks: Attacks don't end your turn"),
+	missionIcon = -amGrenade,
+	wind = 100,
+	initVars = {
+		TurnTime = 45000,
+		Map = "Castle",
+		Theme = "Nature",
+		MinesTime = 0,
+		Seed = 0,
+		GameFlags = gfInfAttack + gfDisableWind,
+	},
+	ammoConfig = {
+		[amGrenade] = { count = 1 },
+		[amParachute] = { count = 1 },
+		[amFirePunch] = { ammoInCrate = 3 },
+	},
+	teams = {
+		{ name = loc("Hero Team"),
+		flag = "cm_swordshield",
+		grave = "star",
+		hogs = {{ name = loc("Good Dude"), health = 1, x = 1050, y = 534 }},
+		},
+		{ name = loc("Bad Team"),
+		flag = "cm_dragonrb",
+		grave = "dragonball",
+		hogs = {{ name = loc("Bad Guy"), health = 1, x = 1512, y = 158, botLevel = 1 }}
+		},
+	},
+	girders = {
+		{ x = 1042, y = 564, frameIdx = 0 },
+		{ x = 1028, y = 474, frameIdx = 6 },
+		{ x = 1074, y = 474, frameIdx = 6 },
+		{ x = 1050, y = 385, frameIdx = 0 },
+		{ x = 1175, y = 731, frameIdx = 7 },
+		{ x = 1452, y = 905, frameIdx = 2 },
+		{ x = 1522, y = 855, frameIdx = 4 },
+		{ x = 1496, y = 900, frameIdx = 3 },
+		{ x = 1682, y = 855, frameIdx = 4 },
+		{ x = 1773, y = 887, frameIdx = 2 },
+		{ x = 1647, y = 901, frameIdx = 1 },
+		{ x = 1871, y = 883, frameIdx = 6 },
+		{ x = 1871, y = 723, frameIdx = 6 },
+		{ x = 1774, y = 768, frameIdx = 6 },
+		{ x = 1773, y = 767, frameIdx = 6 },
+		{ x = 1821, y = 904, frameIdx = 1 },
+		{ x = 1822, y = 802, frameIdx = 3 },
+		{ x = 1820, y = 723, frameIdx = 1 },
+		{ x = 1782, y = 678, frameIdx = 4 },
+		{ x = 1822, y = 661, frameIdx = 0 },
+		{ x = 1822, y = 644, frameIdx = 0 },
+		{ x = 1742, y = 644, frameIdx = 0 },
+		{ x = 1742, y = 661, frameIdx = 0 },
+		{ x = 1694, y = 676, frameIdx = 2 },
+		{ x = 1903, y = 635, frameIdx = 0 },
+	},
+	gears = {
+		{ type = gtMine, x = 1010, y = 680 },
+		{ type = gtMine, x = 1031, y = 720 },
+		{ type = gtMine, x = 1039, y = 748 },
+		{ type = gtMine, x = 1051, y = 777 },
+		{ type = gtMine, x = 1065, y = 796 },
 
------- GIRDER LIST ------
-PlaceGirder(1042,564,0)
-PlaceGirder(1028,474,6)
-PlaceGirder(1074,474,6)
-PlaceGirder(1050,385,0)
-PlaceGirder(1175,731,7)
-PlaceGirder(1452,905,2)
-PlaceGirder(1522,855,4)
-PlaceGirder(1496,900,3)
-PlaceGirder(1682,855,4)
-PlaceGirder(1773,887,2)
-PlaceGirder(1647,901,1)
-PlaceGirder(1871,883,6)
-PlaceGirder(1871,723,6)
-PlaceGirder(1774,768,6)
-PlaceGirder(1773,767,6)
-PlaceGirder(1821,904,1)
-PlaceGirder(1822,802,3)
-PlaceGirder(1820,723,1)
-PlaceGirder(1782,678,4)
-PlaceGirder(1822,661,0)
-PlaceGirder(1822,644,0)
-PlaceGirder(1742,644,0)
-PlaceGirder(1742,661,0)
-PlaceGirder(1694,676,2)
-PlaceGirder(1903,635,0)
------- HEALTH CRATE LIST ------
-SpawnHealthCrate(1476,169)
-SpawnHealthCrate(1551,177)
-SpawnHealthCrate(1586,200)
-SpawnHealthCrate(1439,189)
-SpawnHealthCrate(1401,211)
-SpawnHealthCrate(1633,210)
------- MINE LIST ------
-tempG = AddGear(1010,680,gtMine, 0, 0, 0, 0)
-SetTimer(tempG, 1)
-tempG = AddGear(1031,720,gtMine, 0, 0, 0, 0)
-SetTimer(tempG, 1)
-tempG = AddGear(1039,748,gtMine, 0, 0, 0, 0)
-SetTimer(tempG, 1)
-tempG = AddGear(1051,777,gtMine, 0, 0, 0, 0)
-SetTimer(tempG, 1)
-tempG = AddGear(1065,796,gtMine, 0, 0, 0, 0)
-SetTimer(tempG, 1)
-tempG = AddGear(1094,800,gtMine, 0, 0, 0, 0)
-SetTimer(tempG, 1)
------- REPOSITION LIST ------
-SetGearPosition(player,1050,534)
-SetGearPosition(enemy,1512,158)
-SetHealth(player, 1)
-SetHealth(enemy, 1)
------- CRATE LIST ------
-SpawnSupplyCrate(1632,943,amShotgun)
-SpawnSupplyCrate(1723,888,amFirePunch)
-SpawnSupplyCrate(1915,599,amGrenade)
-SpawnSupplyCrate(1416,913,amBlowTorch)
-SpawnSupplyCrate(1227,640,amPickHammer)
-SpawnSupplyCrate(1519,945,amParachute)
------- END LOADING DATA ------
+		{ type = gtCase, crateType = "supply", x = 1632, y = 943, ammoType = amShotgun },
+		{ type = gtCase, crateType = "supply", x = 1723, y = 888, ammoType = amFirePunch },
+		{ type = gtCase, crateType = "supply", x = 1915, y = 599, ammoType = amGrenade },
+		{ type = gtCase, crateType = "supply", x = 1416, y = 913, ammoType = amBlowTorch },
+		{ type = gtCase, crateType = "supply", x = 1227, y = 640, ammoType = amPickHammer },
+		{ type = gtCase, crateType = "supply", x = 1519, y = 945, ammoType = amParachute},
 
-end
-
-function onGameTick()
-
-	if TurnTimeLeft == TurnTime-1 then
-		SetWind(100)
-	end
-
-end
-
-function onGearDelete(gear)
-	if (GetGearType(gear) == gtCase) and (CurrentHedgehog == player) then
-		if GetHealth(gear) > 0 then
-			AddGear(GetX(gear), GetY(gear), gtGrenade, 0, 0, 0, 1)
-		end
-	elseif gear == player then
-		ShowMission(loc("The Great Escape"), loc("MISSION FAILED"), loc("Oh no! Just try again!"), -amSkip, 0)
-	elseif gear == enemy then
-		ShowMission(loc("The Great Escape"), loc("MISSION SUCCESSFUL"), loc("Congratulations!"), 0, 0)
-	end
-end
-
-function onAmmoStoreInit()
-	SetAmmo(amGrenade, 1, 0, 0, 1)
-	SetAmmo(amParachute, 1, 0, 0, 1)
-	SetAmmo(amFirePunch, 0, 0, 0, 3)
-	SetAmmo(amPickHammer, 0, 0, 0, 1)
-	SetAmmo(amBlowTorch, 0, 0, 0, 1)
-	SetAmmo(amShotgun, 0, 0, 0, 1)
-	SetAmmo(amSkip, 9, 0, 0, 0)
-end
+		{ type = gtCase, crateType = "health", x = 1476, y = 169 },
+		{ type = gtCase, crateType = "health", x = 1551, y = 177 },
+		{ type = gtCase, crateType = "health", x = 1586, y = 200 },
+		{ type = gtCase, crateType = "health", x = 1439, y = 189 },
+		{ type = gtCase, crateType = "health", x = 1401, y = 211 },
+		{ type = gtCase, crateType = "health", x = 1633, y = 210 },
+	},
+})