share/hedgewars/Data/Scripts/Multiplayer/The_Specialists.lua
author Wuzzy <Wuzzy2@mail.ru>
Sat, 05 Jan 2019 20:32:48 +0100
changeset 14522 2fd8f4cd3aa4
parent 14521 f5487302d53b
child 14523 a97216ff1c51
permissions -rw-r--r--
Clean up indents and comments in The_Specialists.lua
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
     1
----------------------------------
14522
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
     2
-- THE SPECIALISTS
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
     3
-- original style by mikade
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
     4
----------------------------------
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
     5
14522
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
     6
--------------------
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
     7
-- TODO
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
     8
--------------------
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
     9
-- add proper gameflag checking, maybe (so that we can throw in a .cfg and let the users break everything)
5362
5f0c46e78e50 Enable autoswitch on turn start for The Specialists Mode.
mikade
parents: 5277
diff changeset
    10
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
    11
8043
da083f8d95e6 We need custom script loading function in lua now
unc0rr
parents: 7143
diff changeset
    12
HedgewarsScriptLoad("/Scripts/Locale.lua")
da083f8d95e6 We need custom script loading function in lua now
unc0rr
parents: 7143
diff changeset
    13
HedgewarsScriptLoad("/Scripts/Tracker.lua")
14521
f5487302d53b Allow customising the teams
nemo
parents: 14406
diff changeset
    14
HedgewarsScriptLoad("/Scripts/Params.lua")
f5487302d53b Allow customising the teams
nemo
parents: 14406
diff changeset
    15
14522
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
    16
--[[
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
    17
Specialist letters:
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
    18
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
    19
  S=[S]oldier
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
    20
  E=[E]ngineer
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
    21
  N=[N]inja
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
    22
  D=[D]emo
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
    23
  X=Sniper
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
    24
  H=Saint ([H]oly)
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
    25
  P=[P]yro
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
    26
  C=Loon ([C]lown)
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
    27
]]
14521
f5487302d53b Allow customising the teams
nemo
parents: 14406
diff changeset
    28
-- default team values
f5487302d53b Allow customising the teams
nemo
parents: 14406
diff changeset
    29
local currTeamIdx = 0;
14522
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
    30
local teamRoles = {
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
    31
	{'S','E','N','D','X','H','P','C'},
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
    32
	{'S','E','N','D','X','H','P','C'},
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
    33
	{'S','E','N','D','X','H','P','C'},
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
    34
	{'S','E','N','D','X','H','P','C'},
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
    35
	{'S','E','N','D','X','H','P','C'},
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
    36
	{'S','E','N','D','X','H','P','C'},
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
    37
	{'S','E','N','D','X','H','P','C'},
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
    38
	{'S','E','N','D','X','H','P','C'}
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
    39
};
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
    40
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
    41
local numhhs = 0
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
    42
local hhs = {}
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
    43
5362
5f0c46e78e50 Enable autoswitch on turn start for The Specialists Mode.
mikade
parents: 5277
diff changeset
    44
local started = false
5457
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
    45
14521
f5487302d53b Allow customising the teams
nemo
parents: 14406
diff changeset
    46
function onParameters()
f5487302d53b Allow customising the teams
nemo
parents: 14406
diff changeset
    47
	parseParams()
f5487302d53b Allow customising the teams
nemo
parents: 14406
diff changeset
    48
	for i = 1, 8 do
14522
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
    49
		if params['t'..i] ~= nil then
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
    50
			for j = 1, 8 do
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
    51
				if string.len(params['t'..i]) >= j  then
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
    52
					teamRoles[i][j] = string.upper(string.sub(params['t'..i],j,j));
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
    53
				end
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
    54
			end
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
    55
		end
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
    56
	end
14521
f5487302d53b Allow customising the teams
nemo
parents: 14406
diff changeset
    57
end
f5487302d53b Allow customising the teams
nemo
parents: 14406
diff changeset
    58
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    59
function onNewAmmoStore(groupIndex, hogIndex)
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
    60
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    61
	SetAmmo(amSkip, 9, 0, 0, 0)
14522
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
    62
	groupIndex = groupIndex + 1
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
    63
	hogIndex = hogIndex + 1
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
    64
14522
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
    65
	if teamRoles[groupIndex][hogIndex] == 'S' then
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    66
		SetAmmo(amBazooka, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    67
		SetAmmo(amGrenade, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    68
		SetAmmo(amShotgun, 1, 0, 0, 0)
14522
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
    69
	elseif teamRoles[groupIndex][hogIndex] == 'E' then
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    70
		SetAmmo(amGirder, 2, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    71
		SetAmmo(amBlowTorch, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    72
		SetAmmo(amPickHammer, 1, 0, 0, 0)
14522
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
    73
	elseif teamRoles[groupIndex][hogIndex] == 'N' then
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    74
		SetAmmo(amRope, 9, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    75
		SetAmmo(amParachute, 9, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    76
		SetAmmo(amFirePunch, 1, 0, 0, 0)
14522
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
    77
	elseif teamRoles[groupIndex][hogIndex] == 'D' then
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    78
		SetAmmo(amDynamite, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    79
		SetAmmo(amMine, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    80
		SetAmmo(amDrill, 1, 0, 0, 0)
14522
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
    81
	elseif teamRoles[groupIndex][hogIndex] == 'X' then
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    82
		SetAmmo(amSniperRifle, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    83
		SetAmmo(amDEagle, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    84
		SetAmmo(amPortalGun, 2, 0, 0, 0)
14522
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
    85
	elseif teamRoles[groupIndex][hogIndex] == 'H' then
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    86
		SetAmmo(amSeduction, 9, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    87
		SetAmmo(amResurrector, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    88
		SetAmmo(amInvulnerable, 1, 0, 0, 0)
14522
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
    89
		SetAmmo(amLowGravity, 1, 0, 0, 0)
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
    90
	elseif teamRoles[groupIndex][hogIndex] == 'P' then
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    91
		SetAmmo(amFlamethrower, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    92
		SetAmmo(amMolotov, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    93
		SetAmmo(amNapalm, 1, 0, 0, 0)
14522
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
    94
	elseif teamRoles[groupIndex][hogIndex] == 'C' then
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    95
		SetAmmo(amBaseballBat, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    96
		SetAmmo(amGasBomb, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    97
		SetAmmo(amKamikaze, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    98
	end
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
    99
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   100
end
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   101
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   102
function CreateTeam()
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   103
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   104
	currTeam = ""
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   105
	lastTeam = ""
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   106
	z = 0
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   107
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   108
	for i = 0, (numhhs-1) do
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   109
14522
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
   110
		currTeam = GetHogTeamName(hhs[i])
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   111
14522
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
   112
		if currTeam == lastTeam then
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
   113
			z = z + 1
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
   114
		else
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
   115
			z = 1
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
   116
			currTeamIdx = currTeamIdx + 1;
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
   117
		end
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   118
14522
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
   119
		if teamRoles[currTeamIdx][z] == 'S' then
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   120
14522
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
   121
			SetHogName(hhs[i],loc("Soldier"))
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
   122
			SetHogHat(hhs[i], "sf_vega")
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
   123
			SetHealth(hhs[i],200)
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   124
14522
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
   125
		elseif teamRoles[currTeamIdx][z] == 'E' then
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   126
14522
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
   127
			SetHogHat(hhs[i], "Glasses")
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
   128
			SetHogName(hhs[i],loc("Engineer"))
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   129
14522
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
   130
		elseif teamRoles[currTeamIdx][z] == 'N' then
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   131
14522
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
   132
			SetHogName(hhs[i],loc("Ninja"))
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
   133
			SetHogHat(hhs[i], "NinjaFull")
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
   134
			SetHealth(hhs[i],80)
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   135
14522
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
   136
		elseif teamRoles[currTeamIdx][z] == 'D' then
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   137
14522
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
   138
			SetHogName(hhs[i],loc("Demo"))
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
   139
			SetHogHat(hhs[i], "Skull")
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
   140
			SetHealth(hhs[i],200)
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   141
14522
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
   142
		elseif teamRoles[currTeamIdx][z] == 'X' then
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   143
14522
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
   144
			SetHogName(hhs[i],loc("Sniper"))
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
   145
			SetHogHat(hhs[i], "Sniper")
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
   146
			SetHealth(hhs[i],120)
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   147
14522
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
   148
		elseif teamRoles[currTeamIdx][z] == 'H' then
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   149
14522
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
   150
			SetHogName(hhs[i],loc("Saint"))
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
   151
			SetHogHat(hhs[i], "angel")
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
   152
			SetHealth(hhs[i],300)
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   153
14522
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
   154
		elseif teamRoles[currTeamIdx][z] == 'P' then
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   155
14522
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
   156
			SetHogName(hhs[i],loc("Pyro"))
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
   157
			SetHogHat(hhs[i], "Gasmask")
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
   158
			SetHealth(hhs[i],150)
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   159
14522
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
   160
		elseif teamRoles[currTeamIdx][z] == 'C' then
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   161
14522
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
   162
			SetHogName(hhs[i],loc("Loon"))
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
   163
			SetHogHat(hhs[i], "clown")
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
   164
			SetHealth(hhs[i],100)
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   165
14522
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
   166
		end
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   167
14522
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
   168
		lastTeam = GetHogTeamName(hhs[i])
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   169
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   170
	end
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   171
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   172
end
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   173
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   174
function onGameInit()
10036
3be36d2fdca6 use new API for changing GameFlags
sheepluva
parents: 8043
diff changeset
   175
	ClearGameFlags()
14521
f5487302d53b Allow customising the teams
nemo
parents: 14406
diff changeset
   176
	EnableGameFlags(gfResetWeps, gfInfAttack, gfPlaceHog, gfPerHogAmmo, gfSwitchHog)
5817
70208e400a59 For now, don't spawn anything other than health crates.
mikade
parents: 5797
diff changeset
   177
	HealthCaseProb = 100
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   178
end
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   179
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   180
function onGameStart()
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   181
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   182
	CreateTeam()
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   183
14522
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
   184
	ShowMission(
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
   185
		loc("THE SPECIALISTS"),
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
   186
		loc("a Hedgewars mini-game"),
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
   187
		loc("Eliminate the enemy specialists.") .. "|" ..
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
   188
		" " .. "|" ..
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
   189
		loc("Game Modifiers: ") .. "|" ..
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
   190
		loc("Per-Hog Ammo") .. "|" ..
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
   191
		loc("Weapons Reset") .. "|" ..
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
   192
		loc("Unlimited Attacks") .. "|" ..
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
   193
		"", 4, 4000
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
   194
	)
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   195
5457
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   196
	trackTeams()
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   197
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   198
end
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   199
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   200
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   201
function onNewTurn()
13278
8f579173b161 The Specialits: Use gfSwitchHog for hog switching and delete the terrible Lua hacks
Wuzzy <Wuzzy2@mail.ru>
parents: 12355
diff changeset
   202
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   203
	started = true
13278
8f579173b161 The Specialits: Use gfSwitchHog for hog switching and delete the terrible Lua hacks
Wuzzy <Wuzzy2@mail.ru>
parents: 12355
diff changeset
   204
	AddCaption(loc("Prepare yourself") .. ", " .. GetHogName(CurrentHedgehog).. "!")
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   205
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   206
end
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   207
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   208
function onGearAdd(gear)
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   209
14522
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14521
diff changeset
   210
	if GetGearType(gear) == gtHedgehog then
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   211
		hhs[numhhs] = gear
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   212
		numhhs = numhhs + 1
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   213
	elseif (GetGearType(gear) == gtMine) and (started == true) then
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5817
diff changeset
   214
		SetTimer(gear,5000)
5457
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   215
	end
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5817
diff changeset
   216
5457
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   217
	if (GetGearType(gear) == gtHedgehog) or (GetGearType(gear) == gtResurrector) then
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   218
		trackGear(gear)
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5817
diff changeset
   219
	end
5457
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   220
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   221
end
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   222
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   223
function onGearDelete(gear)
5457
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   224
	if (GetGearType(gear) == gtHedgehog) or (GetGearType(gear) == gtResurrector) then
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   225
		trackDeletion(gear)
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5817
diff changeset
   226
	end
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   227
end
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   228