share/hedgewars/Data/Missions/Training/User_Mission_-_Bamboo_Thicket.lua
changeset 5427 3817b7e6c871
child 5449 a03d0acd7f06
equal deleted inserted replaced
5423:48b7823ec7e4 5427:3817b7e6c871
       
     1 
       
     2 loadfile(GetDataPath() .. "Scripts/Locale.lua")()
       
     3 
       
     4 local player = nil 
       
     5 local enemy = nil
       
     6 local firedShell = false
       
     7 local turnNumber = 0
       
     8 
       
     9 local hhs = {}
       
    10 local numhhs = 0
       
    11 
       
    12 function onGameInit()
       
    13 
       
    14 	Seed = 0 
       
    15 	TurnTime = 20000 
       
    16 	CaseFreq = 0 
       
    17 	MinesNum = 0 
       
    18 	Explosives = 0 
       
    19 	Map = "Bamboo" 
       
    20 	Theme = "Bamboo"
       
    21 
       
    22 	AddTeam(loc("Pathetic Resistance"), 14483456, "Simple", "Island", "Default")
       
    23 	player = AddHog("Ikeda", 0, 10, "StrawHat")
       
    24 			
       
    25 	AddTeam(loc("Cybernetic Empire"), 	1175851, "Simple", "Island", "Default")
       
    26 	enemy = AddHog(loc("Unit 835"), 5, 10, "cyborg")
       
    27 
       
    28 	SetGearPosition(player,1166,1680)
       
    29 	SetGearPosition(enemy,2848,1443)
       
    30 
       
    31 end
       
    32 
       
    33 
       
    34 function onGameStart()
       
    35 
       
    36 	ShowMission(loc("Bamboo Thicket"), loc("User Challenge"), loc("Eliminate the enemy before the time runs out"), -amBazooka, 0)
       
    37 
       
    38 	--WEAPON CRATE LIST. WCRATES: 1
       
    39 	SpawnAmmoCrate(1915,1876,amBazooka)
       
    40 	--UTILITY CRATE LIST. UCRATES: 2
       
    41 	SpawnUtilityCrate(1986,1141,amBlowTorch)
       
    42 	SpawnUtilityCrate(1427,1527,amParachute)
       
    43 
       
    44 	AddAmmo(enemy, amGrenade, 100)
       
    45 		
       
    46 end
       
    47 
       
    48 function onNewTurn()
       
    49 	SetWind(100)
       
    50 	turnNumber = turnNumber + 1
       
    51 end
       
    52 
       
    53 function onAmmoStoreInit()
       
    54 	SetAmmo(amSkip, 9, 0, 0, 0)
       
    55 	SetAmmo(amGirder, 4, 0, 0, 0)
       
    56 	SetAmmo(amBlowTorch, 0, 0, 0, 1)
       
    57 	SetAmmo(amParachute, 0, 0, 0, 2)
       
    58 	SetAmmo(amBazooka, 0, 0, 0, 2)
       
    59 end
       
    60 
       
    61 
       
    62 function onGearAdd(gear)
       
    63 
       
    64 	if GetGearType(gear) == gtHedgehog then
       
    65 		hhs[numhhs] = gear
       
    66 		numhhs = numhhs + 1
       
    67 	elseif GetGearType(gear) == gtShell then
       
    68 		firedShell = true
       
    69 	end
       
    70 
       
    71 end
       
    72 
       
    73 function onGearDelete(gear)
       
    74 
       
    75 	if (gear == enemy) then
       
    76 		
       
    77 		ShowMission(loc("Bamboo Thicket"), loc("MISSION SUCCESSFUL"), loc("Congratulations!"), 0, 0)
       
    78 		
       
    79 		if (turnNumber < 6) and (firedShell == false) then
       
    80 			AddCaption(loc("Achievement Unlocked") .. ": " .. loc("Energetic Engineer"),0xffba00ff,capgrpMessage2)
       
    81 		end
       
    82 
       
    83 	elseif gear == player then
       
    84 		ShowMission(loc("Bamboo Thicket"), loc("MISSION FAILED"), loc("Oh no! Just try again!"), -amSkip, 0)
       
    85 	end
       
    86 
       
    87 end