share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/fruit03.lua
author Periklis Ntanasis <pntanasis@gmail.com>
Thu, 29 Aug 2013 16:18:13 +0300
branchspacecampaign
changeset 9592 a39cb287e83e
parent 9591 b7870f018e5f
child 9593 ac522dd06f00
permissions -rw-r--r--
a bug fix
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     1
------------------- ABOUT ----------------------
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     2
--
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     3
-- Hero has get into an Red Strawberies ambush
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     4
-- He has to eliminate the enemies by using limited
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     5
-- ammo of sniper rifle and watermelon
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     6
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     7
HedgewarsScriptLoad("/Scripts/Locale.lua")
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     8
HedgewarsScriptLoad("/Scripts/Animate.lua")
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     9
HedgewarsScriptLoad("/Missions/Campaign/A_Space_Adventure/global_functions.lua")
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    10
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    11
----------------- VARIABLES --------------------
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    12
-- globals
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    13
local missionName = loc("Precise shooting")
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    14
-- hogs
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    15
local hero = {
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    16
	name = loc("Hog Solo"),
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    17
	x = 1830,
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    18
	y = 560,
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    19
	dead = false
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    20
}
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    21
local enemiesOdd = {
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    22
	{name = "Hog 1", x = 3670 , y = 175},
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    23
	{name = "Hog 3", x = 3795 , y = 1110},
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    24
	{name = "Hog 5", x = 1950 , y = 1480},
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    25
	{name = "Hog 7", x = 400 , y = 920},
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    26
	{name = "Hog 9", x = 1100 , y = 1950},
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    27
	{name = "Hog 11", x = 1200 , y = 1950},
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    28
	{name = "Hog 13", x = 2300 , y = 1950},
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    29
	{name = "Hog 15", x = 2400 , y = 1950},
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    30
}
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    31
local enemiesEven = {
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    32
	{name = "Hog 2", x = 660, y = 170},
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    33
	{name = "Hog 4", x = 1900, y = 1320},
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    34
	{name = "Hog 6", x = 2030, y = 1335},
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    35
	{name = "Hog 8", x = 1300, y = 1950},
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    36
	{name = "Hog 10", x = 1400, y = 1950},
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    37
	{name = "Hog 12", x = 2500, y = 1950},
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    38
	{name = "Hog 14", x = 2600, y = 1950},
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    39
	{name = "Hog 16", x = 1850, y = 560},
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    40
}
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    41
-- teams
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    42
local teamA = {
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    43
	name = loc("Hog Solo"),
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    44
	color = tonumber("38D61C",16) -- green
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    45
}
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    46
local teamB = {
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    47
	name = loc("RS1"),
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    48
	color = tonumber("FF0000",16) -- red
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    49
}
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    50
local teamC = {
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    51
	name = loc("RS2"),
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    52
	color = tonumber("FF0000",16) -- red
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    53
}
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    54
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    55
-------------- LuaAPI EVENT HANDLERS ------------------
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    56
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    57
function onGameInit()
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    58
	GameFlags = gfDisableWind + gfInfAttack
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    59
	Seed = 1
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    60
	TurnTime = 25000
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    61
	CaseFreq = 0
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    62
	MinesNum = 0
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    63
	MinesTime = 1
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    64
	Explosives = 0
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    65
	Map = "fruit03_map"
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    66
	Theme = "Fruit"
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    67
	
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    68
	-- Hog Solo
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    69
	AddTeam(teamA.name, teamA.color, "Bone", "Island", "HillBilly", "cm_birdy")
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    70
	hero.gear = AddHog(hero.name, 0, 100, "war_desertgrenadier1")
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    71
	AnimSetGearPosition(hero.gear, hero.x, hero.y)
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    72
	-- enemies
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    73
	AddTeam(teamC.name, teamC.color, "Bone", "Island", "HillBilly", "cm_birdy")
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    74
	for i=1,table.getn(enemiesEven) do
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    75
		enemiesEven[i].gear = AddHog(enemiesEven[i].name, 1, 100, "war_desertgrenadier1")
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    76
		AnimSetGearPosition(enemiesEven[i].gear, enemiesEven[i].x, enemiesEven[i].y)
9591
b7870f018e5f fixed bug that caused enemy hogs not to play
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9590
diff changeset
    77
		enemiesEven[i].turnLeft = false
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    78
	end	
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    79
	AddTeam(teamB.name, teamB.color, "Bone", "Island", "HillBilly", "cm_birdy")
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    80
	for i=1,table.getn(enemiesOdd) do
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    81
		enemiesOdd[i].gear = AddHog(enemiesOdd[i].name, 1, 100, "war_desertgrenadier1")
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    82
		AnimSetGearPosition(enemiesOdd[i].gear, enemiesOdd[i].x, enemiesOdd[i].y)
9591
b7870f018e5f fixed bug that caused enemy hogs not to play
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9590
diff changeset
    83
		enemiesOdd[i].turnLeft = false
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    84
	end
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    85
	
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    86
	initCheckpoint("fruit03")
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    87
	
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    88
	AnimInit()
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    89
	--AnimationSetup()
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    90
end
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    91
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    92
function onGameStart()
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    93
	AnimWait(hero.gear, 3000)
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    94
	FollowGear(hero.gear)
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    95
	
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    96
	AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0)
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    97
	
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    98
	--hero ammo
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    99
	AddAmmo(hero.gear, amTeleport, 2)
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   100
	AddAmmo(hero.gear, amSniperRifle, 2)
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   101
	AddAmmo(hero.gear, amWatermelon, 2)
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   102
	--enemies ammo
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   103
	AddAmmo(enemiesOdd[1].gear, amSniperRifle, 100)
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   104
	AddAmmo(enemiesOdd[1].gear, amWatermelon, 1)
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   105
	AddAmmo(enemiesEven[1].gear, amSniperRifle, 100)
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   106
	AddAmmo(enemiesEven[1].gear, amWatermelon, 1)
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   107
	
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   108
	SendHealthStatsOff()
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   109
end
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   110
9592
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   111
function onNewTurn()
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   112
	WriteLnToConsole("NEW TURN")
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   113
end
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   114
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   115
function onGameTick20()
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   116
	turnHogs()
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   117
end
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   118
9591
b7870f018e5f fixed bug that caused enemy hogs not to play
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9590
diff changeset
   119
function onGearDamage(gear, damage)
b7870f018e5f fixed bug that caused enemy hogs not to play
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9590
diff changeset
   120
	FollowGear(gear)
9592
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   121
	WriteLnToConsole("GEAR DAMAGED")
9591
b7870f018e5f fixed bug that caused enemy hogs not to play
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9590
diff changeset
   122
end
b7870f018e5f fixed bug that caused enemy hogs not to play
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9590
diff changeset
   123
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   124
function onGearDelete(gear)
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   125
	if gear == hero.gear then
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   126
		hero.dead = true
9592
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   127
	else
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   128
		AddAmmo(hero.gear, amTeleport, 2)
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   129
		AddAmmo(hero.gear, amSniperRifle, 2)
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   130
		AddAmmo(hero.gear, amWatermelon, 2)
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   131
	end
9592
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   132
	WriteLnToConsole("GEAR KILLED")
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   133
end
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   134
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   135
-------------- EVENTS ------------------
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   136
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   137
function onHeroDeath(gear)
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   138
	if hero.dead then
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   139
		return true
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   140
	end
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   141
	return false
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   142
end
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   143
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   144
-------------- ACTIONS ------------------
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   145
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   146
-- game ends anyway but I want to sent custom stats probably...
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   147
function heroDeath(gear)
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   148
	heroLost()
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   149
end
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   150
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   151
------------------ Other Functions -------------------
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   152
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   153
function turnHogs()
9592
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   154
	if GetHealth(hero.gear) then
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   155
		for i=1,table.getn(enemiesEven) do
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   156
			if GetHealth(enemiesEven[i].gear) then
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   157
				if GetX(enemiesEven[i].gear) < GetX(hero.gear) and enemiesEven[i].turnLeft then
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   158
					HogTurnLeft(enemiesEven[i].gear, false)
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   159
				elseif GetX(enemiesEven[i].gear) > GetX(hero.gear) and not enemiesEven[i].turnLeft then
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   160
					HogTurnLeft(enemiesEven[i].gear, true)
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   161
				end
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   162
			end
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   163
		end
9592
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   164
		for i=1,table.getn(enemiesOdd) do
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   165
			if GetHealth(enemiesOdd[i].gear) then
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   166
				if GetX(enemiesOdd[i].gear) < GetX(hero.gear) and enemiesOdd[i].turnLeft then
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   167
					HogTurnLeft(enemiesOdd[i].gear, false)
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   168
				elseif GetX(enemiesOdd[i].gear) > GetX(hero.gear) and not enemiesOdd[i].turnLeft then
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   169
					HogTurnLeft(enemiesOdd[i].gear, true)
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   170
				end
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   171
			end
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   172
		end
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   173
	end
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   174
end