share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/fruit03.lua
author Wuzzy <almikes@aol.com>
Thu, 28 Sep 2017 07:45:28 +0200
changeset 12573 a778c1bb032e
parent 12538 952afc3d2df2
child 12575 0c5ce463949b
permissions -rw-r--r--
ASA: Explain team abbreviations + update changelog
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
--
9831
afa4e3e04cc5 typos correction
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9810
diff changeset
     3
-- Hero has get into an Red Strawberries ambush
9590
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")
12222
6ffb18cf4c57 Add infinite skipping in fruit03 mission
Wuzzy <almikes@aol.com>
parents: 12088
diff changeset
    14
local timeLeft = 0
6ffb18cf4c57 Add infinite skipping in fruit03 mission
Wuzzy <almikes@aol.com>
parents: 12088
diff changeset
    15
local lastWeaponUsed = amNothing
6ffb18cf4c57 Add infinite skipping in fruit03 mission
Wuzzy <almikes@aol.com>
parents: 12088
diff changeset
    16
local firstTurn = true
11692
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
    17
local challengeObjectives = loc("Use your available weapons in order to eliminate the enemies.").."|"..
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
    18
	loc("You can only use the sniper rifle or the watermelon bomb.").."|"..
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
    19
	loc("You'll have only 2 watermelon bombs during the game.").."|"..
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
    20
	loc("You'll get an extra sniper rifle every time you kill an enemy hog with a limit of max 4 rifles.").."|"..
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
    21
	loc("You'll get an extra teleport every time you kill an enemy hog with a limit of max 2 teleports.").."|"..
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
    22
	loc("The first turn will last 25 sec and every other turn 15 sec.").."|"..
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
    23
	loc("If you skip a turn then the turn time left will be added to your next turn.").."|"..
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
    24
	loc("Some parts of the land are indestructible.")
9596
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
    25
-- dialogs
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
    26
local dialog01 = {}
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
    27
-- mission objectives
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
    28
local goals = {
11692
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
    29
	[dialog01] = {missionName, loc("Challenge objectives"), challengeObjectives, 1, 4500},
9596
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
    30
}
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    31
-- hogs
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    32
local hero = {
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    33
	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
    34
	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
    35
	y = 560
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    36
}
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    37
local enemiesOdd = {
9601
6af4ca27421a added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9600
diff changeset
    38
	{name = loc("Hog 1"), x = 2000 , y = 175},
6af4ca27421a added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9600
diff changeset
    39
	{name = loc("Hog III"), x = 1950 , y = 1110},
6af4ca27421a added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9600
diff changeset
    40
	{name = loc("Hog 100"), x = 1270 , y = 1480},
6af4ca27421a added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9600
diff changeset
    41
	{name = loc("Hog Saturn"), x = 240 , y = 790},
6af4ca27421a added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9600
diff changeset
    42
	{name = loc("Hog nueve"), x = 620 , y = 1950},
6af4ca27421a added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9600
diff changeset
    43
	{name = loc("Hog onze"), x = 720 , y = 1950},
6af4ca27421a added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9600
diff changeset
    44
	{name = loc("Hog dertien"), x = 1620 , y = 1950},
6af4ca27421a added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9600
diff changeset
    45
	{name = loc("Hog 3x5"), x = 1720 , y = 1950},
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    46
}
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    47
local enemiesEven = {
9601
6af4ca27421a added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9600
diff changeset
    48
	{name = loc("Hog two"), x = 660, y = 140},
6af4ca27421a added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9600
diff changeset
    49
	{name = loc("Hog D"), x = 1120, y = 1250},
6af4ca27421a added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9600
diff changeset
    50
	{name = loc("Hog exi"), x = 1290, y = 1250},
6af4ca27421a added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9600
diff changeset
    51
	{name = loc("Hog octo"), x = 820, y = 1950},
6af4ca27421a added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9600
diff changeset
    52
	{name = loc("Hog decar"), x = 920, y = 1950},
6af4ca27421a added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9600
diff changeset
    53
	{name = loc("Hog Hephaestus"), x = 1820, y = 1950},
6af4ca27421a added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9600
diff changeset
    54
	{name = loc("Hog 7+7"), x = 1920, y = 1950},
6af4ca27421a added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9600
diff changeset
    55
	{name = loc("Hog EOF"), x = 1200, y = 560},
9590
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
-- teams
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    58
local teamA = {
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    59
	name = loc("Hog Solo"),
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    60
	color = tonumber("38D61C",16) -- green
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    61
}
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    62
local teamB = {
12573
a778c1bb032e ASA: Explain team abbreviations + update changelog
Wuzzy <almikes@aol.com>
parents: 12538
diff changeset
    63
	-- Red Strawberries 1
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    64
	name = loc("RS1"),
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    65
	color = tonumber("FF0000",16) -- red
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    66
}
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    67
local teamC = {
12573
a778c1bb032e ASA: Explain team abbreviations + update changelog
Wuzzy <almikes@aol.com>
parents: 12538
diff changeset
    68
	-- Red Strawberries 2
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    69
	name = loc("RS2"),
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    70
	color = tonumber("FF0000",16) -- red
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
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    73
-------------- LuaAPI EVENT HANDLERS ------------------
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    74
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    75
function onGameInit()
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    76
	GameFlags = gfDisableWind + gfInfAttack
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    77
	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
    78
	TurnTime = 15000
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    79
	CaseFreq = 0
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    80
	MinesNum = 0
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    81
	MinesTime = 1
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    82
	Explosives = 0
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    83
	Map = "fruit03_map"
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    84
	Theme = "Fruit"
12468
d652c6f5d5f1 Disable Sudden Death for a couple of ASA missions
Wuzzy <almikes@aol.com>
parents: 12222
diff changeset
    85
	-- Disable Sudden Death
d652c6f5d5f1 Disable Sudden Death for a couple of ASA missions
Wuzzy <almikes@aol.com>
parents: 12222
diff changeset
    86
	WaterRise = 0
d652c6f5d5f1 Disable Sudden Death for a couple of ASA missions
Wuzzy <almikes@aol.com>
parents: 12222
diff changeset
    87
	HealthDecrease = 0
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9642
diff changeset
    88
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    89
	-- Hog Solo
12049
030464f34d47 Tweak flags used in all missions to fit more to the theme
Wuzzy <almikes@aol.com>
parents: 11965
diff changeset
    90
	AddTeam(teamA.name, teamA.color, "Bone", "Island", "HillBilly", "hedgewars")
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    91
	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
    92
	AnimSetGearPosition(hero.gear, hero.x, hero.y)
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    93
	-- enemies
9598
5c378d7d2e4d image, description and hats
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9597
diff changeset
    94
	local hats = { "Bandit", "fr_apple", "fr_banana", "fr_lemon", "fr_orange",
5c378d7d2e4d image, description and hats
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9597
diff changeset
    95
					"fr_pumpkin", "Gasmask", "NinjaFull", "NinjaStraight", "NinjaTriangle" }
12049
030464f34d47 Tweak flags used in all missions to fit more to the theme
Wuzzy <almikes@aol.com>
parents: 11965
diff changeset
    96
	AddTeam(teamC.name, teamC.color, "Bone", "Island", "HillBilly", "cm_bars")
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    97
	for i=1,table.getn(enemiesEven) do
9810
54c0fdec4600 changing math functions that may cause desyncs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9758
diff changeset
    98
		enemiesEven[i].gear = AddHog(enemiesEven[i].name, 1, 100, hats[GetRandom(table.getn(hats))+1])
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    99
		AnimSetGearPosition(enemiesEven[i].gear, enemiesEven[i].x, enemiesEven[i].y)
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9642
diff changeset
   100
	end
12049
030464f34d47 Tweak flags used in all missions to fit more to the theme
Wuzzy <almikes@aol.com>
parents: 11965
diff changeset
   101
	AddTeam(teamB.name, teamB.color, "Bone", "Island", "HillBilly", "cm_bars")
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   102
	for i=1,table.getn(enemiesOdd) do
9810
54c0fdec4600 changing math functions that may cause desyncs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9758
diff changeset
   103
		enemiesOdd[i].gear = AddHog(enemiesOdd[i].name, 1, 100, hats[GetRandom(table.getn(hats))+1])
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   104
		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
   105
	end
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9642
diff changeset
   106
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   107
	initCheckpoint("fruit03")
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9642
diff changeset
   108
12088
1da37e2ba6fd Fix A Space Adventure Missions allowing player to walk before 1st animation and screw things up
Wuzzy <almikes@aol.com>
parents: 12049
diff changeset
   109
	AnimInit(true)
9596
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   110
	AnimationSetup()
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   111
end
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
function onGameStart()
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   114
	AnimWait(hero.gear, 3000)
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   115
	FollowGear(hero.gear)
11692
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   116
	ShowMission(missionName, loc("Challenge objectives"), challengeObjectives, -amSkip, 0)
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9642
diff changeset
   117
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   118
	AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0)
9597
83fa1ba837b8 add custom stats
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9596
diff changeset
   119
	AddEvent(onHeroWin, {hero.gear}, heroWin, {hero.gear}, 0)
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9642
diff changeset
   120
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   121
	--hero ammo
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   122
	AddAmmo(hero.gear, amTeleport, 2)
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   123
	AddAmmo(hero.gear, amSniperRifle, 2)
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   124
	AddAmmo(hero.gear, amWatermelon, 2)
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   125
	--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
   126
	AddAmmo(enemiesOdd[1].gear, amDEagle, 100)
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   127
	AddAmmo(enemiesOdd[1].gear, amSniperRifle, 100)
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   128
	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
   129
	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
   130
	AddAmmo(enemiesEven[1].gear, amDEagle, 100)
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   131
	AddAmmo(enemiesEven[1].gear, amSniperRifle, 100)
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   132
	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
   133
	AddAmmo(enemiesEven[1].gear, amGrenade, 5)
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9642
diff changeset
   134
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   135
	SendHealthStatsOff()
9596
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   136
	AddAnim(dialog01)
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   137
end
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   138
9592
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   139
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
   140
	if CurrentHedgehog == hero.gear then
12222
6ffb18cf4c57 Add infinite skipping in fruit03 mission
Wuzzy <almikes@aol.com>
parents: 12088
diff changeset
   141
		if firstTurn then
6ffb18cf4c57 Add infinite skipping in fruit03 mission
Wuzzy <almikes@aol.com>
parents: 12088
diff changeset
   142
			TurnTimeLeft = 25000
6ffb18cf4c57 Add infinite skipping in fruit03 mission
Wuzzy <almikes@aol.com>
parents: 12088
diff changeset
   143
		end
6ffb18cf4c57 Add infinite skipping in fruit03 mission
Wuzzy <almikes@aol.com>
parents: 12088
diff changeset
   144
		if lastWeaponUsed == amSkip then
9594
749ef5bd0eaf fixed the time adding in new hero turn
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9593
diff changeset
   145
			TurnTimeLeft = TurnTime + timeLeft
749ef5bd0eaf fixed the time adding in new hero turn
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9593
diff changeset
   146
		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
   147
		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
   148
	end
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   149
	turnHogs()
9592
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   150
end
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   151
9596
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   152
function onGameTick()
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   153
	AnimUnWait()
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   154
	if ShowAnimation() == false then
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   155
		return
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   156
	end
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   157
	ExecuteAfterAnimations()
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   158
	CheckEvents()
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   159
end
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   160
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   161
function onGameTick20()
9594
749ef5bd0eaf fixed the time adding in new hero turn
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9593
diff changeset
   162
	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
   163
		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
   164
	end
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   165
end
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   166
9600
7daf157d8b52 fix check if deleted gear is hog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9599
diff changeset
   167
function onGearDelete(gear)
7daf157d8b52 fix check if deleted gear is hog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9599
diff changeset
   168
	if (isHog(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
   169
		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
   170
		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
   171
		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
   172
			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
   173
		end
9600
7daf157d8b52 fix check if deleted gear is hog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9599
diff changeset
   174
		if availableSniper < 4 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
   175
			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
   176
		end
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   177
	end
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   178
end
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   179
9596
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   180
function onPrecise()
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   181
	if GameTime > 3000 then
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9642
diff changeset
   182
		SetAnimSkip(true)
9596
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   183
	end
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   184
end
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   185
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   186
-------------- EVENTS ------------------
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   187
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   188
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
   189
	if not GetHealth(hero.gear) then
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   190
		return true
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   191
	end
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   192
	return false
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   193
end
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   194
9597
83fa1ba837b8 add custom stats
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9596
diff changeset
   195
function onHeroWin(gear)
83fa1ba837b8 add custom stats
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9596
diff changeset
   196
	local enemies = enemiesOdd
83fa1ba837b8 add custom stats
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9596
diff changeset
   197
	for i=1,table.getn(enemiesEven) do
83fa1ba837b8 add custom stats
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9596
diff changeset
   198
		table.insert(enemies, enemiesEven[i])
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
	local allDead = true
83fa1ba837b8 add custom stats
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9596
diff changeset
   201
	for i=1,table.getn(enemies) do
83fa1ba837b8 add custom stats
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9596
diff changeset
   202
		if GetHealth(enemies[i].gear) then
83fa1ba837b8 add custom stats
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9596
diff changeset
   203
			allDead = false
83fa1ba837b8 add custom stats
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9596
diff changeset
   204
			break
83fa1ba837b8 add custom stats
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9596
diff changeset
   205
		end
83fa1ba837b8 add custom stats
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9596
diff changeset
   206
	end
83fa1ba837b8 add custom stats
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9596
diff changeset
   207
	return allDead
83fa1ba837b8 add custom stats
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9596
diff changeset
   208
end
83fa1ba837b8 add custom stats
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9596
diff changeset
   209
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   210
-------------- ACTIONS ------------------
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   211
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   212
function heroDeath(gear)
9642
8a691e0f117a use consts for TStatInfo enum
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9631
diff changeset
   213
	SendStat(siGameResult, loc("Hog Solo lost, try again!"))
11692
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   214
	SendStat(siCustomAchievement, loc("You have to eliminate all the enemies."))
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   215
	SendStat(siCustomAchievement, loc("Read the challenge objectives from within the mission for more details."))
12538
952afc3d2df2 Show correct kill counts in all ASA missions (fixes #147)
Wuzzy <almikes@aol.com>
parents: 12514
diff changeset
   216
	sendSimpleTeamRankings({teamB.name, teamC.name, teamA.name})
9597
83fa1ba837b8 add custom stats
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9596
diff changeset
   217
	EndGame()
83fa1ba837b8 add custom stats
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9596
diff changeset
   218
end
83fa1ba837b8 add custom stats
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9596
diff changeset
   219
83fa1ba837b8 add custom stats
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9596
diff changeset
   220
function heroWin(gear)
9630
df942cfac4e6 add bonuses
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9601
diff changeset
   221
	saveBonus(2, 1)
9642
8a691e0f117a use consts for TStatInfo enum
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9631
diff changeset
   222
	SendStat(siGameResult, loc("Congratulations, you won!"))
11692
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   223
	SendStat(siCustomAchievement, string.format(loc("You completed the mission in %d rounds."), TotalRounds))
11892
0526a26ddd6e Save fastest rounds in Killing the specialists and Precise shooting missions
Wuzzy <almikes@aol.com>
parents: 11692
diff changeset
   224
	local record = tonumber(GetCampaignVar("FastestPreciseShooting"))
0526a26ddd6e Save fastest rounds in Killing the specialists and Precise shooting missions
Wuzzy <almikes@aol.com>
parents: 11692
diff changeset
   225
	if record ~= nil and TotalRounds >= record then
0526a26ddd6e Save fastest rounds in Killing the specialists and Precise shooting missions
Wuzzy <almikes@aol.com>
parents: 11692
diff changeset
   226
		SendStat(siCustomAchievement, string.format(loc("Your fastest victory so far: %d rounds"), record))
0526a26ddd6e Save fastest rounds in Killing the specialists and Precise shooting missions
Wuzzy <almikes@aol.com>
parents: 11692
diff changeset
   227
	end
0526a26ddd6e Save fastest rounds in Killing the specialists and Precise shooting missions
Wuzzy <almikes@aol.com>
parents: 11692
diff changeset
   228
	if record == nil or TotalRounds < record then
0526a26ddd6e Save fastest rounds in Killing the specialists and Precise shooting missions
Wuzzy <almikes@aol.com>
parents: 11692
diff changeset
   229
		SaveCampaignVar("FastestPreciseShooting", tostring(TotalRounds))
0526a26ddd6e Save fastest rounds in Killing the specialists and Precise shooting missions
Wuzzy <almikes@aol.com>
parents: 11692
diff changeset
   230
		if record ~= nil then
0526a26ddd6e Save fastest rounds in Killing the specialists and Precise shooting missions
Wuzzy <almikes@aol.com>
parents: 11692
diff changeset
   231
			SendStat(siCustomAchievement, loc("This is a new personal best, congratulations!"))
0526a26ddd6e Save fastest rounds in Killing the specialists and Precise shooting missions
Wuzzy <almikes@aol.com>
parents: 11692
diff changeset
   232
		end
0526a26ddd6e Save fastest rounds in Killing the specialists and Precise shooting missions
Wuzzy <almikes@aol.com>
parents: 11692
diff changeset
   233
	end
11692
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   234
	SendStat(siCustomAchievement, loc("You will gain some extra ammo from the crates the next time you play the \"Getting to the device\" mission."))
12538
952afc3d2df2 Show correct kill counts in all ASA missions (fixes #147)
Wuzzy <almikes@aol.com>
parents: 12514
diff changeset
   235
	sendSimpleTeamRankings({teamA.name, teamB.name, teamC.name})
11952
63988f36debf Save mission success for A Space Adventure missions
Wuzzy <almikes@aol.com>
parents: 11892
diff changeset
   236
	SaveCampaignVar("Mission10Won", "true")
11965
72be38f6d0c0 Complete space campaign's spacetrip mission if all main+side missions are completed
Wuzzy <almikes@aol.com>
parents: 11952
diff changeset
   237
	checkAllMissionsCompleted()
9593
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   238
	EndGame()
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   239
end
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   240
9596
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   241
-------------- ANIMATIONS ------------------
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   242
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   243
function Skipanim(anim)
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   244
	if goals[anim] ~= nil then
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   245
		ShowMission(unpack(goals[anim]))
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
    startBattle()
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   248
end
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   249
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   250
function AnimationSetup()
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   251
	-- DIALOG 01 - Start, game instructions
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   252
	AddSkipFunction(dialog01, Skipanim, {dialog01})
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   253
	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 3000}})
11692
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   254
	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Somewhere in the Fruit Planet Hog Solo got lost ..."), 5000}})
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   255
	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("... and got ambushed by the Red Strawberries"), 5000}})
9596
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   256
	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Use your available weapons in order to eliminate the enemies"), 5000}})
11692
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   257
	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("You can only use the sniper rifle or the watermelon bomb"), 5000}})
9596
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   258
	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("You'll have only 2 watermelon bombs during the game"), 5000}})
11692
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   259
	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 4 rifles"), 5000}})
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   260
	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}})
9596
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   261
	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
   262
	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
   263
	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
   264
	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 500}})
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9642
diff changeset
   265
	table.insert(dialog01, {func = startBattle, args = {hero.gear}})
9596
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   266
end
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   267
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   268
------------------ Other Functions -------------------
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   269
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   270
function turnHogs()
9592
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   271
	if GetHealth(hero.gear) then
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   272
		for i=1,table.getn(enemiesEven) do
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   273
			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
   274
				if GetX(enemiesEven[i].gear) < GetX(hero.gear) then
9592
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   275
					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
   276
				elseif GetX(enemiesEven[i].gear) > GetX(hero.gear) then
9592
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   277
					HogTurnLeft(enemiesEven[i].gear, true)
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   278
				end
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   279
			end
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   280
		end
9592
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   281
		for i=1,table.getn(enemiesOdd) do
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   282
			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
   283
				if GetX(enemiesOdd[i].gear) < GetX(hero.gear) then
9592
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   284
					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
   285
				elseif GetX(enemiesOdd[i].gear) > GetX(hero.gear) then
9592
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   286
					HogTurnLeft(enemiesOdd[i].gear, true)
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   287
				end
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   288
			end
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   289
		end
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   290
	end
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   291
end
9596
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   292
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   293
function startBattle()
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   294
	AnimSwitchHog(enemiesOdd[table.getn(enemiesOdd)].gear)
12514
d89dabfd07ce Use EndTurn to replace TurnTimeLeft=0 in ASA campaign (fixes #225)
Wuzzy <almikes@aol.com>
parents: 12468
diff changeset
   295
	EndTurn(true)
9596
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   296
	-- these 2 are needed in order hero has 10 sec more in the first turn
12222
6ffb18cf4c57 Add infinite skipping in fruit03 mission
Wuzzy <almikes@aol.com>
parents: 12088
diff changeset
   297
	timeLeft = 0
6ffb18cf4c57 Add infinite skipping in fruit03 mission
Wuzzy <almikes@aol.com>
parents: 12088
diff changeset
   298
	AddAmmo(hero.gear, amSkip, 100)
9596
feb3d880852d added challenge objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9595
diff changeset
   299
end
9600
7daf157d8b52 fix check if deleted gear is hog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9599
diff changeset
   300
7daf157d8b52 fix check if deleted gear is hog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9599
diff changeset
   301
function isHog(gear)
7daf157d8b52 fix check if deleted gear is hog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9599
diff changeset
   302
	local hog = false
7daf157d8b52 fix check if deleted gear is hog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9599
diff changeset
   303
	for i=1,table.getn(enemiesOdd) do
7daf157d8b52 fix check if deleted gear is hog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9599
diff changeset
   304
		if gear == enemiesOdd[i].gear then
7daf157d8b52 fix check if deleted gear is hog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9599
diff changeset
   305
			hog = true
7daf157d8b52 fix check if deleted gear is hog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9599
diff changeset
   306
			break
7daf157d8b52 fix check if deleted gear is hog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9599
diff changeset
   307
		end
7daf157d8b52 fix check if deleted gear is hog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9599
diff changeset
   308
	end
7daf157d8b52 fix check if deleted gear is hog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9599
diff changeset
   309
	if not hog then
7daf157d8b52 fix check if deleted gear is hog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9599
diff changeset
   310
		for i=1,table.getn(enemiesEven) do
7daf157d8b52 fix check if deleted gear is hog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9599
diff changeset
   311
			if gear == enemiesEven then
7daf157d8b52 fix check if deleted gear is hog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9599
diff changeset
   312
				hog = true
7daf157d8b52 fix check if deleted gear is hog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9599
diff changeset
   313
				break
7daf157d8b52 fix check if deleted gear is hog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9599
diff changeset
   314
			end
7daf157d8b52 fix check if deleted gear is hog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9599
diff changeset
   315
		end
7daf157d8b52 fix check if deleted gear is hog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9599
diff changeset
   316
	end
7daf157d8b52 fix check if deleted gear is hog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9599
diff changeset
   317
	return hog
7daf157d8b52 fix check if deleted gear is hog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9599
diff changeset
   318
end