share/hedgewars/Data/Missions/Training/Basic_Training_-_Bazooka.lua
author Wuzzy <Wuzzy2@mail.ru>
Wed, 15 May 2019 03:25:20 +0200
changeset 14951 c173fae0a223
parent 14928 4c5fb1ee75b7
child 15068 6f51c75994a4
permissions -rw-r--r--
Hide player ranks in training missions
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13073
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
     1
--[[
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
     2
	Basic Bazooka Training
11015
7a905f0070ce CRLF purge
nemo
parents: 10655
diff changeset
     3
13073
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
     4
	This training missions teaches players how to use the bazooka.
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
     5
	Lesson plan:
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
     6
	- Selecting bazooka
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
     7
	- Aiming and shooting
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
     8
	- Wind
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
     9
	- Limited ammo
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    10
	- “Bouncing bomb” / water skip
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    11
	- Precise aiming
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    12
]]
11015
7a905f0070ce CRLF purge
nemo
parents: 10655
diff changeset
    13
7a905f0070ce CRLF purge
nemo
parents: 10655
diff changeset
    14
HedgewarsScriptLoad("/Scripts/Locale.lua")
13497
65c348d6c1fa Add hidden bazooka training achievement for 100% accuracy
Wuzzy <Wuzzy2@mail.ru>
parents: 13354
diff changeset
    15
HedgewarsScriptLoad("/Scripts/Achievements.lua")
11015
7a905f0070ce CRLF purge
nemo
parents: 10655
diff changeset
    16
13073
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    17
local hog			-- Hog gear
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    18
local weaponSelected = false	-- Player has selected the weapon
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    19
local gamePhase = 0		-- Used to track progress
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    20
local targetsLeft = 0		-- # of targets left in this round
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    21
local targetGears = {}		-- list of target gears
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    22
local bazookasInGame = 0	-- # of bazookas currently flying
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    23
local bazookaGears = {}		-- list of bazooka gears
13184
3966ef529313 Basic Bazooka Training: Add one more target, make limited ammo section easier, add more hints
Wuzzy <Wuzzy2@mail.ru>
parents: 13165
diff changeset
    24
local limitedAmmo = 10		-- amount of ammo for the limited ammo challenge
13073
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    25
local limitedAmmoReset = -1	-- Timer for resetting ammo if player fails in
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    26
				-- limited ammo challenge. -1 = no-op
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    27
local gameOver = false		-- If true, game has ended
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    28
local shotsFired = 0		-- Total # of bazookas fired
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    29
local maxTargets = 0		-- Target counter, used together with flawless
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    30
local flawless = true		-- track flawless victory (100% accuracy, no hurt, no death)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    31
local missedTauntTimer = -1	-- Wait timer for playing sndMissed. -1 = no-op
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    32
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    33
function onGameInit()
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    34
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    35
	ClearGameFlags()
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    36
	EnableGameFlags(gfDisableWind, gfOneClanMode, gfInfAttack, gfSolidLand)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    37
	Map = ""
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    38
	Seed = 0
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    39
	Theme = "Nature"
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    40
	MapGen = mgDrawn
13750
110d6c1e817f Lua: Rename globals: NoPointX→NO_CURSOR, cMaxTurnTime→MAX_TURN_TIME, cMaxHogHealth→MAX_HOG_HEALTH
Wuzzy <Wuzzy2@mail.ru>
parents: 13664
diff changeset
    41
	TurnTime = MAX_TURN_TIME
13073
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    42
	Explosives = 0
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    43
	MinesNum = 0
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    44
	CaseFreq = 0
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    45
	WaterRise = 0
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    46
	HealthDecrease = 0
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    47
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    48
	------ TEAM LIST ------
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    49
14480
208359558642 Use player-chosen team identity for training and a few challenges
Wuzzy <Wuzzy2@mail.ru>
parents: 14464
diff changeset
    50
	AddMissionTeam(-1)
208359558642 Use player-chosen team identity for training and a few challenges
Wuzzy <Wuzzy2@mail.ru>
parents: 14464
diff changeset
    51
	hog = AddMissionHog(100)
13073
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    52
	SetGearPosition(hog, 1485, 2001)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    53
	SetEffect(hog, heResurrectable, 1)
11015
7a905f0070ce CRLF purge
nemo
parents: 10655
diff changeset
    54
13073
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    55
	SendHealthStatsOff()
14951
c173fae0a223 Hide player ranks in training missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14928
diff changeset
    56
	SendRankingStatsOff()
13073
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    57
end
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    58
13630
fe7d2bbf5f3f Fix resurrection animation appearing at wrong position for some missions and styles
Wuzzy <Wuzzy2@mail.ru>
parents: 13583
diff changeset
    59
function onGearResurrect(gear, vGear)
13073
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    60
	if gear == hog then
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    61
		flawless = false
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    62
		SetGearPosition(hog, 1485, 2001)
13630
fe7d2bbf5f3f Fix resurrection animation appearing at wrong position for some missions and styles
Wuzzy <Wuzzy2@mail.ru>
parents: 13583
diff changeset
    63
		if vGear then
fe7d2bbf5f3f Fix resurrection animation appearing at wrong position for some missions and styles
Wuzzy <Wuzzy2@mail.ru>
parents: 13583
diff changeset
    64
			SetVisualGearValues(vGear, GetX(hog), GetY(hog))
fe7d2bbf5f3f Fix resurrection animation appearing at wrong position for some missions and styles
Wuzzy <Wuzzy2@mail.ru>
parents: 13583
diff changeset
    65
		end
13073
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    66
		AddCaption(loc("Your hedgehog has been revived!"))
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    67
	end
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    68
end
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    69
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    70
function placeGirders()
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    71
	PlaceGirder(1520, 2018, 4)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    72
	PlaceGirder(1449, 1927, 6)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    73
	PlaceGirder(1341, 1989, 0)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    74
	PlaceGirder(1141, 1990, 0)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    75
	PlaceGirder(2031, 1907, 6)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    76
	PlaceGirder(2031, 1745, 6)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    77
	PlaceGirder(2398, 1985, 4)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    78
	PlaceGirder(2542, 1921, 7)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    79
	PlaceGirder(2617, 1954, 6)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    80
	PlaceGirder(2565, 2028, 0)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    81
	PlaceGirder(2082, 1979, 0)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    82
	PlaceGirder(2082, 1673, 0)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    83
	PlaceGirder(1980, 1836, 0)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    84
	PlaceGirder(1716, 1674, 0)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    85
	PlaceGirder(1812, 1832, 0)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    86
	PlaceGirder(1665, 1744, 6)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    87
	PlaceGirder(2326, 1895, 6)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    88
	PlaceGirder(2326, 1734, 6)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    89
	PlaceGirder(2326, 1572, 6)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    90
	PlaceGirder(2275, 1582, 0)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    91
	PlaceGirder(1738, 1714, 7)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    92
	PlaceGirder(1818, 1703, 0)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    93
	PlaceGirder(1939, 1703, 4)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    94
	PlaceGirder(2805, 1781, 3)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    95
	PlaceGirder(2905, 1621, 3)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
    96
	PlaceGirder(3005, 1441, 3)
13184
3966ef529313 Basic Bazooka Training: Add one more target, make limited ammo section easier, add more hints
Wuzzy <Wuzzy2@mail.ru>
parents: 13165
diff changeset
    97
	PlaceGirder(945, 1340, 5)
11015
7a905f0070ce CRLF purge
nemo
parents: 10655
diff changeset
    98
end
7a905f0070ce CRLF purge
nemo
parents: 10655
diff changeset
    99
13073
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   100
function spawnTargets(phase)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   101
	if not phase then
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   102
		phase = gamePhase
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   103
	end
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   104
	if phase == 0 then
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   105
		AddGear(1734, 1656, gtTarget, 0, 0, 0, 0)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   106
		AddGear(1812, 1814, gtTarget, 0, 0, 0, 0)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   107
		AddGear(1974, 1818, gtTarget, 0, 0, 0, 0)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   108
	elseif phase == 2 then
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   109
		AddGear(2102, 1655, gtTarget, 0, 0, 0, 0)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   110
		AddGear(2278, 1564, gtTarget, 0, 0, 0, 0)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   111
		AddGear(2080, 1961, gtTarget, 0, 0, 0, 0)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   112
	elseif phase == 3 then
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   113
		AddGear(1141, 1972, gtTarget, 0, 0, 0, 0)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   114
		AddGear(1345, 1971, gtTarget, 0, 0, 0, 0)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   115
		AddGear(1892, 1680, gtTarget, 0, 0, 0, 0)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   116
	elseif phase == 4 then
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   117
		AddGear(2584, 2010, gtTarget, 0, 0, 0, 0)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   118
	elseif phase == 5 then
13184
3966ef529313 Basic Bazooka Training: Add one more target, make limited ammo section easier, add more hints
Wuzzy <Wuzzy2@mail.ru>
parents: 13165
diff changeset
   119
		AddGear(955, 1320, gtTarget, 0, 0, 0, 0)
3966ef529313 Basic Bazooka Training: Add one more target, make limited ammo section easier, add more hints
Wuzzy <Wuzzy2@mail.ru>
parents: 13165
diff changeset
   120
	elseif phase == 6 then
13073
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   121
		AddGear(2794, 1759, gtTarget, 0, 0, 0, 0)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   122
		AddGear(2894, 1599, gtTarget, 0, 0, 0, 0)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   123
		AddGear(2994, 1419, gtTarget, 0, 0, 0, 0)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   124
	end
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   125
end
11015
7a905f0070ce CRLF purge
nemo
parents: 10655
diff changeset
   126
13073
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   127
function onGameStart()
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   128
	placeGirders()
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   129
	spawnTargets()
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   130
	ShowMission(loc("Basic Bazooka Training"), loc("Basic Training"), loc("Destroy all the targets!"), -amBazooka, 0)
11015
7a905f0070ce CRLF purge
nemo
parents: 10655
diff changeset
   131
end
7a905f0070ce CRLF purge
nemo
parents: 10655
diff changeset
   132
13073
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   133
function newGamePhase()
14382
f9d4b8222903 Add tutorial texts for Touch interface
Wuzzy <Wuzzy2@mail.ru>
parents: 13750
diff changeset
   134
	local ctrl = ""
13073
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   135
	-- Spawn targets, update wind and ammo, show instructions
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   136
	if gamePhase == 0 then
14382
f9d4b8222903 Add tutorial texts for Touch interface
Wuzzy <Wuzzy2@mail.ru>
parents: 13750
diff changeset
   137
		if INTERFACE == "desktop" then
f9d4b8222903 Add tutorial texts for Touch interface
Wuzzy <Wuzzy2@mail.ru>
parents: 13750
diff changeset
   138
			ctrl = loc("Open ammo menu: [Right click]").."|"..
f9d4b8222903 Add tutorial texts for Touch interface
Wuzzy <Wuzzy2@mail.ru>
parents: 13750
diff changeset
   139
			loc("Select weapon: [Left click]")
f9d4b8222903 Add tutorial texts for Touch interface
Wuzzy <Wuzzy2@mail.ru>
parents: 13750
diff changeset
   140
		elseif INTERFACE == "touch" then
14388
cf49fac6e88a Make better re-use of some mission strings
Wuzzy <Wuzzy2@mail.ru>
parents: 14382
diff changeset
   141
			ctrl = loc("Open ammo menu: Tap the [Suitcase]")
14382
f9d4b8222903 Add tutorial texts for Touch interface
Wuzzy <Wuzzy2@mail.ru>
parents: 13750
diff changeset
   142
		end
13073
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   143
		ShowMission(loc("Basic Bazooka Training"), loc("Select Weapon"), loc("To begin with the training, select the bazooka from the ammo menu!").."|"..
14382
f9d4b8222903 Add tutorial texts for Touch interface
Wuzzy <Wuzzy2@mail.ru>
parents: 13750
diff changeset
   144
		ctrl, 2, 5000)
13073
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   145
	elseif gamePhase == 1 then
14382
f9d4b8222903 Add tutorial texts for Touch interface
Wuzzy <Wuzzy2@mail.ru>
parents: 13750
diff changeset
   146
		if INTERFACE == "desktop" then
f9d4b8222903 Add tutorial texts for Touch interface
Wuzzy <Wuzzy2@mail.ru>
parents: 13750
diff changeset
   147
			ctrl = loc("Attack: [Space]").."|"..
f9d4b8222903 Add tutorial texts for Touch interface
Wuzzy <Wuzzy2@mail.ru>
parents: 13750
diff changeset
   148
			loc("Aim: [Up]/[Down]").."|"..
f9d4b8222903 Add tutorial texts for Touch interface
Wuzzy <Wuzzy2@mail.ru>
parents: 13750
diff changeset
   149
			loc("Walk: [Left]/[Right]")
f9d4b8222903 Add tutorial texts for Touch interface
Wuzzy <Wuzzy2@mail.ru>
parents: 13750
diff changeset
   150
		elseif INTERFACE == "touch" then
14388
cf49fac6e88a Make better re-use of some mission strings
Wuzzy <Wuzzy2@mail.ru>
parents: 14382
diff changeset
   151
			ctrl = loc("Attack: Tap the [Bomb]").."|"..
14382
f9d4b8222903 Add tutorial texts for Touch interface
Wuzzy <Wuzzy2@mail.ru>
parents: 13750
diff changeset
   152
			loc("Aim: [Up]/[Down]").."|"..
f9d4b8222903 Add tutorial texts for Touch interface
Wuzzy <Wuzzy2@mail.ru>
parents: 13750
diff changeset
   153
			loc("Walk: [Left]/[Right]")
f9d4b8222903 Add tutorial texts for Touch interface
Wuzzy <Wuzzy2@mail.ru>
parents: 13750
diff changeset
   154
		end
f9d4b8222903 Add tutorial texts for Touch interface
Wuzzy <Wuzzy2@mail.ru>
parents: 13750
diff changeset
   155
		ShowMission(loc("Basic Bazooka Training"), loc("My First Bazooka"),
f9d4b8222903 Add tutorial texts for Touch interface
Wuzzy <Wuzzy2@mail.ru>
parents: 13750
diff changeset
   156
		loc("Let's get started!").."|"..
13073
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   157
		loc("Launch some bazookas to destroy the targets!").."|"..
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   158
		loc("Hold the Attack key pressed for more power.").."|"..
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   159
		loc("Don't hit yourself!").."|"..
14382
f9d4b8222903 Add tutorial texts for Touch interface
Wuzzy <Wuzzy2@mail.ru>
parents: 13750
diff changeset
   160
		ctrl, 2, 10000)
13073
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   161
		spawnTargets()
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   162
	elseif gamePhase == 2 then
14382
f9d4b8222903 Add tutorial texts for Touch interface
Wuzzy <Wuzzy2@mail.ru>
parents: 13750
diff changeset
   163
		if INTERFACE == "desktop" then
f9d4b8222903 Add tutorial texts for Touch interface
Wuzzy <Wuzzy2@mail.ru>
parents: 13750
diff changeset
   164
			ctrl = loc("You see the wind strength at the bottom right corner.")
f9d4b8222903 Add tutorial texts for Touch interface
Wuzzy <Wuzzy2@mail.ru>
parents: 13750
diff changeset
   165
		elseif INTERFACE == "touch" then
f9d4b8222903 Add tutorial texts for Touch interface
Wuzzy <Wuzzy2@mail.ru>
parents: 13750
diff changeset
   166
			ctrl = loc("You see the wind strength at the top.")
f9d4b8222903 Add tutorial texts for Touch interface
Wuzzy <Wuzzy2@mail.ru>
parents: 13750
diff changeset
   167
		end
13073
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   168
		ShowMission(loc("Basic Bazooka Training"), loc("Wind"), loc("Bazookas are influenced by wind.").."|"..
14382
f9d4b8222903 Add tutorial texts for Touch interface
Wuzzy <Wuzzy2@mail.ru>
parents: 13750
diff changeset
   169
		ctrl.."|"..
13073
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   170
		loc("Destroy the targets!"), 2, 5000)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   171
		SetWind(50)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   172
		spawnTargets()
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   173
	elseif gamePhase == 3 then
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   174
		-- Vaporize any bazookas still in the air
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   175
		for gear, _ in pairs(bazookaGears) do
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   176
			AddVisualGear(GetX(gear), GetY(gear), vgtSteam, 0, false)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   177
			DeleteGear(gear)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   178
			PlaySound(sndVaporize)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   179
		end
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   180
		ShowMission(loc("Basic Bazooka Training"), loc("Limited Ammo"), loc("Your ammo is limited this time.").."|"..
13184
3966ef529313 Basic Bazooka Training: Add one more target, make limited ammo section easier, add more hints
Wuzzy <Wuzzy2@mail.ru>
parents: 13165
diff changeset
   181
		loc("Destroy all targets with no more than 10 bazookas."),
13073
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   182
		2, 8000)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   183
		SetWind(-20)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   184
		AddAmmo(hog, amBazooka, limitedAmmo)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   185
		spawnTargets()
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   186
	elseif gamePhase == 4 then
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   187
		ShowMission(loc("Basic Bazooka Training"), loc("Bouncing Bomb"), loc("The next target can only be reached by something called “bouncing bomb”.").."|"..
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   188
		loc("Hint: Launch the bazooka horizontally at full power."),
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   189
		2, 8000)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   190
		SetWind(90)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   191
		spawnTargets()
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   192
		AddAmmo(hog, amBazooka, 100)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   193
		if GetCurAmmoType() ~= amBazooka then
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   194
			SetWeapon(amBazooka)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   195
		end
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   196
	elseif gamePhase == 5 then
13184
3966ef529313 Basic Bazooka Training: Add one more target, make limited ammo section easier, add more hints
Wuzzy <Wuzzy2@mail.ru>
parents: 13165
diff changeset
   197
		ShowMission(loc("Basic Bazooka Training"), loc("High Target"),
13354
f9a15dcd857c Fix a couple of English typos
Wuzzy <Wuzzy2@mail.ru>
parents: 13190
diff changeset
   198
		loc("By the way, not only bazookas will bounce on water, but also grenades and many other things.").."|"..
13184
3966ef529313 Basic Bazooka Training: Add one more target, make limited ammo section easier, add more hints
Wuzzy <Wuzzy2@mail.ru>
parents: 13165
diff changeset
   199
		loc("The next target is high in the sky."),
13073
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   200
		2, 8000)
13184
3966ef529313 Basic Bazooka Training: Add one more target, make limited ammo section easier, add more hints
Wuzzy <Wuzzy2@mail.ru>
parents: 13165
diff changeset
   201
		SetWind(-33)
3966ef529313 Basic Bazooka Training: Add one more target, make limited ammo section easier, add more hints
Wuzzy <Wuzzy2@mail.ru>
parents: 13165
diff changeset
   202
		spawnTargets()
3966ef529313 Basic Bazooka Training: Add one more target, make limited ammo section easier, add more hints
Wuzzy <Wuzzy2@mail.ru>
parents: 13165
diff changeset
   203
	elseif gamePhase == 6 then
14382
f9d4b8222903 Add tutorial texts for Touch interface
Wuzzy <Wuzzy2@mail.ru>
parents: 13750
diff changeset
   204
		if INTERFACE == "desktop" then
f9d4b8222903 Add tutorial texts for Touch interface
Wuzzy <Wuzzy2@mail.ru>
parents: 13750
diff changeset
   205
			ctrl = loc("Precise Aim: [Left Shift] + [Up]/[Down]").."|"
f9d4b8222903 Add tutorial texts for Touch interface
Wuzzy <Wuzzy2@mail.ru>
parents: 13750
diff changeset
   206
		end
13184
3966ef529313 Basic Bazooka Training: Add one more target, make limited ammo section easier, add more hints
Wuzzy <Wuzzy2@mail.ru>
parents: 13165
diff changeset
   207
		ShowMission(loc("Basic Bazooka Training"), loc("Final Targets"),
3966ef529313 Basic Bazooka Training: Add one more target, make limited ammo section easier, add more hints
Wuzzy <Wuzzy2@mail.ru>
parents: 13165
diff changeset
   208
		loc("The final targets are quite tricky. You need to aim well.").."|"..
14382
f9d4b8222903 Add tutorial texts for Touch interface
Wuzzy <Wuzzy2@mail.ru>
parents: 13750
diff changeset
   209
		ctrl..
13190
f9c787f58459 Update German Lua translation
Wuzzy <Wuzzy2@mail.ru>
parents: 13184
diff changeset
   210
		loc("Hint: It might be easier if you vary the angle only slightly."),
13184
3966ef529313 Basic Bazooka Training: Add one more target, make limited ammo section easier, add more hints
Wuzzy <Wuzzy2@mail.ru>
parents: 13165
diff changeset
   211
		2, 12000)
13073
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   212
		SetWind(75)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   213
		spawnTargets()
13184
3966ef529313 Basic Bazooka Training: Add one more target, make limited ammo section easier, add more hints
Wuzzy <Wuzzy2@mail.ru>
parents: 13165
diff changeset
   214
	elseif gamePhase == 7 then
14464
ead8928a59f8 Report mission victory for most missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14388
diff changeset
   215
		SaveMissionVar("Won", "true")
13073
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   216
		ShowMission(loc("Basic Bazooka Training"), loc("Training complete!"), loc("Congratulations!"), 0, 0)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   217
		SetInputMask(0)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   218
		AddAmmo(CurrentHedgehog, amBazooka, 0)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   219
		if shotsFired > maxTargets then
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   220
			flawless = false
13497
65c348d6c1fa Add hidden bazooka training achievement for 100% accuracy
Wuzzy <Wuzzy2@mail.ru>
parents: 13354
diff changeset
   221
		else
65c348d6c1fa Add hidden bazooka training achievement for 100% accuracy
Wuzzy <Wuzzy2@mail.ru>
parents: 13354
diff changeset
   222
			-- For 100% accuracy
65c348d6c1fa Add hidden bazooka training achievement for 100% accuracy
Wuzzy <Wuzzy2@mail.ru>
parents: 13354
diff changeset
   223
			awardAchievement(loc("Bazooka Master"))
13073
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   224
		end
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   225
		if flawless then
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   226
			PlaySound(sndFlawless, hog)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   227
		else
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   228
			PlaySound(sndVictory, hog)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   229
		end
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   230
		SendStat(siCustomAchievement, loc("Good job!"))
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   231
		SendStat(siGameResult, loc("You have completed the Basic Bazooka Training!"))
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   232
		EndGame()
14928
4c5fb1ee75b7 Add winner animation for missions that didn't have it
Wuzzy <Wuzzy2@mail.ru>
parents: 14480
diff changeset
   233
		SetState(hog, gstWinner)
13073
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   234
		gameOver = true
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   235
	end
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   236
	gamePhase = gamePhase + 1
11015
7a905f0070ce CRLF purge
nemo
parents: 10655
diff changeset
   237
end
7a905f0070ce CRLF purge
nemo
parents: 10655
diff changeset
   238
7a905f0070ce CRLF purge
nemo
parents: 10655
diff changeset
   239
function onNewTurn()
13073
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   240
	if gamePhase == 0 then
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   241
		newGamePhase()
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   242
	end
11015
7a905f0070ce CRLF purge
nemo
parents: 10655
diff changeset
   243
end
7a905f0070ce CRLF purge
nemo
parents: 10655
diff changeset
   244
13073
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   245
function onHogAttack(ammoType)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   246
	if ammoType == amBazooka then
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   247
		HideMission()
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   248
	end
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   249
end
11015
7a905f0070ce CRLF purge
nemo
parents: 10655
diff changeset
   250
13503
c5d7376fa58a Bazooka/Grende training: Hide mission panel on pressing attack key
Wuzzy <Wuzzy2@mail.ru>
parents: 13497
diff changeset
   251
function onAttack()
c5d7376fa58a Bazooka/Grende training: Hide mission panel on pressing attack key
Wuzzy <Wuzzy2@mail.ru>
parents: 13497
diff changeset
   252
	if GetCurAmmoType() == amBazooka then
c5d7376fa58a Bazooka/Grende training: Hide mission panel on pressing attack key
Wuzzy <Wuzzy2@mail.ru>
parents: 13497
diff changeset
   253
		HideMission()
c5d7376fa58a Bazooka/Grende training: Hide mission panel on pressing attack key
Wuzzy <Wuzzy2@mail.ru>
parents: 13497
diff changeset
   254
	end
c5d7376fa58a Bazooka/Grende training: Hide mission panel on pressing attack key
Wuzzy <Wuzzy2@mail.ru>
parents: 13497
diff changeset
   255
end
c5d7376fa58a Bazooka/Grende training: Hide mission panel on pressing attack key
Wuzzy <Wuzzy2@mail.ru>
parents: 13497
diff changeset
   256
13073
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   257
function onGearAdd(gear)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   258
	if GetGearType(gear) == gtTarget then
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   259
		targetsLeft = targetsLeft + 1
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   260
		maxTargets = maxTargets + 1
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   261
		targetGears[gear] = true
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   262
	elseif GetGearType(gear) == gtShell then
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   263
		bazookasInGame = bazookasInGame + 1
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   264
		bazookaGears[gear] = true
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   265
		shotsFired = shotsFired + 1
11015
7a905f0070ce CRLF purge
nemo
parents: 10655
diff changeset
   266
	end
7a905f0070ce CRLF purge
nemo
parents: 10655
diff changeset
   267
end
7a905f0070ce CRLF purge
nemo
parents: 10655
diff changeset
   268
13073
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   269
function onGearDelete(gear)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   270
	if GetGearType(gear) == gtTarget then
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   271
		targetsLeft = targetsLeft - 1
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   272
		targetGears[gear] = nil
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   273
		if targetsLeft <= 0 then
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   274
			newGamePhase()
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   275
		end
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   276
	elseif GetGearType(gear) == gtShell then
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   277
		bazookasInGame = bazookasInGame - 1
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   278
		bazookaGears[gear] = nil
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   279
		if bazookasInGame == 0 and GetAmmoCount(hog, amBazooka) == 0 then
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   280
			limitedAmmoReset = 20
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   281
			flawless = false
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   282
		end
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   283
	end
11015
7a905f0070ce CRLF purge
nemo
parents: 10655
diff changeset
   284
end
7a905f0070ce CRLF purge
nemo
parents: 10655
diff changeset
   285
13073
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   286
function onGearDamage(gear)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   287
	if gear == hog then
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   288
		flawless = false
11015
7a905f0070ce CRLF purge
nemo
parents: 10655
diff changeset
   289
	end
7a905f0070ce CRLF purge
nemo
parents: 10655
diff changeset
   290
end
7a905f0070ce CRLF purge
nemo
parents: 10655
diff changeset
   291
13073
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   292
function onGameTick20()
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   293
	-- Reset targets and ammo if ammo depleted
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   294
	if limitedAmmoReset > 0 then
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   295
		limitedAmmoReset = limitedAmmoReset - 20
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   296
	end
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   297
	if limitedAmmoReset == 0 then
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   298
		if not gameOver and bazookasInGame == 0 and GetAmmoCount(hog, amBazooka) == 0 then
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   299
			for gear, _ in pairs(targetGears) do
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   300
				DeleteGear(gear)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   301
			end
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   302
			spawnTargets(3)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   303
			AddCaption(loc("Out of ammo! Try again!"))
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   304
			AddAmmo(hog, amBazooka, limitedAmmo)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   305
			SetWeapon(amBazooka)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   306
			missedTauntTimer = 1000
11015
7a905f0070ce CRLF purge
nemo
parents: 10655
diff changeset
   307
		end
13073
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   308
		limitedAmmoReset = -1
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   309
	end
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   310
	if missedTauntTimer > 0 then
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   311
		missedTauntTimer = missedTauntTimer - 20
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   312
	end
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   313
	if missedTauntTimer == 0 then
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   314
		PlaySound(sndMissed, hog)
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   315
		missedTauntTimer = -1
11015
7a905f0070ce CRLF purge
nemo
parents: 10655
diff changeset
   316
	end
13165
89a6b862e692 Bazooka/Grenade Training: Make weapon selection detection future-proof
Wuzzy <Wuzzy2@mail.ru>
parents: 13076
diff changeset
   317
89a6b862e692 Bazooka/Grenade Training: Make weapon selection detection future-proof
Wuzzy <Wuzzy2@mail.ru>
parents: 13076
diff changeset
   318
	if not weaponSelected and gamePhase == 1 and GetCurAmmoType() == amBazooka then
89a6b862e692 Bazooka/Grenade Training: Make weapon selection detection future-proof
Wuzzy <Wuzzy2@mail.ru>
parents: 13076
diff changeset
   319
		newGamePhase()
89a6b862e692 Bazooka/Grenade Training: Make weapon selection detection future-proof
Wuzzy <Wuzzy2@mail.ru>
parents: 13076
diff changeset
   320
		weaponSelected = true
89a6b862e692 Bazooka/Grenade Training: Make weapon selection detection future-proof
Wuzzy <Wuzzy2@mail.ru>
parents: 13076
diff changeset
   321
	end
11015
7a905f0070ce CRLF purge
nemo
parents: 10655
diff changeset
   322
end
7a905f0070ce CRLF purge
nemo
parents: 10655
diff changeset
   323
13073
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   324
function onAmmoStoreInit()
bd629a70b4a1 Complete redo of Basic Bazooka Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12425
diff changeset
   325
	SetAmmo(amBazooka, 9, 0, 0, 0)
11015
7a905f0070ce CRLF purge
nemo
parents: 10655
diff changeset
   326
end