share/hedgewars/Data/Scripts/Multiplayer/Continental_supplies.lua
changeset 13360 e27540ad33bd
parent 13359 7d772358dc22
child 13362 8a9a723eb185
equal deleted inserted replaced
13359:7d772358dc22 13360:e27540ad33bd
    45 		return 1
    45 		return 1
    46 	end
    46 	end
    47 end
    47 end
    48 
    48 
    49 --Will end the turn + give escape time
    49 --Will end the turn + give escape time
    50 function EndTurn(seconds)
    50 function EndTurnCS(seconds)
    51 	SetState(CurrentHedgehog,bor(GetState(CurrentHedgehog),gstAttacked))
    51 	--set escape time
    52 	--set espace time
       
    53 	TurnTimeLeft = GetAwayTime*10*seconds
    52 	TurnTimeLeft = GetAwayTime*10*seconds
       
    53 	if TurnTimeLeft > 0 then
       
    54 		Retreat(TurnTimeLeft, false)
       
    55 	end
    54  end
    56  end
    55 
    57 
    56  --show health tag (will mostly be used when a hog is damaged)
    58  --show health tag (will mostly be used when a hog is damaged)
    57 function ShowDamageTag(hog,damage)
    59 function ShowDamageTag(hog,damage)
    58 	healthtag=AddVisualGear(GetX(hog), GetY(hog), vgtHealthTag, damage, false)
    60 	local healthtag=AddVisualGear(GetX(hog), GetY(hog), vgtHealthTag, damage, false)
    59 	v1, v2, v3, v4, v5, v6, v7, v8, v9, v10 = GetVisualGearValues(healthtag)
    61 	SetVisualGearValues(healthtag, nil, nil, nil, nil, nil, nil, nil, nil, nil, GetClanColor(GetHogClan(hog)))
    60 	SetVisualGearValues(healthtag, v1, v2, v3, v4, v5, v6, v7, v8, v9, GetClanColor(GetHogClan(hog)))
       
    61 end
    62 end
    62 
    63 
    63 --will use IntegerSqrt
    64 --will use IntegerSqrt
    64 function FireGear(hedgehog,geartype,vx,vy,timer)
    65 function FireGear(hedgehog,geartype,vx,vy,timer)
    65 	local hypo=Norm(vx,vy)
    66 	local hypo=Norm(vx,vy)
    66 	return AddGear(div((GetGearRadius(hedgehog)*2*vx),hypo)+GetX(hedgehog), div((GetGearRadius(hedgehog)*2*vy),hypo)+GetY(hedgehog), geartype, 0, vx, vy, timer)
    67 	return AddGear(div((GetGearRadius(hedgehog)*2*vx),hypo)+GetX(hedgehog), div((GetGearRadius(hedgehog)*2*vy),hypo)+GetY(hedgehog), geartype, 0, vx, vy, timer)
    67 end
    68 end
    68 
    69 
    69 --====MISC GLOBALS====
    70 function CollectMultiAmmo(hog, ammoList, noAddAmmo)
       
    71 	local x, y = GetGearPosition(hog)
       
    72 	x = x + 2
       
    73 	y = y + 32
       
    74 	local ammoStr = ""
       
    75 	local ammoLength = 0
       
    76 	for _, _ in pairs(ammoList) do
       
    77 		ammoLength = ammoLength + 1
       
    78 	end
       
    79 	local a = 1
       
    80 	for ammo, count in pairs(ammoList) do
       
    81 		if not noAddAmmo then
       
    82 			local oldCount = GetAmmoCount(hog, ammo)
       
    83 			local newCount = oldCount + count
       
    84 			-- Make sure that finite ammo stays finite
       
    85 			if count < 100 and oldCount < 100 and newCount >= 100 then
       
    86 				newCount = 99
       
    87 			end
       
    88 			AddAmmo(hog, ammo, newCount)
       
    89 		end
       
    90 		if IsHogLocal(hog) then
       
    91 			x = x + 2
       
    92 			y = y + 32
       
    93 			local vgear = AddVisualGear(x, y, vgtAmmo, 0, true)
       
    94 			if vgear ~= nil then
       
    95 				local vgtFrame = ammo
       
    96 				SetVisualGearValues(vgear, nil, nil, nil, nil, nil, vgtFrame)
       
    97 			end
       
    98 
       
    99 			ammoStr = ammoStr .. string.format(loc("%s (+%d)"), GetAmmoName(ammo), count)
       
   100 			if a < ammoLength then
       
   101 				ammoStr = ammoStr .. " • "
       
   102 			end
       
   103 		end
       
   104 		a = a + 1
       
   105 	end
       
   106 	if ammoLength > 0 then
       
   107 		PlaySound(sndShotgunReload)
       
   108 		-- Show collected ammo
       
   109 		if IsHogLocal(hog) then
       
   110 			AddCaption(ammoStr, GetClanColor(GetHogClan(hog)), capgrpAmmoinfo)
       
   111 		end
       
   112 	end
       
   113 end
       
   114 
       
   115 function SetAttackState(state)
       
   116 	if state==true then
       
   117 		SetInputMask(bor(GetInputMask(), gmAttack))
       
   118 	else
       
   119 		SetInputMask(band(GetInputMask(), bnot(gmAttack)))
       
   120 	end
       
   121 end
       
   122 
       
   123 --====MISC_TIMER GLOBALS====
       
   124 local CS = {}
    70 
   125 
    71 --for selecting continent
   126 --for selecting continent
    72 local GLOBAL_INIT_TEAMS = {}
   127 
    73 local GLOBAL_SELECT_CONTINENT_CHECK=false
   128 CS.INIT_TEAMS = {}
    74 local GLOBAL_START_TIME=0
   129 CS.GAME_STARTED = false
    75 local GLOBAL_HOG_HEALTH=100
   130 CS.SELECT_CONTINENT_CHECK=false
    76 local GLOBAL_TEAM_CONTINENT = {}
   131 CS.START_TIME=0
       
   132 CS.HOG_HEALTH=100
       
   133 CS.TEAM_CONTINENT = {}
    77 
   134 
    78 --variables for seeing if you have swaped around on a weapon
   135 --variables for seeing if you have swaped around on a weapon
    79 local GLOBAL_AUSTRALIAN_SPECIAL=0
   136 CS.AUSTRALIAN_SPECIAL=0
    80 local GLOBAL_AFRICAN_SPECIAL_SEDUCTION=0
   137 CS.AFRICAN_SPECIAL_SEDUCTION=0
    81 local GLOBAL_AFRICAN_SPECIAL_STICKY=0
   138 CS.AFRICAN_SPECIAL_STICKY=0
    82 local GLOBAL_SOUTH_AMERICAN_SPECIAL=false
   139 CS.SOUTH_AMERICAN_SPECIAL=false
    83 local GLOBAL_NORTH_AMERICAN_SPECIAL_SNIPER=1
   140 CS.NORTH_AMERICAN_SPECIAL_SNIPER=1
    84 local GLOBAL_NORTH_AMERICAN_SPECIAL_SNIPER_IS_ON=false
   141 CS.NORTH_AMERICAN_SPECIAL_SNIPER_IS_ON=false
    85 local GLOBAL_KERGUELEN_SPECIAL=1
   142 CS.KERGUELEN_SPECIAL=1
    86 local GLOBAL_NORTH_AMERICAN_SPECIAL_SHOTGUN=false
   143 CS.NORTH_AMERICAN_SPECIAL_SHOTGUN=false
    87 local GLOBAL_EUROPE_SPECIAL=0
   144 CS.EUROPE_SPECIAL=0
    88 local GLOBAL_ANTARCTICA_SPECIAL=0
   145 CS.ANTARCTICA_SPECIAL=0
    89 local GLOBAL_SEDUCTION_INCREASER=0
   146 CS.SEDUCTION_INCREASER=0
    90 
   147 
    91 --detection if something is activated
   148 --detection if something is activated
    92 local GLOBAL_SWITCH_HOG_IS_ON=false
   149 CS.SWITCH_HOG_IS_ON=false
    93 local GLOBAL_VAMPIRIC_IS_ON=0
   150 CS.VAMPIRIC_IS_ON=0
    94 local GLOBAL_EXTRA_DAMAGE_IS_ON=100
   151 CS.EXTRA_DAMAGE_IS_ON=100
    95 local GLOBAL_PARACHUTE_IS_ON=false
   152 CS.PARACHUTE_IS_ON=false
       
   153 CS.PRECISE=false
       
   154 
       
   155 CS.CONTINENT_LABEL_TIMER=-1
       
   156 CS.SPEECH_TIMER=-1
       
   157 CS.HANDLE_SPECIAL_WEAPON_MISC_TIMER=-1
       
   158 CS.CONFIRM_CONTINENT_SELECTION=-1
    96 
   159 
    97 --the visual circle for kerguelen
   160 --the visual circle for kerguelen
    98 local GLOBAL_VISUAL_CIRCLE=nil
   161 CS.VISUAL_CIRCLE=nil
    99 
   162 
   100 --the global temp value
   163 --the global temporary value
   101 local GLOBAL_TEMP_VALUE=0
   164 CS.TEMP_VALUE=0
       
   165 
       
   166 --true if player used any sticky mine mine mode besides hedgehog projectile in this turn
       
   167 CS.AFRICAN_SPECIAL_NON_PROJECTILE_USED=false
       
   168 
       
   169 -- “constants”
       
   170 CS.SABOTAGE_GRAVITY=350
       
   171 CS.SABOTAGE_GRAVITY_LOW=175
       
   172 CS.SABOTAGE_DAMAGE=2
       
   173 CS.SABOTAGE_FREQUENCY=100
   102 
   174 
   103 --for sabotage
   175 --for sabotage
   104 local GLOBAL_SABOTAGE_COUNTER=0
   176 CS.SABOTAGE_COUNTER=0
   105 local GLOBAL_SABOTAGE_HOGS={}
   177 CS.SABOTAGE_HOGS={}
   106 local GLOBAL_SABOTAGE_FREQUENCY=0
   178 CS.SABOTAGE_FREQUENCY_NOW=0
   107 
       
   108 local GLOBAL_CRATE_TEST=-1
       
   109 
   179 
   110 --for sundaland
   180 --for sundaland
   111 local GLOBAL_SUNDALAND_END_HOG_CONTINENT_NAME
   181 CS.SUNDALAND_END_HOG_CONTINENT_NAME=nil
   112 
   182 
   113 local OPTION_NO_SPECIALS=false
   183 --misc.
       
   184 CS.OPTION_NO_SPECIALS=false
   114 
   185 
   115 --====GENERAL GLOBALS (useful for handling continents)====
   186 --====GENERAL GLOBALS (useful for handling continents)====
   116 
   187 
   117 local GLOBAL_SNIPER_SPECIAL_INFO = loc("Green lipstick bullet: [Poisonous, deals no damage]")
   188 CS.SNIPER_SPECIAL_NAME = loc("Green Lipstick Bullet")
   118 local GLOBAL_BASEBALLBAT_BOOMERANG_INFO = loc("Bouncy boomerang: [Launch your bouncy boomerang ~ Turns into a present on explosion]")
   189 CS.BASEBALLBAT_BOOMERANG_NAME = loc("Bouncy Boomerang")
   119 local GLOBAL_CHEESE_SPECIAL_INFO = loc("Anno 1032: [The explosion will make a strong push ~ No poison]")
   190 CS.CHEESE_SPECIAL_NAME = loc("Anno 1032")
   120 local GLOBAL_SEDUCTION_SPECIAL_INFO = loc("Dust storm: [Deals 15 + %s damage to all enemies in the circle]")
   191 CS.SEDUCTION_SPECIAL_NAME = loc("Dust Storm")
   121 local GLOBAL_INVULNERABLE_SPECIAL_INFO = loc("Temporarily increase the damage of duststorm with +7%s, Removes 1 Invurnurable%s")
   192 CS.BASEBALLBAT_CRICKET_NAME = loc("Cricket Time")
   122 local GLOBAL_BASEBALLBAT_CRICKET_INFO = loc("Cricket time: [Fire away a 1 sec mine! ~ Cannot be fired close to another hog]")
   193 CS.PARACHUTE_SPECIAL_NAME = loc("Heroic Wind")
   123 local GLOBAL_PARACHUTE_SPECIAL_INFO = loc("Drop a bomb: [Drop some heroic wind that will turn into a bomb on impact ~ wont end turn]")
   194 CS.HAMMER_ROAR_NAME = loc("Penguin Roar")
   124 local GLOBAL_HAMMER_ROAR_INFO = loc("Penguin roar: [Deal 15 damage + 10% of your hog’s health to all hogs around you and get 2/3 back]")
   195 CS.HAMMER_SWAP_NAME = loc("Disguise as a Rockhopper Penguin")
   125 local GLOBAL_HAMMER_SWAP_INFO = loc("Disguise as a Rockhopper Penguin: [Swap place with a random enemy hog in the circle]")
   196 CS.HAMMER_LONELY_NAME = loc("Lonely Cries")
   126 local GLOBAL_HAMMER_LONELY_INFO = loc("Lonely Cries: [Rise the water if no hog is in the circle and deal 6 damage to all enemy hogs.]")
   197 CS.STICKY_PROJECTILE_NAME = loc("Hedgehog Projectile")
   127 local GLOBAL_STICKY_PROJECTILE_INFO = loc("Hedgehog projectile: [Fire your hog like a Sticky Bomb]")
   198 CS.STICKY_NAPALM_NAME = loc("Napalm Rocket")
   128 local GLOBAL_STICKY_NAPALM_INFO = loc("Napalm rocket: [Fire a bomb with napalm!]")
   199 CS.SHOTGUN_SPECIAL_NAME = loc("Eagle Eye")
   129 local GLOBAL_SHOTGUN_SPECIAL_INFO = loc("Eagle Eye: [Blink to the impact ~ One shot]")
   200 CS.MOLOTOV_SPECIAL_NAME = loc("Medicine")
   130 local GLOBAL_MOLOTOV_SPECIAL_INFO = loc("Medicine: [Fire some exploding medicine that will heal 15 hp to all hogs effected by the explosion]")
   201 CS.HAMMER_SABOTAGE_NAME = loc("Flare")
   131 local GLOBAL_HAMMER_SABOTAGE_INFO = loc("Flare: [Sabotage all hogs in the circle (dmg over time and high gravity) and fire one cluster above you]")
   202 CS.PICKHAMMER_SPECIAL_NAME = loc("Upside-Down World")
   132 local GLOBAL_PICKHAMMER_SPECIAL_INFO = loc("World wrap: [Will teleport you to the top of the map, expect fall damage]")
   203 
   133 
   204 CS.SNIPER_SPECIAL_DESC = loc("Poisonous, deals no damage.")
   134 local GLOBAL_ALL_SPECIALS_INFO = loc("Weapons with specials: ")..loc("Shotgun")..", "..loc("Sniper Rifle")..", "..loc("GasBomb")..", "..loc("Molotov")..", "..loc("Parachute")..", "..loc("Seduction")..", "..loc("Sticky Mine").." (2),"..loc("Baseballbat (2)")..", "..loc("Hammer (4)")
   205 CS.BASEBALLBAT_BOOMERANG_DESC = loc("Launch a bouncy ball which explodes into a crate.")
   135 
   206 CS.CHEESE_SPECIAL_DESC = loc("Strong knockback, but no poison.")
   136 local GLOBAL_SELECT_WEP_INFORMATION=loc("Select your continent with: the \"Up\" or \"Down\" keys, or by selecting a representative weapon.")
   207 CS.SEDUCTION_SPECIAL_DESC = loc("Deals 15 damage to all enemies in the circle.")
   137 local GLOBAL_GENERAL_INFORMATION="- "..loc("Per team weapons").."|- "..loc("10 weapon schemes").."|- "..loc("Unique new weapons").."| |"..GLOBAL_SELECT_WEP_INFORMATION.."|"..loc("Note: Some weapons have a second option (See continent information). Find and use them with the \"")..loc("switch").."\" "..loc("key").." (↹).|"..GLOBAL_ALL_SPECIALS_INFO.."|"..loc("Tip: See the \"esc\" key (this menu) if you want to see the currently playing teams continent, or that continents specials." .. "|")
   208 CS.BASEBALLBAT_CRICKET_DESC = loc("Throw a 1 second mine!")
   138 
   209 CS.PARACHUTE_SPECIAL_DESC = loc("Drop a ball of dirt which turns into a|cluster on impact. Doesn’t end turn.")
   139 local GLOBAL_CONTINENT_INFORMATION =
   210 CS.HAMMER_ROAR_DESC = loc("Deal 15 damage + 10% of your hog’s health to all hogs around you and get 2/3 back.")
       
   211 CS.HAMMER_SWAP_DESC = loc("Swap place with a random enemy in the circle.")
       
   212 CS.HAMMER_LONELY_DESC = loc("Rise the water if nobody else is in the circle and deal 6 damage to all enemy hogs.")
       
   213 CS.STICKY_PROJECTILE_DESC = loc("Fire your hedgehog like a sticky mine.")
       
   214 CS.STICKY_NAPALM_DESC = loc("Fire a rocket with napalm.")
       
   215 CS.SHOTGUN_SPECIAL_DESC = loc("Teleport to the impact location.")
       
   216 CS.MOLOTOV_SPECIAL_DESC = loc("Fire some exploding medicine that will heal 15 health to all hogs in its effect radius.")
       
   217 CS.HAMMER_SABOTAGE_DESC = loc("Sabotage all hogs in the circle and fire a cluster above you.|Sabotaged hogs lose health and have to deal with a very high gravity during their turn.")
       
   218 CS.PICKHAMMER_SPECIAL_DESC = loc("Teleport to the top of the map, expect fall damage!")
       
   219 
       
   220 CS.INVULNERABLE_SPECIAL_CAPTION = loc("15+%d damage, %d invulnerable left")
       
   221 -- Make info
       
   222 local minfo = function(name, desc)
       
   223 	return string.format(loc("%s: %s"), name, desc)
       
   224 end
       
   225 CS.SNIPER_SPECIAL_INFO = minfo(CS.SNIPER_SPECIAL_NAME, CS.SNIPER_SPECIAL_DESC)
       
   226 CS.BASEBALLBAT_BOOMERANG_INFO = minfo(CS.BASEBALLBAT_BOOMERANG_NAME, CS.BASEBALLBAT_BOOMERANG_DESC)
       
   227 CS.CHEESE_SPECIAL_INFO = minfo(CS.CHEESE_SPECIAL_NAME, CS.CHEESE_SPECIAL_DESC)
       
   228 CS.SEDUCTION_SPECIAL_INFO = minfo(CS.SEDUCTION_SPECIAL_NAME, CS.SEDUCTION_SPECIAL_DESC)
       
   229 CS.INVULNERABLE_SPECIAL_INFO = loc("Increase the dust storm damage by sacrificing|your invulnerable ammo.")
       
   230 CS.INVULNERABLE_SPECIAL_CTRL = loc("Up/Down: Adjust dust storm damage")
       
   231 CS.BASEBALLBAT_CRICKET_INFO = minfo(CS.BASEBALLBAT_CRICKET_NAME, CS.BASEBALLBAT_CRICKET_DESC)
       
   232 CS.PARACHUTE_SPECIAL_INFO = minfo(CS.PARACHUTE_SPECIAL_NAME, CS.PARACHUTE_SPECIAL_DESC)
       
   233 CS.HAMMER_ROAR_INFO = minfo(CS.HAMMER_ROAR_NAME, CS.HAMMER_ROAR_DESC)
       
   234 CS.HAMMER_SWAP_INFO = minfo(CS.HAMMER_SWAP_NAME, CS.HAMMER_SWAP_DESC)
       
   235 CS.HAMMER_LONELY_INFO = minfo(CS.HAMMER_LONELY_NAME, CS.HAMMER_LONELY_DESC)
       
   236 CS.STICKY_PROJECTILE_INFO = minfo(CS.STICKY_PROJECTILE_NAME, CS.STICKY_PROJECTILE_DESC)
       
   237 CS.STICKY_NAPALM_INFO = minfo(CS.STICKY_NAPALM_NAME, CS.STICKY_NAPALM_DESC)
       
   238 CS.SHOTGUN_SPECIAL_INFO = minfo(CS.SHOTGUN_SPECIAL_NAME, CS.SHOTGUN_SPECIAL_DESC)
       
   239 CS.MOLOTOV_SPECIAL_INFO = minfo(CS.MOLOTOV_SPECIAL_NAME, CS.MOLOTOV_SPECIAL_DESC)
       
   240 CS.HAMMER_SABOTAGE_INFO = minfo(CS.HAMMER_SABOTAGE_NAME, CS.HAMMER_SABOTAGE_DESC)
       
   241 CS.PICKHAMMER_SPECIAL_INFO = minfo(CS.PICKHAMMER_SPECIAL_NAME, CS.PICKHAMMER_SPECIAL_DESC)
       
   242 
       
   243 CS.SELECT_WEP_INFORMATION=loc("Select your continent with [Up]/[Down] or by selecting a representative weapon.").."|"..
       
   244 	loc("Press [Attack] to confirm.")
       
   245 CS.SELECT_WEP_INFORMATION_SHORT=loc("%s, select your continent!")
       
   246 
       
   247 function GeneralInformation()
       
   248 	local select_wep, quit_hint
       
   249 	if not CS.GAME_STARTED then
       
   250 		select_wep = "| |"..CS.SELECT_WEP_INFORMATION
       
   251 		quit_hint = "|"..loc("Hint: Use the quit key to see the team’s continent.")
       
   252 	else
       
   253 		select_wep = ""
       
   254 		quit_hint = ""
       
   255 	end
       
   256 	local general_information =
       
   257 		loc("Continents: Select a continent at the beginning.").."|"..
       
   258 		loc("Supplies: Each continent gives you unique weapons, specials and health.").."|"..
       
   259 		loc("Weapon specials: Some weapons have special modes (see weapon description).")..
       
   260 		select_wep..
       
   261 		quit_hint
       
   262 	return general_information
       
   263 end
       
   264 
       
   265 CS.CONTINENT_INFORMATION =
   140 {
   266 {
   141 {loc("North America"),"["..loc("Difficulty: ")..loc("EASY").."] ",loc("- You can switch between hogs at the start of your turns. (Not first one)").."|"..loc("Special Weapons:").."|"..loc("Shotgun")..": "..GLOBAL_SHOTGUN_SPECIAL_INFO.."|"..loc("Sniper Rifle")..": "..GLOBAL_SNIPER_SPECIAL_INFO,{amSniperRifle,1},
   267 {loc("North America"),
       
   268 loc("The continent of firearms"),
       
   269 loc("The Union: You can select a hedgehog at the start of your turns.").."| |"..
       
   270 loc("Special weapons:").."|"..
       
   271 GetAmmoName(amShotgun)..": "..CS.SHOTGUN_SPECIAL_INFO.."|"..
       
   272 GetAmmoName(amSniperRifle)..": "..CS.SNIPER_SPECIAL_INFO,
       
   273 {amSniperRifle,1},
   142 {{amShotgun,100},{amDEagle,100},{amLaserSight,2},{amSniperRifle,100},{amCake,1},{amAirAttack,2},{amSwitch,2}},
   274 {{amShotgun,100},{amDEagle,100},{amLaserSight,2},{amSniperRifle,100},{amCake,1},{amAirAttack,2},{amSwitch,2}},
   143 },
   275 {sndShotgunFire,sndCover},100},
   144 --{sndShotgunFire,sndCover},100},
   276 
   145 
   277 {loc("South America"),
   146 {loc("South America"),"["..loc("Difficulty: ")..loc("MEDIUM").."] ",loc("Special Weapons:").."|"..loc("GasBomb")..": "..GLOBAL_CHEESE_SPECIAL_INFO,{amGasBomb,2},
   278 loc("The continent of guerilla tactics"),
       
   279 "| |"..loc("Special weapons:").."|"
       
   280 ..GetAmmoName(amGasBomb)..": "..CS.CHEESE_SPECIAL_INFO,
       
   281 {amGasBomb,2},
   147 {{amBirdy,100},{amHellishBomb,1},{amBee,100},{amGasBomb,100},{amFlamethrower,100},{amNapalm,2},{amExtraDamage,3}},
   282 {{amBirdy,100},{amHellishBomb,1},{amBee,100},{amGasBomb,100},{amFlamethrower,100},{amNapalm,2},{amExtraDamage,3}},
   148 {sndEggBreak,sndLaugh},125},
   283 {sndEggBreak,sndLaugh},125},
   149 
   284 
   150 {loc("Europe"),"["..loc("Difficulty: ")..loc("EASY").."] ",loc("Special Weapons:").."|"..loc("Molotov")..": "..GLOBAL_MOLOTOV_SPECIAL_INFO,{amBazooka,3},
   285 {loc("Europe"),
       
   286 loc("The continent of medicine"),
       
   287 "| |"..loc("Special weapons:").."|"
       
   288 ..GetAmmoName(amMolotov)..": "..CS.MOLOTOV_SPECIAL_INFO,
       
   289 {amBazooka,3},
   151 {{amBazooka,100},{amGrenade,100},{amMortar,100},{amMolotov,100},{amVampiric,4},{amPiano,1},{amResurrector,2},{amJetpack,4}},
   290 {{amBazooka,100},{amGrenade,100},{amMortar,100},{amMolotov,100},{amVampiric,4},{amPiano,1},{amResurrector,2},{amJetpack,4}},
   152 {sndExplosion,sndEnemyDown},100},
   291 {sndExplosion,sndEnemyDown},100},
   153 
   292 
   154 {loc("Africa"),"["..loc("Difficulty: ")..loc("MEDIUM").."] ",loc("Special Weapons:").."|"..loc("Seduction")..": "..string.format(GLOBAL_SEDUCTION_SPECIAL_INFO,loc("(*see below)")).."|- "..string.format(GLOBAL_INVULNERABLE_SPECIAL_INFO,"","").."|- "..loc("You can modify the damage/invulnerables with the up/down keys on dust storm.").."|"..loc("Sticky Mine")..": "..GLOBAL_STICKY_PROJECTILE_INFO.."|"..loc("Sticky Mine")..": "..GLOBAL_STICKY_NAPALM_INFO,{amSMine,4},
   293 {loc("Africa"),
       
   294 loc("The continent of dust"),
       
   295 "| |"..loc("Special weapons:").."|"..
       
   296 GetAmmoName(amSeduction)..": "..CS.SEDUCTION_SPECIAL_INFO.."|"..
       
   297 CS.INVULNERABLE_SPECIAL_INFO.."|"..
       
   298 GetAmmoName(amSMine)..": "..CS.STICKY_PROJECTILE_INFO.."|"..
       
   299 GetAmmoName(amSMine)..": "..CS.STICKY_NAPALM_INFO,
       
   300 {amSMine,4},
   155 {{amSMine,100},{amWatermelon,1},{amDrillStrike,1},{amDrill,100},{amInvulnerable,7},{amSeduction,100},{amLandGun,3}},
   301 {{amSMine,100},{amWatermelon,1},{amDrillStrike,1},{amDrill,100},{amInvulnerable,7},{amSeduction,100},{amLandGun,3}},
   156 {sndMelonImpact,sndCoward},125},
   302 {sndMelonImpact,sndCoward},125},
   157 
   303 
   158 {loc("Asia"),"["..loc("Difficulty: ")..loc("MEDIUM").."] ",loc("- Will give you a parachute every third turn.").."|"..loc("Special Weapons:").."|"..loc("Parachute")..": "..GLOBAL_PARACHUTE_SPECIAL_INFO,{amRope,5},
   304 {loc("Asia"),
       
   305 loc("The continent of ninjas"),
       
   306 loc("Textile industry: Will give you a parachute every second turn.").."| |"..
       
   307 loc("Special weapons:").."|"..
       
   308 GetAmmoName(amParachute)..": "..CS.PARACHUTE_SPECIAL_INFO,
       
   309 {amRope,5},
   159 {{amRope,100},{amFirePunch,100},{amParachute,1},{amKnife,2},{amDynamite,1}},
   310 {{amRope,100},{amFirePunch,100},{amParachute,1},{amKnife,2},{amDynamite,1}},
   160 {sndRopeAttach,sndComeonthen},50},
   311 {sndRopeAttach,sndComeonthen},50},
   161 
   312 
   162 {loc("Australia"),"["..loc("Difficulty: ")..loc("EASY").."] ",loc("Special Weapons:").."|"..loc("Baseballbat")..": "..GLOBAL_BASEBALLBAT_CRICKET_INFO.."|"..loc("Baseballbat")..": "..GLOBAL_BASEBALLBAT_BOOMERANG_INFO,{amBaseballBat,6},
   313 {loc("Australia"),
       
   314 loc("The continent of sports"),
       
   315 "| |"..loc("Special weapons:").."|"..
       
   316 GetAmmoName(amBaseballBat)..": "..CS.BASEBALLBAT_CRICKET_INFO.."|"..
       
   317 GetAmmoName(amBaseballBat)..": "..CS.BASEBALLBAT_BOOMERANG_INFO.."|"..
       
   318 loc("Baseball bat specials cannot be used close to other hogs."),
       
   319 {amBaseballBat,6},
   163 {{amBaseballBat,100},{amMine,100},{amLowGravity,4},{amBlowTorch,100},{amRCPlane,2},{amRubber,4}},
   320 {{amBaseballBat,100},{amMine,100},{amLowGravity,4},{amBlowTorch,100},{amRCPlane,2},{amRubber,4}},
   164 {sndBaseballBat,sndNooo},100},
   321 {sndBaseballBat,sndNooo},100},
   165 
   322 
   166 {loc("Antarctica"),"["..loc("Difficulty: ")..loc("HARD").."] ",loc("Antarctic summer: - Will give you girders=1,mudballs=1,sineguns=2,portals=1 every fourth turn.").."|"..loc("Special Weapons:").."|"..loc("Pick hammer")..": "..GLOBAL_PICKHAMMER_SPECIAL_INFO,{amIceGun,7},
   323 {loc("Antarctica"),
       
   324 loc("The continent of ice and science"),
       
   325 loc("Antarctic summer: Every 4th turn you get 1 girder, 1 mudball, 2 sine guns and 1 portable portal device.").."| |"..
       
   326 loc("Special weapons:").."|"..
       
   327 GetAmmoName(amPickHammer)..": "..CS.PICKHAMMER_SPECIAL_INFO,
       
   328 {amIceGun,7},
   167 {{amSnowball,2},{amPickHammer,100},{amSineGun,4},{amGirder,1},{amExtraTime,1},{amIceGun,1},{amPortalGun,2}},
   329 {{amSnowball,2},{amPickHammer,100},{amSineGun,4},{amGirder,1},{amExtraTime,1},{amIceGun,1},{amPortalGun,2}},
   168 {sndSineGun,sndOops},75},
   330 {sndSineGun,sndOops},75},
   169 
   331 
   170 {loc("Kerguelen"),"["..loc("Difficulty: ")..loc("EASY").."] ",loc("Special Weapons:").."|"..loc("Hammer")..": "..GLOBAL_HAMMER_ROAR_INFO.."|"..loc("Hammer")..": "..GLOBAL_HAMMER_SWAP_INFO.."|"..loc("Hammer")..": "..GLOBAL_HAMMER_LONELY_INFO.."|"..loc("Hammer")..": "..GLOBAL_HAMMER_SABOTAGE_INFO,{amHammer,8},
   332 {loc("Kerguelen"),
       
   333 loc("The continent of cowards"),
       
   334 "| |"..loc("Special weapons:").."|"..
       
   335 GetAmmoName(amHammer)..": "..CS.HAMMER_ROAR_INFO.."|"..
       
   336 GetAmmoName(amHammer)..": "..CS.HAMMER_SWAP_INFO.."|"..
       
   337 GetAmmoName(amHammer)..": "..CS.HAMMER_LONELY_INFO.."|"..
       
   338 GetAmmoName(amHammer)..": "..CS.HAMMER_SABOTAGE_INFO,
       
   339 {amHammer,8},
   171 {{amHammer,100},{amMineStrike,1},{amBallgun,1},{amTeleport,1}},
   340 {{amHammer,100},{amMineStrike,1},{amBallgun,1},{amTeleport,1}},
   172 {sndPiano5,sndStupid},75},
   341 {sndPiano5,sndStupid},75},
   173 
   342 
   174 {loc("Zealandia"),"["..loc("Difficulty: ")..loc("MEDIUM").."] ",loc("- Will Get 1-3 random weapons") .. "|" .. loc("- Massive weapon bonus on first turn|You will lose all your weapons each turn."),{amInvulnerable,9},
   343 {loc("Zealandia"),
       
   344 loc("The forgotten continent"),
       
   345 loc("Surprise supplies: Get 1-3 random weapons each turn.") .. "|" ..
       
   346 loc("Treasure: Massive weapon bonus in first turn.").."|"..
       
   347 loc("Forgetfulness: You will lose all your weapons each turn."),
       
   348 {amInvulnerable,9},
   175 {{amBazooka,1},{amGrenade,1},{amBlowTorch,1},{amSwitch,1},{amRope,1},{amDrill,1},{amDEagle,1},{amPickHammer,1},{amFirePunch,1},{amWhip,1},{amMortar,1},{amSnowball,1},{amExtraTime,1},{amInvulnerable,1},{amVampiric,1},{amFlamethrower,1},{amBee,1},{amClusterBomb,1},{amTeleport,1},{amLowGravity,1},{amJetpack,1},{amGirder,1},{amLandGun,1},{amBirdy,1},{amAirMine,1},{amTardis,1},{amLaserSight,1},{amAirMine,1}},
   349 {{amBazooka,1},{amGrenade,1},{amBlowTorch,1},{amSwitch,1},{amRope,1},{amDrill,1},{amDEagle,1},{amPickHammer,1},{amFirePunch,1},{amWhip,1},{amMortar,1},{amSnowball,1},{amExtraTime,1},{amInvulnerable,1},{amVampiric,1},{amFlamethrower,1},{amBee,1},{amClusterBomb,1},{amTeleport,1},{amLowGravity,1},{amJetpack,1},{amGirder,1},{amLandGun,1},{amBirdy,1},{amAirMine,1},{amTardis,1},{amLaserSight,1},{amAirMine,1}},
   176 {sndSplash,sndFirstBlood},100},
   350 {sndSplash,sndFirstBlood},100},
   177 
   351 
   178 {loc("Sundaland"),"["..loc("Difficulty: ")..loc("HARD").."] ",loc("- You will recieve 6 weapons on each kill! (Even on own hogs)"),{amTardis,10},
   352 {loc("Sundaland"),
   179 {{amClusterBomb,5},{amTardis,100},{amWhip,100},{amKamikaze,100},{amAirMine,2},{amDuck,2}},
   353 loc("The continent of greed"),
       
   354 loc("Bounty: Get 6 weapons for each kill (even on own hogs)."),
       
   355 {amTardis,10},
       
   356 {{amClusterBomb,5},{amTardis,100},{amWhip,100},{amKamikaze,100},{amAirMine,2}},
   180 {sndWarp,sndSameTeam},100}
   357 {sndWarp,sndSameTeam},100}
   181 
   358 
   182 }
   359 }
   183 
   360 
   184 --very strange bug
       
   185 GLOBAL_CONTINENT_INFORMATION[1][7]=100
       
   186 GLOBAL_CONTINENT_INFORMATION[1][6]={sndShotgunFire,sndCover}
       
   187 
       
   188 --weapontype,ammo,?,duration,*times your choice,affect on random team (should be placed with 1,0,1,0,1 on the 6th option for better randomness)
   361 --weapontype,ammo,?,duration,*times your choice,affect on random team (should be placed with 1,0,1,0,1 on the 6th option for better randomness)
   189 local GLOBAL_WEAPONS_DAMAGE = {
   362 CS.WEAPONS_DAMAGE = {
   190 	{amKamikaze,    0, 1, 0, 1, 0},
   363 	{amKamikaze,    0, 1, 0, 1, 0},
   191 	{amSineGun,     0, 1, 0, 1, 0},
   364 	{amSineGun,     0, 1, 0, 1, 0},
   192 	{amMineStrike,  0, 1, 6, 1, 1},
   365 	{amMineStrike,  0, 1, 6, 1, 1},
   193 	{amGrenade,     0, 1, 0, 1, 0},
   366 	{amGrenade,     0, 1, 0, 1, 0},
   194 	{amPiano,       0, 1, 7, 1, 0},
   367 	{amPiano,       0, 1, 7, 1, 0},
   223 	{amSnowball,    0, 1, 0, 1, 0},
   396 	{amSnowball,    0, 1, 0, 1, 0},
   224 	{amKnife,       0, 1, 0, 1, 0},
   397 	{amKnife,       0, 1, 0, 1, 0},
   225 	{amDrillStrike, 0, 1, 5, 1, 1},
   398 	{amDrillStrike, 0, 1, 5, 1, 1},
   226 	{amBazooka,     0, 1, 0, 1, 0},
   399 	{amBazooka,     0, 1, 0, 1, 0},
   227 	{amAirMine,     0, 1, 0, 1, 0},
   400 	{amAirMine,     0, 1, 0, 1, 0},
   228 	{amDuck,        0, 1, 0, 1, 0}
       
   229 }
   401 }
   230 local GLOBAL_WEAPONS_SUPPORT = {
   402 CS.WEAPONS_SUPPORT = {
   231 	{amParachute,   0, 1, 0, 1, 0},
   403 	{amParachute,   0, 1, 0, 1, 0},
   232 	{amGirder,      0, 1, 0, 1, 0},
   404 	{amGirder,      0, 1, 0, 1, 0},
   233 	{amSwitch,      0, 1, 0, 1, 0},
   405 	{amSwitch,      0, 1, 0, 1, 0},
   234 	{amLowGravity,  0, 1, 0, 1, 0},
   406 	{amLowGravity,  0, 1, 0, 1, 0},
   235 	{amExtraDamage, 0, 1, 2, 1, 0},
   407 	{amExtraDamage, 0, 1, 2, 1, 0},
   271 		end
   443 		end
   272 	end
   444 	end
   273 end
   445 end
   274 
   446 
   275 function SpawnRandomCrate(x,y,strength)
   447 function SpawnRandomCrate(x,y,strength)
   276 	local tot=table.maxn(GLOBAL_WEAPONS_SUPPORT)+table.maxn(GLOBAL_WEAPONS_DAMAGE)
   448 	local tot=table.maxn(CS.WEAPONS_SUPPORT)+table.maxn(CS.WEAPONS_DAMAGE)
   277 	local rand=GetRandom(tot)+1
   449 	local rand=GetRandom(tot)+1
   278 
   450 
   279 	if(rand>table.maxn(GLOBAL_WEAPONS_SUPPORT))
   451 	if(rand>table.maxn(CS.WEAPONS_SUPPORT))
   280 	then
   452 	then
   281 		local weapon=rand-table.maxn(GLOBAL_WEAPONS_SUPPORT)
   453 		local weapon=rand-table.maxn(CS.WEAPONS_SUPPORT)
   282 
   454 
   283 		while(wepNotValidBorder(GLOBAL_WEAPONS_DAMAGE[weapon][1])==false)
   455 		while(wepNotValidBorder(CS.WEAPONS_DAMAGE[weapon][1])==false)
   284 		do
   456 		do
   285 			if(weapon>=table.maxn(GLOBAL_WEAPONS_DAMAGE))
   457 			if(weapon>=table.maxn(CS.WEAPONS_DAMAGE))
   286 			then
   458 			then
   287 				weapon=0
   459 				weapon=0
   288 			end
   460 			end
   289 			weapon = weapon+1
   461 			weapon = weapon+1
   290 		end
   462 		end
   291 
   463 
   292 		SpawnAmmoCrate(x, y, GLOBAL_WEAPONS_DAMAGE[weapon][1])
   464 		SpawnAmmoCrate(x, y, CS.WEAPONS_DAMAGE[weapon][1])
   293 	else
   465 	else
   294 		SpawnUtilityCrate(x, y, GLOBAL_WEAPONS_SUPPORT[rand][1])
   466 		SpawnUtilityCrate(x, y, CS.WEAPONS_SUPPORT[rand][1])
   295 	end
   467 	end
   296 end
   468 end
   297 
   469 
   298 --removes one weapon
   470 --removes one weapon
   299 function RemoveWeapon(hog,weapon)
   471 function RemoveWeapon(hog,weapon)
   305 end
   477 end
   306 
   478 
   307 --reset all weapons for a team
   479 --reset all weapons for a team
   308 function CleanWeapons(hog)
   480 function CleanWeapons(hog)
   309 
   481 
   310 	local i=1
   482 	for w=1, #CS.WEAPONS_SUPPORT do
   311 	--+1 for skip
   483 		AddAmmo(hog, CS.WEAPONS_SUPPORT[w][1], 0)
   312 	while(i<=table.maxn(GLOBAL_WEAPONS_SUPPORT)+table.maxn(GLOBAL_WEAPONS_DAMAGE)+1)
   484 	end
   313 	do
   485 	for w=1, #CS.WEAPONS_DAMAGE do
   314 		AddAmmo(hog,i,0)
   486 		AddAmmo(hog, CS.WEAPONS_DAMAGE[w][1], 0)
   315 		i=i+1
   487 	end
   316 	end
       
   317 
       
   318 	AddAmmo(hog,amSkip,100)
       
   319 end
   488 end
   320 
   489 
   321 --get the weapons from a weaponset
   490 --get the weapons from a weaponset
   322 function LoadWeaponset(hog, num)
   491 function LoadWeaponset(hog, num)
   323 	for v,w in pairs(GLOBAL_CONTINENT_INFORMATION[num][5])
   492 	for v,w in pairs(CS.CONTINENT_INFORMATION[num][5])
   324 	do
   493 	do
   325 		ValidateWeapon(hog, w[1],w[2])
   494 		ValidateWeapon(hog, w[1],w[2])
   326 	end
   495 	end
   327 
   496 
   328 	GLOBAL_TEMP_VALUE=GLOBAL_CONTINENT_INFORMATION[num][7]
   497 	CS.TEMP_VALUE=CS.CONTINENT_INFORMATION[num][7]
   329 	runOnGears(SetHogHealth)
   498 	runOnGears(SetHogHealth)
   330 end
   499 end
   331 
   500 
   332 --list up all weapons from the icons for each continent
   501 --list up all weapons from the icons for each continent
   333 function InitWeaponsMenu(hog)
   502 function InitWeaponsMenu(hog)
   334 
   503 
   335 	if(GetHogLevel(hog)==0 or GLOBAL_CONTINENT_INFORMATION[1][6][1]==sndFrozenHogImpact)
   504 	if(GetHogLevel(hog)==0 or CS.CONTINENT_INFORMATION[1][6][1]==sndFrozenHogImpact)
   336 	then
   505 	then
   337 		for v,w in pairs(GLOBAL_CONTINENT_INFORMATION)
   506 		for v,w in pairs(CS.CONTINENT_INFORMATION)
   338 		do
   507 		do
   339 			ValidateWeapon(hog, GLOBAL_CONTINENT_INFORMATION[v][4][1],1)
   508 			ValidateWeapon(hog, CS.CONTINENT_INFORMATION[v][4][1], 100)
   340 		end
   509 		end
   341 		AddAmmo(hog,amSwitch) --random continent
   510 		AddAmmo(hog, amSwitch, 100) --random continent
   342 
   511 
   343 	--for the computers
   512 	--for the computers
   344 	else
   513 	else
   345 		--europe
   514 		--europe
   346 		ValidateWeapon(hog, GLOBAL_CONTINENT_INFORMATION[3][4][1],1)
   515 		ValidateWeapon(hog, CS.CONTINENT_INFORMATION[3][4][1], 100)
   347 		--north america
   516 		--north america
   348 		ValidateWeapon(hog, GLOBAL_CONTINENT_INFORMATION[1][4][1],1)
   517 		ValidateWeapon(hog, CS.CONTINENT_INFORMATION[1][4][1], 100)
   349 	end
   518 	end
   350 end
   519 end
   351 
   520 
   352 --shows the continent info
   521 --shows the continent info
   353 function ShowContinentInfo(continent,time,generalinf)
   522 function ShowContinentInfo(continent,time,generalinf)
   358 		time=0
   527 		time=0
   359 		ns=true
   528 		ns=true
   360 	end
   529 	end
   361 	if(generalinf)
   530 	if(generalinf)
   362 	then
   531 	then
   363 		geninftext="| |"..loc("General information")..": |"..GLOBAL_GENERAL_INFORMATION
   532 		geninftext="| |"..loc("General information:").."|"..GeneralInformation()
   364 	end
   533 	else
   365 
   534 		geninftext="| |"..loc("Press [Attack] to select this continent!")
   366 	ShowMission(GLOBAL_CONTINENT_INFORMATION[continent][1],GLOBAL_CONTINENT_INFORMATION[continent][2]..loc(" Starting HP: ")..GLOBAL_CONTINENT_INFORMATION[continent][7],GLOBAL_CONTINENT_INFORMATION[continent][3]..geninftext, GLOBAL_CONTINENT_INFORMATION[continent][4][2], time)
   535 	end
       
   536 
       
   537 	ShowMission(CS.CONTINENT_INFORMATION[continent][1],
       
   538 		CS.CONTINENT_INFORMATION[continent][2],
       
   539 		string.format(loc("Initial health: %d"), CS.CONTINENT_INFORMATION[continent][7]) .. "|"..
       
   540 		CS.CONTINENT_INFORMATION[continent][3]..geninftext,
       
   541 		CS.CONTINENT_INFORMATION[continent][4][2], time)
   367 	if(ns)
   542 	if(ns)
   368 	then
   543 	then
   369 		HideMission()
   544 		HideMission()
       
   545 	elseif not CS.GAME_STARTED then
       
   546 		AddCaption(CS.CONTINENT_INFORMATION[continent][1], GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmoinfo)
   370 	end
   547 	end
   371 end
   548 end
   372 
   549 
   373 --will show a circle of gears (eye candy)
   550 --will show a circle of gears (eye candy)
   374 function VisualExplosion(range,xpos,ypos,gear1,gear2)
   551 function VisualExplosion(range,xpos,ypos,gear1,gear2)
   424 
   601 
   425 --zealandia (generates weapons from the weaponinfo above) and sundaland
   602 --zealandia (generates weapons from the weaponinfo above) and sundaland
   426 function RandomContinentsGetWeapons(hog)
   603 function RandomContinentsGetWeapons(hog)
   427 	if(GetGearType(hog) == gtHedgehog)
   604 	if(GetGearType(hog) == gtHedgehog)
   428 	then
   605 	then
   429 		local currCont=GLOBAL_TEAM_CONTINENT[GetHogTeamName(hog)]
   606 		local currCont=CS.TEAM_CONTINENT[GetHogTeamName(hog)]
   430 
   607 
   431 		if(currCont~=0)
   608 		if(currCont~=0)
   432 		then
   609 		then
   433 			local checkDefCont=GLOBAL_CONTINENT_INFORMATION[currCont][4][2]
   610 			local checkDefCont=CS.CONTINENT_INFORMATION[currCont][4][2]
   434 
   611 
   435 			--for sunda
   612 			--for sunda
   436 			local wepamount=getTeamValue(GetHogTeamName(hog), "sundaland-count")
   613 			local wepamount=getTeamValue(GetHogTeamName(hog), "sundaland-count")
   437 
   614 
   438 			if(checkDefCont==9 and getTeamValue(GetHogTeamName(hog), "rand-done-turn")==false)
   615 			if(checkDefCont==9 and getTeamValue(GetHogTeamName(hog), "rand-done-turn")==false)
   439 			then
   616 			then
   440 				CleanWeapons(hog)
   617 				CleanWeapons(hog)
   441 
   618 
   442 				local rand_weaponset_power = 0
   619 				local rand_weaponset_power = 0
   443 				local currwep
   620 
   444 
   621 				rand_weaponset_power=GetRandomWeapon(hog,CS.WEAPONS_DAMAGE,100,true,false,rand_weaponset_power)
   445 				rand_weaponset_power, currwep=GetRandomWeapon(hog,GLOBAL_WEAPONS_DAMAGE,100,true,false,rand_weaponset_power)
   622 				rand_weaponset_power=GetRandomWeapon(hog,CS.WEAPONS_SUPPORT,2,true,false,rand_weaponset_power)
   446 				rand_weaponset_power, currwep=GetRandomWeapon(hog,GLOBAL_WEAPONS_SUPPORT,2,true,false,rand_weaponset_power)
   623 				rand_weaponset_power=GetRandomWeapon(hog,CS.WEAPONS_DAMAGE,1,true,false,rand_weaponset_power)
   447 				rand_weaponset_power, currwep=GetRandomWeapon(hog,GLOBAL_WEAPONS_DAMAGE,1,true,false,rand_weaponset_power)
       
   448 
   624 
   449 				setTeamValue(GetHogTeamName(hog), "rand-done-turn", true)
   625 				setTeamValue(GetHogTeamName(hog), "rand-done-turn", true)
   450 
   626 
   451 			elseif(checkDefCont==10 and wepamount~=nil)
   627 			elseif(checkDefCont==10 and wepamount~=nil)
   452 			then
   628 			then
   453 				local loci=0
   629 				local loci=0
   454 
   630 
   455 				while(loci<wepamount)
   631 				while(loci<wepamount)
   456 				do
   632 				do
       
   633 					local _
       
   634 					local wep = {}
   457 					--6 random weapons
   635 					--6 random weapons
   458 					GetRandomWeapon(hog,GLOBAL_WEAPONS_DAMAGE,100,false,true,0)
   636 					_, wep[1] = GetRandomWeapon(hog,CS.WEAPONS_DAMAGE,100,false,true,0)
   459 					GetRandomWeapon(hog,GLOBAL_WEAPONS_DAMAGE,100,false,true,0)
   637 					_, wep[2] = GetRandomWeapon(hog,CS.WEAPONS_DAMAGE,100,false,true,0)
   460 					GetRandomWeapon(hog,GLOBAL_WEAPONS_DAMAGE,2,false,true,1)
   638 					_, wep[3] = GetRandomWeapon(hog,CS.WEAPONS_DAMAGE,2,false,true,1)
   461 
   639 
   462 					GetRandomWeapon(hog,GLOBAL_WEAPONS_SUPPORT,100,false,true,0)
   640 					_, wep[4] = GetRandomWeapon(hog,CS.WEAPONS_SUPPORT,100,false,true,0)
   463 					GetRandomWeapon(hog,GLOBAL_WEAPONS_SUPPORT,100,false,true,0)
   641 					_, wep[5] = GetRandomWeapon(hog,CS.WEAPONS_SUPPORT,100,false,true,0)
   464 					GetRandomWeapon(hog,GLOBAL_WEAPONS_SUPPORT,100,false,true,0)
   642 					_, wep[6] = GetRandomWeapon(hog,CS.WEAPONS_SUPPORT,100,false,true,0)
       
   643 
       
   644 					-- Don't give weapons directly, only insert them into the global temp. value
       
   645 					-- We expect this function to be called by runOnGears for Sundaland.
       
   646 					if CS.TEMP_VALUE[hog] == nil then
       
   647 						CS.TEMP_VALUE[hog] = {}
       
   648 					end
       
   649 					for w=1, #wep do
       
   650 						local ammoList = CS.TEMP_VALUE[hog]
       
   651 						if ammoList[wep[w]] == nil then
       
   652 							ammoList[wep[w]] = 1
       
   653 						else
       
   654 							ammoList[wep[w]] = math.min(99, ammoList[wep[w]] + 1)
       
   655 						end
       
   656 					end
   465 
   657 
   466 					loci=loci+1
   658 					loci=loci+1
   467 				end
   659 				end
   468 
   660 
   469 				setTeamValue(GetHogTeamName(hog), "sundaland-count",nil)
   661 				setTeamValue(GetHogTeamName(hog), "sundaland-count",nil)
   474 
   666 
   475 --this will take that hogs settings for the weapons and add them
   667 --this will take that hogs settings for the weapons and add them
   476 function SetContinentWeapons()
   668 function SetContinentWeapons()
   477 
   669 
   478 	CleanWeapons(CurrentHedgehog)
   670 	CleanWeapons(CurrentHedgehog)
   479 	LoadWeaponset(CurrentHedgehog,GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)])
   671 	LoadWeaponset(CurrentHedgehog,CS.TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)])
   480 
   672 
   481 	visualstuff=AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog)-5, vgtDust,0, false)
   673 	local visualstuff=AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog)-5, vgtDust,0, false)
   482 	v1, v2, v3, v4, v5, v6, v7, v8, v9, v10 = GetVisualGearValues(visualstuff)
   674 	SetVisualGearValues(visualstuff, nil, nil, nil, nil, nil, nil, nil, 2, nil, GetClanColor(GetHogClan(CurrentHedgehog)))
   483 	SetVisualGearValues(visualstuff, v1, v2, v3, v4, v5, v6, v7, 2, v9, GetClanColor(GetHogClan(CurrentHedgehog)))
   675 
   484 
   676 	SetCSAmmoDescriptions("weapons")
   485 	ShowContinentInfo(GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)],3000,false)
   677 	ShowContinentInfo(CS.TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)],5000,false)
   486 end
   678 end
   487 
   679 
   488 --count hogs in team
   680 --count hogs in team
   489 function CountHogsInTeam(hog)
   681 function CountHogsInTeam(hog)
   490 	if(GetHogTeamName(hog)==GetHogTeamName(CurrentHedgehog))
   682 	if(GetHogTeamName(hog)==GetHogTeamName(CurrentHedgehog))
   491 	then
   683 	then
   492 		GLOBAL_TEMP_VALUE=GLOBAL_TEMP_VALUE+1
   684 		CS.TEMP_VALUE=CS.TEMP_VALUE+1
   493 	end
   685 	end
   494 end
   686 end
   495 
   687 
   496 --==========================run throw all hog/gear weapons ==========================
   688 --==========================run throw all hog/gear weapons ==========================
   497 
   689 
   498 function SetHogHealth(hog)
   690 function SetHogHealth(hog)
   499 	if(GetGearType(hog) == gtHedgehog and GetHogClan(hog) == GetHogClan(CurrentHedgehog))
   691 	if(GetGearType(hog) == gtHedgehog and GetHogClan(hog) == GetHogClan(CurrentHedgehog))
   500 	then
   692 	then
   501 		SetHealth(hog, div(GLOBAL_TEMP_VALUE*GLOBAL_HOG_HEALTH,100))
   693 		SetHealth(hog, div(CS.TEMP_VALUE*CS.HOG_HEALTH,100))
   502 	end
   694 	end
   503 end
   695 end
   504 
   696 
   505 --will check if the mine is nicely placed
   697 --will check if the mine is nicely placed
   506 function AustraliaSpecialCheckHogs(hog)
   698 function AustraliaSpecialCheckHogs(hog)
   507 	if(GetGearType(hog) == gtHedgehog)
   699 	if(GetGearType(hog) == gtHedgehog)
   508 	then
   700 	then
   509 		if(gearIsInCircle(hog,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 40, false)==true and hog ~= CurrentHedgehog)
   701 		if(gearIsInCircle(hog,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 40, false)==true and hog ~= CurrentHedgehog)
   510 		then
   702 		then
   511 			GLOBAL_TEMP_VALUE=1
   703 			CS.TEMP_VALUE=1
   512 		end
   704 		end
       
   705 	end
       
   706 end
       
   707 
       
   708 function HogOuch(hog, ouchType)
       
   709 	local r
       
   710 	if ouchType == "moan" then
       
   711 		r = math.random(1, 2)
       
   712 		if r == 1 then
       
   713 			PlaySound(sndPoisonMoan, hog, true)
       
   714 		else
       
   715 			PlaySound(sndPoisonCough, hog, true)
       
   716 		end
       
   717 	else
       
   718 		local r = math.random(1, 4)
       
   719 		PlaySound(_G["sndOw"..r], hog)
   513 	end
   720 	end
   514 end
   721 end
   515 
   722 
   516 --african special on sedunction
   723 --african special on sedunction
   517 function AfricaSpecialSeduction(hog)
   724 function AfricaSpecialSeduction(hog)
   518 	if(GetGearType(hog) == gtHedgehog)
   725 	if(GetGearType(hog) == gtHedgehog)
   519 	then
   726 	then
   520 		local dmg=div((15+GLOBAL_SEDUCTION_INCREASER)*GLOBAL_EXTRA_DAMAGE_IS_ON,100)
   727 		local dmg=div((15+CS.SEDUCTION_INCREASER)*CS.EXTRA_DAMAGE_IS_ON,100)
   521 		if(gearIsInCircle(hog,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 250, false)==true and GetHogClan(hog) ~= GetHogClan(CurrentHedgehog))
   728 		if(gearIsInCircle(hog,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 250, false)==true and GetHogClan(hog) ~= GetHogClan(CurrentHedgehog))
   522 		then
   729 		then
   523 			if(GetHealth(hog) > dmg)
   730 			if(GetHealth(hog) > dmg)
   524 			then
   731 			then
   525 				GLOBAL_TEMP_VALUE=GLOBAL_TEMP_VALUE+div(dmg*GLOBAL_VAMPIRIC_IS_ON,100)
   732 				CS.TEMP_VALUE=CS.TEMP_VALUE+div(dmg*CS.VAMPIRIC_IS_ON,100)
   526 				SetHealth(hog, GetHealth(hog)-dmg)
   733 				SetHealth(hog, GetHealth(hog)-dmg)
   527 			else
   734 			else
   528 				GLOBAL_TEMP_VALUE=GLOBAL_TEMP_VALUE+div(GetHealth(hog)*GLOBAL_VAMPIRIC_IS_ON,100)
   735 				CS.TEMP_VALUE=CS.TEMP_VALUE+div(GetHealth(hog)*CS.VAMPIRIC_IS_ON,100)
   529 				SetHealth(hog, 0)
   736 				SetHealth(hog, 0)
   530 			end
   737 			end
       
   738 			HogOuch(hog)
   531 			ShowDamageTag(hog,dmg)
   739 			ShowDamageTag(hog,dmg)
   532 		end
   740 		end
   533 	end
   741 	end
   534 end
   742 end
   535 
   743 
   537 function KerguelenSpecialRed(hog)
   745 function KerguelenSpecialRed(hog)
   538 	if(GetGearType(hog) == gtHedgehog)
   746 	if(GetGearType(hog) == gtHedgehog)
   539 	then
   747 	then
   540 		if(gearIsInCircle(hog,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 120, false)==true and GetHogClan(hog) ~= GetHogClan(CurrentHedgehog))
   748 		if(gearIsInCircle(hog,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 120, false)==true and GetHogClan(hog) ~= GetHogClan(CurrentHedgehog))
   541 		then
   749 		then
   542 			local dmg=div((15+div(GetHealth(CurrentHedgehog)*10,100))*GLOBAL_EXTRA_DAMAGE_IS_ON,100)
   750 			local dmg=div((15+div(GetHealth(CurrentHedgehog)*10,100))*CS.EXTRA_DAMAGE_IS_ON,100)
   543 
   751 
   544 			if(GetHealth(hog)>dmg)
   752 			if(GetHealth(hog)>dmg)
   545 			then
   753 			then
   546 				GLOBAL_TEMP_VALUE=GLOBAL_TEMP_VALUE+div(dmg*2,3)+div(dmg*GLOBAL_VAMPIRIC_IS_ON*2,100*3)
   754 				CS.TEMP_VALUE=CS.TEMP_VALUE+div(dmg*2,3)+div(dmg*CS.VAMPIRIC_IS_ON*2,100*3)
   547 				SetHealth(hog, GetHealth(hog)-dmg)
   755 				SetHealth(hog, GetHealth(hog)-dmg)
   548 			else
   756 			else
   549 				GLOBAL_TEMP_VALUE=GLOBAL_TEMP_VALUE+(div(GetHealth(hog)*75,100))+(div(GetHealth(CurrentHedgehog)*10,100))+div((GetHealth(hog)+div(GetHealth(CurrentHedgehog)*10,100))*GLOBAL_VAMPIRIC_IS_ON,100)
   757 				CS.TEMP_VALUE=CS.TEMP_VALUE+(div(GetHealth(hog)*75,100))+(div(GetHealth(CurrentHedgehog)*10,100))+div((GetHealth(hog)+div(GetHealth(CurrentHedgehog)*10,100))*CS.VAMPIRIC_IS_ON,100)
   550 				SetHealth(hog, 0)
   758 				SetHealth(hog, 0)
   551 			end
   759 			end
       
   760 			HogOuch(hog)
   552 			ShowDamageTag(hog,dmg)
   761 			ShowDamageTag(hog,dmg)
   553 			AddVisualGear(GetX(hog), GetY(hog), vgtExplosion, 0, false)
   762 			AddVisualGear(GetX(hog), GetY(hog), vgtExplosion, 0, false)
   554 			AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtSmokeWhite, 0, false)
   763 			AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtSmokeWhite, 0, false)
   555 		end
   764 		end
   556 	end
   765 	end
   560 function KerguelenSpecialYellowCountHogs(hog)
   769 function KerguelenSpecialYellowCountHogs(hog)
   561 	if(GetGearType(hog) == gtHedgehog)
   770 	if(GetGearType(hog) == gtHedgehog)
   562 	then
   771 	then
   563 		if(GetHogClan(hog) ~= GetHogClan(CurrentHedgehog) and gearIsInCircle(hog,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 390, false))
   772 		if(GetHogClan(hog) ~= GetHogClan(CurrentHedgehog) and gearIsInCircle(hog,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 390, false))
   564 		then
   773 		then
   565 			GLOBAL_TEMP_VALUE=GLOBAL_TEMP_VALUE+1
   774 			CS.TEMP_VALUE=CS.TEMP_VALUE+1
   566 		end
   775 		end
   567 	end
   776 	end
   568 end
   777 end
   569 --kerguelen special swap hog
   778 --kerguelen special swap hog
   570 function KerguelenSpecialYellowSwap(hog)
   779 function KerguelenSpecialYellowSwap(hog)
   571 	if(GetGearType(hog) == gtHedgehog)
   780 	if(GetGearType(hog) == gtHedgehog)
   572 	then
   781 	then
   573 		if(GLOBAL_KERGUELEN_SPECIAL ~= -1 and GetHogClan(hog) ~= GetHogClan(CurrentHedgehog) and gearIsInCircle(hog,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 420, false))
   782 		if(CS.KERGUELEN_SPECIAL ~= -1 and GetHogClan(hog) ~= GetHogClan(CurrentHedgehog) and gearIsInCircle(hog,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 420, false))
   574 		then
   783 		then
   575 			if(GLOBAL_TEMP_VALUE==0)
   784 			if(CS.TEMP_VALUE==0)
   576 			then
   785 			then
   577 				local thisX=GetX(CurrentHedgehog)
   786 				local thisX=GetX(CurrentHedgehog)
   578 				local thisY=GetY(CurrentHedgehog)
   787 				local thisY=GetY(CurrentHedgehog)
   579 				SetGearPosition(CurrentHedgehog, GetX(hog), GetY(hog))
   788 				SetGearPosition(CurrentHedgehog, GetX(hog), GetY(hog))
   580 				SetGearPosition(hog, thisX, thisY)
   789 				SetGearPosition(hog, thisX, thisY)
   581 				GLOBAL_KERGUELEN_SPECIAL=-1
   790 				CS.KERGUELEN_SPECIAL=-1
   582 			else
   791 			else
   583 				GLOBAL_TEMP_VALUE=GLOBAL_TEMP_VALUE-1
   792 				CS.TEMP_VALUE=CS.TEMP_VALUE-1
   584 			end
   793 			end
   585 		end
   794 		end
   586 	end
   795 	end
   587 end
   796 end
   588 
   797 
   590 function KerguelenSpecialGreen(hog)
   799 function KerguelenSpecialGreen(hog)
   591 	if(GetGearType(hog) == gtHedgehog)
   800 	if(GetGearType(hog) == gtHedgehog)
   592 	then
   801 	then
   593 		if(CurrentHedgehog~=hog and gearIsInCircle(hog,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 80, false))
   802 		if(CurrentHedgehog~=hog and gearIsInCircle(hog,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 80, false))
   594 		then
   803 		then
   595 			GLOBAL_TEMP_VALUE=1
   804 			CS.TEMP_VALUE=1
   596 			GLOBAL_SABOTAGE_HOGS[hog]=1
   805 			CS.SABOTAGE_HOGS[hog]=1
   597 			AddGear(GetX(hog), GetY(hog), gtCluster, 0, 0, 0, 1)
   806 			AddGear(GetX(hog), GetY(hog), gtCluster, 0, 0, 0, 1)
   598 			PlaySound(sndNooo,hog)
   807 			PlaySound(sndNooo,hog)
   599 		end
   808 		end
   600 	end
   809 	end
   601 end
   810 end
   602 
   811 
   603 --first part on kerguelen special (lonely cries)
   812 --first part on kerguelen special (lonely cries)
   604 function KerguelenSpecialBlueCheck(hog)
   813 function KerguelenSpecialBlueCheck(hog)
   605 	if(GetGearType(hog) == gtHedgehog and hog ~= CurrentHedgehog and gearIsInCircle(hog,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 500, false))
   814 	if(GetGearType(hog) == gtHedgehog and hog ~= CurrentHedgehog and GetHealth(CurrentHedgehog) and gearIsInCircle(hog,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 500, false))
   606 	then
   815 	then
   607 		GLOBAL_TEMP_VALUE=1
   816 		CS.TEMP_VALUE=1
   608 	end
   817 	end
   609 end
   818 end
   610 
   819 
   611 --second part on kerguelen special (lonely cries)
   820 --second part on kerguelen special (lonely cries)
   612 function KerguelenSpecialBlueActivate(hog)
   821 function KerguelenSpecialBlueActivate(hog)
   613 	if(GetGearType(hog) == gtHedgehog)
   822 	if(GetGearType(hog) == gtHedgehog)
   614 	then
   823 	then
   615 		local dmg=div(6*GLOBAL_EXTRA_DAMAGE_IS_ON,100)
   824 		local dmg=div(6*CS.EXTRA_DAMAGE_IS_ON,100)
   616 		if(GetHogClan(hog) ~= GetHogClan(CurrentHedgehog))
   825 		if(GetHogClan(hog) ~= GetHogClan(CurrentHedgehog))
   617 		then
   826 		then
   618 			if(GetHealth(hog) > dmg)
   827 			if(GetHealth(hog) > dmg)
   619 			then
   828 			then
   620 				GLOBAL_TEMP_VALUE=GLOBAL_TEMP_VALUE+div(dmg*GLOBAL_VAMPIRIC_IS_ON,100)
   829 				CS.TEMP_VALUE=CS.TEMP_VALUE+div(dmg*CS.VAMPIRIC_IS_ON,100)
   621 				SetHealth(hog, GetHealth(hog)-dmg)
   830 				SetHealth(hog, GetHealth(hog)-dmg)
   622 			else
   831 			else
   623 				GLOBAL_TEMP_VALUE=GLOBAL_TEMP_VALUE+div(GetHealth(hog)*GLOBAL_VAMPIRIC_IS_ON,100)
   832 				CS.TEMP_VALUE=CS.TEMP_VALUE+div(GetHealth(hog)*CS.VAMPIRIC_IS_ON,100)
   624 				SetHealth(hog, 0)
   833 				SetHealth(hog, 0)
   625 			end
   834 			end
       
   835 			HogOuch(hog, "moan")
   626 			ShowDamageTag(hog,dmg)
   836 			ShowDamageTag(hog,dmg)
   627 
   837 
   628 			AddVisualGear(GetX(hog), GetY(hog)-30, vgtEvilTrace, 0, false)
   838 			AddVisualGear(GetX(hog), GetY(hog)-30, vgtEvilTrace, 0, false)
   629 		end
   839 		end
   630 	end
   840 	end
   635 	if(GetGearType(hog) == gtHedgehog or GetGearType(hog) == gtMine or GetGearType(hog) == gtExplosives)
   845 	if(GetGearType(hog) == gtHedgehog or GetGearType(hog) == gtMine or GetGearType(hog) == gtExplosives)
   636 	then
   846 	then
   637 		local power_radius_outer=230
   847 		local power_radius_outer=230
   638 		local power_sa=700000
   848 		local power_sa=700000
   639 		local hypo=0
   849 		local hypo=0
   640 		if(gearIsInCircle(hog,GetX(GLOBAL_TEMP_VALUE), GetY(GLOBAL_TEMP_VALUE), power_radius_outer, false))
   850 		if(gearIsInCircle(hog,GetX(CS.TEMP_VALUE), GetY(CS.TEMP_VALUE), power_radius_outer, false))
   641 		then
   851 		then
   642 			if(hog == CurrentHedgehog)
   852 			if(hog == CurrentHedgehog)
   643 			then
   853 			then
   644 				SetState(CurrentHedgehog, gstMoving)
   854 				SetState(CurrentHedgehog, gstMoving)
   645 			end
   855 			end
   646 			SetGearPosition(hog, GetX(hog),GetY(hog)-3)
   856 			SetGearPosition(hog, GetX(hog),GetY(hog)-3)
   647 			hypo=Norm(math.abs(GetX(hog)-GetX(GLOBAL_TEMP_VALUE)),math.abs(GetY(hog)-GetY(GLOBAL_TEMP_VALUE)))
   857 			hypo=Norm(math.abs(GetX(hog)-GetX(CS.TEMP_VALUE)),math.abs(GetY(hog)-GetY(CS.TEMP_VALUE)))
   648 			SetGearVelocity(hog, div((power_radius_outer-hypo)*power_sa*GetIfNegative(GetX(hog)-GetX(GLOBAL_TEMP_VALUE)),power_radius_outer), div((power_radius_outer-hypo)*power_sa*GetIfNegative(GetY(hog)-GetY(GLOBAL_TEMP_VALUE)),power_radius_outer))
   858 			SetGearVelocity(hog, div((power_radius_outer-hypo)*power_sa*GetIfNegative(GetX(hog)-GetX(CS.TEMP_VALUE)),power_radius_outer), div((power_radius_outer-hypo)*power_sa*GetIfNegative(GetY(hog)-GetY(CS.TEMP_VALUE)),power_radius_outer))
   649 		end
   859 		end
   650 	end
   860 	end
   651 end
   861 end
   652 
   862 
   653 --north american special on sniper
   863 --north american special on sniper
   654 function NorthAmericaSpecialSniper(hog)
   864 function NorthAmericaSpecialSniper(hog)
   655 	if(GetGearType(hog) == gtHedgehog)
   865 	if(GetGearType(hog) == gtHedgehog)
   656 	then
   866 	then
   657 		if(gearIsInCircle(GLOBAL_TEMP_VALUE,GetX(hog), GetY(hog), 20, false))
   867 		if(gearIsInCircle(CS.TEMP_VALUE,GetX(hog), GetY(hog), 20, false))
   658 		then
   868 		then
   659 			SetEffect(hog, hePoisoned, 5)
   869 			SetEffect(hog, hePoisoned, 5)
   660 			PlaySound(sndBump)
   870 			PlaySound(sndBump)
       
   871 			SetSoundMask(sndMissed, true)
   661 		end
   872 		end
   662 	end
   873 	end
   663 end
   874 end
   664 
   875 
   665 --european special on molotov (used fire gear)
   876 --european special on molotov (used fire gear)
   666 function EuropeSpecialMolotovHit(hog)
   877 function EuropeSpecialMolotovHit(hog)
   667 	if(GetGearType(hog) == gtHedgehog)
   878 	if(GetGearType(hog) == gtHedgehog)
   668 	then
   879 	then
   669 		if(gearIsInCircle(GLOBAL_TEMP_VALUE,GetX(hog), GetY(hog), 100, false))
   880 		if(gearIsInCircle(CS.TEMP_VALUE,GetX(hog), GetY(hog), 100, false))
   670 		then
   881 		then
   671 			local healthadd=15
   882 			local healthadd=15
   672 			HealHog(hog, healthadd+(div(healthadd*GLOBAL_VAMPIRIC_IS_ON,100)), hog == CurrentHedgehog)
   883 			HealHog(hog, healthadd+(div(healthadd*CS.VAMPIRIC_IS_ON,100)), hog == CurrentHedgehog)
   673 			SetEffect(hog, hePoisoned, false)
   884 			SetEffect(hog, hePoisoned, false)
   674 			GLOBAL_SABOTAGE_HOGS[hog]=0
   885 			CS.SABOTAGE_HOGS[hog]=0
       
   886 			SetSoundMask(sndMissed, true)
   675 		end
   887 		end
   676 	end
   888 	end
   677 end
   889 end
   678 
   890 
   679 --a weaponset string to something readable by the script
   891 --a weaponset string to something readable by the script
   688 
   900 
   689 	--default icon
   901 	--default icon
   690 	continentinfo[4]={}
   902 	continentinfo[4]={}
   691 	if(icon==1000)
   903 	if(icon==1000)
   692 	then
   904 	then
   693 		local mid=table.maxn(GLOBAL_WEAPONS_DAMAGE)
   905 		local mid=table.maxn(CS.WEAPONS_DAMAGE)
   694 		local max=mid+table.maxn(GLOBAL_WEAPONS_SUPPORT)
   906 		local max=mid+table.maxn(CS.WEAPONS_SUPPORT)
   695 		local ic=(string.byte(string) % max)+1
   907 		local ic=(string.byte(string) % max)+1
   696 
   908 
   697 		if(ic>mid)
   909 		if(ic>mid)
   698 		then
   910 		then
   699 			ic=GLOBAL_WEAPONS_SUPPORT[ic-mid][1]
   911 			ic=CS.WEAPONS_SUPPORT[ic-mid][1]
   700 		else
   912 		else
   701 			ic=GLOBAL_WEAPONS_DAMAGE[ic][1]
   913 			ic=CS.WEAPONS_DAMAGE[ic][1]
   702 		end
   914 		end
   703 
   915 
   704 		continentinfo[4][1]=ic
   916 		continentinfo[4][1]=ic
   705 		continentinfo[4][2]=-ic
   917 		continentinfo[4][2]=-ic
   706 	else
   918 	else
   754 		numb=numb+1
   966 		numb=numb+1
   755 	end
   967 	end
   756 
   968 
   757 	if(continentinfo[5]~=nil and continentinfo[5][1]~=nil)
   969 	if(continentinfo[5]~=nil and continentinfo[5][1]~=nil)
   758 	then
   970 	then
   759 		continentinfo[3]="- "..continentinfo[1]..loc(" was extracted from the scheme|- This continent will be able to use the specials from the other continents!")
   971 		continentinfo[3] =
   760 
   972 			string.format(loc("%s was extracted from the scheme"), continentinfo[1])
   761 		table.insert(GLOBAL_CONTINENT_INFORMATION, continentinfo)
   973 
       
   974 		table.insert(CS.CONTINENT_INFORMATION, continentinfo)
   762 	end
   975 	end
   763 
   976 
   764 	return nil
   977 	return nil
   765 end
   978 end
   766 
   979 
   780 				local weaponcode=string.sub(string,numb+2)
   993 				local weaponcode=string.sub(string,numb+2)
   781 				local continentinfo=transferableParamToWeaponSet(weaponcode,1000)
   994 				local continentinfo=transferableParamToWeaponSet(weaponcode,1000)
   782 
   995 
   783 				if(continentinfo~=nil)
   996 				if(continentinfo~=nil)
   784 				then
   997 				then
   785 					table.insert(GLOBAL_CONTINENT_INFORMATION, continentinfo)
   998 					table.insert(CS.CONTINENT_INFORMATION, continentinfo)
   786 				end
   999 				end
   787 				return
  1000 				return
   788 			end
  1001 			end
   789 			numb=numb+1
  1002 			numb=numb+1
   790 		end
  1003 		end
   806 	local searchfor="wt=yes"
  1019 	local searchfor="wt=yes"
   807 	local match=string.find(ScriptParam,searchfor, 1)
  1020 	local match=string.find(ScriptParam,searchfor, 1)
   808 
  1021 
   809 	if(match~=nil)
  1022 	if(match~=nil)
   810 	then
  1023 	then
   811 		GLOBAL_TEMP_VALUE=1
  1024 		CS.TEMP_VALUE=1
   812 
  1025 
   813 		ScriptParam=string.gsub(ScriptParam,"(,?)"..searchfor.."(,?)","")
  1026 		ScriptParam=string.gsub(ScriptParam,"(,?)"..searchfor.."(,?)","")
   814 	end
  1027 	end
   815 
  1028 
   816 	searchfor="spec=off"
  1029 	searchfor="spec=off"
   817 	match=string.find(ScriptParam,searchfor, 1)
  1030 	match=string.find(ScriptParam,searchfor, 1)
   818 
  1031 
   819 	if(match~=nil)
  1032 	if(match~=nil)
   820 	then
  1033 	then
   821 		OPTION_NO_SPECIALS=true
  1034 		CS.OPTION_NO_SPECIALS=true
   822 
  1035 
   823 		ScriptParam=string.gsub(ScriptParam,"(,?)"..searchfor.."(,?)","")
  1036 		ScriptParam=string.gsub(ScriptParam,"(,?)"..searchfor.."(,?)","")
   824 	end
  1037 	end
   825 
  1038 
   826 	searchfor="cont=no"
  1039 	searchfor="cont=no"
   827 	match=string.find(ScriptParam,searchfor, 1)
  1040 	match=string.find(ScriptParam,searchfor, 1)
   828 
  1041 
   829 	if(match~=nil)
  1042 	if(match~=nil)
   830 	then
  1043 	then
   831 		GLOBAL_CONTINENT_INFORMATION={}
  1044 		CS.CONTINENT_INFORMATION={}
   832 
  1045 
   833 		ScriptParam=string.gsub(ScriptParam,"(,?)"..searchfor.."(,?)","")
  1046 		ScriptParam=string.gsub(ScriptParam,"(,?)"..searchfor.."(,?)","")
   834 	end
  1047 	end
   835 
  1048 
   836 	if(ScriptParam~=nil)
  1049 	if(ScriptParam~=nil)
   837 	then
  1050 	then
   838 		local continentinfo=transferableParamToWeaponSet(ScriptParam,amLowGravity)
  1051 		local continentinfo=transferableParamToWeaponSet(ScriptParam,amLowGravity)
   839 
  1052 
   840 		if(continentinfo~=nil)
  1053 		if(continentinfo~=nil)
   841 		then
  1054 		then
   842 			table.insert(GLOBAL_CONTINENT_INFORMATION, continentinfo)
  1055 			table.insert(CS.CONTINENT_INFORMATION, continentinfo)
   843 		end
  1056 		end
   844 	end
  1057 	end
   845 end
  1058 end
   846 
  1059 
   847 --set each weapons settings
  1060 --set each weapons settings
   848 function onAmmoStoreInit()
  1061 function onAmmoStoreInit()
   849 
  1062 
   850 	SetAmmo(amSkip, 9, 0, 0, 0)
  1063 	SetAmmo(amSkip, 9, 0, 0, 0)
   851 
  1064 
   852 	for v,w in pairs(GLOBAL_WEAPONS_DAMAGE)
  1065 	for v,w in pairs(CS.WEAPONS_DAMAGE)
   853 	do
  1066 	do
   854 		SetAmmo(w[1], w[2], w[3], w[4], w[5])
  1067 		SetAmmo(w[1], w[2], w[3], w[4], w[5])
   855 	end
  1068 	end
   856 
  1069 
   857 	for v,w in pairs(GLOBAL_WEAPONS_SUPPORT)
  1070 	for v,w in pairs(CS.WEAPONS_SUPPORT)
   858 	do
  1071 	do
   859 		SetAmmo(w[1], w[2], w[3], w[4], w[5])
  1072 		SetAmmo(w[1], w[2], w[3], w[4], w[5])
   860 	end
  1073 	end
   861 end
  1074 end
   862 
  1075 
       
  1076 function SetCSAmmoDescriptions(mode)
       
  1077 	if mode == "continents" then
       
  1078 		for c=1, #CS.CONTINENT_INFORMATION do
       
  1079 			local cont = CS.CONTINENT_INFORMATION[c]
       
  1080 			local hp = string.format(loc("Initial health: %d"), cont[7])
       
  1081 			SetAmmoTexts(cont[4][1], cont[1], cont[2], hp .."|" .. cont[3])
       
  1082 			SetAmmoDescriptionAppendix(cont[4][1], nil)
       
  1083 		end
       
  1084 		SetAmmoTexts(amSwitch, loc("Random continent"), loc("If you just don't care …"), loc("Select this item for a random continent."))
       
  1085 
       
  1086 	elseif mode == "weapons" then
       
  1087 		local specSelect = loc("Switch: Select weapon special")
       
  1088 		local specHeader = loc("Available weapon specials:")
       
  1089 		local specText="|"..
       
  1090 			specSelect.."| |"..
       
  1091 			specHeader.."|"
       
  1092 
       
  1093 		SetAmmoDescriptionAppendix(amSniperRifle,
       
  1094 			specText..
       
  1095 			CS.SNIPER_SPECIAL_INFO)
       
  1096 		SetAmmoDescriptionAppendix(amBaseballBat,
       
  1097 			specText..
       
  1098 			CS.BASEBALLBAT_BOOMERANG_INFO .. "|" ..
       
  1099 			CS.BASEBALLBAT_CRICKET_INFO .. "|" ..
       
  1100 			loc("These weapon specials cannot be used close to other hogs."))
       
  1101 		SetAmmoDescriptionAppendix(amGasBomb,
       
  1102 			specText..
       
  1103 			CS.CHEESE_SPECIAL_INFO)
       
  1104 		SetAmmoDescriptionAppendix(amSeduction,
       
  1105 			specSelect .. "|" ..
       
  1106 			CS.INVULNERABLE_SPECIAL_CTRL .. "| |" ..
       
  1107 			specHeader .. "|" ..
       
  1108 			CS.SEDUCTION_SPECIAL_INFO .. "|" ..
       
  1109 			CS.INVULNERABLE_SPECIAL_INFO)
       
  1110 		SetAmmoDescriptionAppendix(amParachute,
       
  1111 			loc("Switch: Drop ball of dirt from parachute (once)") .. "| |" ..
       
  1112 			specHeader .. "|" ..
       
  1113 			CS.PARACHUTE_SPECIAL_INFO)
       
  1114 		SetAmmoDescriptionAppendix(amHammer,
       
  1115 			specText..
       
  1116 			CS.HAMMER_ROAR_INFO .. "|" ..
       
  1117 			CS.HAMMER_SWAP_INFO .. "|" ..
       
  1118 			CS.HAMMER_LONELY_INFO .. "|" ..
       
  1119 			CS.HAMMER_SABOTAGE_INFO)
       
  1120 		SetAmmoDescriptionAppendix(amSMine,
       
  1121 			specText..
       
  1122 			CS.STICKY_PROJECTILE_INFO .. "|" ..
       
  1123 			CS.STICKY_NAPALM_INFO)
       
  1124 		SetAmmoDescriptionAppendix(amShotgun,
       
  1125 			specText..
       
  1126 			CS.SHOTGUN_SPECIAL_INFO)
       
  1127 		SetAmmoDescriptionAppendix(amMolotov,
       
  1128 			specText..
       
  1129 			CS.MOLOTOV_SPECIAL_INFO)
       
  1130 		SetAmmoDescriptionAppendix(amPickHammer,
       
  1131 			specText..
       
  1132 			CS.PICKHAMMER_SPECIAL_INFO)
       
  1133 
       
  1134 		for c=1, #CS.CONTINENT_INFORMATION do
       
  1135 			local cont = CS.CONTINENT_INFORMATION[c]
       
  1136 			SetAmmoTexts(cont[4][1], nil, nil, nil)
       
  1137 		end
       
  1138 		SetAmmoTexts(amSwitch, nil, nil, nil)
       
  1139 	end
       
  1140 
       
  1141 	if mode == "continents" or not CS.GAME_STARTED then
       
  1142 		SetAmmoTexts(amSkip, loc("Select continent"), loc("Continent selection"), loc("Select the current continent.") .. "|" .. loc("Choose your continent wisely, as your decision will be permanent.") .. "|" .. loc("Up/Down: Browse through continents") .. "|" .. loc("Attack: Select this continent"))
       
  1143 	else
       
  1144 		SetAmmoTexts(amSkip, nil, nil, nil)
       
  1145 	end
       
  1146 end
       
  1147 
   863 --on game start
  1148 --on game start
   864 function onGameStart()
  1149 function onGameStart()
   865 	ShowMission(loc("Continental supplies"),loc("Let a continent provide your weapons!"),GLOBAL_GENERAL_INFORMATION, -amLowGravity, 0)
  1150 	ShowMission(loc("Continental supplies"),loc("Let a continent provide your weapons!"),GeneralInformation(), 0, 0)
   866 
  1151 	SetCSAmmoDescriptions("continents")
   867 	local specText="| |"..loc("Additional feautures for this weapon: (Switch/Tab)").."|"
  1152 
   868 
  1153 	if(CS.TEMP_VALUE==1)
   869 	SetAmmoDescriptionAppendix(amSniperRifle,specText..GLOBAL_SNIPER_SPECIAL_INFO)
       
   870 	SetAmmoDescriptionAppendix(amBaseballBat,specText..GLOBAL_BASEBALLBAT_BOOMERANG_INFO .. "|" .. GLOBAL_BASEBALLBAT_CRICKET_INFO)
       
   871 	SetAmmoDescriptionAppendix(amGasBomb,specText..GLOBAL_CHEESE_SPECIAL_INFO)
       
   872 	SetAmmoDescriptionAppendix(amSeduction,specText..GLOBAL_SEDUCTION_SPECIAL_INFO)
       
   873 	SetAmmoDescriptionAppendix(amInvulnerable,specText..GLOBAL_INVULNERABLE_SPECIAL_INFO)
       
   874 	SetAmmoDescriptionAppendix(amParachute,specText..GLOBAL_PARACHUTE_SPECIAL_INFO)
       
   875 	SetAmmoDescriptionAppendix(amHammer,specText..GLOBAL_HAMMER_ROAR_INFO .. "|" .. GLOBAL_HAMMER_SWAP_INFO .. "|" .. GLOBAL_HAMMER_LONELY_INFO .. "|" .. GLOBAL_HAMMER_SABOTAGE_INFO)
       
   876 	SetAmmoDescriptionAppendix(amSMine,specText..GLOBAL_STICKY_PROJECTILE_INFO .. "|" .. GLOBAL_STICKY_NAPALM_INFO)
       
   877 	SetAmmoDescriptionAppendix(amShotgun,specText..GLOBAL_SHOTGUN_SPECIAL_INFO)
       
   878 	SetAmmoDescriptionAppendix(amMolotov,specText..GLOBAL_MOLOTOV_SPECIAL_INFO)
       
   879 	SetAmmoDescriptionAppendix(amPickHammer,specText..GLOBAL_PICKHAMMER_SPECIAL_INFO)
       
   880 
       
   881 	if(GLOBAL_TEMP_VALUE==1)
       
   882 	then
  1154 	then
   883 		runOnGears(HogNameToWeaponset)
  1155 		runOnGears(HogNameToWeaponset)
   884 	end
  1156 	end
   885 end
  1157 end
   886 
  1158 
   888 	SuddenDeathTurns= SuddenDeathTurns+1
  1160 	SuddenDeathTurns= SuddenDeathTurns+1
   889 end
  1161 end
   890 
  1162 
   891 --what happen when a turn starts
  1163 --what happen when a turn starts
   892 function onNewTurn()
  1164 function onNewTurn()
   893 
       
   894 	--will refresh the info on each tab weapon
  1165 	--will refresh the info on each tab weapon
   895 	GLOBAL_AUSTRALIAN_SPECIAL=0
  1166 	CS.AUSTRALIAN_SPECIAL=0
   896 	GLOBAL_AFRICAN_SPECIAL_SEDUCTION=0
  1167 	CS.AFRICAN_SPECIAL_SEDUCTION=0
   897 	GLOBAL_SEDUCTION_INCREASER=0
  1168 	CS.SEDUCTION_INCREASER=0
   898 	GLOBAL_SOUTH_AMERICAN_SPECIAL=false
  1169 	CS.SOUTH_AMERICAN_SPECIAL=false
   899 	GLOBAL_AFRICAN_SPECIAL_STICKY=0
  1170 	CS.AFRICAN_SPECIAL_STICKY=0
   900 	GLOBAL_KERGUELEN_SPECIAL=1
  1171 	CS.KERGUELEN_SPECIAL=1
   901 	GLOBAL_NORTH_AMERICAN_SPECIAL_SNIPER=1
  1172 	CS.NORTH_AMERICAN_SPECIAL_SNIPER=1
   902 	GLOBAL_NORTH_AMERICAN_SPECIAL_SHOTGUN=false
  1173 	CS.NORTH_AMERICAN_SPECIAL_SHOTGUN=false
   903 	GLOBAL_NORTH_AMERICAN_SPECIAL_SNIPER_IS_ON=false
  1174 	CS.NORTH_AMERICAN_SPECIAL_SNIPER_IS_ON=false
   904 	GLOBAL_EUROPE_SPECIAL=0
  1175 	CS.EUROPE_SPECIAL=0
   905 	GLOBAL_VAMPIRIC_IS_ON=0
  1176 	CS.VAMPIRIC_IS_ON=0
   906 	GLOBAL_EXTRA_DAMAGE_IS_ON=100
  1177 	CS.EXTRA_DAMAGE_IS_ON=100
   907 	GLOBAL_CRATE_TEST=-1
  1178 	CS.SABOTAGE_COUNTER=0
   908 	GLOBAL_SABOTAGE_COUNTER=0
  1179 	CS.ANTARCTICA_SPECIAL=0
   909 	GLOBAL_ANTARCTICA_SPECIAL=0
  1180 
   910 
  1181 	CS.TEMP_VALUE=0
   911 	GLOBAL_TEMP_VALUE=0
  1182 
   912 
  1183 	CS.SUNDALAND_END_HOG_CONTINENT_NAME=GetHogTeamName(CurrentHedgehog)
   913 	GLOBAL_SUNDALAND_END_HOG_CONTINENT_NAME=GetHogTeamName(CurrentHedgehog)
  1184 
       
  1185 	if TotalRounds >= 1 then
       
  1186 		CS.GAME_STARTED = true
       
  1187 	end
       
  1188 
       
  1189 	SetSoundMask(sndLaugh, false)
       
  1190 	SetSoundMask(sndMissed, false)
       
  1191 	CS.AFRICAN_SPECIAL_NON_PROJECTILE_USED=false
       
  1192 	SetAttackState(true)
   914 
  1193 
   915 	--when all hogs are "placed"
  1194 	--when all hogs are "placed"
   916 	if(GetCurAmmoType()~=amTeleport)
  1195 	if(GetCurAmmoType()~=amTeleport)
   917 	then
  1196 	then
   918 		--will run once when the game really starts (after placing hogs and so on
  1197 		--will run once when the game really starts (after placing hogs and so on
   919 		if(GLOBAL_INIT_TEAMS[GetHogTeamName(CurrentHedgehog)] == nil)
  1198 		if(CS.INIT_TEAMS[GetHogTeamName(CurrentHedgehog)] == nil)
   920 		then
  1199 		then
   921 			SetInputMask(band(0xFFFFFFFF,gmWeapon))
  1200 			SetInputMask(band(GetInputMask(), gmWeapon))
   922 
  1201 
   923 			if(GLOBAL_START_TIME==0)
  1202 			if(CS.START_TIME==0)
   924 			then
  1203 			then
   925 				GLOBAL_START_TIME=TurnTimeLeft
  1204 				CS.START_TIME=TurnTimeLeft
   926 				GLOBAL_HOG_HEALTH=GetHealth(CurrentHedgehog)
  1205 				CS.HOG_HEALTH=GetHealth(CurrentHedgehog)
   927 			end
  1206 			end
   928 
  1207 
   929 			TurnTimeLeft=100000
  1208 			TurnTimeLeft=100000
   930 
  1209 
   931 			AddCaption(GLOBAL_SELECT_WEP_INFORMATION, GetClanColor(GetHogClan(CurrentHedgehog)), capgrpMessage)
  1210 			AddCaption(string.format(CS.SELECT_WEP_INFORMATION_SHORT, GetHogTeamName(CurrentHedgehog)), 0xFFFFFFFF, capgrpGameState)
   932 			ShowMission(loc("Continental supplies"),loc("Let a continent provide your weapons!"),GLOBAL_GENERAL_INFORMATION, -amLowGravity, 0)
  1211 			AddCaption(loc("No continent selected"), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmoinfo)
   933 			HideMission()
  1212 			CS.SELECT_CONTINENT_CHECK=true
       
  1213 			ShowMission(loc("Continental supplies"),loc("Let a continent provide your weapons!"),GeneralInformation(), 0, 0)
       
  1214 			SetCSAmmoDescriptions("continents")
   934 
  1215 
   935 			InitWeaponsMenu(CurrentHedgehog)
  1216 			InitWeaponsMenu(CurrentHedgehog)
   936 			GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]=0
  1217 			CS.TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]=0
   937 			GLOBAL_SELECT_CONTINENT_CHECK=true
  1218 			CS.INIT_TEAMS[GetHogTeamName(CurrentHedgehog)] = 2
   938 			GLOBAL_INIT_TEAMS[GetHogTeamName(CurrentHedgehog)] = 2
  1219 
   939 
       
   940 --			if(GLOBAL_SABOTAGE_HOGS[CurrentHedgehog]==1)
       
   941 --			then
       
   942 --				GLOBAL_SABOTAGE_COUNTER=-750
       
   943 --			end
       
   944 		else
  1220 		else
   945 			--if its not the initialization turn
  1221 			--if its not the initialization turn
   946 			GLOBAL_SELECT_CONTINENT_CHECK=false
  1222 			CS.SELECT_CONTINENT_CHECK=false
   947 			SetInputMask(0xFFFFFFFF)
  1223 			SetInputMask(bor(GetInputMask(), bnot(gmWeapon)))
   948 
  1224 
   949 			if(GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]==0)
  1225 			if(CS.TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]==0)
   950 			then
  1226 			then
   951 				GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]=GetRandom(table.maxn(GLOBAL_CONTINENT_INFORMATION))+1
  1227 				CS.TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]=GetRandom(table.maxn(CS.CONTINENT_INFORMATION))+1
   952 				SetContinentWeapons()
  1228 				SetContinentWeapons()
   953 			end
  1229 			end
   954 			local currCont=GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]
  1230 			local currCont=CS.TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]
   955 			local checkDefCont=GLOBAL_CONTINENT_INFORMATION[currCont][4][2]
  1231 			local checkDefCont=CS.CONTINENT_INFORMATION[currCont][4][2]
   956 
  1232 
   957 			--give zeelandia-teams new weapons so they can plan for the next turn
  1233 			--give zeelandia-teams new weapons so they can plan for the next turn
       
  1234 			-- Use temporary value to store list of collected weapons
       
  1235 			CS.TEMP_VALUE = {}
   958 			runOnGears(RandomContinentsGetWeapons)
  1236 			runOnGears(RandomContinentsGetWeapons)
   959 
  1237 			for hog, ammoList in pairs(CS.TEMP_VALUE) do
   960 			--some specials for some continents (GLOBAL_TEMP_VALUE is from get random weapons)
  1238 				CollectMultiAmmo(hog, ammoList, true)
       
  1239 			end
       
  1240 
       
  1241 			--some specials for some continents (CS.TEMP_VALUE is from get random weapons)
   961 			if(checkDefCont==9)
  1242 			if(checkDefCont==9)
   962 			then
  1243 			then
   963 				setTeamValue(GetHogTeamName(CurrentHedgehog), "rand-done-turn", false)
  1244 				setTeamValue(GetHogTeamName(CurrentHedgehog), "rand-done-turn", false)
   964 			elseif(checkDefCont==7)
  1245 			elseif(checkDefCont==7)
   965 			then
  1246 			then
   967 				if(getTeamValue(GetHogTeamName(CurrentHedgehog), "Antarctica2-turntick")==nil)
  1248 				if(getTeamValue(GetHogTeamName(CurrentHedgehog), "Antarctica2-turntick")==nil)
   968 				then
  1249 				then
   969 					setTeamValue(GetHogTeamName(CurrentHedgehog), "Antarctica2-turntick", 1)
  1250 					setTeamValue(GetHogTeamName(CurrentHedgehog), "Antarctica2-turntick", 1)
   970 				end
  1251 				end
   971 
  1252 
       
  1253 				-- Antarctic summer
   972 				if(getTeamValue(GetHogTeamName(CurrentHedgehog), "Antarctica2-turntick")>=4)
  1254 				if(getTeamValue(GetHogTeamName(CurrentHedgehog), "Antarctica2-turntick")>=4)
   973 				then
  1255 				then
   974 					AddAmmo(CurrentHedgehog,amPortalGun)
  1256 					CollectMultiAmmo(CurrentHedgehog, {[amPortalGun] = 1, [amSineGun] = 2, [amGirder] = 1, [amSnowball] = 1})
   975 					AddAmmo(CurrentHedgehog,amSineGun)
       
   976 					AddAmmo(CurrentHedgehog,amSineGun)
       
   977 					AddAmmo(CurrentHedgehog,amGirder)
       
   978 					AddAmmo(CurrentHedgehog,amSnowball)
       
   979 					setTeamValue(GetHogTeamName(CurrentHedgehog), "Antarctica2-turntick", 0)
  1257 					setTeamValue(GetHogTeamName(CurrentHedgehog), "Antarctica2-turntick", 0)
   980 				end
  1258 				end
   981 				setTeamValue(GetHogTeamName(CurrentHedgehog), "Antarctica2-turntick", getTeamValue(GetHogTeamName(CurrentHedgehog), "Antarctica2-turntick")+1)
  1259 				setTeamValue(GetHogTeamName(CurrentHedgehog), "Antarctica2-turntick", getTeamValue(GetHogTeamName(CurrentHedgehog), "Antarctica2-turntick")+1)
   982 
  1260 
   983 			elseif(checkDefCont==5)
  1261 			elseif(checkDefCont==5)
   988 					setTeamValue(GetHogTeamName(CurrentHedgehog), "Asia-turntick", 1)
  1266 					setTeamValue(GetHogTeamName(CurrentHedgehog), "Asia-turntick", 1)
   989 				end
  1267 				end
   990 
  1268 
   991 				if(getTeamValue(GetHogTeamName(CurrentHedgehog), "Asia-turntick")>=2)
  1269 				if(getTeamValue(GetHogTeamName(CurrentHedgehog), "Asia-turntick")>=2)
   992 				then
  1270 				then
   993 					AddAmmo(CurrentHedgehog,amParachute)
  1271 					CollectMultiAmmo(CurrentHedgehog, {[amParachute] = 1})
   994 					setTeamValue(GetHogTeamName(CurrentHedgehog), "Asia-turntick", 0)
  1272 					setTeamValue(GetHogTeamName(CurrentHedgehog), "Asia-turntick", 0)
   995 				end
  1273 				end
   996 				setTeamValue(GetHogTeamName(CurrentHedgehog), "Asia-turntick", getTeamValue(GetHogTeamName(CurrentHedgehog), "Asia-turntick")+1)
  1274 				setTeamValue(GetHogTeamName(CurrentHedgehog), "Asia-turntick", getTeamValue(GetHogTeamName(CurrentHedgehog), "Asia-turntick")+1)
   997 			elseif(checkDefCont==1)
  1275 			elseif(checkDefCont==1)
   998 			then
  1276 			then
   999 				GLOBAL_TEMP_VALUE=0
  1277 				CS.TEMP_VALUE=0
  1000 				runOnGears(CountHogsInTeam)
  1278 				runOnGears(CountHogsInTeam)
  1001 
  1279 
  1002 				if(GLOBAL_TEMP_VALUE>1)
  1280 				if(CS.TEMP_VALUE>1)
  1003 				then
  1281 				then
  1004 					AddAmmo(CurrentHedgehog,amSwitch,GetAmmoCount(CurrentHedgehog, amSwitch)+1)
  1282 					AddAmmo(CurrentHedgehog,amSwitch,GetAmmoCount(CurrentHedgehog, amSwitch)+1)
  1005 
  1283 
  1006 					SetWeapon(amSwitch)
  1284 					SetWeapon(amSwitch)
  1007 					GLOBAL_TEMP_VALUE=87
  1285 					CS.TEMP_VALUE=87
  1008 				end
  1286 				end
  1009 			end
  1287 			end
  1010 
  1288 
  1011 			ShowContinentInfo(currCont,-1,true)
  1289 			ShowContinentInfo(currCont,-1,true)
  1012 		end
  1290 			SetCSAmmoDescriptions("weapons")
  1013 	end
  1291 		end
       
  1292 	end
       
  1293 end
       
  1294 
       
  1295 function ShowSpecialWeaponCaption(ammoType)
       
  1296 	--place mine (australia)
       
  1297 	if(ammoType == amBaseballBat)
       
  1298 	then
       
  1299 		if(CS.AUSTRALIAN_SPECIAL==1)
       
  1300 		then
       
  1301 			AddCaption(CS.BASEBALLBAT_CRICKET_NAME, GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmoinfo)
       
  1302 		elseif(CS.AUSTRALIAN_SPECIAL==2)
       
  1303 		then
       
  1304 			AddCaption(CS.BASEBALLBAT_BOOMERANG_NAME, GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmoinfo)
       
  1305 		else
       
  1306 			AddCaption(GetAmmoName(amBaseballBat), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmoinfo)
       
  1307 		end
       
  1308 
       
  1309 	--africa
       
  1310 	elseif(ammoType == amSeduction)
       
  1311 	then
       
  1312 		if(CS.AFRICAN_SPECIAL_SEDUCTION==1)
       
  1313 		then
       
  1314 			AddCaption(CS.SEDUCTION_SPECIAL_NAME, GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmoinfo)
       
  1315 			AddCaption(string.format(CS.INVULNERABLE_SPECIAL_CAPTION, CS.SEDUCTION_INCREASER, GetAmmoCount(CurrentHedgehog,amInvulnerable)), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmostate)
       
  1316 		else
       
  1317 			AddCaption(GetAmmoName(amSeduction), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmoinfo)
       
  1318 		end
       
  1319 
       
  1320 	--south america
       
  1321 	elseif(ammoType == amGasBomb)
       
  1322 	then
       
  1323 		if(CS.SOUTH_AMERICAN_SPECIAL==true)
       
  1324 		then
       
  1325 			AddCaption(CS.CHEESE_SPECIAL_NAME, GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmoinfo)
       
  1326 		else
       
  1327 			AddCaption(GetAmmoName(amGasBomb), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmoinfo)
       
  1328 		end
       
  1329 
       
  1330 	--africa
       
  1331 	elseif(ammoType == amSMine)
       
  1332 	then
       
  1333 		if(CS.AFRICAN_SPECIAL_STICKY==1)
       
  1334 		then
       
  1335 			AddCaption(CS.STICKY_PROJECTILE_NAME, GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmoinfo)
       
  1336 		elseif(CS.AFRICAN_SPECIAL_STICKY == 2)
       
  1337 		then
       
  1338 			AddCaption(CS.STICKY_NAPALM_NAME, GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmoinfo)
       
  1339 		else
       
  1340 			AddCaption(GetAmmoName(amSMine), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmoinfo)
       
  1341 		end
       
  1342 
       
  1343 	--north america (sniper)
       
  1344 	elseif(ammoType == amSniperRifle and CS.NORTH_AMERICAN_SPECIAL_SNIPER_IS_ON==false)
       
  1345 	then
       
  1346 		if(CS.NORTH_AMERICAN_SPECIAL_SNIPER==1)
       
  1347 		then
       
  1348 			AddCaption(GetAmmoName(amSniperRifle), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmoinfo)
       
  1349 		elseif(CS.NORTH_AMERICAN_SPECIAL_SNIPER==2)
       
  1350 		then
       
  1351 			AddCaption(CS.SNIPER_SPECIAL_NAME, GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmoinfo)
       
  1352 		end
       
  1353 
       
  1354 	--north america (shotgun)
       
  1355 	elseif(ammoType == amShotgun)
       
  1356 	then
       
  1357 		if(CS.NORTH_AMERICAN_SPECIAL_SHOTGUN==true)
       
  1358 		then
       
  1359 			AddCaption(CS.SHOTGUN_SPECIAL_NAME, GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmoinfo)
       
  1360 		else
       
  1361 			AddCaption(GetAmmoName(amShotgun), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmoinfo)
       
  1362 		end
       
  1363 
       
  1364 	--europe
       
  1365 	elseif(ammoType == amMolotov)
       
  1366 	then
       
  1367 		if(CS.EUROPE_SPECIAL==1)
       
  1368 		then
       
  1369 			AddCaption(CS.MOLOTOV_SPECIAL_NAME, GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmoinfo)
       
  1370 		else
       
  1371 			AddCaption(GetAmmoName(amMolotov), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmoinfo)
       
  1372 		end
       
  1373 
       
  1374 	--antarctica
       
  1375 	elseif(ammoType == amPickHammer)
       
  1376 	then
       
  1377 		if(CS.ANTARCTICA_SPECIAL==1)
       
  1378 		then
       
  1379 			AddCaption(CS.PICKHAMMER_SPECIAL_NAME, GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmoinfo)
       
  1380 		else
       
  1381 			AddCaption(GetAmmoName(amPickHammer), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmoinfo)
       
  1382 		end
       
  1383 
       
  1384 	--kerguelen
       
  1385 	elseif(ammoType == amHammer)
       
  1386 	then
       
  1387 		if(CS.KERGUELEN_SPECIAL==1)
       
  1388 		then
       
  1389 			AddCaption(GetAmmoName(amHammer), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmoinfo)
       
  1390 		elseif(CS.KERGUELEN_SPECIAL==2)
       
  1391 		then
       
  1392 			AddCaption(CS.HAMMER_ROAR_NAME, GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmoinfo)
       
  1393 		elseif(CS.KERGUELEN_SPECIAL==3)
       
  1394 		then
       
  1395 			AddCaption(CS.HAMMER_SWAP_NAME, GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmoinfo)
       
  1396 		elseif(CS.KERGUELEN_SPECIAL==5)
       
  1397 		then
       
  1398 			AddCaption(CS.HAMMER_LONELY_NAME, GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmoinfo)
       
  1399 		elseif(CS.KERGUELEN_SPECIAL==6)
       
  1400 		then
       
  1401 			AddCaption(CS.HAMMER_SABOTAGE_NAME, GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmoinfo)
       
  1402 		end
       
  1403 	end
       
  1404 end
       
  1405 
       
  1406 function onPrecise()
       
  1407 	CS.PRECISE = true
       
  1408 end
       
  1409 function onPreciseUp()
       
  1410 	CS.PRECISE = false
  1014 end
  1411 end
  1015 
  1412 
  1016 --what happens when you press "tab" (common button)
  1413 --what happens when you press "tab" (common button)
  1017 function onSwitch()
  1414 function onSwitch()
  1018 
  1415 
  1019 	if(GLOBAL_SWITCH_HOG_IS_ON==false)
  1416 	if(CS.SWITCH_HOG_IS_ON==false)
  1020 	then
  1417 	then
  1021 		if(OPTION_NO_SPECIALS==false and GLOBAL_SELECT_CONTINENT_CHECK==false)
  1418 		if(CS.OPTION_NO_SPECIALS==false and CS.SELECT_CONTINENT_CHECK==false and
       
  1419 		band(GetState(CurrentHedgehog), gstAttacked) == 0 and
       
  1420 		band(GetState(CurrentHedgehog), gstHHDriven) ~= 0)
  1022 		then
  1421 		then
  1023 			--place mine (australia)
  1422 			--place mine (australia)
  1024 			if(GetCurAmmoType() == amBaseballBat)
  1423 			if(GetCurAmmoType() == amBaseballBat)
  1025 			then
  1424 			then
  1026 				if(GLOBAL_AUSTRALIAN_SPECIAL==0)
  1425 				CS.AUSTRALIAN_SPECIAL = CS.AUSTRALIAN_SPECIAL + 1
  1027 				then
  1426 				CS.AUSTRALIAN_SPECIAL = CS.AUSTRALIAN_SPECIAL % 3
  1028 					GLOBAL_AUSTRALIAN_SPECIAL = 1
  1427 
  1029 					AddCaption(GLOBAL_BASEBALLBAT_CRICKET_INFO)
  1428 				SetAttackState(CS.AUSTRALIAN_SPECIAL == 0)
  1030 				elseif(GLOBAL_AUSTRALIAN_SPECIAL==1)
       
  1031 				then
       
  1032 					GLOBAL_AUSTRALIAN_SPECIAL = 2
       
  1033 					AddCaption(GLOBAL_BASEBALLBAT_BOOMERANG_INFO)
       
  1034 				else
       
  1035 					GLOBAL_AUSTRALIAN_SPECIAL = 0
       
  1036 					AddCaption(loc("DEFAULT"))
       
  1037 				end
       
  1038 
  1429 
  1039 			--Asian special
  1430 			--Asian special
  1040 			elseif(GLOBAL_PARACHUTE_IS_ON==1)
  1431 			elseif(CS.PARACHUTE_IS_ON==1)
  1041 			then
  1432 			then
  1042 				asiabomb=AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog)+3, gtSnowball, 0, 0, 0, 0)
  1433 				local asiabomb=AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog)+3, gtSnowball, 0, 0, 0, 0)
  1043 				SetGearMessage(asiabomb, 1)
  1434 				SetGearMessage(asiabomb, 1)
  1044 
  1435 
  1045 				GLOBAL_PARACHUTE_IS_ON=2
  1436 				CS.PARACHUTE_IS_ON=2
  1046 				GLOBAL_SELECT_CONTINENT_CHECK=false
  1437 				CS.SELECT_CONTINENT_CHECK=false
  1047 
  1438 
  1048 			--africa
  1439 			--africa
  1049 			elseif(GetCurAmmoType() == amSeduction)
  1440 			elseif(GetCurAmmoType() == amSeduction)
  1050 			then
  1441 			then
  1051 				if(GLOBAL_AFRICAN_SPECIAL_SEDUCTION==0)
  1442 				if(CS.AFRICAN_SPECIAL_SEDUCTION==0)
  1052 				then
  1443 				then
  1053 					GLOBAL_AFRICAN_SPECIAL_SEDUCTION = 1
  1444 					CS.AFRICAN_SPECIAL_SEDUCTION = 1
  1054 
       
  1055 					AddCaption(string.format(GLOBAL_SEDUCTION_SPECIAL_INFO,GLOBAL_SEDUCTION_INCREASER))
       
  1056 				else
  1445 				else
  1057 					GLOBAL_AFRICAN_SPECIAL_SEDUCTION = 0
  1446 					CS.AFRICAN_SPECIAL_SEDUCTION = 0
  1058 					AddCaption(loc("DEFAULT"))
       
  1059 				end
  1447 				end
  1060 
  1448 
  1061 			--south america
  1449 			--south america
  1062 			elseif(GetCurAmmoType() == amGasBomb)
  1450 			elseif(GetCurAmmoType() == amGasBomb)
  1063 			then
  1451 			then
  1064 				if(GLOBAL_SOUTH_AMERICAN_SPECIAL==false)
  1452 				if(CS.SOUTH_AMERICAN_SPECIAL==false)
  1065 				then
  1453 				then
  1066 					GLOBAL_SOUTH_AMERICAN_SPECIAL = true
  1454 					CS.SOUTH_AMERICAN_SPECIAL = true
  1067 					AddCaption(GLOBAL_CHEESE_SPECIAL_INFO)
       
  1068 				else
  1455 				else
  1069 					GLOBAL_SOUTH_AMERICAN_SPECIAL = false
  1456 					CS.SOUTH_AMERICAN_SPECIAL = false
  1070 					AddCaption(loc("DEFAULT"))
       
  1071 				end
  1457 				end
  1072 
  1458 
  1073 			--africa
  1459 			--africa
  1074 			elseif(GetCurAmmoType() == amSMine)
  1460 			elseif(GetCurAmmoType() == amSMine)
  1075 			then
  1461 			then
  1076 				if(GLOBAL_AFRICAN_SPECIAL_STICKY==0)
  1462 				CS.AFRICAN_SPECIAL_STICKY = CS.AFRICAN_SPECIAL_STICKY + 1
       
  1463 				CS.AFRICAN_SPECIAL_STICKY = CS.AFRICAN_SPECIAL_STICKY % 3
       
  1464 				SetSoundMask(sndLaugh, CS.AFRICAN_SPECIAL_STICKY ~= 0)
       
  1465 
       
  1466 			--north america (sniper)
       
  1467 			elseif(GetCurAmmoType() == amSniperRifle and CS.NORTH_AMERICAN_SPECIAL_SNIPER_IS_ON==false)
       
  1468 			then
       
  1469 				if(CS.NORTH_AMERICAN_SPECIAL_SNIPER==2)
  1077 				then
  1470 				then
  1078 					GLOBAL_AFRICAN_SPECIAL_STICKY = 1
  1471 					CS.NORTH_AMERICAN_SPECIAL_SNIPER = 1
  1079 					AddCaption(GLOBAL_STICKY_PROJECTILE_INFO)
  1472 				elseif(CS.NORTH_AMERICAN_SPECIAL_SNIPER==1)
  1080 				elseif(GLOBAL_AFRICAN_SPECIAL_STICKY == 1)
       
  1081 				then
  1473 				then
  1082 					GLOBAL_AFRICAN_SPECIAL_STICKY = 2
  1474 					CS.NORTH_AMERICAN_SPECIAL_SNIPER = 2
  1083 					AddCaption(GLOBAL_STICKY_NAPALM_INFO)
       
  1084 				elseif(GLOBAL_AFRICAN_SPECIAL_STICKY == 2)
       
  1085 				then
       
  1086 					GLOBAL_AFRICAN_SPECIAL_STICKY = 0
       
  1087 					AddCaption(loc("DEFAULT"))
       
  1088 				end
       
  1089 
       
  1090 			--north america (sniper)
       
  1091 			elseif(GetCurAmmoType() == amSniperRifle and GLOBAL_NORTH_AMERICAN_SPECIAL_SNIPER_IS_ON==false)
       
  1092 			then
       
  1093 				if(GLOBAL_NORTH_AMERICAN_SPECIAL_SNIPER==2)
       
  1094 				then
       
  1095 					GLOBAL_NORTH_AMERICAN_SPECIAL_SNIPER = 1
       
  1096 					AddCaption(loc("DEFAULT"))
       
  1097 				elseif(GLOBAL_NORTH_AMERICAN_SPECIAL_SNIPER==1)
       
  1098 				then
       
  1099 					GLOBAL_NORTH_AMERICAN_SPECIAL_SNIPER = 2
       
  1100 					AddCaption(GLOBAL_SNIPER_SPECIAL_INFO)
       
  1101 				end
  1475 				end
  1102 
  1476 
  1103 			--north america (shotgun)
  1477 			--north america (shotgun)
  1104 			elseif(GetCurAmmoType() == amShotgun)
  1478 			elseif(GetCurAmmoType() == amShotgun)
  1105 			then
  1479 			then
  1106 				if(GLOBAL_NORTH_AMERICAN_SPECIAL_SHOTGUN==false)
  1480 				if(CS.NORTH_AMERICAN_SPECIAL_SHOTGUN==false)
  1107 				then
  1481 				then
  1108 					GLOBAL_NORTH_AMERICAN_SPECIAL_SHOTGUN = true
  1482 					CS.NORTH_AMERICAN_SPECIAL_SHOTGUN = true
  1109 					AddCaption(GLOBAL_SHOTGUN_SPECIAL_INFO)
       
  1110 				else
  1483 				else
  1111 					GLOBAL_NORTH_AMERICAN_SPECIAL_SHOTGUN = false
  1484 					CS.NORTH_AMERICAN_SPECIAL_SHOTGUN = false
  1112 					AddCaption(loc("DEFAULT"))
       
  1113 				end
  1485 				end
  1114 
  1486 
  1115 			--europe
  1487 			--europe
  1116 			elseif(GetCurAmmoType() == amMolotov)
  1488 			elseif(GetCurAmmoType() == amMolotov)
  1117 			then
  1489 			then
  1118 				if(GLOBAL_EUROPE_SPECIAL==0)
  1490 				if(CS.EUROPE_SPECIAL==0)
  1119 				then
  1491 				then
  1120 					GLOBAL_EUROPE_SPECIAL = 1
  1492 					CS.EUROPE_SPECIAL = 1
  1121 					AddCaption(GLOBAL_MOLOTOV_SPECIAL_INFO)
       
  1122 				else
  1493 				else
  1123 					GLOBAL_EUROPE_SPECIAL = 0
  1494 					CS.EUROPE_SPECIAL = 0
  1124 					AddCaption(loc("DEFAULT"))
       
  1125 				end
  1495 				end
  1126 
  1496 
  1127 			--antarctica
  1497 			--antarctica
  1128 			elseif(GetCurAmmoType() == amPickHammer)
  1498 			elseif(GetCurAmmoType() == amPickHammer)
  1129 			then
  1499 			then
  1130 				if(GLOBAL_ANTARCTICA_SPECIAL==0)
  1500 				if(CS.ANTARCTICA_SPECIAL==0)
  1131 				then
  1501 				then
  1132 					GLOBAL_ANTARCTICA_SPECIAL = 1
  1502 					CS.ANTARCTICA_SPECIAL = 1
  1133 					AddCaption(GLOBAL_PICKHAMMER_SPECIAL_INFO)
       
  1134 				else
  1503 				else
  1135 					GLOBAL_ANTARCTICA_SPECIAL = 0
  1504 					CS.ANTARCTICA_SPECIAL = 0
  1136 					AddCaption(loc("DEFAULT"))
       
  1137 				end
  1505 				end
  1138 
  1506 
  1139 			--kerguelen
  1507 			--kerguelen
  1140 			elseif(GetCurAmmoType() == amHammer)
  1508 			elseif(GetCurAmmoType() == amHammer)
  1141 			then
  1509 			then
  1142 				if(GLOBAL_KERGUELEN_SPECIAL==6)
  1510 				if(CS.KERGUELEN_SPECIAL==6)
  1143 				then
  1511 				then
  1144 					GLOBAL_KERGUELEN_SPECIAL = 1
  1512 					CS.KERGUELEN_SPECIAL = 1
  1145 					AddCaption("DEFAULT")
  1513 				elseif(CS.KERGUELEN_SPECIAL==1)
  1146 				elseif(GLOBAL_KERGUELEN_SPECIAL==1)
       
  1147 				then
  1514 				then
  1148 					GLOBAL_KERGUELEN_SPECIAL = 2
  1515 					CS.KERGUELEN_SPECIAL = 2
  1149 					AddCaption("#"..GLOBAL_HAMMER_ROAR_INFO)
  1516 				elseif(CS.KERGUELEN_SPECIAL==2)
  1150 				elseif(GLOBAL_KERGUELEN_SPECIAL==2)
       
  1151 				then
  1517 				then
  1152 					GLOBAL_KERGUELEN_SPECIAL = 3
  1518 					CS.KERGUELEN_SPECIAL = 3
  1153 					AddCaption("##"..GLOBAL_HAMMER_SWAP_INFO)
  1519 				elseif(CS.KERGUELEN_SPECIAL==3)
  1154 				elseif(GLOBAL_KERGUELEN_SPECIAL==3)
       
  1155 				then
  1520 				then
  1156 					GLOBAL_KERGUELEN_SPECIAL = 5
  1521 					CS.KERGUELEN_SPECIAL = 5
  1157 					AddCaption("###"..GLOBAL_HAMMER_LONELY_INFO)
  1522 				elseif(CS.KERGUELEN_SPECIAL==5)
  1158 				elseif(GLOBAL_KERGUELEN_SPECIAL==5)
       
  1159 				then
  1523 				then
  1160 					GLOBAL_KERGUELEN_SPECIAL = 6
  1524 					CS.KERGUELEN_SPECIAL = 6
  1161 					AddCaption("####"..GLOBAL_HAMMER_SABOTAGE_INFO)
       
  1162 				end
  1525 				end
  1163 			end
  1526 				SetAttackState(CS.KERGUELEN_SPECIAL == 1)
       
  1527 			end
       
  1528 			ShowSpecialWeaponCaption(GetCurAmmoType())
  1164 		end
  1529 		end
  1165 		--for selecting weaponset, this is mostly for old players.
  1530 		--for selecting weaponset, this is mostly for old players.
  1166 		if(GetHogLevel(CurrentHedgehog)==0 and GLOBAL_SELECT_CONTINENT_CHECK==true and (GetCurAmmoType() == amSkip or GetCurAmmoType() == amNothing))
  1531 		-- Switch: Next continent
  1167 		then
  1532 		-- Precise+Switch: Previous continent
  1168 			GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]=GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]+1
  1533 		TrySelectNextContinent(CS.PRECISE)
  1169 
       
  1170 			if(GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]> table.maxn(GLOBAL_CONTINENT_INFORMATION))
       
  1171 			then
       
  1172 				GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]=1
       
  1173 			end
       
  1174 			SetContinentWeapons()
       
  1175 		end
       
  1176 	--if switching out from sabotage.
  1534 	--if switching out from sabotage.
  1177 	elseif(GLOBAL_SABOTAGE_HOGS[CurrentHedgehog]~=nil and GLOBAL_SABOTAGE_HOGS[CurrentHedgehog]==2)
  1535 	elseif(CS.SABOTAGE_HOGS[CurrentHedgehog]~=nil and CS.SABOTAGE_HOGS[CurrentHedgehog]==2)
  1178 	then
  1536 	then
  1179 		GLOBAL_SABOTAGE_HOGS[CurrentHedgehog]=1
  1537 		CS.SABOTAGE_HOGS[CurrentHedgehog]=1
       
  1538 	end
       
  1539 end
       
  1540 
       
  1541 function TrySelectNextContinent(reverse)
       
  1542 	local direction = 1
       
  1543 	if reverse then
       
  1544 		direction = -1
       
  1545 	end
       
  1546 	if(GetHogLevel(CurrentHedgehog)==0 and CS.SELECT_CONTINENT_CHECK==true and (GetCurAmmoType() == amSkip or GetCurAmmoType() == amNothing))
       
  1547 	then
       
  1548 		CS.TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]=CS.TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)] + direction
       
  1549 
       
  1550 		if(CS.TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]> table.maxn(CS.CONTINENT_INFORMATION))
       
  1551 		then
       
  1552 			CS.TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]=1
       
  1553 		end
       
  1554 		if(CS.TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]<=0)
       
  1555 		then
       
  1556 			CS.TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]=table.maxn(CS.CONTINENT_INFORMATION)
       
  1557 		end
       
  1558 		SetContinentWeapons()
       
  1559 
       
  1560 		PlaySound(sndSwitchHog)
  1180 	end
  1561 	end
  1181 end
  1562 end
  1182 
  1563 
  1183 function onUp()
  1564 function onUp()
  1184 	--swap forward in the weaponmenu (1.0 style)
  1565 	--swap forward in the weaponmenu (1.0 style)
  1185 	if(GetHogLevel(CurrentHedgehog)==0 and GLOBAL_SELECT_CONTINENT_CHECK==true and (GetCurAmmoType() == amSkip or GetCurAmmoType() == amNothing))
  1566 	TrySelectNextContinent(false)
  1186 	then
  1567 
  1187 		GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]=GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]+1
  1568 	if(GetCurAmmoType() == amSeduction and CS.AFRICAN_SPECIAL_SEDUCTION == 1 and GetAmmoCount(CurrentHedgehog,amInvulnerable)>0)
  1188 
  1569 	then
  1189 		if(GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]> table.maxn(GLOBAL_CONTINENT_INFORMATION))
  1570 		CS.SEDUCTION_INCREASER=CS.SEDUCTION_INCREASER+7
  1190 		then
       
  1191 			GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]=1
       
  1192 		end
       
  1193 		SetContinentWeapons()
       
  1194 	end
       
  1195 
       
  1196 	if(GetCurAmmoType() == amSeduction and GLOBAL_AFRICAN_SPECIAL_SEDUCTION == 1 and GetAmmoCount(CurrentHedgehog,amInvulnerable)>0)
       
  1197 	then
       
  1198 		GLOBAL_SEDUCTION_INCREASER=GLOBAL_SEDUCTION_INCREASER+7
       
  1199 
  1571 
  1200 		RemoveWeapon(CurrentHedgehog,amInvulnerable)
  1572 		RemoveWeapon(CurrentHedgehog,amInvulnerable)
  1201 
  1573 
  1202 		AddCaption(string.format(GLOBAL_INVULNERABLE_SPECIAL_INFO," ("..(GLOBAL_SEDUCTION_INCREASER+15)..")"," ("..GetAmmoCount(CurrentHedgehog,amInvulnerable)..")"))
  1574 		AddCaption(string.format(CS.INVULNERABLE_SPECIAL_CAPTION, CS.SEDUCTION_INCREASER, GetAmmoCount(CurrentHedgehog,amInvulnerable)), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmostate)
  1203 	end
  1575 	end
  1204 end
  1576 end
  1205 
  1577 
  1206 function onDown()
  1578 function onDown()
  1207 	--swap backwards in the weaponmenu (1.0 style)
  1579 	--swap backwards in the weaponmenu (1.0 style)
  1208 	if(GetHogLevel(CurrentHedgehog)==0 and GLOBAL_SELECT_CONTINENT_CHECK==true and (GetCurAmmoType() == amSkip or GetCurAmmoType() == amNothing))
  1580 	TrySelectNextContinent(true)
  1209 	then
  1581 
  1210 		GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]=GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]-1
  1582 	if(GetCurAmmoType() == amSeduction and CS.AFRICAN_SPECIAL_SEDUCTION == 1 and CS.SEDUCTION_INCREASER>0)
  1211 
  1583 	then
  1212 		if(GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]<=0)
  1584 		CS.SEDUCTION_INCREASER=CS.SEDUCTION_INCREASER-7
  1213 		then
       
  1214 			GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]=table.maxn(GLOBAL_CONTINENT_INFORMATION)
       
  1215 		end
       
  1216 		SetContinentWeapons()
       
  1217 	end
       
  1218 
       
  1219 	if(GetCurAmmoType() == amSeduction and GLOBAL_AFRICAN_SPECIAL_SEDUCTION == 1 and GLOBAL_SEDUCTION_INCREASER>0)
       
  1220 	then
       
  1221 		GLOBAL_SEDUCTION_INCREASER=GLOBAL_SEDUCTION_INCREASER-7
       
  1222 
  1585 
  1223 		AddAmmo(CurrentHedgehog,amInvulnerable,GetAmmoCount(CurrentHedgehog, amInvulnerable)+1)
  1586 		AddAmmo(CurrentHedgehog,amInvulnerable,GetAmmoCount(CurrentHedgehog, amInvulnerable)+1)
  1224 
  1587 
  1225 		AddCaption(string.format(GLOBAL_INVULNERABLE_SPECIAL_INFO," ("..(GLOBAL_SEDUCTION_INCREASER+15)..")"," ("..GetAmmoCount(CurrentHedgehog,amInvulnerable)..")"))
  1588 		AddCaption(string.format(CS.INVULNERABLE_SPECIAL_CAPTION, CS.SEDUCTION_INCREASER, GetAmmoCount(CurrentHedgehog,amInvulnerable)), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmostate)
       
  1589 	end
       
  1590 end
       
  1591 
       
  1592 -- Spawn sabotage smoke for inactive hogs (red smoke, more subtle than for active hogs)
       
  1593 function SabotageSmokeInactive(gear)
       
  1594 	if GetGearType(gear) == gtHedgehog and gear ~= CurrentHedgehog and CS.SABOTAGE_HOGS[gear]~=nil and CS.SABOTAGE_HOGS[gear]>=1 then
       
  1595 		local vg = AddVisualGear(GetX(gear), GetY(gear), vgtSmokeWhite, 0, false)
       
  1596 		SetVisualGearValues(vg, nil, nil, nil, nil, nil, nil, nil, nil, nil, 0xFF8080B0)
       
  1597 	end
       
  1598 end
       
  1599 
       
  1600 function ShowContinentLabel()
       
  1601 	if CS.TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)] == 0 then
       
  1602 		AddCaption(loc("Random continent"), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmoinfo)
       
  1603 	else
       
  1604 		AddCaption(CS.CONTINENT_INFORMATION[CS.TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]][1], GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmoinfo)
       
  1605 	end
       
  1606 end
       
  1607 
       
  1608 function onGameTick()
       
  1609 	-- This is a trick to show the continent label delayed by 1 tick
       
  1610 	if CS.CONTINENT_LABEL_TIMER > 0 then
       
  1611 		CS.CONTINENT_LABEL_TIMER = CS.CONTINENT_LABEL_TIMER - 1
       
  1612 	end
       
  1613 	if CS.CONTINENT_LABEL_TIMER == 0 then
       
  1614 		ShowContinentLabel()
       
  1615 		CS.CONTINENT_LABEL_TIMER = -1
       
  1616 	end
       
  1617 
       
  1618 	if CS.HANDLE_SPECIAL_WEAPON_MISC_TIMER > 0 then
       
  1619 		CS.HANDLE_SPECIAL_WEAPON_MISC_TIMER = CS.HANDLE_SPECIAL_WEAPON_MISC_TIMER - 1
       
  1620 	end
       
  1621 	if CS.HANDLE_SPECIAL_WEAPON_MISC_TIMER == 0 then
       
  1622 		HandleSpecialWeaponMisc()
       
  1623 		CS.HANDLE_SPECIAL_WEAPON_MISC_TIMER = -1
       
  1624 	end
       
  1625 
       
  1626 	-- See onAttack()
       
  1627 	if CS.CONFIRM_CONTINENT_SELECTION > 0 then
       
  1628 		CS.CONFIRM_CONTINENT_SELECTION = CS.CONFIRM_CONTINENT_SELECTION - 1
       
  1629 	end
       
  1630 	if CS.CONFIRM_CONTINENT_SELECTION == 0 then
       
  1631 		CS.SELECT_CONTINENT_CHECK=false
       
  1632 		EndTurnCS(0)
       
  1633 		PlaySound(sndPlaced)
       
  1634 		ShowContinentLabel()
       
  1635 		CS.CONFIRM_CONTINENT_SELECTION = -1
       
  1636 	end
       
  1637 
       
  1638 	if GameTime % 600 == 0 then
       
  1639 		runOnGears(SabotageSmokeInactive)
  1226 	end
  1640 	end
  1227 end
  1641 end
  1228 
  1642 
  1229 function onGameTick20()
  1643 function onGameTick20()
  1230 	--if you picked a weaponset from the weaponmenu (icon)
  1644 	--if you picked a weaponset from the weaponmenu (icon)
  1231 	if(GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]==0)
  1645 	if(CS.TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]==0)
  1232 	then
  1646 	then
  1233 		if(GetCurAmmoType()==amSwitch)
  1647 		if(GetCurAmmoType()==amSwitch)
  1234 		then
  1648 		then
  1235 			GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]=GetRandom(table.maxn(GLOBAL_CONTINENT_INFORMATION))+1
  1649 			CS.TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]=GetRandom(table.maxn(CS.CONTINENT_INFORMATION))+1
  1236 			SetContinentWeapons()
  1650 			SetContinentWeapons()
       
  1651 			SetWeapon(amSkip)
  1237 			PlaySound(sndMineTick)
  1652 			PlaySound(sndMineTick)
       
  1653 			CS.CONTINENT_LABEL_TIMER = 1
  1238 		else
  1654 		else
  1239 			for v,w in pairs(GLOBAL_CONTINENT_INFORMATION)
  1655 			for v,w in pairs(CS.CONTINENT_INFORMATION)
  1240 			do
  1656 			do
  1241 				if(GetCurAmmoType()==GLOBAL_CONTINENT_INFORMATION[v][4][1])
  1657 				if(GetCurAmmoType()==CS.CONTINENT_INFORMATION[v][4][1])
  1242 				then
  1658 				then
  1243 					GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]=v
  1659 					CS.TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]=v
  1244 					SetContinentWeapons()
  1660 					SetContinentWeapons()
  1245 					PlaySound(GLOBAL_CONTINENT_INFORMATION[v][6][1])
  1661 					SetWeapon(amSkip)
  1246 					PlaySound(GLOBAL_CONTINENT_INFORMATION[v][6][2],CurrentHedgehog)
  1662 					PlaySound(CS.CONTINENT_INFORMATION[v][6][1])
       
  1663 					PlaySound(CS.CONTINENT_INFORMATION[v][6][2],CurrentHedgehog)
       
  1664 					CS.CONTINENT_LABEL_TIMER = 1
       
  1665 					break
  1247 				end
  1666 				end
  1248 			end
  1667 			end
  1249 		end
  1668 		end
  1250 	end
  1669 	end
  1251 
  1670 
  1252 	--show the kerguelen ring
  1671 	--show the kerguelen ring
  1253 	if(GLOBAL_KERGUELEN_SPECIAL > 1 and GetCurAmmoType() == amHammer)
  1672 	if(CS.KERGUELEN_SPECIAL > 1 and GetCurAmmoType() == amHammer and
  1254 	then
  1673 		band(GetState(CurrentHedgehog), gstAttacked) == 0 and
  1255 		if(GLOBAL_VISUAL_CIRCLE==nil)
  1674 		band(GetState(CurrentHedgehog), gstHHDriven) ~= 0)
  1256 		then
  1675 	then
  1257 			GLOBAL_VISUAL_CIRCLE=AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtCircle, 0, true)
  1676 		if(CS.VISUAL_CIRCLE==nil)
  1258 		end
  1677 		then
  1259 
  1678 			CS.VISUAL_CIRCLE=AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtCircle, 0, true)
  1260 		if(GLOBAL_KERGUELEN_SPECIAL == 2) --walrus scream
  1679 		end
  1261 		then
  1680 
  1262 			SetVisualGearValues(GLOBAL_VISUAL_CIRCLE, GetX(CurrentHedgehog), GetY(CurrentHedgehog),20, 200, 0, 0, 100, 120, 4, 0xff0000ee)
  1681 		if(CS.KERGUELEN_SPECIAL == 2) --walrus scream
  1263 		elseif(GLOBAL_KERGUELEN_SPECIAL == 3) --swap hog
  1682 		then
  1264 		then
  1683 			SetVisualGearValues(CS.VISUAL_CIRCLE, GetX(CurrentHedgehog), GetY(CurrentHedgehog),20, 200, 0, 0, 100, 120, 4, 0xff0000ee)
  1265 			SetVisualGearValues(GLOBAL_VISUAL_CIRCLE, GetX(CurrentHedgehog), GetY(CurrentHedgehog),20, 200, 0, 0, 100, 390, 3, 0xffff00ee)
  1684 		elseif(CS.KERGUELEN_SPECIAL == 3) --swap hog
  1266 		elseif(GLOBAL_KERGUELEN_SPECIAL == 5) --cries
  1685 		then
  1267 		then
  1686 			SetVisualGearValues(CS.VISUAL_CIRCLE, GetX(CurrentHedgehog), GetY(CurrentHedgehog),20, 200, 0, 0, 100, 390, 3, 0xffff00ee)
  1268 
  1687 		elseif(CS.KERGUELEN_SPECIAL == 5) --cries
  1269 			GLOBAL_TEMP_VALUE=0
  1688 		then
       
  1689 
       
  1690 			CS.TEMP_VALUE=0
  1270 			runOnGears(KerguelenSpecialBlueCheck)
  1691 			runOnGears(KerguelenSpecialBlueCheck)
  1271 			if(GLOBAL_TEMP_VALUE==0)
  1692 			if(CS.TEMP_VALUE==0)
  1272 			then
  1693 			then
  1273 				SetVisualGearValues(GLOBAL_VISUAL_CIRCLE, GetX(CurrentHedgehog), GetY(CurrentHedgehog),20, 200, 0, 0, 100, 500, 1, 0x0000ffee)
  1694 				SetVisualGearValues(CS.VISUAL_CIRCLE, GetX(CurrentHedgehog), GetY(CurrentHedgehog),20, 200, 0, 0, 100, 500, 1, 0x0000ffee)
  1274 			else
  1695 			else
  1275 				SetVisualGearValues(GLOBAL_VISUAL_CIRCLE, GetX(CurrentHedgehog), GetY(CurrentHedgehog),20, 200, 0, 0, 100, 500, 10, 0x0000ffee)
  1696 				SetVisualGearValues(CS.VISUAL_CIRCLE, GetX(CurrentHedgehog), GetY(CurrentHedgehog),20, 200, 0, 0, 100, 500, 10, 0x0000ffee)
  1276 			end
  1697 			end
  1277 
  1698 
  1278 		elseif(GLOBAL_KERGUELEN_SPECIAL == 6) --sabotage
  1699 		elseif(CS.KERGUELEN_SPECIAL == 6) --sabotage
  1279 		then
  1700 		then
  1280 			SetVisualGearValues(GLOBAL_VISUAL_CIRCLE, GetX(CurrentHedgehog), GetY(CurrentHedgehog),20, 200, 0, 0, 100, 80, 10, 0x00ff00ee)
  1701 			SetVisualGearValues(CS.VISUAL_CIRCLE, GetX(CurrentHedgehog), GetY(CurrentHedgehog),20, 200, 0, 0, 100, 80, 10, 0x00ff00ee)
  1281 		end
  1702 		end
  1282 
  1703 
  1283 	elseif(GLOBAL_VISUAL_CIRCLE~=nil)
  1704 	elseif(CS.VISUAL_CIRCLE~=nil)
  1284 	then
  1705 	then
  1285 		DeleteVisualGear(GLOBAL_VISUAL_CIRCLE)
  1706 		DeleteVisualGear(CS.VISUAL_CIRCLE)
  1286 		GLOBAL_VISUAL_CIRCLE=nil
  1707 		CS.VISUAL_CIRCLE=nil
  1287 	end
  1708 	end
  1288 
  1709 
  1289 	--sabotage
  1710 	--sabotage
  1290 	if(GLOBAL_SABOTAGE_HOGS[CurrentHedgehog]~=nil and GLOBAL_SABOTAGE_HOGS[CurrentHedgehog]>=1)
  1711 	if(CS.SABOTAGE_HOGS[CurrentHedgehog]~=nil and CS.SABOTAGE_HOGS[CurrentHedgehog]>=1)
  1291 	then
  1712 	then
  1292 		--for sabotage
  1713 		--for sabotage
  1293 		if(GLOBAL_SABOTAGE_HOGS[CurrentHedgehog]==1)
  1714 		if(CS.SABOTAGE_HOGS[CurrentHedgehog]==1)
  1294 		then
  1715 		then
  1295 			AddCaption(loc("You are sabotaged, RUN!"))
  1716 			AddCaption(loc("You are sabotaged, RUN!"))
  1296 
  1717 
  1297 			PlaySound(sndHellish)
  1718 			PlaySound(sndHellish)
  1298 			--update the constant at the top also to something in between
  1719 			--update the constant at the top also to something in between
  1299 			GLOBAL_SABOTAGE_FREQUENCY=100
  1720 			CS.SABOTAGE_FREQUENCY_NOW=CS.SABOTAGE_FREQUENCY
  1300 			SetGravity(350)
  1721 			SetGravity(CS.SABOTAGE_GRAVITY)
  1301 
  1722 
  1302 			GLOBAL_SABOTAGE_HOGS[CurrentHedgehog]=2
  1723 			CS.SABOTAGE_HOGS[CurrentHedgehog]=2
  1303 		end
  1724 		end
  1304 
  1725 
  1305 		if(GLOBAL_SABOTAGE_COUNTER % 20 == 0)
  1726 		if(CS.SABOTAGE_COUNTER % 20 == 0)
  1306 		then
  1727 		then
  1307 			AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtSmokeWhite, 0, false)
  1728 			-- Sabotage effect (red smoke)
       
  1729 			local vg = AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtSmokeWhite, 0, false)
       
  1730 			SetVisualGearValues(vg, nil, nil, nil, nil, nil, nil, nil, nil, nil, 0xFF4040FF)
  1308 		end
  1731 		end
  1309 
  1732 
  1310 		if(TurnTimeLeft<(GetAwayTime*10) or band(GetState(CurrentHedgehog),gstAttacked)==1)
  1733 		if(TurnTimeLeft<(GetAwayTime*10) or band(GetState(CurrentHedgehog),gstAttacked)==1)
  1311 		then
  1734 		then
  1312 			GLOBAL_SABOTAGE_HOGS[CurrentHedgehog]=0
  1735 			CS.SABOTAGE_HOGS[CurrentHedgehog]=0
  1313 		elseif(GLOBAL_SABOTAGE_COUNTER >= GLOBAL_SABOTAGE_FREQUENCY)
  1736 		elseif(CS.SABOTAGE_COUNTER >= CS.SABOTAGE_FREQUENCY_NOW)
  1314 		then
  1737 		then
  1315 
  1738 			-- Sabotage decreases hog health regularily,
  1316 			if(GetHealth(CurrentHedgehog)<=2)
  1739 			-- but invulnerable protects.
  1317 			then
  1740 			-- Also do not decrease health while retreating or attacking.
  1318 				SetHealth(CurrentHedgehog, 0)
  1741 			if(GetEffect(CurrentHedgehog, heInvulnerable) == 0 and
  1319 				GLOBAL_SABOTAGE_HOGS[CurrentHedgehog]=0
  1742 			band(GetState(CurrentHedgehog), gstHHDriven) ~= 0 and
  1320 			else
  1743 			band(GetState(CurrentHedgehog), gstAttacked+gstAttacking) == 0)
  1321 				SetHealth(CurrentHedgehog, GetHealth(CurrentHedgehog)-2)
  1744 			then
  1322 			end
  1745 				if(GetHealth(CurrentHedgehog)<=CS.SABOTAGE_DAMAGE)
  1323 			ShowDamageTag(CurrentHedgehog,2)
  1746 				then
  1324 
  1747 					-- All health lost! Sabotage is cruel.
  1325 			GLOBAL_SABOTAGE_COUNTER=0
  1748 					PlaySound(sndPoisonMoan, CurrentHedgehog)
       
  1749 					SetHealth(CurrentHedgehog, 0)
       
  1750 					CS.SABOTAGE_HOGS[CurrentHedgehog]=0
       
  1751 					-- Take away control so the hog can die in peace.
       
  1752 					SetState(CurrentHedgehog, band(GetState(CurrentHedgehog), bnot(gstHHDriven)))
       
  1753 				else
       
  1754 					local newHealth = GetHealth(CurrentHedgehog)-CS.SABOTAGE_DAMAGE
       
  1755 					-- Start moaning if health is at a critical level
       
  1756 					if newHealth <= 16 then
       
  1757 						PlaySound(sndPoisonMoan, CurrentHedgehog)
       
  1758 					elseif newHealth <= 32 then
       
  1759 						PlaySound(sndPoisonCough, CurrentHedgehog)
       
  1760 					end
       
  1761 					SetHealth(CurrentHedgehog, newHealth)
       
  1762 				end
       
  1763 				ShowDamageTag(CurrentHedgehog,CS.SABOTAGE_DAMAGE)
       
  1764 			end
       
  1765 
       
  1766 			CS.SABOTAGE_COUNTER=0
  1326 		else
  1767 		else
  1327 			GLOBAL_SABOTAGE_COUNTER=GLOBAL_SABOTAGE_COUNTER+1
  1768 			CS.SABOTAGE_COUNTER=CS.SABOTAGE_COUNTER+1
  1328 		end
  1769 		end
  1329 	elseif(GetGravity()==350 and (GLOBAL_SABOTAGE_HOGS[CurrentHedgehog]==0 or GLOBAL_SABOTAGE_HOGS[CurrentHedgehog]==nil))
  1770 	elseif((GetGravity()==CS.SABOTAGE_GRAVITY or GetGravity()==CS.SABOTAGE_GRAVITY_LOW) and (CS.SABOTAGE_HOGS[CurrentHedgehog]==0 or CS.SABOTAGE_HOGS[CurrentHedgehog]==nil))
  1330 	then
  1771 	then
       
  1772 		-- Reset gravity
  1331 		SetGravity(100)
  1773 		SetGravity(100)
  1332 	end
  1774 	end
  1333 
  1775 
  1334 	--enable switch (north america)
  1776 	--enable switch (north america)
  1335 	if(GetCurAmmoType() == amSwitch and GLOBAL_TEMP_VALUE==87)
  1777 	if(GetCurAmmoType() == amSwitch and CS.TEMP_VALUE==87)
  1336 	then
  1778 	then
  1337 		SetGearMessage(CurrentHedgehog,gmAttack)
  1779 		SetGearMessage(CurrentHedgehog,gmAttack)
  1338 		GLOBAL_TEMP_VALUE=0
  1780 		CS.TEMP_VALUE=0
  1339 	end
  1781 	end
       
  1782 
       
  1783 	if(CS.SPEECH_TIMER > 0) then
       
  1784 		CS.SPEECH_TIMER = CS.SPEECH_TIMER - 20
       
  1785 	end
       
  1786 end
       
  1787 
       
  1788 function HandleSpecialWeaponMisc(ammoType)
       
  1789 	if not ammoType then
       
  1790 		ammoType = GetCurAmmoType()
       
  1791 	end
       
  1792 	ShowSpecialWeaponCaption(ammoType)
       
  1793 	if ammoType == amSMine and CS.AFRICAN_SPECIAL_STICKY ~= 0 then
       
  1794 		SetSoundMask(sndLaugh, true)
       
  1795 	else
       
  1796 		SetSoundMask(sndLaugh, false)
       
  1797 	end
       
  1798 	if (ammoType == amHammer and CS.KERGUELEN_SPECIAL > 1) or (ammoType == amBaseballBat and CS.AUSTRALIAN_SPECIAL ~= 0) then
       
  1799 		SetAttackState(false)
       
  1800 	else
       
  1801 		SetAttackState(true)
       
  1802 	end
       
  1803 
  1340 end
  1804 end
  1341 
  1805 
  1342 --some ppl complained :P
  1806 --some ppl complained :P
  1343 function onSlot(slot)
  1807 function onSlot(slot)
  1344 	if(GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]==0)
  1808 	if(CS.TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]==0)
  1345 	then
  1809 	then
  1346 		SetWeapon(amSkip)
  1810 		SetWeapon(amSkip)
       
  1811 	end
       
  1812 	if CS.GAME_STARTED then
       
  1813 		-- Delay calling HandleSpecialWeaponMisc because
       
  1814 		-- the CurAmmoType is not updated yet.
       
  1815 		CS.HANDLE_SPECIAL_WEAPON_MISC_TIMER = 2
       
  1816 	end
       
  1817 end
       
  1818 
       
  1819 function onSetWeapon(ammoType)
       
  1820 	if CS.GAME_STARTED then
       
  1821 		HandleSpecialWeaponMisc(ammoType)
  1347 	end
  1822 	end
  1348 end
  1823 end
  1349 
  1824 
  1350 --if you used hogswitch or any similar weapon, dont enable any weaponchange
  1825 --if you used hogswitch or any similar weapon, dont enable any weaponchange
  1351 function onAttack()
  1826 function onAttack()
  1352 	if(GLOBAL_SELECT_CONTINENT_CHECK==true)
  1827 	if(CS.SELECT_CONTINENT_CHECK==true)
  1353 	then
  1828 	then
  1354 		if(GetCurAmmoType() == amSkip or GetCurAmmoType() == amNothing)
  1829 		if(GetCurAmmoType() == amSkip or GetCurAmmoType() == amNothing)
  1355 		then
  1830 		then
  1356 			GLOBAL_SELECT_CONTINENT_CHECK=false
  1831 			SetWeapon(amNothing)
  1357 			EndTurn(0)
  1832 			-- Delay the real continent selection so the SetWeapon
       
  1833 			-- has time to take effect.
       
  1834 			CS.CONFIRM_CONTINENT_SELECTION=2
  1358 		else
  1835 		else
  1359 			SetWeapon(amSkip)
  1836 			SetWeapon(amSkip)
  1360 		end
  1837 		end
  1361 	end
  1838 	end
  1362 
  1839 
  1363 	--african special
  1840 	--african special
  1364 	if(GLOBAL_AFRICAN_SPECIAL_SEDUCTION == 1 and GetCurAmmoType() == amSeduction and band(GetState(CurrentHedgehog),gstAttacked)==0)
  1841 	if(CS.AFRICAN_SPECIAL_SEDUCTION == 1 and GetCurAmmoType() == amSeduction and band(GetState(CurrentHedgehog),gstAttacked)==0)
  1365 	then
  1842 	then
  1366 		EndTurn(3)
  1843 		EndTurnCS(3)
  1367 
  1844 
  1368 		GLOBAL_TEMP_VALUE=0
  1845 		CS.TEMP_VALUE=0
  1369 		runOnGears(AfricaSpecialSeduction)
  1846 		runOnGears(AfricaSpecialSeduction)
  1370 		SetHealth(CurrentHedgehog, GetHealth(CurrentHedgehog)+GLOBAL_TEMP_VALUE)
  1847 		SetHealth(CurrentHedgehog, GetHealth(CurrentHedgehog)+CS.TEMP_VALUE)
  1371 
  1848 
  1372 		--visual stuff
  1849 		--visual stuff
  1373 		VisualExplosion(250,GetX(CurrentHedgehog), GetY(CurrentHedgehog),vgtSmoke,vgtSmokeWhite)
  1850 		VisualExplosion(250,GetX(CurrentHedgehog), GetY(CurrentHedgehog),vgtSmoke,vgtSmokeWhite)
  1374 		PlaySound(sndParachute)
  1851 		PlaySound(sndParachute)
  1375 
  1852 
  1376 		RemoveWeapon(CurrentHedgehog,amSeduction)
  1853 		RemoveWeapon(CurrentHedgehog,amSeduction)
  1377 
  1854 
  1378 	elseif(GLOBAL_ANTARCTICA_SPECIAL == 1 and GetCurAmmoType() == amPickHammer and band(GetState(CurrentHedgehog),gstAttacked)==0)
  1855 	elseif(CS.ANTARCTICA_SPECIAL == 1 and GetCurAmmoType() == amPickHammer and band(GetState(CurrentHedgehog),gstAttacked)==0)
  1379 	then
  1856 	then
  1380 		EndTurn(10)
  1857 		EndTurnCS(10)
  1381 		SetGearPosition(CurrentHedgehog,GetX(CurrentHedgehog),0)
  1858 		SetGearPosition(CurrentHedgehog,GetX(CurrentHedgehog),0)
  1382 		ParseCommand("hjump")
  1859 		ParseCommand("hjump")
  1383 		SetGearVelocity(CurrentHedgehog, 0, 100000000)
  1860 		SetGearVelocity(CurrentHedgehog, 0, 100000000)
  1384 
  1861 
  1385 		PlaySound(sndPiano8)
  1862 		PlaySound(sndPiano8)
       
  1863 		PlaySound(sndWarp)
  1386 
  1864 
  1387 		RemoveWeapon(CurrentHedgehog,amPickHammer)
  1865 		RemoveWeapon(CurrentHedgehog,amPickHammer)
  1388 
  1866 
  1389 	--Kerguelen specials
  1867 	--Kerguelen specials
  1390 	elseif(GetCurAmmoType() == amHammer and GLOBAL_KERGUELEN_SPECIAL > 1 and band(GetState(CurrentHedgehog),gstAttacked)==0)
  1868 	elseif(GetCurAmmoType() == amHammer and CS.KERGUELEN_SPECIAL > 1 and band(GetState(CurrentHedgehog),gstAttacked)==0)
  1391 	then
  1869 	then
  1392 		local escapetime=3
  1870 		local escapetime=3
  1393 
  1871 
  1394 		--scream
  1872 		--scream
  1395 		if(GLOBAL_KERGUELEN_SPECIAL == 2)
  1873 		if(CS.KERGUELEN_SPECIAL == 2)
  1396 		then
  1874 		then
  1397 			GLOBAL_TEMP_VALUE=0
  1875 			CS.TEMP_VALUE=0
  1398 			runOnGears(KerguelenSpecialRed)
  1876 			runOnGears(KerguelenSpecialRed)
  1399 			HealHog(CurrentHedgehog, GLOBAL_TEMP_VALUE)
  1877 			HealHog(CurrentHedgehog, CS.TEMP_VALUE)
  1400 			PlaySound(sndHellish)
  1878 			PlaySound(sndHellish)
  1401 
  1879 
  1402 		--swap
  1880 		--swap
  1403 		elseif(GLOBAL_KERGUELEN_SPECIAL == 3)
  1881 		elseif(CS.KERGUELEN_SPECIAL == 3)
  1404 		then
  1882 		then
  1405 			GLOBAL_TEMP_VALUE=0
  1883 			CS.TEMP_VALUE=0
  1406 			runOnGears(KerguelenSpecialYellowCountHogs)
  1884 			runOnGears(KerguelenSpecialYellowCountHogs)
  1407 			if(GLOBAL_TEMP_VALUE>0)
  1885 			if(CS.TEMP_VALUE>0)
  1408 			then
  1886 			then
  1409 				GLOBAL_TEMP_VALUE=GetRandom(GLOBAL_TEMP_VALUE)
  1887 				CS.TEMP_VALUE=GetRandom(CS.TEMP_VALUE)
  1410 				runOnGears(KerguelenSpecialYellowSwap)
  1888 				runOnGears(KerguelenSpecialYellowSwap)
  1411 				PlaySound(sndPiano3)
  1889 				PlaySound(sndPiano3)
  1412 			else
  1890 			else
  1413 				PlaySound(sndPiano6)
  1891 				PlaySound(sndPiano6)
  1414 			end
  1892 			end
  1415 
  1893 
  1416 		--cries
  1894 		--cries
  1417 		elseif(GLOBAL_KERGUELEN_SPECIAL == 5)
  1895 		elseif(CS.KERGUELEN_SPECIAL == 5)
  1418 		then
  1896 		then
  1419 			GLOBAL_TEMP_VALUE=0
  1897 			CS.TEMP_VALUE=0
  1420 			runOnGears(KerguelenSpecialBlueCheck)
  1898 			runOnGears(KerguelenSpecialBlueCheck)
  1421 			if(GLOBAL_TEMP_VALUE==0)
  1899 			if(CS.TEMP_VALUE==0)
  1422 			then
  1900 			then
  1423 				AddGear(0, 0, gtWaterUp, 0, 0,0,0)
  1901 				AddGear(0, 0, gtWaterUp, 0, 0,0,0)
  1424 				PlaySound(sndWarp)
  1902 				PlaySound(sndWarp)
  1425 				PlaySound(sndMolotov)
  1903 				PlaySound(sndMolotov)
  1426 
  1904 
  1427 				runOnGears(KerguelenSpecialBlueActivate)
  1905 				runOnGears(KerguelenSpecialBlueActivate)
  1428 				SetHealth(CurrentHedgehog, GetHealth(CurrentHedgehog)+GLOBAL_TEMP_VALUE)
  1906 				SetHealth(CurrentHedgehog, GetHealth(CurrentHedgehog)+CS.TEMP_VALUE)
  1429 			else
  1907 			else
  1430 				HogSay(CurrentHedgehog, loc("Hogs in sight!"), SAY_SAY)
  1908 				PlaySound(sndDenied)
  1431 			end
  1909 				escapetime = -1
  1432 
  1910 				if CS.SPEECH_TIMER <= 0 then
  1433 		--sabotage
  1911 					HogSay(CurrentHedgehog, loc("Hogs in sight!"), SAY_SAY)
  1434 		elseif(GLOBAL_KERGUELEN_SPECIAL == 6)
  1912 					CS.SPEECH_TIMER = 5000
  1435 		then
  1913 				end
  1436 			GLOBAL_TEMP_VALUE=0
  1914 			end
       
  1915 
       
  1916 		--flare/sabotage
       
  1917 		elseif(CS.KERGUELEN_SPECIAL == 6)
       
  1918 		then
       
  1919 			CS.TEMP_VALUE=0
  1437 			runOnGears(KerguelenSpecialGreen)
  1920 			runOnGears(KerguelenSpecialGreen)
  1438 
  1921 
  1439 			PlaySound(sndThrowRelease)
  1922 			PlaySound(sndThrowRelease)
  1440 			AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog)-20, gtCluster, 0, 0, -1000000, 32)
  1923 			AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog)-20, gtCluster, 0, 0, -1000000, 32)
  1441 
  1924 
  1442 			if(GLOBAL_TEMP_VALUE==1)
  1925 			if(CS.TEMP_VALUE==1)
  1443 			then
  1926 			then
  1444 				escapetime=10
  1927 				escapetime=10
  1445 			end
  1928 			end
  1446 		end
  1929 		end
  1447 
  1930 
  1448 		EndTurn(escapetime)
  1931 		if escapetime >= 0 then
  1449 
  1932 			EndTurnCS(escapetime)
  1450 		DeleteVisualGear(GLOBAL_VISUAL_CIRCLE)
  1933 
  1451 		GLOBAL_VISUAL_CIRCLE=nil
  1934 			DeleteVisualGear(CS.VISUAL_CIRCLE)
  1452 		GLOBAL_KERGUELEN_SPECIAL=0
  1935 			CS.VISUAL_CIRCLE=nil
  1453 
  1936 			CS.KERGUELEN_SPECIAL=0
  1454 		RemoveWeapon(CurrentHedgehog,amHammer)
  1937 
       
  1938 			RemoveWeapon(CurrentHedgehog,amHammer)
       
  1939 		end
       
  1940 
       
  1941 	elseif(GetCurAmmoType() == amBaseballBat)
       
  1942 	then
       
  1943 		if CS.AUSTRALIAN_SPECIAL ~= 0
       
  1944 		then
       
  1945 			CS.TEMP_VALUE=0
       
  1946 			runOnGears(AustraliaSpecialCheckHogs)
       
  1947 			if CS.TEMP_VALUE == 0 then
       
  1948 				SetGearMessage(CurrentHedgehog, bor(GetGearMessage(CurrentHedgehog), gmAttack))
       
  1949 			else
       
  1950 				PlaySound(sndDenied)
       
  1951 			end
       
  1952 		end
  1455 
  1953 
  1456 	elseif(GetCurAmmoType() == amVampiric)
  1954 	elseif(GetCurAmmoType() == amVampiric)
  1457 	then
  1955 	then
  1458 		GLOBAL_VAMPIRIC_IS_ON=75
  1956 		CS.VAMPIRIC_IS_ON=75
  1459 	elseif(GetCurAmmoType() == amExtraDamage)
  1957 	elseif(GetCurAmmoType() == amExtraDamage)
  1460 	then
  1958 	then
  1461 		GLOBAL_EXTRA_DAMAGE_IS_ON=150
  1959 		CS.EXTRA_DAMAGE_IS_ON=150
       
  1960 	end
       
  1961 end
       
  1962 
       
  1963 function onHogAttack(ammoType)
       
  1964 	-- When a sabotaged hog uses low gravity, overwrite the default low gravity,
       
  1965 	-- otherwise it would be too easy.
       
  1966 	if(ammoType == amLowGravity and CS.SABOTAGE_HOGS[CurrentHedgehog]~=nil and CS.SABOTAGE_HOGS[CurrentHedgehog]>=1)
       
  1967 	then
       
  1968 		SetGravity(CS.SABOTAGE_GRAVITY_LOW)
  1462 	end
  1969 	end
  1463 end
  1970 end
  1464 
  1971 
  1465 function onGearAdd(gearUid)
  1972 function onGearAdd(gearUid)
  1466 	GLOBAL_SELECT_CONTINENT_CHECK=false
  1973 	CS.SELECT_CONTINENT_CHECK=false
  1467 
  1974 
  1468 	--track the gears im using
  1975 	--track the gears im using
  1469 	if(GetGearType(gearUid) == gtHedgehog or GetGearType(gearUid) == gtMine or GetGearType(gearUid) == gtExplosives)
  1976 	if(GetGearType(gearUid) == gtHedgehog or GetGearType(gearUid) == gtMine or GetGearType(gearUid) == gtExplosives)
  1470 	then
  1977 	then
  1471 		trackGear(gearUid)
  1978 		trackGear(gearUid)
  1472 	end
  1979 	end
  1473 
  1980 
  1474 	--remove gasclouds on gasbombspecial
  1981 	--remove gasclouds on gasbombspecial
  1475 	if(GetGearType(gearUid)==gtPoisonCloud and GLOBAL_SOUTH_AMERICAN_SPECIAL == true)
  1982 	if(GetGearType(gearUid)==gtPoisonCloud and CS.SOUTH_AMERICAN_SPECIAL == true)
  1476 	then
  1983 	then
  1477 		DeleteGear(gearUid)
  1984 		DeleteGear(gearUid)
  1478 	--african special
  1985 	--african special
  1479 	elseif(GetGearType(gearUid)==gtSMine)
  1986 	elseif(GetGearType(gearUid)==gtSMine)
  1480 	then
  1987 	then
  1481 		vx,vy=GetGearVelocity(gearUid)
  1988 		local vx,vy=GetGearVelocity(gearUid)
  1482 		if(GLOBAL_AFRICAN_SPECIAL_STICKY == 1)
  1989 		if(CS.AFRICAN_SPECIAL_STICKY == 1)
  1483 		then
  1990 		then
  1484 			SetState(CurrentHedgehog, gstHHDriven+gstMoving)
  1991 			SetState(CurrentHedgehog, gstHHDriven+gstMoving)
  1485 			SetGearPosition(CurrentHedgehog, GetX(CurrentHedgehog),GetY(CurrentHedgehog)-3)
  1992 			SetGearPosition(CurrentHedgehog, GetX(CurrentHedgehog),GetY(CurrentHedgehog)-3)
  1486 			SetGearVelocity(CurrentHedgehog, vx, vy)
  1993 			SetGearVelocity(CurrentHedgehog, vx, vy)
       
  1994 			PlaySound(sndJump2, CurrentHedgehog)
  1487 			DeleteGear(gearUid)
  1995 			DeleteGear(gearUid)
  1488 
  1996 			if (not CS.AFRICAN_SPECIAL_NON_PROJECTILE_USED) then
  1489 		elseif(GLOBAL_AFRICAN_SPECIAL_STICKY == 2)
  1997 				SetSoundMask(sndMissed, true)
       
  1998 			end
       
  1999 
       
  2000 		elseif(CS.AFRICAN_SPECIAL_STICKY == 2)
  1490 		then
  2001 		then
  1491 			FireGear(CurrentHedgehog,gtNapalmBomb, vx, vy, 0)
  2002 			FireGear(CurrentHedgehog,gtNapalmBomb, vx, vy, 0)
  1492 			DeleteGear(gearUid)
  2003 			DeleteGear(gearUid)
       
  2004 			CS.AFRICAN_SPECIAL_NON_PROJECTILE_USED=true
       
  2005 			SetSoundMask(sndMissed, false)
       
  2006 		else
       
  2007 			CS.AFRICAN_SPECIAL_NON_PROJECTILE_USED=true
       
  2008 			SetSoundMask(sndMissed, false)
  1493 		end
  2009 		end
  1494 	--north american special
  2010 	--north american special
  1495 	elseif(GetGearType(gearUid)==gtSniperRifleShot)
  2011 	elseif(GetGearType(gearUid)==gtSniperRifleShot)
  1496 	then
  2012 	then
  1497 		GLOBAL_NORTH_AMERICAN_SPECIAL_SNIPER_IS_ON=true
  2013 		CS.NORTH_AMERICAN_SPECIAL_SNIPER_IS_ON=true
  1498 		if(GLOBAL_NORTH_AMERICAN_SPECIAL_SNIPER~=1)
  2014 		if(CS.NORTH_AMERICAN_SPECIAL_SNIPER~=1)
  1499 		then
  2015 		then
  1500 			SetHealth(gearUid, 1)
  2016 			SetHealth(gearUid, 1)
       
  2017 			SetGearValues(gearUid, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 0)
  1501 		end
  2018 		end
  1502 	--north american special
  2019 	--north american special
  1503 	elseif(GetGearType(gearUid)==gtShotgunShot)
  2020 	elseif(GetGearType(gearUid)==gtShotgunShot)
  1504 	then
  2021 	then
  1505 		if(GLOBAL_NORTH_AMERICAN_SPECIAL_SHOTGUN==true)
  2022 		if(CS.NORTH_AMERICAN_SPECIAL_SHOTGUN==true)
  1506 		then
  2023 		then
  1507 			AddVisualGear(GetX(gearUid), GetY(gearUid), vgtFeather, 0, false)
  2024 			AddVisualGear(GetX(gearUid), GetY(gearUid), vgtFeather, 0, false)
  1508 			AddVisualGear(GetX(gearUid), GetY(gearUid), vgtFeather, 0, false)
  2025 			AddVisualGear(GetX(gearUid), GetY(gearUid), vgtFeather, 0, false)
  1509 			AddVisualGear(GetX(gearUid), GetY(gearUid), vgtFeather, 0, false)
  2026 			AddVisualGear(GetX(gearUid), GetY(gearUid), vgtFeather, 0, false)
  1510 			PlaySound(sndBirdyLay)
  2027 			PlaySound(sndBirdyLay)
  1511 		end
  2028 		end
  1512 	--european special
  2029 	--european special
  1513 	elseif(GetGearType(gearUid)==gtMolotov and GLOBAL_EUROPE_SPECIAL==1)
  2030 	elseif(GetGearType(gearUid)==gtMolotov and CS.EUROPE_SPECIAL==1)
  1514 	then
  2031 	then
  1515 		vx,vy=GetGearVelocity(gearUid)
  2032 		local vx,vy=GetGearVelocity(gearUid)
  1516 		e_health=FireGear(CurrentHedgehog,gtCluster, vx, vy, 1)
  2033 		local e_health=FireGear(CurrentHedgehog,gtCluster, vx, vy, 1)
  1517 		SetGearMessage(e_health, 2)
  2034 		SetGearMessage(e_health, 2)
  1518 		DeleteGear(gearUid)
  2035 		DeleteGear(gearUid)
  1519 	--australian specials
  2036 	--australian specials
  1520 	elseif(GetGearType(gearUid)==gtShover and GLOBAL_AUSTRALIAN_SPECIAL~=0)
  2037 	elseif(GetGearType(gearUid)==gtShover and CS.AUSTRALIAN_SPECIAL~=0)
  1521 	then
  2038 	then
  1522 		GLOBAL_TEMP_VALUE=0
  2039 		CS.TEMP_VALUE=0
  1523 		runOnGears(AustraliaSpecialCheckHogs)
  2040 		runOnGears(AustraliaSpecialCheckHogs)
  1524 
  2041 
  1525 		if(GLOBAL_TEMP_VALUE==0)
  2042 		if(CS.TEMP_VALUE==0)
  1526 		then
  2043 		then
  1527 			vx,vy=GetGearVelocity(gearUid)
  2044 			local vx,vy=GetGearVelocity(gearUid)
  1528 
  2045 
  1529 			if(GLOBAL_AUSTRALIAN_SPECIAL==1)
  2046 			if(CS.AUSTRALIAN_SPECIAL==1)
  1530 			then
  2047 			then
  1531 				local austmine=FireGear(CurrentHedgehog,gtMine, vx, vy, 0)
  2048 				local austmine=FireGear(CurrentHedgehog,gtMine, vx, vy, 0)
  1532 				SetHealth(austmine, 100)
  2049 				SetHealth(austmine, 100)
  1533 				SetTimer(austmine, 1000)
  2050 				SetTimer(austmine, 1000)
       
  2051 				PlaySound(sndLaugh, CurrentHedgehog)
  1534 			else
  2052 			else
  1535 				local austmine=FireGear(CurrentHedgehog,gtBall, vx, vy, 1)
  2053 				local austmine=FireGear(CurrentHedgehog,gtBall, vx, vy, 1)
  1536 				--SetHealth(austmine, 1)
       
  1537 				SetTimer(austmine, 1000)
  2054 				SetTimer(austmine, 1000)
  1538 				SetGearMessage(austmine, 3)
  2055 				SetGearMessage(austmine, 3)
  1539 			end
  2056 			end
  1540 		else
  2057 		else
  1541 			PlaySound(sndDenied)
  2058 			PlaySound(sndDenied)
  1542 		end
  2059 		end
  1543 	elseif(GetGearType(gearUid)==gtParachute)
  2060 	elseif(GetGearType(gearUid)==gtParachute)
  1544 	then
  2061 	then
  1545 		GLOBAL_PARACHUTE_IS_ON=1
  2062 		CS.PARACHUTE_IS_ON=1
  1546 	elseif(GetGearType(gearUid)==gtSwitcher)
  2063 	elseif(GetGearType(gearUid)==gtSwitcher)
  1547 	then
  2064 	then
  1548 		GLOBAL_SWITCH_HOG_IS_ON=true
  2065 		CS.SWITCH_HOG_IS_ON=true
  1549 	end
  2066 	end
  1550 end
  2067 end
  1551 
  2068 
  1552 function onGearDamage(gearUid, damage)
  2069 function onGearDamage(gearUid, damage)
  1553 	if (GetGearType(gearUid) == gtCase)
  2070 	if(gearUid==CurrentHedgehog and CS.SABOTAGE_HOGS[CurrentHedgehog]==1)
  1554 	then
  2071 	then
  1555 		GLOBAL_CRATE_TEST=gearUid
  2072 		CS.SABOTAGE_HOGS[CurrentHedgehog]=0
  1556 	end
       
  1557 
       
  1558 	if(gearUid==CurrentHedgehog and GLOBAL_SABOTAGE_HOGS[CurrentHedgehog]==1)
       
  1559 	then
       
  1560 		GLOBAL_SABOTAGE_HOGS[CurrentHedgehog]=0
       
  1561 	end
  2073 	end
  1562 end
  2074 end
  1563 
  2075 
  1564 function onGearDelete(gearUid)
  2076 function onGearDelete(gearUid)
  1565 
  2077 
  1566 	if(GetGearType(gearUid) == gtHedgehog or GetGearType(gearUid) == gtMine or GetGearType(gearUid) == gtExplosives)
  2078 	if(GetGearType(gearUid) == gtHedgehog or GetGearType(gearUid) == gtMine or GetGearType(gearUid) == gtExplosives)
  1567 	then
  2079 	then
  1568 		--sundaland special
  2080 		--sundaland special
  1569 		if(GetGearType(gearUid) == gtHedgehog and GLOBAL_TEAM_CONTINENT[GLOBAL_SUNDALAND_END_HOG_CONTINENT_NAME]==10)
  2081 		if(GetGearType(gearUid) == gtHedgehog and CS.TEAM_CONTINENT[CS.SUNDALAND_END_HOG_CONTINENT_NAME]==10)
  1570 		then
  2082 		then
  1571 			local currvalue=getTeamValue(GLOBAL_SUNDALAND_END_HOG_CONTINENT_NAME, "sundaland-count")
  2083 			local currvalue=getTeamValue(CS.SUNDALAND_END_HOG_CONTINENT_NAME, "sundaland-count")
  1572 
  2084 
  1573 			if(currvalue==nil)
  2085 			if(currvalue==nil)
  1574 			then
  2086 			then
  1575 				currvalue=0
  2087 				currvalue=0
  1576 			end
  2088 			end
  1577 
  2089 
  1578 			setTeamValue(GLOBAL_SUNDALAND_END_HOG_CONTINENT_NAME, "sundaland-count", currvalue+1)
  2090 			setTeamValue(CS.SUNDALAND_END_HOG_CONTINENT_NAME, "sundaland-count", currvalue+1)
  1579 			PlaySound(sndReinforce,CurrentHedgehog)
       
  1580 		end
  2091 		end
  1581 
  2092 
  1582 		trackDeletion(gearUid)
  2093 		trackDeletion(gearUid)
  1583 	end
  2094 	end
  1584 
  2095 
  1585 	--if picking up a health crate
  2096 	--if picking up a health crate, heal sabotage
  1586 	if(GLOBAL_SABOTAGE_HOGS[CurrentHedgehog]~=0 and GetGearType(gearUid) == gtCase and GetHealth(gearUid)~=0 and gearUid~=GLOBAL_CRATE_TEST and gearIsInCircle(CurrentHedgehog,GetX(gearUid), GetY(gearUid), 50, false)==true)
  2097 	if(CS.SABOTAGE_HOGS[CurrentHedgehog]~=0 and GetGearType(gearUid) == gtCase and GetGearPos(gearUid)==2 and band(GetGearMessage(gearUid), gmDestroy) ~= 0)
  1587 	then
  2098 	then
  1588 		GLOBAL_SABOTAGE_HOGS[CurrentHedgehog]=0
  2099 		CS.SABOTAGE_HOGS[CurrentHedgehog]=0
  1589 	end
  2100 	end
  1590 
  2101 
  1591 	--north american lipstick
  2102 	--north american lipstick
  1592 	if(GetGearType(gearUid)==gtSniperRifleShot )
  2103 	if(GetGearType(gearUid)==gtSniperRifleShot )
  1593 	then
  2104 	then
  1594 		GLOBAL_NORTH_AMERICAN_SPECIAL_SNIPER_IS_ON=false
  2105 		CS.NORTH_AMERICAN_SPECIAL_SNIPER_IS_ON=false
  1595 		if(GLOBAL_NORTH_AMERICAN_SPECIAL_SNIPER==2)
  2106 		if(CS.NORTH_AMERICAN_SPECIAL_SNIPER==2)
  1596 		then
  2107 		then
  1597 			GLOBAL_TEMP_VALUE=gearUid
  2108 			CS.TEMP_VALUE=gearUid
  1598 			runOnGears(NorthAmericaSpecialSniper)
  2109 			runOnGears(NorthAmericaSpecialSniper)
  1599 		end
  2110 		end
  1600 	--north american eagle eye
  2111 	--north american eagle eye
  1601 	elseif(GetGearType(gearUid)==gtShotgunShot and GLOBAL_NORTH_AMERICAN_SPECIAL_SHOTGUN==true)
  2112 	elseif(GetGearType(gearUid)==gtShotgunShot and CS.NORTH_AMERICAN_SPECIAL_SHOTGUN==true)
  1602 	then
  2113 	then
  1603 		SetGearPosition(CurrentHedgehog, GetX(gearUid), GetY(gearUid)+7)
  2114 		SetGearPosition(CurrentHedgehog, GetX(gearUid), GetY(gearUid)+7)
  1604 		PlaySound(sndWarp)
  2115 		PlaySound(sndWarp)
  1605 	--south american special
  2116 	--south american special
  1606 	elseif(GetGearType(gearUid)==gtGasBomb and GLOBAL_SOUTH_AMERICAN_SPECIAL == true)
  2117 	elseif(GetGearType(gearUid)==gtGasBomb and CS.SOUTH_AMERICAN_SPECIAL == true)
  1607 	then
  2118 	then
  1608 		GLOBAL_TEMP_VALUE=gearUid
  2119 		if band(GetState(gearUid), gstDrowning) == 0 then
  1609 		runOnGears(SouthAmericaSpecialCheeseExplosion)
  2120 			CS.TEMP_VALUE=gearUid
  1610 		AddVisualGear(GetX(gearUid), GetY(gearUid), vgtExplosion, 0, false)
  2121 			runOnGears(SouthAmericaSpecialCheeseExplosion)
       
  2122 			AddVisualGear(GetX(gearUid), GetY(gearUid), vgtExplosion, 0, false)
       
  2123 		end
  1611 
  2124 
  1612 	--asian special
  2125 	--asian special
  1613 	elseif(GetGearType(gearUid)==gtSnowball and GetGearMessage(gearUid)==1)
  2126 	elseif(GetGearType(gearUid)==gtSnowball and GetGearMessage(gearUid)==1)
  1614 	then
  2127 	then
  1615 		AddGear(GetX(gearUid), GetY(gearUid), gtCluster, 0, 0, 0, 22)
  2128 		AddGear(GetX(gearUid), GetY(gearUid), gtCluster, 0, 0, 0, 22)
  1616 
  2129 
  1617 	--europe special
  2130 	--europe special
  1618 	elseif(GetGearType(gearUid)==gtCluster and GetGearMessage(gearUid)==2)
  2131 	elseif(GetGearType(gearUid)==gtCluster and GetGearMessage(gearUid)==2)
  1619 	then
  2132 	then
  1620 		GLOBAL_TEMP_VALUE=gearUid
  2133 		if band(GetState(gearUid), gstDrowning) == 0 then
  1621 		runOnGears(EuropeSpecialMolotovHit)
  2134 			CS.TEMP_VALUE=gearUid
  1622 		VisualExplosion(100,GetX(gearUid), GetY(gearUid),vgtSmokeWhite,vgtSmokeWhite)
  2135 			runOnGears(EuropeSpecialMolotovHit)
  1623 		AddVisualGear(GetX(gearUid), GetY(gearUid), vgtExplosion, 0, false)
  2136 			VisualExplosion(100,GetX(gearUid), GetY(gearUid),vgtSmokeWhite,vgtSmokeWhite)
  1624 		PlaySound(sndGraveImpact)
  2137 			AddVisualGear(GetX(gearUid), GetY(gearUid), vgtExplosion, 0, false)
       
  2138 			PlaySound(sndGraveImpact)
       
  2139 		end
  1625 	--australian special
  2140 	--australian special
  1626 	elseif(GetGearType(gearUid)==gtBall and GetGearMessage(gearUid)==3)
  2141 	elseif(GetGearType(gearUid)==gtBall and GetGearMessage(gearUid)==3)
  1627 	then
  2142 	then
  1628 		SpawnRandomCrate(GetX(gearUid), GetY(gearUid))
  2143 		SpawnRandomCrate(GetX(gearUid), GetY(gearUid))
  1629 
  2144 
  1630 	--asia (using para)
  2145 	--asia (using para)
  1631 	elseif(GetGearType(gearUid)==gtParachute)
  2146 	elseif(GetGearType(gearUid)==gtParachute)
  1632 	then
  2147 	then
  1633 		GLOBAL_PARACHUTE_IS_ON=false
  2148 		CS.PARACHUTE_IS_ON=false
  1634 	elseif(GetGearType(gearUid)==gtSwitcher)
  2149 	elseif(GetGearType(gearUid)==gtSwitcher)
  1635 	then
  2150 	then
  1636 		GLOBAL_SWITCH_HOG_IS_ON=false
  2151 		CS.SWITCH_HOG_IS_ON=false
  1637 	end
  2152 	end
  1638 end
  2153 end
  1639 
  2154 
  1640 --[[
       
  1641 	sources (populations & area):
       
  1642 	Own calculations from wikipedia.
       
  1643 	Some are approximations.
       
  1644 ]]
       
  1645