share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/fruit03.lua
author Periklis Ntanasis <pntanasis@gmail.com>
Fri, 30 Aug 2013 05:16:29 +0300
branchspacecampaign
changeset 9597 83fa1ba837b8
parent 9596 feb3d880852d
child 9598 5c378d7d2e4d
permissions -rw-r--r--
add custom stats
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")
9593
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
    14
local timeLeft = 10000
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
    15
local lastWeaponUsed = amSniperRifle
9596
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
    16
local challengeObjectives = loc("Use your available weapons in order to eliminate the enemies").."|"..
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
    17
	loc("You can only use the Sniper Rifle or the Watermelon bomb").."|"..
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
    18
	loc("You'll have only 2 watermelon bombs during the game").."|"..
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
    19
	loc("You'll get an extra Sniper Rifle every time you kill an enemy hog with a limit of max 3 rifles").."|"..
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
    20
	loc("You'll get an extra Teleport every time you kill an enemy hog with a limit of max 2 teleports").."|"..
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
    21
	loc("The first turn will last 25 sec and every other turn 15 sec").."|"..
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
    22
	loc("If you skip the game your time left will be added to your next turn").."|"..
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
    23
	loc("Some parts of the land are indestructible")
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
    24
-- dialogs
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
    25
local dialog01 = {}
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
    26
-- mission objectives
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
    27
local goals = {
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
    28
	[dialog01] = {missionName, loc("Challenge Objectives"), challengeObjectives, 1, 4500},
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
    29
}
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    30
-- hogs
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    31
local hero = {
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    32
	name = loc("Hog Solo"),
9593
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
    33
	x = 1100,
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
    34
	y = 560
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    35
}
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    36
local enemiesOdd = {
9593
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
    37
	{name = "Hog 1", x = 2000 , y = 175},
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
    38
	{name = "Hog 3", x = 1950 , y = 1110},
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
    39
	{name = "Hog 5", x = 1270 , y = 1480},
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
    40
	{name = "Hog 7", x = 240 , y = 790},
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
    41
	{name = "Hog 9", x = 620 , y = 1950},
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
    42
	{name = "Hog 11", x = 720 , y = 1950},
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
    43
	{name = "Hog 13", x = 1620 , y = 1950},
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
    44
	{name = "Hog 15", x = 1720 , y = 1950},
9590
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 enemiesEven = {
9593
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
    47
	{name = "Hog 2", x = 660, y = 140},
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
    48
	{name = "Hog 4", x = 1120, y = 1250},
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
    49
	{name = "Hog 6", x = 1290, y = 1250},
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
    50
	{name = "Hog 8", x = 820, y = 1950},
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
    51
	{name = "Hog 10", x = 920, y = 1950},
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
    52
	{name = "Hog 12", x = 1820, y = 1950},
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
    53
	{name = "Hog 14", x = 1920, y = 1950},
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
    54
	{name = "Hog 16", x = 1200, y = 560},
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    55
}
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    56
-- teams
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    57
local teamA = {
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    58
	name = loc("Hog Solo"),
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    59
	color = tonumber("38D61C",16) -- green
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    60
}
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    61
local teamB = {
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    62
	name = loc("RS1"),
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    63
	color = tonumber("FF0000",16) -- red
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    64
}
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    65
local teamC = {
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    66
	name = loc("RS2"),
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    67
	color = tonumber("FF0000",16) -- red
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    68
}
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    69
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    70
-------------- LuaAPI EVENT HANDLERS ------------------
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    71
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    72
function onGameInit()
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    73
	GameFlags = gfDisableWind + gfInfAttack
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    74
	Seed = 1
9593
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
    75
	TurnTime = 15000
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    76
	CaseFreq = 0
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    77
	MinesNum = 0
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    78
	MinesTime = 1
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    79
	Explosives = 0
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    80
	Map = "fruit03_map"
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    81
	Theme = "Fruit"
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    82
	
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    83
	-- Hog Solo
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    84
	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
    85
	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
    86
	AnimSetGearPosition(hero.gear, hero.x, hero.y)
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    87
	-- enemies
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    88
	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
    89
	for i=1,table.getn(enemiesEven) do
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    90
		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
    91
		AnimSetGearPosition(enemiesEven[i].gear, enemiesEven[i].x, enemiesEven[i].y)
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    92
	end	
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    93
	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
    94
	for i=1,table.getn(enemiesOdd) do
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    95
		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
    96
		AnimSetGearPosition(enemiesOdd[i].gear, enemiesOdd[i].x, enemiesOdd[i].y)
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    97
	end
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    98
	
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    99
	initCheckpoint("fruit03")
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   100
	
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   101
	AnimInit()
9596
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   102
	AnimationSetup()
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   103
end
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   104
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   105
function onGameStart()
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   106
	AnimWait(hero.gear, 3000)
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   107
	FollowGear(hero.gear)
9596
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   108
	ShowMission(missionName, loc("Challenge Objectives"), challengeObjectives, -amSkip, 0)
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   109
	
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   110
	AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0)
9597
83fa1ba837b8 add custom stats
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9596
diff changeset
   111
	AddEvent(onHeroWin, {hero.gear}, heroWin, {hero.gear}, 0)
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   112
	
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   113
	--hero ammo
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   114
	AddAmmo(hero.gear, amTeleport, 2)
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   115
	AddAmmo(hero.gear, amSniperRifle, 2)
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   116
	AddAmmo(hero.gear, amWatermelon, 2)
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   117
	--enemies ammo
9593
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   118
	AddAmmo(enemiesOdd[1].gear, amDEagle, 100)
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   119
	AddAmmo(enemiesOdd[1].gear, amSniperRifle, 100)
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   120
	AddAmmo(enemiesOdd[1].gear, amWatermelon, 1)
9593
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   121
	AddAmmo(enemiesOdd[1].gear, amGrenade, 5)
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   122
	AddAmmo(enemiesEven[1].gear, amDEagle, 100)
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   123
	AddAmmo(enemiesEven[1].gear, amSniperRifle, 100)
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   124
	AddAmmo(enemiesEven[1].gear, amWatermelon, 1)
9593
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   125
	AddAmmo(enemiesEven[1].gear, amGrenade, 5)
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   126
	
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   127
	SendHealthStatsOff()
9596
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   128
	AddAnim(dialog01)
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   129
end
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   130
9592
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   131
function onNewTurn()
9593
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   132
	if CurrentHedgehog == hero.gear then
9594
749ef5bd0eaf fixed the time adding in new hero turn
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9593
diff changeset
   133
		if GetAmmoCount(hero.gear, amSkip) == 0 then
749ef5bd0eaf fixed the time adding in new hero turn
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9593
diff changeset
   134
			TurnTimeLeft = TurnTime + timeLeft
749ef5bd0eaf fixed the time adding in new hero turn
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9593
diff changeset
   135
			AddAmmo(hero.gear, amSkip, 1)
749ef5bd0eaf fixed the time adding in new hero turn
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9593
diff changeset
   136
		end
9593
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   137
		timeLeft = 0
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   138
	end
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   139
	turnHogs()
9592
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   140
end
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   141
9596
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   142
function onGameTick()
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   143
	AnimUnWait()
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   144
	if ShowAnimation() == false then
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   145
		return
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   146
	end
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   147
	ExecuteAfterAnimations()
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   148
	CheckEvents()
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   149
end
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   150
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   151
function onGameTick20()
9594
749ef5bd0eaf fixed the time adding in new hero turn
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9593
diff changeset
   152
	if CurrentHedgehog == hero.gear and TurnTimeLeft ~= 0 then
9593
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   153
		timeLeft = TurnTimeLeft
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   154
	end
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   155
end
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   156
9595
1acc5c3dc066 deleted debug prints
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9594
diff changeset
   157
function onGearDelete(gear)	
9593
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   158
	if (gear > hero.gear and gear <= enemiesOdd[table.getn(enemiesOdd)].gear) or 
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   159
			(gear > hero.gear and gear <= enemiesEven[table.getn(enemiesEven)].gear) then
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   160
		local availableTeleports = GetAmmoCount(hero.gear,amTeleport)
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   161
		local availableSniper = GetAmmoCount(hero.gear,amSniperRifle)
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   162
		if availableTeleports < 2 then
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   163
			AddAmmo(hero.gear, amTeleport, availableTeleports + 1 )
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   164
		end
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   165
		if availableSniper < 3 then
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   166
			AddAmmo(hero.gear, amSniperRifle, availableSniper + 1 )
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   167
		end
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   168
	end
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   169
end
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   170
9596
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   171
function onPrecise()
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   172
	if GameTime > 3000 then
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   173
		SetAnimSkip(true)   
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   174
	end
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   175
end
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   176
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   177
-------------- EVENTS ------------------
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   178
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   179
function onHeroDeath(gear)
9593
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   180
	if not GetHealth(hero.gear) then
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   181
		return true
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   182
	end
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   183
	return false
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   184
end
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   185
9597
83fa1ba837b8 add custom stats
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9596
diff changeset
   186
function onHeroWin(gear)
83fa1ba837b8 add custom stats
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9596
diff changeset
   187
	local enemies = enemiesOdd
83fa1ba837b8 add custom stats
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9596
diff changeset
   188
	for i=1,table.getn(enemiesEven) do
83fa1ba837b8 add custom stats
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9596
diff changeset
   189
		table.insert(enemies, enemiesEven[i])
83fa1ba837b8 add custom stats
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9596
diff changeset
   190
	end
83fa1ba837b8 add custom stats
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9596
diff changeset
   191
	local allDead = true
83fa1ba837b8 add custom stats
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9596
diff changeset
   192
	for i=1,table.getn(enemies) do
83fa1ba837b8 add custom stats
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9596
diff changeset
   193
		if GetHealth(enemies[i].gear) then
83fa1ba837b8 add custom stats
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9596
diff changeset
   194
			allDead = false
83fa1ba837b8 add custom stats
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9596
diff changeset
   195
			break
83fa1ba837b8 add custom stats
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9596
diff changeset
   196
		end
83fa1ba837b8 add custom stats
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9596
diff changeset
   197
	end
83fa1ba837b8 add custom stats
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9596
diff changeset
   198
	return allDead
83fa1ba837b8 add custom stats
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9596
diff changeset
   199
end
83fa1ba837b8 add custom stats
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9596
diff changeset
   200
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   201
-------------- ACTIONS ------------------
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   202
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   203
-- 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
   204
function heroDeath(gear)
9597
83fa1ba837b8 add custom stats
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9596
diff changeset
   205
	SendStat('siGameResult', loc("Hog Solo lost, try again!")) --1
83fa1ba837b8 add custom stats
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9596
diff changeset
   206
	SendStat('siCustomAchievement', loc("You have to eliminate all the enemies")) --11			
83fa1ba837b8 add custom stats
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9596
diff changeset
   207
	SendStat('siCustomAchievement', loc("Read the Challenge Objectives from within the mission for more details")) --11		
83fa1ba837b8 add custom stats
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9596
diff changeset
   208
	SendStat('siPlayerKills','1',teamB.name)
83fa1ba837b8 add custom stats
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9596
diff changeset
   209
	SendStat('siPlayerKills','0',teamA.name)
83fa1ba837b8 add custom stats
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9596
diff changeset
   210
	EndGame()
83fa1ba837b8 add custom stats
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9596
diff changeset
   211
end
83fa1ba837b8 add custom stats
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9596
diff changeset
   212
83fa1ba837b8 add custom stats
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9596
diff changeset
   213
function heroWin(gear)
83fa1ba837b8 add custom stats
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9596
diff changeset
   214
	SendStat('siGameResult', loc("Congratulations, you won!")) --1
83fa1ba837b8 add custom stats
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9596
diff changeset
   215
	SendStat('siCustomAchievement', loc("You complete the mission in "..TotalRounds.." rounds")) --11			
83fa1ba837b8 add custom stats
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9596
diff changeset
   216
	-- TODO SendStat('siCustomAchievement', loc("You will gain some extra ammo the next time you play the Getting to the device mission")) --11		
83fa1ba837b8 add custom stats
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9596
diff changeset
   217
	SendStat('siPlayerKills','1',teamA.name)
9593
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   218
	EndGame()
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   219
end
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   220
9596
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   221
-------------- ANIMATIONS ------------------
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   222
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   223
function Skipanim(anim)
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   224
	if goals[anim] ~= nil then
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   225
		ShowMission(unpack(goals[anim]))
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   226
    end
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   227
    startBattle()
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   228
end
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   229
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   230
function AnimationSetup()
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   231
	-- DIALOG 01 - Start, game instructions
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   232
	AddSkipFunction(dialog01, Skipanim, {dialog01})
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   233
	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 3000}})
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   234
	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Somewhere in the Fruit Planet Hog Solo got lost..."), 5000}})
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   235
	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("...and got ambushed by the Red Strawberies"), 5000}})
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   236
	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Use your available weapons in order to eliminate the enemies"), 5000}})
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   237
	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("You can only use the Sniper Rifle or the Watermelon bomb"), 5000}})
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   238
	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("You'll have only 2 watermelon bombs during the game"), 5000}})
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   239
	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("You'll get an extra Sniper Rifle every time you kill an enemy hog with a limit of max 3 rifles"), 5000}})
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   240
	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("You'll get an extra Teleport every time you kill an enemy hog with a limit of max 2 teleports"), 5000}})
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   241
	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("The first turn will last 25 sec and every other turn 15 sec"), 5000}})
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   242
	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("If you skip the game your time left will be added to your next turn"), 5000}})
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   243
	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Some parts of the land are indestructible"), 5000}})
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   244
	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 500}})
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   245
	table.insert(dialog01, {func = startBattle, args = {hero.gear}})	
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   246
end
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   247
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   248
------------------ Other Functions -------------------
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   249
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   250
function turnHogs()
9592
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   251
	if GetHealth(hero.gear) then
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   252
		for i=1,table.getn(enemiesEven) do
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   253
			if GetHealth(enemiesEven[i].gear) then
9593
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   254
				if GetX(enemiesEven[i].gear) < GetX(hero.gear) then
9592
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   255
					HogTurnLeft(enemiesEven[i].gear, false)
9593
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   256
				elseif GetX(enemiesEven[i].gear) > GetX(hero.gear) then
9592
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   257
					HogTurnLeft(enemiesEven[i].gear, true)
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   258
				end
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   259
			end
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   260
		end
9592
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   261
		for i=1,table.getn(enemiesOdd) do
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   262
			if GetHealth(enemiesOdd[i].gear) then
9593
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   263
				if GetX(enemiesOdd[i].gear) < GetX(hero.gear) then
9592
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   264
					HogTurnLeft(enemiesOdd[i].gear, false)
9593
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   265
				elseif GetX(enemiesOdd[i].gear) > GetX(hero.gear) then
9592
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   266
					HogTurnLeft(enemiesOdd[i].gear, true)
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   267
				end
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   268
			end
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   269
		end
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   270
	end
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   271
end
9596
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   272
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   273
function startBattle()
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   274
	AnimSwitchHog(enemiesOdd[table.getn(enemiesOdd)].gear)
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   275
	TurnTimeLeft = 0
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   276
	-- these 2 are needed in order hero has 10 sec more in the first turn
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   277
	timeLeft = 10000
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   278
	AddAmmo(hero.gear, amSkip, 0)
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   279
end