share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/death01.lua
branchspacecampaign
changeset 9558 455f1260ef43
child 9560 5872edd6864e
equal deleted inserted replaced
9556:bae6ebef3673 9558:455f1260ef43
       
     1 ------------------- ABOUT ----------------------
       
     2 --
       
     3 -- This is the mission to acquire the last part.
       
     4 -- This mission is the cameo of Professor Hogevil
       
     5 -- who has took hostages H and Dr. Cornelius.
       
     6 -- Hog Solo has to defeat him and his thugs.
       
     7 
       
     8 HedgewarsScriptLoad("/Scripts/Locale.lua")
       
     9 HedgewarsScriptLoad("/Scripts/Animate.lua")
       
    10 
       
    11 ----------------- VARIABLES --------------------
       
    12 -- globals
       
    13 local campaignName = loc("A Space Adventure")
       
    14 local missionName = loc("Desert planet, lost in sand!")
       
    15 -- dialogs
       
    16 -- missions objectives
       
    17 -- crates
       
    18 local portalCrate = {x = 1520, y = 1950}
       
    19 local cakeCrate = {x = 325, y = 1500}
       
    20 -- hogs
       
    21 local hero = {}
       
    22 local paoth1 = {}
       
    23 local paoth2 = {}
       
    24 local professor = {}
       
    25 local thug1 = {}
       
    26 local thug2 = {}
       
    27 local thug3 = {}
       
    28 local thug4 = {}
       
    29 local thug5 = {}
       
    30 local thug6 = {}
       
    31 local thug7 = {}
       
    32 local thugs = { thug1, thug2, thug3, thug4, thug5, thug6, thug7 }
       
    33 -- teams
       
    34 local teamA = {}
       
    35 local teamB = {}
       
    36 local teamC = {}
       
    37 -- hedgehogs values
       
    38 hero.name = "Hog Solo"
       
    39 hero.x = 520
       
    40 hero.y = 845
       
    41 hero.dead = false
       
    42 paoth1.name = "H"
       
    43 paoth1.x = 3730
       
    44 paoth1.y = 1480
       
    45 paoth2.name = "Dr. Cornelius"
       
    46 paoth2.x = 3800
       
    47 paoth2.y = 1480
       
    48 professor.name = "Prof. Hogevil"
       
    49 professor.x = 3630
       
    50 professor.y = 1480
       
    51 professor.dead = false
       
    52 thug1.x = 1265
       
    53 thug1.y = 1400
       
    54 thug1.health = 100
       
    55 thug2.x = 2035
       
    56 thug2.y = 1320
       
    57 thug2.health = 100
       
    58 thug3.x = 1980
       
    59 thug3.y = 815
       
    60 thug3.health = 35
       
    61 thug3.turnLeft = true
       
    62 thug4.x = 2830
       
    63 thug4.y = 1960
       
    64 thug4.health = 80
       
    65 thug5.x = 2890
       
    66 thug5.y = 1960
       
    67 thug5.health = 80
       
    68 thug6.x = 2940
       
    69 thug6.y = 1960
       
    70 thug6.health = 80
       
    71 thug7.x = 2990
       
    72 thug7.y = 1960
       
    73 thug7.health = 80
       
    74 teamA.name = loc("Hog Solo")
       
    75 teamA.color = tonumber("38D61C",16) -- green
       
    76 teamB.name = loc("PAotH")
       
    77 teamB.color = tonumber("FF0000",16) -- red
       
    78 teamC.name = loc("Professor")
       
    79 teamC.color = tonumber("0033FF",16) -- blue
       
    80 
       
    81 -------------- LuaAPI EVENT HANDLERS ------------------
       
    82 
       
    83 function onGameInit()
       
    84 	Seed = 1
       
    85 	TurnTime = 25000
       
    86 	CaseFreq = 0
       
    87 	MinesNum = 3
       
    88 	MinesTime = 1500
       
    89 	Explosives = 2
       
    90 	Delay = 3
       
    91 	SuddenDeathTurns = 100
       
    92 	Map = "death01_map"
       
    93 	Theme = "Hell"
       
    94 	
       
    95 	-- Hog Solo
       
    96 	AddTeam(teamA.name, teamA.color, "Bone", "Island", "HillBilly", "cm_birdy")
       
    97 	hero.gear = AddHog(hero.name, 0, 100, "war_desertgrenadier1")
       
    98 	AnimSetGearPosition(hero.gear, hero.x, hero.y)
       
    99 	-- PAotH
       
   100 	AddTeam(teamB.name, teamB.color, "Bone", "Island", "HillBilly", "cm_birdy")
       
   101 	paoth1.gear = AddHog(paoth1.name, 0, 100, "war_desertgrenadier1")
       
   102 	AnimSetGearPosition(paoth1.gear, paoth1.x, paoth1.y)
       
   103 	HogTurnLeft(paoth1.gear, true)
       
   104 	paoth2.gear = AddHog(paoth2.name, 0, 100, "war_desertgrenadier1")
       
   105 	AnimSetGearPosition(paoth2.gear, paoth2.x, paoth2.y)
       
   106 	HogTurnLeft(paoth2.gear, true)
       
   107 	-- Professor and Thugs
       
   108 	AddTeam(teamC.name, teamC.color, "Bone", "Island", "HillBilly", "cm_birdy")
       
   109 	professor.gear = AddHog(professor.name, 0, 300, "war_desertgrenadier1")
       
   110 	AnimSetGearPosition(professor.gear, professor.x, professor.y)
       
   111 	HogTurnLeft(professor.gear, true)
       
   112 	for i=1,table.getn(thugs) do
       
   113 		thugs[i].gear = AddHog("thug #"..i, 1, thugs[i].health, "war_desertgrenadier1")
       
   114 		AnimSetGearPosition(thugs[i].gear, thugs[i].x, thugs[i].y)
       
   115 		HogTurnLeft(thugs[i].gear, not thugs[i].turnLeft)
       
   116 	end
       
   117 	
       
   118 	AnimInit()
       
   119 	--AnimationSetup()
       
   120 end
       
   121 
       
   122 function onGameStart()
       
   123 	AnimWait(hero.gear, 3000)
       
   124 	FollowGear(hero.gear)
       
   125 	
       
   126 	-- add crates
       
   127 	SpawnAmmoCrate(portalCrate.x, portalCrate.y, amPortalGun)
       
   128 	SpawnAmmoCrate(cakeCrate.x, cakeCrate.y, amCake)
       
   129 	-- add explosives
       
   130 	AddGear(1900, 850, gtExplosives, 0, 0, 0, 0)
       
   131 	AddGear(1900, 800, gtExplosives, 0, 0, 0, 0)
       
   132 	AddGear(1900, 750, gtExplosives, 0, 0, 0, 0)
       
   133 	AddGear(1900, 710, gtExplosives, 0, 0, 0, 0)
       
   134 	-- add mines
       
   135 	AddGear(3520, 1650, gtMine, 0, 0, 0, 0)
       
   136 	AddGear(3480, 1680, gtMine, 0, 0, 0, 0)
       
   137 	AddGear(3440, 1690, gtMine, 0, 0, 0, 0)
       
   138 	AddGear(3400, 1710, gtMine, 0, 0, 0, 0)
       
   139 	-- add girders
       
   140 	PlaceGirder(3770, 1370, 4)
       
   141 	PlaceGirder(3700, 1460, 6)
       
   142 	PlaceGirder(3840, 1460, 6)
       
   143 	
       
   144 	-- add ammo
       
   145 	-- hero ammo
       
   146 	AddAmmo(hero.gear, amRope, 2)
       
   147 	AddAmmo(hero.gear, amBazooka, 3)
       
   148 	AddAmmo(hero.gear, amParachute, 1)
       
   149 	AddAmmo(hero.gear, amGrenade, 6)
       
   150 	AddAmmo(hero.gear, amDEagle, 4)
       
   151 	-- evil ammo
       
   152 	AddAmmo(professor.gear, amRope, 4)
       
   153 	AddAmmo(professor.gear, amBazooka, 8)
       
   154 	AddAmmo(professor.gear, amSwitch, 100)
       
   155 	AddAmmo(professor.gear, amGrenade, 8)
       
   156 	AddAmmo(professor.gear, amDEagle, 8)
       
   157 	
       
   158 	SendHealthStatsOff()
       
   159 end
       
   160 
       
   161 function onNewTurn()
       
   162 	if CurrentHedgehog == paoth1.gear or CurrentHedgehog == paoth2.gear then
       
   163 		TurnTimeLeft = 0
       
   164 	end
       
   165 end
       
   166 
       
   167 function onGameTick()
       
   168 	AnimUnWait()
       
   169 	if ShowAnimation() == false then
       
   170 		return
       
   171 	end
       
   172 	ExecuteAfterAnimations()
       
   173 	CheckEvents()
       
   174 end
       
   175 
       
   176 function onAmmoStoreInit()
       
   177 	SetAmmo(amCake, 0, 0, 0, 1)
       
   178 	SetAmmo(amPortalGun, 0, 0, 0, 1)
       
   179 end
       
   180 
       
   181 function onGearDelete(gear)
       
   182 	if gear == hero.gear then
       
   183 		hero.dead = true
       
   184 	elseif gear == professor.gear then
       
   185 		professor.dead = true
       
   186 	end
       
   187 end