share/hedgewars/Data/Missions/Training/Basic_Training_-_Cluster_Bomb.lua
changeset 6505 b005fbba039e
parent 6501 4a6666deb85b
child 7165 aad1aea05f1e
--- a/share/hedgewars/Data/Missions/Training/Basic_Training_-_Cluster_Bomb.lua	Tue Dec 06 04:46:47 2011 +0200
+++ b/share/hedgewars/Data/Missions/Training/Basic_Training_-_Cluster_Bomb.lua	Tue Dec 06 05:41:52 2011 +0200
@@ -7,10 +7,28 @@
 local time_goal = 0
 
 function spawnTarget()
+
 	gear = AddGear(0, 0, gtTarget, 0, 0, 0, 0)
-	FindPlace(gear, true, 0, LAND_WIDTH)
-	x, y = GetGearPosition(gear)
-	SetGearPosition(gear, x, 500)
+	
+	if scored == 0 then x = 1652 end
+	if scored == 1 then x = 1915 end
+	if scored == 2 then x = 2333 end
+	if scored == 3 then x = 2152 end
+	if scored == 4 then x = 1434 end
+	if scored == 5 then x = 2588 end
+	if scored == 6 then x = 2372 end
+	if scored == 7 then x = 1193 end
+	if scored == 8 then x = 2744 end
+	if scored == 9 then x = 2465 end
+	if scored == 10 then x = 1623 end
+	if scored == 11 then x = 2662 end
+
+	if scored == 6 then
+		SetGearPosition(gear, 2272, 1500)
+	else
+		SetGearPosition(gear, x, 1000)
+	end
+
 end
 
 function onGameInit()
@@ -27,7 +45,7 @@
 
 	AddTeam("The Hogies", 2850005, "Statue", "Island", "Hog Islands")
 
-	player = AddHog("Private Novak", 0, 100, "war_desertGrenadier1")
+	player = AddHog(loc("Private Novak"), 0, 1, "war_desertGrenadier1")
 	SetGearPosition(player, 1780, 1300)
 
 end
@@ -35,22 +53,21 @@
 function onAmmoStoreInit()
 
 	SetAmmo(amClusterBomb, 9, 0, 0, 0)
-	SetAmmo(amGrenade, 9, 0, 0, 0)
 
 end
 
 function onGameStart()
 
-	ShowMission("Cluster Bomb Training", loc("Aiming Practice"), "You have to destroy 12 targets in 120 seconds|Timer is set to 3 seconds", -amClusterBomb, 5000)
+	ShowMission(loc("Cluster Bomb Training"), loc("Aiming Practice"), loc("You have to destroy 12 targets in 180 seconds"), -amClusterBomb, 5000)
 	spawnTarget()
 
 end
 
 function onGameTick()
 
-	if TurnTimeLeft == 1 and scored < 12 then
+	if TurnTimeLeft == 1 and scored < 12 and game_lost == false then
 		game_lost = true
-		ShowMission("Cluster Bomb Training", loc("Aiming Practice"), loc("Oh no! Time's up! Just try again."), -amSkip, 0)
+		ShowMission(loc("Cluster Bomb Training"), loc("Aiming Practice"), loc("Oh no! Time's up! Just try again."), -amSkip, 0)
 		SetHealth(player, 0)
 		time_goal = 1
 	end
@@ -67,6 +84,7 @@
 end
 
 function onNewTurn()
+	ParseCommand("setweap " .. string.char(amClusterBomb))
 end
 
 function onGearAdd(gear)
@@ -80,13 +98,26 @@
 			spawnTarget()
 		else
 			if not game_lost then
-				ShowMission("Cluster Bomb Training", loc("Aiming Practice"), loc("Congratulations! You've eliminated all targets|within the allowed time frame."), 0, 0)
+
+				if TurnTimeLeft > 90 * 10 then
+					ShowMission(loc("Cluster Bomb MASTER!"), loc("Aiming Practice"), loc("Congratulations! You needed only half of time|to eliminate all targets."), 4, 0)
+				else
+					ShowMission(loc("Cluster Bomb Training"), loc("Aiming Practice"), loc("Congratulations! You've eliminated all targets|within the allowed time frame."), 0, 0)
+				end
 				PlaySound(sndVictory)
 				time_goal = TurnTimeLeft
 			end
 		end
 	end
+
+	if GetGearType(gear) == gtHedgehog then
+		game_lost = true
+		ShowMission(loc("Cluster Bomb Training"), loc("Aiming Practice"), loc("Oh no! You failed! Just try again."), -amSkip, 0)
+		SetHealth(player, 0)
+		time_goal = 1
+	end
+
 end
 
 function onGearDelete(gear)
-end
+end
\ No newline at end of file