share/hedgewars/Data/Scripts/Multiplayer/Continental_supplies.lua
changeset 10965 fb2b006ba476
parent 10956 80c3314f8123
child 11515 4dd77731453b
equal deleted inserted replaced
10963:e061da85f32d 10965:fb2b006ba476
     1 --[[
     1 --[[
     2 Made for 0.9.21
     2 	version 1.3n
     3 
     3 
     4 Copyright (C) 2012 Vatten
     4 	The expat (MIT) license
     5 
     5 
     6 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
     6 	Copyright (C) 2012 Vatten
     7 
     7 
     8 The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
     8 	Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
     9 
     9 
    10 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    10 	The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
       
    11 
       
    12 	THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    11 ]]
    13 ]]
    12 
    14 
    13 HedgewarsScriptLoad("/Scripts/Locale.lua")
    15 HedgewarsScriptLoad("/Scripts/Locale.lua")
    14 HedgewarsScriptLoad("/Scripts/Utils.lua")
    16 HedgewarsScriptLoad("/Scripts/Utils.lua")
    15 HedgewarsScriptLoad("/Scripts/Tracker.lua")
    17 HedgewarsScriptLoad("/Scripts/Tracker.lua")
    16 
    18 
    17 function int_sqrt(num)
    19 --approximative version of square root. This function follows the babylonian method.
       
    20 function IntegerSqrt(num)
    18 	local temp=num
    21 	local temp=num
    19 	while(temp*temp-div(temp,2)>num)
    22 	while(temp*temp-div(temp,2)>num)
    20 	do
    23 	do
    21 		temp=div((temp+div(num,temp)),2)
    24 		temp=div((temp+div(num,temp)),2)
    22 	end
    25 	end
    23 	
    26 
    24 	return math.abs(temp)
    27 	return math.abs(temp)
    25 end
    28 end
    26 
    29 
    27 function norm(xx,yy)
    30 -- sqrt(x^2,y^2), work without desyncs. is approximative
       
    31 function Norm(xx,yy)
    28 	--to fix overflows
    32 	--to fix overflows
    29 	if(((math.abs(xx)^2)+(math.abs(yy)^2))>2^26)
    33 	if(((math.abs(xx)^2)+(math.abs(yy)^2))>2^26)
    30 	then
    34 	then
    31 		local bitr=2^13
    35 		local bitr=2^13
    32 		return int_sqrt((div(math.abs(xx),bitr)^2)+(div(math.abs(yy),bitr)^2))*bitr
    36 		return IntegerSqrt((div(math.abs(xx),bitr)^2)+(div(math.abs(yy),bitr)^2))*bitr
    33 	else
    37 	else
    34 		return int_sqrt((math.abs(xx)^2)+(math.abs(yy)^2))
    38 		return IntegerSqrt((math.abs(xx)^2)+(math.abs(yy)^2))
    35 	end
    39 	end
    36 end
    40 end
    37 
    41 
    38 function positive(num)
    42 -- returns 1 or -1 depending on where it is
       
    43 function GetIfNegative(num)
    39 	if(num<0)
    44 	if(num<0)
    40 	then
    45 	then
    41 		return -1
    46 		return -1
    42 	else
    47 	else
    43 		return 1
    48 		return 1
    44 	end
    49 	end
    45 end
    50 end
    46 
    51 
       
    52 --Will end the turn + give escape time
    47 function EndTurn()
    53 function EndTurn()
    48 	SetState(CurrentHedgehog,bor(GetState(CurrentHedgehog),gstAttacked))
    54 	SetState(CurrentHedgehog,bor(GetState(CurrentHedgehog),gstAttacked))
    49 	--3 sec espace time
    55 	--3 sec espace time
    50 	TurnTimeLeft = GetAwayTime*10*3
    56 	TurnTimeLeft = GetAwayTime*10*3
    51 end
    57  end
       
    58 
       
    59  --show health tag (will mostly be used when a hog is damaged)
       
    60 function ShowDamageTag(hog,damage)
       
    61 	healthtag=AddVisualGear(GetX(hog), GetY(hog), vgtHealthTag, damage, false)
       
    62 	v1, v2, v3, v4, v5, v6, v7, v8, v9, v10 = GetVisualGearValues(healthtag)
       
    63 	SetVisualGearValues(healthtag, v1, v2, v3, v4, v5, v6, v7, v8, v9, GetClanColor(GetHogClan(hog)))
       
    64 end
       
    65 
       
    66 --will use IntegerSqrt
       
    67 function FireGear(hedgehog,geartype,vx,vy,timer)
       
    68 	local hypo=Norm(vx,vy)
       
    69 	return AddGear(div((GetGearRadius(hedgehog)*2*vx),hypo)+GetX(hedgehog), div((GetGearRadius(hedgehog)*2*vy),hypo)+GetY(hedgehog), geartype, 0, vx, vy, timer)
       
    70 end
       
    71 
       
    72 --This function will set the gravity on a scale from 0->100, where 50 is the standard one.
       
    73  function SetGravityFromScale(grav)
       
    74 	if(grav>100)
       
    75 	then
       
    76 		grav=100
       
    77 	elseif(grav<0)
       
    78 	then
       
    79 		grav=0
       
    80 	end
       
    81 
       
    82 	if(grav>50)
       
    83 	then
       
    84 		SetGravity(100+((grav-50)*12))
       
    85 	else
       
    86 		SetGravity(25+grav+div(grav,2))
       
    87 	end
       
    88  end
       
    89 
       
    90 --====MISC GLOBALS====
       
    91 
       
    92 --for selecting continent
       
    93 local GLOBAL_INIT_TEAMS = {}
       
    94 local GLOBAL_SELECT_CONTINENT_CHECK=false
       
    95 local GLOBAL_TEAM_CONTINENT = {}
       
    96 
       
    97 --variables for seeing if you have swaped around on a weapon
       
    98 local GLOBAL_AUSTRALIAN_SPECIAL=0
       
    99 local GLOBAL_AFRICAN_SPECIAL_SEDUCTION=0
       
   100 local GLOBAL_AFRICAN_SPECIAL_STICKY=0
       
   101 local GLOBAL_SOUTH_AMERICAN_SPECIAL=false
       
   102 local GLOBAL_NORTH_AMERICAN_SPECIAL_SNIPER=1
       
   103 local GLOBAL_NORTH_AMERICAN_SPECIAL_SNIPER_IS_ON=false
       
   104 local GLOBAL_KERGUELEN_SPECIAL=1
       
   105 local GLOBAL_NORTH_AMERICAN_SPECIAL_SHOTGUN=false
       
   106 local GLOBAL_EUROPE_SPECIAL=0
       
   107 
       
   108 --detection if something is activated
       
   109 local GLOBAL_SWITCH_HOG_IS_ON=false
       
   110 local GLOBAL_VAMPIRIC_IS_ON=0
       
   111 local GLOBAL_EXTRA_DAMAGE_IS_ON=100
       
   112 local GLOBAL_PARACHUTE_IS_ON=false
       
   113 
       
   114 --the visual circle for kerguelen
       
   115 local GLOBAL_VISUAL_CIRCLE=nil
       
   116 
       
   117 --the global temp value
       
   118 local GLOBAL_TEMP_VALUE=0
       
   119 
       
   120 --for sabotage
       
   121 local GLOBAL_SABOTAGE_COUNTER=0
       
   122 local GLOBAL_SABOTAGE_HOGS={}
       
   123 local GLOBAL_SABOTAGE_FREQUENCY=0
       
   124 local GLOBAL_SABOTAGE_GRAVITY_SWITCH=true
    52 
   125 
    53 --for sundaland
   126 --for sundaland
    54 local turnhog=0
   127 local GLOBAL_SUNDALAND_END_HOG=0
    55 
   128 
    56 local teams_ok = {}
   129 --====GENERAL GLOBALS (useful for handling continents)====
    57 local wepcode_teams={}
   130 
    58 local swapweps=false
   131 local GLOBAL_GENERAL_INFORMATION="- "..loc("Per team weapons").."|- 10 "..loc("weaponschemes").."|- "..loc("Unique new weapons").."| |"..loc("Select your continent/weaponset: with the \"Up\" or \"Down\" keys. You can also select one with the weapons menu.").."|"..loc("Note: Some weapons have a second option (See continent information). Find and use them with the \"")..loc("switch").."\" "..loc("key.").."|"..loc("Tip: See the \"esc\" key (this menu) if you want to see the currently playing teams continent, or that continents specials.")
    59 
   132 
    60 --variables for seeing if you have swaped around on a weapon
   133 local GLOBAL_SHOW_SMALL_INFO=0
    61 local australianSpecial=false
   134 
    62 local africanSpecial=0
   135 local GLOBAL_WEAPON_TEXTS = {
    63 local africaspecial2=0
       
    64 local samericanSpecial=false
       
    65 local namericanSpecial=1
       
    66 local sniper_s_in_use=false
       
    67 local kergulenSpecial=1
       
    68 local shotgun_s=false
       
    69 local europe_s=0
       
    70 local VampOn=0
       
    71 
       
    72 local austmine=nil
       
    73 local inpara=false
       
    74 local asianflame=0
       
    75 
       
    76 local visualcircle=nil
       
    77 
       
    78 local temp_val=0
       
    79 
       
    80 --for sabotage
       
    81 local disallowattack=0
       
    82 local disable_moving={}
       
    83 local disableRand=0
       
    84 --local disableoffsetai=0
       
    85 local onsabotageai=false
       
    86 
       
    87 local continent = {}
       
    88 
       
    89 local generalinfo="- "..loc("Per team weapons").."|- 10 "..loc("weaponschemes").."|- "..loc("Unique new weapons").."| |"..loc("Select continent first round with the Weapon Menu or by").." (["..loc("switch").."/"..loc("tab").."]="..loc("Increase")..",["..loc("presice").."/"..loc("left shift").."]="..loc("Decrease")..") "..loc("on Skip").."|"..loc("Some weapons have a second option. Find them with").." ["..loc("switch").."/"..loc("tab").."]"
       
    90 
       
    91 local weapontexts = {
       
    92 loc("Green lipstick bullet: [Poisonous, deals no damage]"),
   136 loc("Green lipstick bullet: [Poisonous, deals no damage]"),
    93 loc("REMOVED"),
   137 loc("Cluck-cluck time: [Fire an egg ~ Sabotages and cures poison ~ Cannot be fired close to another hog]"),
    94 loc("Anno 1032: [The explosion will make a strong push ~ Wide range, wont affect hogs close to the target]"),
   138 loc("Anno 1032: [The explosion will make a strong push ~ Wide range, wont affect hogs close to the target]"),
    95 loc("Dust storm: [Deals 15 damage to all enemies in the circle]"),
   139 loc("Dust storm: [Deals 15 damage to all enemies in the circle]"),
    96 loc("Cricket time: [Drop a fireable mine! ~ Will work if fired close to your hog & far away from enemy ~ 1 sec]"),
   140 loc("Cricket time: [Fire away a 1 sec mine! ~ Cannot be fired close to another hog]"),
    97 loc("Drop a bomb: [Drop some heroic wind that will turn into a bomb on impact]"),
   141 loc("Drop a bomb: [Drop some heroic wind that will turn into a bomb on impact]"),
    98 loc("Penguin roar: [Deal 15 damage + 15% of your hogs health to all hogs around you and get 2/3 back]"),
   142 loc("Penguin roar: [Deal 15 damage + 10% of your hogs health to all hogs around you and get 2/3 back]"),
    99 loc("Disguise as a Rockhopper Penguin: [Swap place with a random enemy hog in the circle]"),
   143 loc("Disguise as a Rockhopper Penguin: [Swap place with a random enemy hog in the circle]"),
   100 loc("REMOVED"),
   144 nil,
   101 loc("Lonely Cries: [Rise the water if no hog is in the circle and deal 7 damage to all enemy hogs]"),
   145 loc("Lonely Cries: [Rise the water if no hog is in the circle and deal 6 damage to all enemy hogs.]"),
   102 loc("Hedgehog projectile: [Fire your hog like a Sticky Bomb]"),
   146 loc("Hedgehog projectile: [Fire your hog like a Sticky Bomb]"),
   103 loc("Napalm rocket: [Fire a bomb with napalm!]"),
   147 loc("Napalm rocket: [Fire a bomb with napalm!]"),
   104 loc("Eagle Eye: [Blink to the impact ~ One shot]"),
   148 loc("Eagle Eye: [Blink to the impact ~ One shot]"),
   105 loc("Medicine: [Fire some exploding medicine that will heal all hogs effected by the explosion]"),
   149 loc("Medicine: [Fire some exploding medicine that will heal all hogs effected by the explosion]"),
   106 loc("Sabotage/Flare: [Sabotage all hogs in the circle and deal ~1 dmg OR Fire a cluster up into the air]")
   150 loc("Sabotage/Flare: [Sabotage all hogs in the circle and deal ~1 dmg OR Fire a cluster up into the air]")
   107 }
   151 }
   108 
   152 
   109 local weaponsets = 
   153 local GLOBAL_CONTINENT_INFORMATION =
   110 {
   154 {
   111 {loc("North America"),loc("Area")..": 24,709,000 km2, "..loc("Population")..": 529,000,000",loc("- Will give you an airstrike every fifth turn.").."|"..loc("Special Weapons:").."|"..loc("Shotgun")..": "..weapontexts[13].."|"..loc("Sniper Rifle")..": "..weapontexts[1],amSniperRifle,
   155 {loc("North America"),"["..loc("Difficulty: ")..loc("EASY").."] "..loc("Area")..": 24,709,000 km2, "..loc("Population")..": 529,000,000",loc("- You can switch between hogs at the start of your turns. (Not first one)").."|"..loc("Special Weapons:").."|"..loc("Shotgun")..": "..GLOBAL_WEAPON_TEXTS[13].."|"..loc("Sniper Rifle")..": "..GLOBAL_WEAPON_TEXTS[1],amSniperRifle,
   112 {{amShotgun,100},{amDEagle,100},{amLaserSight,4},{amSniperRifle,100},{amCake,1},{amAirAttack,2},{amSwitch,5}}},
   156 {{amShotgun,100},{amDEagle,100},{amLaserSight,2},{amSniperRifle,100},{amCake,1},{amAirAttack,2},{amSwitch,2}}},
   113 
   157 
   114 {loc("South America"),loc("Area")..": 17,840,000 km2, "..loc("Population")..": 387,000,000",loc("Special Weapons:").."|"..loc("GasBomb")..": "..weapontexts[3],amGasBomb,
   158 {loc("South America"),"["..loc("Difficulty: ")..loc("MEDIUM").."] "..loc("Area")..": 17,840,000 km2, "..loc("Population")..": 387,000,000",loc("Special Weapons:").."|"..loc("GasBomb")..": "..GLOBAL_WEAPON_TEXTS[3],amGasBomb,
   115 {{amBirdy,100},{amHellishBomb,1},{amBee,100},{amGasBomb,100},{amFlamethrower,100},{amNapalm,1},{amExtraDamage,3}}},
   159 {{amBirdy,100},{amHellishBomb,1},{amBee,100},{amGasBomb,100},{amFlamethrower,100},{amNapalm,1},{amExtraDamage,2}}},
   116 
   160 
   117 {loc("Europe"),loc("Area")..": 10,180,000 km2, "..loc("Population")..": 740,000,000",loc("Special Weapons:").."|"..loc("Molotov")..": "..weapontexts[14],amBazooka,
   161 {loc("Europe"),"["..loc("Difficulty: ")..loc("EASY").."] "..loc("Area")..": 10,180,000 km2, "..loc("Population")..": 740,000,000",loc("Special Weapons:").."|"..loc("Molotov")..": "..GLOBAL_WEAPON_TEXTS[14],amBazooka,
   118 {{amBazooka,100},{amGrenade,100},{amMortar,100},{amMolotov,100},{amVampiric,3},{amPiano,1},{amResurrector,2},{amJetpack,4}}},
   162 {{amBazooka,100},{amGrenade,100},{amMortar,100},{amMolotov,100},{amVampiric,3},{amPiano,1},{amResurrector,2},{amJetpack,4}}},
   119 
   163 
   120 {loc("Africa"),loc("Area")..": 30,222,000 km2, "..loc("Population")..": 1,033,000,000",loc("Special Weapons:").."|"..loc("Seduction")..": "..weapontexts[4].."|"..loc("Sticky Mine")..": "..weapontexts[11].."|"..loc("Sticky Mine")..": "..weapontexts[12],amSMine,
   164 {loc("Africa"),"["..loc("Difficulty: ")..loc("MEDIUM").."] "..loc("Area")..": 30,222,000 km2, "..loc("Population")..": 1,033,000,000",loc("Special Weapons:").."|"..loc("Seduction")..": "..GLOBAL_WEAPON_TEXTS[4].."|"..loc("Sticky Mine")..": "..GLOBAL_WEAPON_TEXTS[11].."|"..loc("Sticky Mine")..": "..GLOBAL_WEAPON_TEXTS[12],amSMine,
   121 {{amSMine,100},{amWatermelon,1},{amDrillStrike,1},{amDrill,100},{amInvulnerable,4},{amSeduction,100},{amLandGun,2}}},
   165 {{amSMine,100},{amWatermelon,1},{amDrillStrike,1},{amDrill,100},{amInvulnerable,5},{amSeduction,100},{amLandGun,2}}},
   122 
   166 
   123 {loc("Asia"),loc("Area")..": 44,579,000 km2, "..loc("Population")..": 3,880,000,000",loc("- Will give you a parachute every second turn.").."|"..loc("Special Weapons:").."|"..loc("Parachute")..": "..weapontexts[6],amRope,
   167 {loc("Asia"),"["..loc("Difficulty: ")..loc("MEDIUM").."] "..loc("Area")..": 44,579,000 km2, "..loc("Population")..": 3,880,000,000",loc("- Will give you a parachute every second turn.").."|"..loc("Special Weapons:").."|"..loc("Parachute")..": "..GLOBAL_WEAPON_TEXTS[6],amRope,
   124 {{amRope,100},{amFirePunch,100},{amParachute,1},{amKnife,2},{amDynamite,1}}},
   168 {{amRope,100},{amFirePunch,100},{amParachute,2},{amKnife,2},{amDynamite,1}}},
   125 
   169 
   126 {loc("Australia"),loc("Area")..": 8,468,000 km2, "..loc("Population")..": 31,000,000",loc("Special Weapons:").."|"..loc("Baseballbat")..": "..weapontexts[5],amBaseballBat,
   170 {loc("Australia"),"["..loc("Difficulty: ")..loc("EASY").."] "..loc("Area")..": 8,468,000 km2, "..loc("Population")..": 31,000,000",loc("Special Weapons:").."|"..loc("Baseballbat")..": "..GLOBAL_WEAPON_TEXTS[5].."|"..loc("Baseballbat")..": "..GLOBAL_WEAPON_TEXTS[2],amBaseballBat,
   127 {{amBaseballBat,100},{amMine,100},{amLowGravity,4},{amBlowTorch,100},{amRCPlane,2},{amTeleport,3}}},
   171 {{amBaseballBat,100},{amMine,100},{amLowGravity,4},{amBlowTorch,100},{amRCPlane,2},{amTeleport,2},{amRubber,2}}},
   128 
   172 
   129 {loc("Antarctica"),loc("Area")..": 14,000,000 km2, "..loc("Population")..": ~1,000",loc("Antarctic summer: - Will give you one girder/mudball and two sineguns/portals every fourth turn."),amIceGun,
   173 {loc("Antarctica"),"["..loc("Difficulty: ")..loc("HARD").."] "..loc("Area")..": 14,000,000 km2, "..loc("Population")..": ~1,000",loc("Antarctic summer: - Will give you one girder/mudball and two sineguns/portals every fourth turn."),amIceGun,
   130 {{amSnowball,2},{amIceGun,2},{amPickHammer,100},{amSineGun,4},{amGirder,2},{amExtraTime,2},{amPortalGun,2}}},
   174 {{amSnowball,2},{amIceGun,2},{amPickHammer,100},{amSineGun,5},{amGirder,2},{amExtraTime,1},{amPortalGun,2}}},
   131 
   175 
   132 {loc("Kerguelen"),loc("Area")..": 1,100,000 km2, "..loc("Population")..": ~100",loc("Special Weapons:").."|"..loc("Hammer")..": "..weapontexts[7].."|"..loc("Hammer")..": "..weapontexts[8].." ("..loc("Duration")..": 2)|"..loc("Hammer")..": "..weapontexts[10].."|"..loc("Hammer")..": "..weapontexts[15],amHammer,
   176 {loc("Kerguelen"),"["..loc("Difficulty: ")..loc("EASY").."] "..loc("Area")..": 1,100,000 km2, "..loc("Population")..": ~100",loc("Special Weapons:").."|"..loc("Hammer")..": "..GLOBAL_WEAPON_TEXTS[7].."|"..loc("Hammer")..": "..GLOBAL_WEAPON_TEXTS[8].." ("..loc("Duration")..": 2)|"..loc("Hammer")..": "..GLOBAL_WEAPON_TEXTS[10].."|"..loc("Hammer")..": "..GLOBAL_WEAPON_TEXTS[15],amHammer,
   133 {{amHammer,100},{amMineStrike,2},{amBallgun,1}}},
   177 {{amHammer,100},{amMineStrike,1},{amBallgun,1}}},
   134 
   178 
   135 {loc("Zealandia"),loc("Area")..": 3,500,000 km2, "..loc("Population")..": 5,000,000",loc("- Will Get 1-3 random weapons") .. "|" .. loc("- Massive weapon bonus on first turn"),amInvulnerable,
   179 {loc("Zealandia"),"["..loc("Difficulty: ")..loc("MEDIUM").."] "..loc("Area")..": 3,500,000 km2, "..loc("Population")..": 5,000,000",loc("- Will Get 1-3 random weapons") .. "|" .. loc("- Massive weapon bonus on first turn"),amInvulnerable,
   136 {{amBazooka,1},{amGrenade,1},{amBlowTorch,1},{amSwitch,100},{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}}},
   180 {{amBazooka,1},{amGrenade,1},{amBlowTorch,1},{amSwitch,100},{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}}},
   137 
   181 
   138 {loc("Sundaland"),loc("Area")..": 1,850,000 km2, "..loc("Population")..": 290,000,000",loc("- You will recieve 2-4 weapons on each kill! (Even on own hogs)"),amTardis,
   182 {loc("Sundaland"),"["..loc("Difficulty: ")..loc("HARD").."] "..loc("Area")..": 1,850,000 km2, "..loc("Population")..": 290,000,000",loc("- You will recieve 2-4 weapons on each kill! (Even on own hogs)"),amTardis,
   139 {{amClusterBomb,3},{amTardis,4},{amWhip,100},{amKamikaze,4}}}
   183 {{amClusterBomb,4},{amTardis,4},{amWhip,100},{amKamikaze,4}}}
   140 
   184 
   141 }
   185 }
   142 
   186 
   143 local weaponsetssounds=
   187 local GLOBAL_CONTINENT_SOUNDS=
   144 {
   188 {
   145 	{sndShotgunFire,sndCover},
   189 	{sndShotgunFire,sndCover},
   146 	{sndEggBreak,sndLaugh},
   190 	{sndEggBreak,sndLaugh},
   147 	{sndExplosion,sndEnemyDown},
   191 	{sndExplosion,sndEnemyDown},
   148 	{sndMelonImpact,sndCoward},
   192 	{sndMelonImpact,sndCoward},
   149 	{sndRopeAttach,sndComeonthen},
   193 	{sndRopeAttach,sndComeonthen},
   150 	{sndBaseballBat,sndNooo},
   194 	{sndBaseballBat,sndNooo},
   151 	{sndSineGun,sndOops},
   195 	{sndSineGun,sndOops},
   152 	{sndPiano5,sndStupid},
   196 	{sndPiano5,sndStupid},
   153 	{sndSplash,sndFirstBlood},
   197 	{sndSplash,sndFirstBlood},
   154 	{sndWarp,sndSameTeam}
   198 	{sndWarp,sndSameTeam},
       
   199 	{sndFrozenHogImpact,sndUhOh}
   155 }
   200 }
   156 
   201 
   157 --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)
   202 --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)
   158 local weapons_dmg = {
   203 local GLOBAL_WEAPONS_DAMAGE = {
   159 	{amKamikaze, 0, 1, 0, 1, 0},
   204 	{amKamikaze, 0, 1, 0, 1, 0},
   160 	{amSineGun, 0, 1, 0, 1, 1},
   205 	{amSineGun, 0, 1, 0, 1, 1},
   161 	{amBazooka, 0, 1, 0, 1, 0},
   206 	{amBazooka, 0, 1, 0, 1, 0},
   162 	{amMineStrike, 0, 1, 5, 1, 2},
   207 	{amMineStrike, 0, 1, 5, 1, 2},
   163 	{amGrenade, 0, 1, 0, 1, 0},
   208 	{amGrenade, 0, 1, 0, 1, 0},
   180 	{amSeduction, 0, 0, 0, 1, 0},
   225 	{amSeduction, 0, 0, 0, 1, 0},
   181 	{amWatermelon, 0, 1, 5, 1, 2},
   226 	{amWatermelon, 0, 1, 5, 1, 2},
   182 	{amDrill, 0, 1, 0, 1, 0},
   227 	{amDrill, 0, 1, 0, 1, 0},
   183 	{amBallgun, 0, 1, 5, 1, 2},
   228 	{amBallgun, 0, 1, 5, 1, 2},
   184 	{amMolotov, 0, 1, 0, 1, 0},
   229 	{amMolotov, 0, 1, 0, 1, 0},
       
   230 	{amHammer, 0, 1, 0, 1, 2},
   185 	{amBirdy, 0, 1, 0, 1, 0},
   231 	{amBirdy, 0, 1, 0, 1, 0},
   186 	{amBlowTorch, 0, 1, 0, 1, 0},
   232 	{amBlowTorch, 0, 1, 0, 1, 0},
   187 	{amRCPlane, 0, 1, 5, 1, 2},
   233 	{amRCPlane, 0, 1, 5, 1, 2},
   188 	{amGasBomb, 0, 0, 0, 1, 0},
   234 	{amGasBomb, 0, 0, 0, 1, 0},
   189 	{amAirAttack, 0, 1, 4, 1, 1},
   235 	{amAirAttack, 0, 1, 4, 1, 1},
   190 	{amFlamethrower, 0, 1, 0, 1, 0},
   236 	{amFlamethrower, 0, 1, 0, 1, 0},
   191 	{amSMine, 0, 1, 0, 1, 1},
   237 	{amSMine, 0, 1, 0, 1, 1},
   192 	{amHammer, 0, 1, 0, 1, 0},
       
   193 	{amDrillStrike, 0, 1, 4, 1, 2},
   238 	{amDrillStrike, 0, 1, 4, 1, 2},
   194 	{amSnowball, 0, 1, 0, 1, 0}
   239 	{amSnowball, 0, 1, 0, 1, 0}
   195 }
   240 }
   196 local weapons_supp = {
   241 local GLOBAL_WEAPONS_SUPPORT = {
   197 	{amParachute, 0, 1, 0, 1, 0},
   242 	{amParachute, 0, 1, 0, 1, 0},
   198 	{amGirder, 0, 1, 0, 1, 0},
   243 	{amGirder, 0, 1, 0, 1, 0},
   199 	{amSwitch, 0, 1, 0, 1, 0},
   244 	{amSwitch, 0, 1, 0, 1, 0},
   200 	{amLowGravity, 0, 1, 0, 1, 0},
   245 	{amLowGravity, 0, 1, 0, 1, 0},
   201 	{amExtraDamage, 0, 1, 2, 1, 0},
   246 	{amExtraDamage, 0, 1, 2, 1, 0},
   209 	{amResurrector, 0, 1, 3, 1, 0},
   254 	{amResurrector, 0, 1, 3, 1, 0},
   210 	{amTeleport, 0, 1, 0, 1, 0},
   255 	{amTeleport, 0, 1, 0, 1, 0},
   211 	{amLandGun, 0, 1, 0, 1, 0},
   256 	{amLandGun, 0, 1, 0, 1, 0},
   212 	{amTardis, 0, 1, 0, 1, 0},
   257 	{amTardis, 0, 1, 0, 1, 0},
   213 	{amIceGun, 0, 1, 0, 1, 0},
   258 	{amIceGun, 0, 1, 0, 1, 0},
   214 	{amKnife, 0, 1, 0, 1, 0}
   259 	{amKnife, 0, 1, 0, 1, 0},
       
   260 	{amRubber, 0, 1, 0, 1, 0}
       
   261 
   215 }
   262 }
   216 
   263 
   217 --will check after borders and stuff
   264 --will check after borders and stuff
   218 function validate_weapon(hog,weapon,amount)
   265 function ValidateWeapon(hog,weapon,amount)
   219 	if(MapHasBorder() == false or (MapHasBorder() == true and weapon ~= amAirAttack and weapon ~= amMineStrike and weapon ~= amNapalm and weapon ~= amDrillStrike and weapon ~= amPiano))
   266 	if(MapHasBorder() == false or (MapHasBorder() == true and weapon ~= amAirAttack and weapon ~= amMineStrike and weapon ~= amNapalm and weapon ~= amDrillStrike and weapon ~= amPiano))
   220 	then
   267 	then
   221 		if(amount==1)
   268 		if(amount==1)
   222 		then
   269 		then
   223 			AddAmmo(hog, weapon)
   270 			AddAmmo(hog, weapon)
   225 			AddAmmo(hog, weapon,amount)
   272 			AddAmmo(hog, weapon,amount)
   226 		end
   273 		end
   227 	end
   274 	end
   228 end
   275 end
   229 
   276 
       
   277 --removes one weapon
   230 function RemoveWeapon(hog,weapon)
   278 function RemoveWeapon(hog,weapon)
   231 
   279 
   232 	if(GetAmmoCount(hog, weapon)<100)
   280 	if(GetAmmoCount(hog, weapon)<100)
   233 	then
   281 	then
   234 		AddAmmo(hog,weapon,GetAmmoCount(hog, weapon)-1)
   282 		AddAmmo(hog,weapon,GetAmmoCount(hog, weapon)-1)
   235 	end
   283 	end
   236 end
   284 end
   237 
   285 
   238 --reset all weapons for a team
   286 --reset all weapons for a team
   239 function cleanweps(hog)
   287 function CleanWeapons(hog)
   240 
   288 
   241 	local i=1
   289 	local i=1
   242 	--+1 for skip +1 for freezer
   290 	--+1 for skip
   243 	while(i<=table.maxn(weapons_supp)+table.maxn(weapons_dmg)+2)
   291 	while(i<=table.maxn(GLOBAL_WEAPONS_SUPPORT)+table.maxn(GLOBAL_WEAPONS_DAMAGE)+1)
   244 	do
   292 	do
   245 		AddAmmo(hog,i,0)
   293 		AddAmmo(hog,i,0)
   246 		i=i+1
   294 		i=i+1
   247 	end
   295 	end
   248 	
   296 
   249 	AddAmmo(hog,amSkip,100)
   297 	AddAmmo(hog,amSkip,100)
   250 end
   298 end
   251 
   299 
   252 --get the weapons from a weaponset
   300 --get the weapons from a weaponset
   253 function load_weaponset(hog, num)
   301 function LoadWeaponset(hog, num)
   254 	for v,w in pairs(weaponsets[num][5]) 
   302 	for v,w in pairs(GLOBAL_CONTINENT_INFORMATION[num][5])
   255 	do
   303 	do
   256 		validate_weapon(hog, w[1],w[2])
   304 		ValidateWeapon(hog, w[1],w[2])
   257 	end
   305 	end
   258 end
   306 end
   259 
   307 
   260 --list up all weapons from the icons for each continent
   308 --list up all weapons from the icons for each continent
   261 function load_continent_selection(hog)
   309 function InitWeaponsMenu(hog)
   262 
   310 
   263 	if(GetHogLevel(hog)==0)
   311 	if(GetHogLevel(hog)==0)
   264 	then
   312 	then
   265 		for v,w in pairs(weaponsets) 
   313 		for v,w in pairs(GLOBAL_CONTINENT_INFORMATION)
   266 		do
   314 		do
   267 			validate_weapon(hog, weaponsets[v][4],1)
   315 			ValidateWeapon(hog, GLOBAL_CONTINENT_INFORMATION[v][4],1)
   268 		end
   316 		end
   269 		AddAmmo(hog,amSwitch) --random continent
   317 		AddAmmo(hog,amSwitch) --random continent
   270 	
   318 
   271 	--for the computers
   319 	--for the computers
   272 	else
   320 	else
   273 		--europe
   321 		--europe
   274 		validate_weapon(hog, weaponsets[3][4],1)
   322 		ValidateWeapon(hog, GLOBAL_CONTINENT_INFORMATION[3][4],1)
   275 		--north america
   323 		--north america
   276 		validate_weapon(hog, weaponsets[1][4],1)
   324 		ValidateWeapon(hog, GLOBAL_CONTINENT_INFORMATION[1][4],1)
   277 	end
   325 	end
   278 end
   326 end
   279 
   327 
   280 --shows the continent info
   328 --shows the continent info
   281 function show_continent_info(continent,time,generalinf)
   329 function ShowContinentInfo(continent,time,generalinf)
   282 	local geninftext=""
   330 	local geninftext=""
   283 	local ns=false
   331 	local ns=false
   284 	if(time==-1)
   332 	if(time==-1)
   285 	then
   333 	then
   286 		time=0
   334 		time=0
   287 		ns=true
   335 		ns=true
   288 	end
   336 	end
   289 	if(generalinf)
   337 	if(generalinf)
   290 	then
   338 	then
   291 		geninftext="| |"..loc("General information")..": |"..generalinfo
   339 		geninftext="| |"..loc("General information")..": |"..GLOBAL_GENERAL_INFORMATION
   292 	end
   340 	end
   293 	ShowMission(weaponsets[continent][1],weaponsets[continent][2],weaponsets[continent][3]..geninftext, -weaponsets[continent][4], time)
   341 
       
   342 	GLOBAL_SHOW_SMALL_INFO=div(time,40)
       
   343 
       
   344 	ShowMission(GLOBAL_CONTINENT_INFORMATION[continent][1],GLOBAL_CONTINENT_INFORMATION[continent][2],GLOBAL_CONTINENT_INFORMATION[continent][3]..geninftext, -GLOBAL_CONTINENT_INFORMATION[continent][4], time)
   294 	if(ns)
   345 	if(ns)
   295 	then
   346 	then
   296 		HideMission()
   347 		HideMission()
   297 	end
   348 	end
   298 end
   349 end
   299 
   350 
   300 --will show a circle of gears (eye candy)
   351 --will show a circle of gears (eye candy)
   301 function visual_gear_explosion(range,xpos,ypos,gear1,gear2)
   352 function VisualExplosion(range,xpos,ypos,gear1,gear2)
   302 	local degr=0
   353 	local degr=0
   303 	local lap=30
   354 	local lap=30
   304 	while(lap<range)
   355 	while(lap<range)
   305 	do
   356 	do
   306 		while(degr < 6.2831)
   357 		while(degr < 6.2831)
   316 		degr=degr-6.2831
   367 		degr=degr-6.2831
   317 	end
   368 	end
   318 end
   369 end
   319 
   370 
   320 --zealandia (generates weapons from the weaponinfo above
   371 --zealandia (generates weapons from the weaponinfo above
   321 function get_random_weapon(hog)
   372 function ZealandiaGetWeapons(hog)
   322 	if(GetGearType(hog) == gtHedgehog and continent[GetHogTeamName(hog)]==9 and getTeamValue(GetHogTeamName(hog), "rand-done-turn")==nil)
   373 	if(GetGearType(hog) == gtHedgehog and GLOBAL_TEAM_CONTINENT[GetHogTeamName(hog)]==9 and getTeamValue(GetHogTeamName(hog), "rand-done-turn")==nil)
   323 	then
   374 	then
   324 		cleanweps(hog)
   375 		CleanWeapons(hog)
   325 	
   376 
   326 		local random_weapon = 0
   377 		local random_weapon = 0
   327 		local old_rand_weap = 0
   378 		local old_rand_weap = 0
   328 		local rand_weaponset_power = 0
   379 		local rand_weaponset_power = 0
   329 		
   380 
   330 		local numberof_weapons_supp=table.maxn(weapons_supp)
   381 		local numberofweaponssupp=table.maxn(GLOBAL_WEAPONS_SUPPORT)
   331 		local numberof_weapons_dmg=table.maxn(weapons_dmg)
   382 		local numberofweaponsdmg=table.maxn(GLOBAL_WEAPONS_DAMAGE)
   332 		
   383 
   333 		local rand1=math.abs(GetRandom(numberof_weapons_supp)+1)
   384 		local rand1=math.abs(GetRandom(numberofweaponssupp)+1)
   334 		local rand2=math.abs(GetRandom(numberof_weapons_dmg)+1)
   385 		local rand2=math.abs(GetRandom(numberofweaponsdmg)+1)
   335 		
   386 
   336 		random_weapon = math.abs(GetRandom(table.maxn(weapons_dmg))+1)
   387 		random_weapon = math.abs(GetRandom(table.maxn(GLOBAL_WEAPONS_DAMAGE))+1)
   337 		
   388 
   338 		while(weapons_dmg[random_weapon][4]>TotalRounds or (MapHasBorder() == true and (weapons_dmg[random_weapon][1]== amAirAttack or weapons_dmg[random_weapon][1] == amMineStrike or weapons_dmg[random_weapon][1] == amNapalm or weapons_dmg[random_weapon][1] == amDrillStrike or weapons_dmg[random_weapon][1] == amPiano)))
   389 		while(GLOBAL_WEAPONS_DAMAGE[random_weapon][4]>TotalRounds or (MapHasBorder() == true and (GLOBAL_WEAPONS_DAMAGE[random_weapon][1]== amAirAttack or GLOBAL_WEAPONS_DAMAGE[random_weapon][1] == amMineStrike or GLOBAL_WEAPONS_DAMAGE[random_weapon][1] == amNapalm or GLOBAL_WEAPONS_DAMAGE[random_weapon][1] == amDrillStrike or GLOBAL_WEAPONS_DAMAGE[random_weapon][1] == amPiano)))
   339 		do
   390 		do
   340 			if(random_weapon>=numberof_weapons_dmg)
   391 			if(random_weapon>=numberofweaponsdmg)
   341 			then
   392 			then
   342 				random_weapon=0
   393 				random_weapon=0
   343 			end
   394 			end
   344 			random_weapon = random_weapon+1
   395 			random_weapon = random_weapon+1
   345 		end
   396 		end
   346 		validate_weapon(hog, weapons_dmg[random_weapon][1],1)
   397 		ValidateWeapon(hog, GLOBAL_WEAPONS_DAMAGE[random_weapon][1],1)
   347 		rand_weaponset_power=weapons_dmg[random_weapon][6]
   398 		rand_weaponset_power=GLOBAL_WEAPONS_DAMAGE[random_weapon][6]
   348 		old_rand_weap = random_weapon
   399 		old_rand_weap = random_weapon
   349 		
   400 
   350 		if(rand_weaponset_power <2)
   401 		if(rand_weaponset_power <2)
   351 		then
   402 		then
   352 			random_weapon = rand1
   403 			random_weapon = rand1
   353 			while(weapons_supp[random_weapon][4]>TotalRounds or rand_weaponset_power+weapons_supp[random_weapon][6]>2)
   404 			while(GLOBAL_WEAPONS_SUPPORT[random_weapon][4]>TotalRounds or rand_weaponset_power+GLOBAL_WEAPONS_SUPPORT[random_weapon][6]>2)
   354 			do
   405 			do
   355 				if(random_weapon>=numberof_weapons_supp)
   406 				if(random_weapon>=numberofweaponssupp)
   356 				then
   407 				then
   357 					random_weapon=0
   408 					random_weapon=0
   358 				end
   409 				end
   359 				random_weapon = random_weapon+1
   410 				random_weapon = random_weapon+1
   360 			end
   411 			end
   361 			validate_weapon(hog, weapons_supp[random_weapon][1],1)
   412 			ValidateWeapon(hog, GLOBAL_WEAPONS_SUPPORT[random_weapon][1],1)
   362 			rand_weaponset_power=rand_weaponset_power+weapons_supp[random_weapon][6]
   413 			rand_weaponset_power=rand_weaponset_power+GLOBAL_WEAPONS_SUPPORT[random_weapon][6]
   363 		end
   414 		end
   364 		--check again if  the power is enough
   415 		--check again if  the power is enough
   365 		if(rand_weaponset_power <1)
   416 		if(rand_weaponset_power <1)
   366 		then
   417 		then
   367 			random_weapon = rand2
   418 			random_weapon = rand2
   368 			while(weapons_dmg[random_weapon][4]>TotalRounds or old_rand_weap == random_weapon or weapons_dmg[random_weapon][6]>0 or (MapHasBorder() == true and (weapons_dmg[random_weapon][1]== amAirAttack or weapons_dmg[random_weapon][1] == amMineStrike or weapons_dmg[random_weapon][1] == amNapalm or weapons_dmg[random_weapon][1] == amDrillStrike or weapons_dmg[random_weapon][1] == amPiano)))
   419 			while(GLOBAL_WEAPONS_DAMAGE[random_weapon][4]>TotalRounds or old_rand_weap == random_weapon or GLOBAL_WEAPONS_DAMAGE[random_weapon][6]>0 or (MapHasBorder() == true and (GLOBAL_WEAPONS_DAMAGE[random_weapon][1]== amAirAttack or GLOBAL_WEAPONS_DAMAGE[random_weapon][1] == amMineStrike or GLOBAL_WEAPONS_DAMAGE[random_weapon][1] == amNapalm or GLOBAL_WEAPONS_DAMAGE[random_weapon][1] == amDrillStrike or GLOBAL_WEAPONS_DAMAGE[random_weapon][1] == amPiano)))
   369 			do
   420 			do
   370 				if(random_weapon>=numberof_weapons_dmg)
   421 				if(random_weapon>=numberofweaponsdmg)
   371 				then
   422 				then
   372 					random_weapon=0
   423 					random_weapon=0
   373 				end
   424 				end
   374 				random_weapon = random_weapon+1
   425 				random_weapon = random_weapon+1
   375 			end
   426 			end
   376 			validate_weapon(hog, weapons_dmg[random_weapon][1],1)
   427 			ValidateWeapon(hog, GLOBAL_WEAPONS_DAMAGE[random_weapon][1],1)
   377 		end
   428 		end
   378 			
   429 
   379 		setTeamValue(GetHogTeamName(hog), "rand-done-turn", true)
   430 		setTeamValue(GetHogTeamName(hog), "rand-done-turn", true)
   380 	end
   431 	end
   381 end
   432 end
   382 
   433 
   383 --sundaland add weps
   434 --sundaland add weps
   384 function get_random_weapon_on_death(hog)
   435 function SundalandGetWeapons(hog)
   385 	
   436 
   386 		local random_weapon = 0
   437 		local random_weapon = 0
   387 		local old_rand_weap = 0
   438 		local old_rand_weap = 0
   388 		local rand_weaponset_power = 0
   439 		local rand_weaponset_power = 0
   389 		
   440 
   390 		local firstTurn=0
   441 		local firstTurn=0
   391 		
   442 
   392 		local numberof_weapons_supp=table.maxn(weapons_supp)
   443 		local numberofweaponssupp=table.maxn(GLOBAL_WEAPONS_SUPPORT)
   393 		local numberof_weapons_dmg=table.maxn(weapons_dmg)
   444 		local numberofweaponsdmg=table.maxn(GLOBAL_WEAPONS_DAMAGE)
   394 		
   445 
   395 		local rand1=GetRandom(numberof_weapons_supp)+1
   446 		local rand1=GetRandom(numberofweaponssupp)+1
   396 		local rand2=GetRandom(numberof_weapons_dmg)+1
   447 		local rand2=GetRandom(numberofweaponsdmg)+1
   397 		local rand3=GetRandom(numberof_weapons_dmg)+1
   448 		local rand3=GetRandom(numberofweaponsdmg)+1
   398 		
   449 
   399 		random_weapon = GetRandom(numberof_weapons_dmg)+1
   450 		random_weapon = GetRandom(numberofweaponsdmg)+1
   400 		
   451 
   401 		if(TotalRounds<0)
   452 		if(TotalRounds<0)
   402 		then
   453 		then
   403 			firstTurn=-TotalRounds
   454 			firstTurn=-TotalRounds
   404 		end
   455 		end
   405 		
   456 
   406 		while(weapons_dmg[random_weapon][4]>(TotalRounds+firstTurn) or (MapHasBorder() == true and (weapons_dmg[random_weapon][1]== amAirAttack or weapons_dmg[random_weapon][1] == amMineStrike or weapons_dmg[random_weapon][1] == amNapalm or weapons_dmg[random_weapon][1] == amDrillStrike or weapons_dmg[random_weapon][1] == amPiano)))
   457 		while(GLOBAL_WEAPONS_DAMAGE[random_weapon][4]>(TotalRounds+firstTurn) or (MapHasBorder() == true and (GLOBAL_WEAPONS_DAMAGE[random_weapon][1]== amAirAttack or GLOBAL_WEAPONS_DAMAGE[random_weapon][1] == amMineStrike or GLOBAL_WEAPONS_DAMAGE[random_weapon][1] == amNapalm or GLOBAL_WEAPONS_DAMAGE[random_weapon][1] == amDrillStrike or GLOBAL_WEAPONS_DAMAGE[random_weapon][1] == amPiano)))
   407 		do
   458 		do
   408 			if(random_weapon>=numberof_weapons_dmg)
   459 			if(random_weapon>=numberofweaponsdmg)
   409 			then
   460 			then
   410 				random_weapon=0
   461 				random_weapon=0
   411 			end
   462 			end
   412 			random_weapon = random_weapon+1
   463 			random_weapon = random_weapon+1
   413 		end
   464 		end
   414 		validate_weapon(hog, weapons_dmg[random_weapon][1],1)
   465 		ValidateWeapon(hog, GLOBAL_WEAPONS_DAMAGE[random_weapon][1],1)
   415 		rand_weaponset_power=weapons_dmg[random_weapon][6]
   466 		rand_weaponset_power=GLOBAL_WEAPONS_DAMAGE[random_weapon][6]
   416 		old_rand_weap = random_weapon
   467 		old_rand_weap = random_weapon
   417 		
   468 
   418 		random_weapon = rand1
   469 		random_weapon = rand1
   419 		while(weapons_supp[random_weapon][4]>(TotalRounds+firstTurn) or rand_weaponset_power+weapons_supp[random_weapon][6]>2)
   470 		while(GLOBAL_WEAPONS_SUPPORT[random_weapon][4]>(TotalRounds+firstTurn) or rand_weaponset_power+GLOBAL_WEAPONS_SUPPORT[random_weapon][6]>2)
   420 		do
   471 		do
   421 			if(random_weapon>=numberof_weapons_supp)
   472 			if(random_weapon>=numberofweaponssupp)
   422 			then
   473 			then
   423 				random_weapon=0
   474 				random_weapon=0
   424 			end
   475 			end
   425 			random_weapon = random_weapon+1
   476 			random_weapon = random_weapon+1
   426 		end
   477 		end
   427 		validate_weapon(hog, weapons_supp[random_weapon][1],1)
   478 		ValidateWeapon(hog, GLOBAL_WEAPONS_SUPPORT[random_weapon][1],1)
   428 		rand_weaponset_power=rand_weaponset_power+weapons_supp[random_weapon][6]
   479 		rand_weaponset_power=rand_weaponset_power+GLOBAL_WEAPONS_SUPPORT[random_weapon][6]
   429 		
   480 
   430 		--check again if  the power is enough
   481 		--check again if  the power is enough
   431 		if(rand_weaponset_power <2)
   482 		if(rand_weaponset_power <2)
   432 		then
   483 		then
   433 			random_weapon = rand2
   484 			random_weapon = rand2
   434 			while(weapons_dmg[random_weapon][4]>(TotalRounds+firstTurn) or old_rand_weap == random_weapon or weapons_dmg[random_weapon][6]>0 or (MapHasBorder() == true and (weapons_dmg[random_weapon][1]== amAirAttack or weapons_dmg[random_weapon][1] == amMineStrike or weapons_dmg[random_weapon][1] == amNapalm or weapons_dmg[random_weapon][1] == amDrillStrike or weapons_dmg[random_weapon][1] == amPiano)))
   485 			while(GLOBAL_WEAPONS_DAMAGE[random_weapon][4]>(TotalRounds+firstTurn) or old_rand_weap == random_weapon or GLOBAL_WEAPONS_DAMAGE[random_weapon][6]>0 or (MapHasBorder() == true and (GLOBAL_WEAPONS_DAMAGE[random_weapon][1]== amAirAttack or GLOBAL_WEAPONS_DAMAGE[random_weapon][1] == amMineStrike or GLOBAL_WEAPONS_DAMAGE[random_weapon][1] == amNapalm or GLOBAL_WEAPONS_DAMAGE[random_weapon][1] == amDrillStrike or GLOBAL_WEAPONS_DAMAGE[random_weapon][1] == amPiano)))
   435 			do
   486 			do
   436 				if(random_weapon>=numberof_weapons_dmg)
   487 				if(random_weapon>=numberofweaponsdmg)
   437 				then
   488 				then
   438 					random_weapon=0
   489 					random_weapon=0
   439 				end
   490 				end
   440 				random_weapon = random_weapon+1
   491 				random_weapon = random_weapon+1
   441 			end
   492 			end
   442 			validate_weapon(hog, weapons_dmg[random_weapon][1],1)
   493 			ValidateWeapon(hog, GLOBAL_WEAPONS_DAMAGE[random_weapon][1],1)
   443 			rand_weaponset_power=weapons_dmg[random_weapon][6]
   494 			rand_weaponset_power=GLOBAL_WEAPONS_DAMAGE[random_weapon][6]
   444 		end
   495 		end
   445 		
   496 
   446 		if(rand_weaponset_power <1)
   497 		if(rand_weaponset_power <1)
   447 		then
   498 		then
   448 			random_weapon = rand3
   499 			random_weapon = rand3
   449 			while(weapons_dmg[random_weapon][4]>(TotalRounds+firstTurn) or old_rand_weap == random_weapon or weapons_dmg[random_weapon][6]>0 or (MapHasBorder() == true and (weapons_dmg[random_weapon][1]== amAirAttack or weapons_dmg[random_weapon][1] == amMineStrike or weapons_dmg[random_weapon][1] == amNapalm or weapons_dmg[random_weapon][1] == amDrillStrike or weapons_dmg[random_weapon][1] == amPiano)))
   500 			while(GLOBAL_WEAPONS_DAMAGE[random_weapon][4]>(TotalRounds+firstTurn) or old_rand_weap == random_weapon or GLOBAL_WEAPONS_DAMAGE[random_weapon][6]>0 or (MapHasBorder() == true and (GLOBAL_WEAPONS_DAMAGE[random_weapon][1]== amAirAttack or GLOBAL_WEAPONS_DAMAGE[random_weapon][1] == amMineStrike or GLOBAL_WEAPONS_DAMAGE[random_weapon][1] == amNapalm or GLOBAL_WEAPONS_DAMAGE[random_weapon][1] == amDrillStrike or GLOBAL_WEAPONS_DAMAGE[random_weapon][1] == amPiano)))
   450 			do
   501 			do
   451 				if(random_weapon>=numberof_weapons_dmg)
   502 				if(random_weapon>=numberofweaponsdmg)
   452 				then
   503 				then
   453 					random_weapon=0
   504 					random_weapon=0
   454 				end
   505 				end
   455 				random_weapon = random_weapon+1
   506 				random_weapon = random_weapon+1
   456 			end
   507 			end
   457 			validate_weapon(hog, weapons_dmg[random_weapon][1],1)
   508 			ValidateWeapon(hog, GLOBAL_WEAPONS_DAMAGE[random_weapon][1],1)
   458 		end
   509 		end
   459 		
   510 
   460 		AddVisualGear(GetX(hog), GetY(hog)-30, vgtEvilTrace,0, false)
   511 		AddVisualGear(GetX(hog), GetY(hog)-30, vgtEvilTrace,0, false)
   461 		PlaySound(sndReinforce,hog)
   512 		PlaySound(sndReinforce,hog)
   462 end
   513 end
   463 
   514 
   464 
   515 
   465 --this will take that hogs settings for the weapons and add them
   516 --this will take that hogs settings for the weapons and add them
   466 function setweapons()
   517 function SetContinentWeapons()
   467 
   518 
   468 	cleanweps(CurrentHedgehog)
   519 	CleanWeapons(CurrentHedgehog)
   469 	load_weaponset(CurrentHedgehog,continent[GetHogTeamName(CurrentHedgehog)])
   520 	LoadWeaponset(CurrentHedgehog,GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)])
   470 	
   521 
   471 	visualstuff=AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog)-5, vgtDust,0, false)
   522 	visualstuff=AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog)-5, vgtDust,0, false)
   472 	v1, v2, v3, v4, v5, v6, v7, v8, v9, v10 = GetVisualGearValues(visualstuff)
   523 	v1, v2, v3, v4, v5, v6, v7, v8, v9, v10 = GetVisualGearValues(visualstuff)
   473 	SetVisualGearValues(visualstuff, v1, v2, v3, v4, v5, v6, v7, 2, v9, GetClanColor(GetHogClan(CurrentHedgehog)))
   524 	SetVisualGearValues(visualstuff, v1, v2, v3, v4, v5, v6, v7, 2, v9, GetClanColor(GetHogClan(CurrentHedgehog)))
   474 	
   525 
   475 	show_continent_info(continent[GetHogTeamName(CurrentHedgehog)],0,false)
   526 	ShowContinentInfo(GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)],3000,false)
   476 end
       
   477 
       
   478 --show health tag (will mostly be used when a hog is damaged)
       
   479 function show_damage_tag(hog,damage)
       
   480 	healthtag=AddVisualGear(GetX(hog), GetY(hog), vgtHealthTag, damage, false)
       
   481 	v1, v2, v3, v4, v5, v6, v7, v8, v9, v10 = GetVisualGearValues(healthtag)
       
   482 	SetVisualGearValues(healthtag, v1, v2, v3, v4, v5, v6, v7, v8, v9, GetClanColor(GetHogClan(hog)))
       
   483 end
       
   484 
       
   485 --will use int_sqrt
       
   486 function fire_gear(hedgehog,geartype,vx,vy,timer)
       
   487 	local hypo=norm(vx,vy)
       
   488 	return AddGear(div((GetGearRadius(hedgehog)*2*vx),hypo)+GetX(hedgehog), div((GetGearRadius(hedgehog)*2*vy),hypo)+GetY(hedgehog), geartype, 0, vx, vy, timer)
       
   489 end
   527 end
   490 
   528 
   491 --==========================run throw all hog/gear weapons ==========================
   529 --==========================run throw all hog/gear weapons ==========================
   492 --will check if the mine is nicely placed 
   530 --will check if the mine is nicely placed
   493 function weapon_aust_check(hog)
   531 function AustraliaSpecialCheckHogs(hog)
   494 	if(GetGearType(hog) == gtHedgehog)
   532 	if(GetGearType(hog) == gtHedgehog)
   495 	then
   533 	then
   496 		if(gearIsInCircle(hog,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 50, false)==true and hog ~= CurrentHedgehog)
   534 		if(gearIsInCircle(hog,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 40, false)==true and hog ~= CurrentHedgehog)
   497 		then
   535 		then
   498 			temp_val=1
   536 			GLOBAL_TEMP_VALUE=1
   499 		end
   537 		end
   500 	end
   538 	end
   501 end
   539 end
   502 
   540 
   503 --african special on sedunction
   541 --african special on sedunction
   504 function weapon_duststorm(hog)
   542 function AfricaSpecialSeduction(hog)
   505 	if(GetGearType(hog) == gtHedgehog)
   543 	if(GetGearType(hog) == gtHedgehog)
   506 	then
   544 	then
   507 		local dmg=15
   545 		local dmg=div(15*GLOBAL_EXTRA_DAMAGE_IS_ON,100)
   508 		if(gearIsInCircle(hog,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 250, false)==true and GetHogClan(hog) ~= GetHogClan(CurrentHedgehog))
   546 		if(gearIsInCircle(hog,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 250, false)==true and GetHogClan(hog) ~= GetHogClan(CurrentHedgehog))
   509 		then
   547 		then
   510 			if(GetHealth(hog) > dmg)
   548 			if(GetHealth(hog) > dmg)
   511 			then
   549 			then
   512 				temp_val=temp_val+div(dmg*VampOn,100)
   550 				GLOBAL_TEMP_VALUE=GLOBAL_TEMP_VALUE+div(dmg*GLOBAL_VAMPIRIC_IS_ON,100)
   513 				SetHealth(hog, GetHealth(hog)-dmg)
   551 				SetHealth(hog, GetHealth(hog)-dmg)
   514 			else
   552 			else
   515 				temp_val=temp_val+div(GetHealth(hog)*VampOn,100)
   553 				GLOBAL_TEMP_VALUE=GLOBAL_TEMP_VALUE+div(GetHealth(hog)*GLOBAL_VAMPIRIC_IS_ON,100)
   516 				SetHealth(hog, 0)
   554 				SetHealth(hog, 0)
   517 			end
   555 			end
   518 			show_damage_tag(hog,dmg)
   556 			ShowDamageTag(hog,dmg)
   519 		end
   557 		end
   520 	end
   558 	end
   521 end
   559 end
   522 
   560 
   523 --kerguelen special on structure 
   561 --kerguelen special on structure
   524 function weapon_scream_pen(hog)
   562 function KerguelenSpecialRed(hog)
   525 	if(GetGearType(hog) == gtHedgehog)
   563 	if(GetGearType(hog) == gtHedgehog)
   526 	then
   564 	then
   527 		if(gearIsInCircle(hog,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 120, false)==true and GetHogClan(hog) ~= GetHogClan(CurrentHedgehog))
   565 		if(gearIsInCircle(hog,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 120, false)==true and GetHogClan(hog) ~= GetHogClan(CurrentHedgehog))
   528 		then
   566 		then
   529 			local dmg=15+GetHealth(CurrentHedgehog)*0.15
   567 			local dmg=div((15+div(GetHealth(CurrentHedgehog)*10,100))*GLOBAL_EXTRA_DAMAGE_IS_ON,100)
   530 		
   568 
   531 			if(GetHealth(hog)>dmg)
   569 			if(GetHealth(hog)>dmg)
   532 			then
   570 			then
   533 				temp_val=temp_val+div(dmg*2,3)+div(dmg*VampOn*2,100*3)
   571 				GLOBAL_TEMP_VALUE=GLOBAL_TEMP_VALUE+div(dmg*2,3)+div(dmg*GLOBAL_VAMPIRIC_IS_ON*2,100*3)
   534 				SetHealth(hog, GetHealth(hog)-dmg)
   572 				SetHealth(hog, GetHealth(hog)-dmg)
   535 			else
   573 			else
   536 				temp_val=temp_val+(GetHealth(hog)*0.75)+(GetHealth(CurrentHedgehog)*0.1)+div((GetHealth(hog)+(GetHealth(CurrentHedgehog)*0.15))*VampOn,100)
   574 				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)
   537 				SetHealth(hog, 0)
   575 				SetHealth(hog, 0)
   538 			end
   576 			end
   539 			show_damage_tag(hog,dmg)
   577 			ShowDamageTag(hog,dmg)
   540 			AddVisualGear(GetX(hog), GetY(hog), vgtExplosion, 0, false)
   578 			AddVisualGear(GetX(hog), GetY(hog), vgtExplosion, 0, false)
   541 			AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtSmokeWhite, 0, false)
   579 			AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtSmokeWhite, 0, false)
   542 		end
   580 		end
   543 	end
   581 	end
   544 end
   582 end
   545 
   583 
       
   584 --will count the hogs, used to get one random hog.
       
   585 function KerguelenSpecialYellowCountHogs(hog)
       
   586 	if(GetGearType(hog) == gtHedgehog)
       
   587 	then
       
   588 		if(GetHogClan(hog) ~= GetHogClan(CurrentHedgehog) and gearIsInCircle(hog,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 420, false))
       
   589 		then
       
   590 			GLOBAL_TEMP_VALUE=GLOBAL_TEMP_VALUE+1
       
   591 		end
       
   592 	end
       
   593 end
   546 --kerguelen special swap hog
   594 --kerguelen special swap hog
   547 function weapon_swap_kerg(hog)
   595 function KerguelenSpecialYellowSwap(hog)
   548 	if(GetGearType(hog) == gtHedgehog)
   596 	if(GetGearType(hog) == gtHedgehog)
   549 	then
   597 	then
   550 		if(kergulenSpecial ~= -1 and GetHogClan(hog) ~= GetHogClan(CurrentHedgehog) and gearIsInCircle(hog,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 450, false))
   598 		if(GLOBAL_KERGUELEN_SPECIAL ~= -1 and GetHogClan(hog) ~= GetHogClan(CurrentHedgehog) and gearIsInCircle(hog,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 420, false))
   551 		then
   599 		then
   552 			local thisX=GetX(CurrentHedgehog)
   600 			if(GLOBAL_TEMP_VALUE==0)
   553 			local thisY=GetY(CurrentHedgehog)
   601 			then
   554 			SetGearPosition(CurrentHedgehog, GetX(hog), GetY(hog))
   602 				local thisX=GetX(CurrentHedgehog)
   555 			SetGearPosition(hog, thisX, thisY)
   603 				local thisY=GetY(CurrentHedgehog)
   556 			kergulenSpecial=-1
   604 				SetGearPosition(CurrentHedgehog, GetX(hog), GetY(hog))
       
   605 				SetGearPosition(hog, thisX, thisY)
       
   606 				GLOBAL_KERGUELEN_SPECIAL=-1
       
   607 			else
       
   608 				GLOBAL_TEMP_VALUE=GLOBAL_TEMP_VALUE-1
       
   609 			end
   557 		end
   610 		end
   558 	end
   611 	end
   559 end
   612 end
   560 
   613 
   561 --kerguelen special will apply sabotage
   614 --kerguelen special will apply sabotage
   562 function weapon_sabotage(hog)
   615 function KerguelenSpecialGreen(hog)
   563 	if(GetGearType(hog) == gtHedgehog)
   616 	if(GetGearType(hog) == gtHedgehog)
   564 	then
   617 	then
   565 		if(CurrentHedgehog~=hog and gearIsInCircle(hog,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 80, false))
   618 		if(CurrentHedgehog~=hog and gearIsInCircle(hog,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 80, false))
   566 		then
   619 		then
   567 			temp_val=1
   620 			GLOBAL_TEMP_VALUE=1
   568 			disable_moving[hog]=true
   621 			GLOBAL_SABOTAGE_HOGS[hog]=1
   569 			AddGear(GetX(hog), GetY(hog), gtCluster, 0, 0, 0, 1)
   622 			AddGear(GetX(hog), GetY(hog), gtCluster, 0, 0, 0, 1)
   570 			PlaySound(sndNooo,hog)
   623 			PlaySound(sndNooo,hog)
   571 		end
   624 		end
   572 	end
   625 	end
   573 end
   626 end
   574 
   627 
       
   628 --first part on kerguelen special (lonely cries)
       
   629 function KerguelenSpecialBlueCheck(hog)
       
   630 	if(GetGearType(hog) == gtHedgehog and hog ~= CurrentHedgehog and gearIsInCircle(hog,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 550, false))
       
   631 	then
       
   632 		GLOBAL_KERGUELEN_SPECIAL=-1
       
   633 	end
       
   634 end
       
   635 
       
   636 --second part on kerguelen special (lonely cries)
       
   637 function KerguelenSpecialBlueActivate(hog)
       
   638 	if(GetGearType(hog) == gtHedgehog)
       
   639 	then
       
   640 		local dmg=div(6*GLOBAL_EXTRA_DAMAGE_IS_ON,100)
       
   641 		if(GetHogClan(hog) ~= GetHogClan(CurrentHedgehog))
       
   642 		then
       
   643 			if(GetHealth(hog) > dmg)
       
   644 			then
       
   645 				GLOBAL_TEMP_VALUE=GLOBAL_TEMP_VALUE+div(dmg*GLOBAL_VAMPIRIC_IS_ON,100)
       
   646 				SetHealth(hog, GetHealth(hog)-dmg)
       
   647 			else
       
   648 				GLOBAL_TEMP_VALUE=GLOBAL_TEMP_VALUE+div(GetHealth(hog)*GLOBAL_VAMPIRIC_IS_ON,100)
       
   649 				SetHealth(hog, 0)
       
   650 			end
       
   651 			ShowDamageTag(hog,dmg)
       
   652 
       
   653 			AddVisualGear(GetX(hog), GetY(hog)-30, vgtEvilTrace, 0, false)
       
   654 		end
       
   655 	end
       
   656 end
       
   657 
       
   658 --australia
       
   659 function AustraliaSpecialEggHit(hog)
       
   660 	if(GetGearType(hog) == gtHedgehog)
       
   661 	then
       
   662 		if(gearIsInCircle(hog,GetX(GLOBAL_TEMP_VALUE), GetY(GLOBAL_TEMP_VALUE), 18, false))
       
   663 		then
       
   664 			GLOBAL_SABOTAGE_HOGS[hog]=1
       
   665 			PlaySound(sndNooo,hog)
       
   666 			SetEffect(hog, hePoisoned, false)
       
   667 		end
       
   668 	end
       
   669 end
       
   670 
   575 --south american special (used fire gear)
   671 --south american special (used fire gear)
   576 function weapon_anno_south(hog)
   672 function SouthAmericaSpecialCheeseExplosion(hog)
   577 	local power_radius_outer=230
   673 	if(GetGearType(hog) == gtHedgehog or GetGearType(hog) == gtMine or GetGearType(hog) == gtExplosives)
   578 	local power_radius_inner=45
   674 	then
   579 	local power_sa=500000
   675 		local power_radius_outer=230
   580 	local hypo=0
   676 		local power_radius_inner=45
   581 	if(gearIsInCircle(hog,GetX(temp_val), GetY(temp_val), power_radius_outer, false) and gearIsInCircle(hog,GetX(temp_val), GetY(temp_val), power_radius_inner, false)==false)
   677 		local power_sa=500000
   582 	then
   678 		local hypo=0
   583 		if(hog == CurrentHedgehog)
   679 		if(gearIsInCircle(hog,GetX(GLOBAL_TEMP_VALUE), GetY(GLOBAL_TEMP_VALUE), power_radius_outer, false) and gearIsInCircle(hog,GetX(GLOBAL_TEMP_VALUE), GetY(GLOBAL_TEMP_VALUE), power_radius_inner, false)==false)
   584 		then
   680 		then
   585 			SetState(CurrentHedgehog, gstMoving)
   681 			if(hog == CurrentHedgehog)
   586 		end
   682 			then
   587 		SetGearPosition(hog, GetX(hog),GetY(hog)-3)
   683 				SetState(CurrentHedgehog, gstMoving)
   588 		hypo=norm(math.abs(GetX(hog)-GetX(temp_val)),math.abs(GetY(hog)-GetY(temp_val)))
   684 			end
   589 		SetGearVelocity(hog, div((power_radius_outer-hypo)*power_sa*positive(GetX(hog)-GetX(temp_val)),power_radius_outer), div((power_radius_outer-hypo)*power_sa*positive(GetY(hog)-GetY(temp_val)),power_radius_outer))
   685 			SetGearPosition(hog, GetX(hog),GetY(hog)-3)
   590 	end
   686 			hypo=Norm(math.abs(GetX(hog)-GetX(GLOBAL_TEMP_VALUE)),math.abs(GetY(hog)-GetY(GLOBAL_TEMP_VALUE)))
   591 end
   687 			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))
   592 
   688 		end
   593 --first part on kerguelen special (lonely cries)
   689 	end
   594 function weapon_cries_a(hog)
   690 end
   595 	if(GetGearType(hog) == gtHedgehog and hog ~= CurrentHedgehog and gearIsInCircle(hog,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 500, false))
   691 
   596 	then
   692 --north american special on sniper
   597 		kergulenSpecial=-1
   693 function NorthAmericaSpecialSniper(hog)
   598 	end
       
   599 end
       
   600 
       
   601 --second part on kerguelen special (lonely cries)
       
   602 function weapon_cries_b(hog)
       
   603 	if(GetGearType(hog) == gtHedgehog)
   694 	if(GetGearType(hog) == gtHedgehog)
   604 	then
   695 	then
   605 		local dmg=7
   696 		if(gearIsInCircle(GLOBAL_TEMP_VALUE,GetX(hog), GetY(hog), 20, false))
   606 		if(GetHogClan(hog) ~= GetHogClan(CurrentHedgehog))
       
   607 		then
       
   608 			if(GetHealth(hog) > dmg)
       
   609 			then
       
   610 				temp_val=temp_val+div(dmg*VampOn,100)
       
   611 				SetHealth(hog, GetHealth(hog)-dmg)
       
   612 			else
       
   613 				temp_val=temp_val+div(GetHealth(hog)*VampOn,100)
       
   614 				SetHealth(hog, 0)
       
   615 			end
       
   616 			show_damage_tag(hog,dmg)
       
   617 			AddVisualGear(GetX(hog), GetY(hog)-30, vgtEvilTrace, 0, false)
       
   618 		end
       
   619 	end
       
   620 end
       
   621 
       
   622 --north american special on sniper
       
   623 function weapon_lipstick(hog)
       
   624 	if(GetGearType(hog) == gtHedgehog)
       
   625 	then
       
   626 		if(gearIsInCircle(temp_val,GetX(hog), GetY(hog), 20, false))
       
   627 		then
   697 		then
   628 			SetEffect(hog, hePoisoned, 1)
   698 			SetEffect(hog, hePoisoned, 1)
   629 			PlaySound(sndBump)
   699 			PlaySound(sndBump)
   630 		end
   700 		end
   631 	end
   701 	end
   632 end
   702 end
   633 
   703 
   634 --european special on molotov (used fire gear)
   704 --european special on molotov (used fire gear)
   635 function weapon_health(hog)
   705 function EuropeSpecialMolotovHit(hog)
   636 	if(GetGearType(hog) == gtHedgehog)
   706 	if(GetGearType(hog) == gtHedgehog)
   637 	then
   707 	then
   638 		if(gearIsInCircle(temp_val,GetX(hog), GetY(hog), 100, false))
   708 		if(gearIsInCircle(GLOBAL_TEMP_VALUE,GetX(hog), GetY(hog), 100, false))
   639 		then
   709 		then
   640 			SetHealth(hog, GetHealth(hog)+25+(div(25*VampOn,100)))
   710 			SetHealth(hog, GetHealth(hog)+25+(div(25*GLOBAL_VAMPIRIC_IS_ON,100)))
   641 			SetEffect(hog, hePoisoned, false)
   711 			SetEffect(hog, hePoisoned, false)
       
   712 			GLOBAL_SABOTAGE_HOGS[hog]=0
   642 		end
   713 		end
   643 	end
   714 	end
   644 end
   715 end
   645 
   716 
   646 --for sundaland
   717 --for sundaland
   647 function find_other_hog_in_team(hog)
   718 function SundalandFindOtherHogInTeam(hog)
   648 	if(GetGearType(hog) == gtHedgehog)
   719 	if(GetGearType(hog) == gtHedgehog)
   649 	then
   720 	then
   650 		if(GetHogTeamName(turnhog)==GetHogTeamName(hog))
   721 		if(GetHogTeamName(GLOBAL_SUNDALAND_END_HOG)==GetHogTeamName(hog))
   651 		then
   722 		then
   652 			turnhog=hog
   723 			GLOBAL_SUNDALAND_END_HOG=hog
   653 		end
   724 		end
   654 	end
   725 	end
   655 end
   726 end
   656 --============================================================================
   727 --============================================================================
       
   728 
       
   729 --for custom made continent, follows the same standards as the globalism one. You can make your continent with <Name>~<Information>~<Weapons>. Take the weapons generated from globalism, if you want a GUI :P
       
   730 --weapons=<ammo><types>, ammo = ascii[116(1 ammo) to 125(inf ammo)] types = ascii[36(Grenade), 37(Clusterbomb) to 90(knife)] see https://code.google.com/p/hedgewars/wiki/AmmoTypes
       
   731 --ex "Own continent~this continent rocks!~tZ}$" will get 1 knife and inf grenades
       
   732 function onParameters()
       
   733 
       
   734 	if(ScriptParam~=nil)
       
   735 	then
       
   736 		local continentinfo={}
       
   737 		local numb=0
       
   738 		local wepcodes=0
       
   739 		local where=0
       
   740 
       
   741 		local x=0
       
   742 		local i=1
       
   743 
       
   744 		--default icon
       
   745 		continentinfo[4]=amLowGravity
       
   746 
       
   747 		for c in ScriptParam:gmatch"."
       
   748 		do
       
   749 			if(where==0)
       
   750 			then
       
   751 				if(string.byte(c)==126)
       
   752 				then
       
   753 					continentinfo[1]=string.sub(ScriptParam,0,numb)
       
   754 					wepcodes=numb
       
   755 					where=1
       
   756 				end
       
   757 			elseif(where==1)
       
   758 			then
       
   759 				if(string.byte(c)==126)
       
   760 				then
       
   761 					continentinfo[2]=string.sub(ScriptParam,wepcodes+2,numb)
       
   762 					continentinfo[5]={}
       
   763 					wepcodes=numb
       
   764 					where=2
       
   765 				end
       
   766 			elseif(where==2)
       
   767 			then
       
   768 				x=string.byte(c)-35
       
   769 				if(x>90)
       
   770 				then
       
   771 					break
       
   772 				elseif(x>80)
       
   773 				then
       
   774 					if(x-80<10)
       
   775 					then
       
   776 						i=x-80
       
   777 					else
       
   778 						i=100
       
   779 					end
       
   780 				else
       
   781 					table.insert(continentinfo[5],{x,i})
       
   782 				end
       
   783 			end
       
   784 			numb=numb+1
       
   785 		end
       
   786 
       
   787 		if(continentinfo[5]~=nil and continentinfo[5][1]~=nil)
       
   788 		then
       
   789 			continentinfo[3]="- "..continentinfo[1]..loc(" was extracted from the scheme|- This continent will be able to use the specials from the other continents!")
       
   790 
       
   791 			table.insert(GLOBAL_CONTINENT_INFORMATION, continentinfo)
       
   792 		end
       
   793 	end
       
   794 end
   657 
   795 
   658 --set each weapons settings
   796 --set each weapons settings
   659 function onAmmoStoreInit()
   797 function onAmmoStoreInit()
   660 
   798 
   661 	SetAmmo(amSkip, 9, 0, 0, 0)
   799 	SetAmmo(amSkip, 9, 0, 0, 0)
   662 	
   800 
   663 	for v,w in pairs(weapons_dmg) 
   801 	for v,w in pairs(GLOBAL_WEAPONS_DAMAGE)
   664 	do
   802 	do
   665 		SetAmmo(w[1], w[2], w[3], w[4], w[5])
   803 		SetAmmo(w[1], w[2], w[3], w[4], w[5])
   666 	end
   804 	end
   667 	
   805 
   668 	for v,w in pairs(weapons_supp) 
   806 	for v,w in pairs(GLOBAL_WEAPONS_SUPPORT)
   669 	do
   807 	do
   670 		SetAmmo(w[1], w[2], w[3], w[4], w[5])
   808 		SetAmmo(w[1], w[2], w[3], w[4], w[5])
   671 	end
   809 	end
   672 end
   810 end
   673 
   811 
       
   812 --on game start
   674 function onGameStart()
   813 function onGameStart()
   675 	--trackTeams()
   814 	ShowMission(loc("Continental supplies"),loc("Let a continent provide your weapons!"),
   676 
   815 	GLOBAL_GENERAL_INFORMATION, -amLowGravity, 0)
   677 	ShowMission(loc("Continental supplies"),loc("Let a Continent provide your weapons!"),
       
   678 	generalinfo, -amLowGravity, 0)
       
   679 end
   816 end
   680 
   817 
   681 --what happen when a turn starts
   818 --what happen when a turn starts
   682 function onNewTurn()
   819 function onNewTurn()
   683 	
   820 
   684 	--will refresh the info on each tab weapon
   821 	--will refresh the info on each tab weapon
   685 	australianSpecial=true
   822 	GLOBAL_AUSTRALIAN_SPECIAL=0
   686 	austmine=nil
   823 	GLOBAL_AFRICAN_SPECIAL_SEDUCTION=0
   687 	africanSpecial=0
   824 	GLOBAL_SOUTH_AMERICAN_SPECIAL=false
   688 	samericanSpecial=false
   825 	GLOBAL_AFRICAN_SPECIAL_STICKY=0
   689 	africaspecial2=0
   826 	GLOBAL_KERGUELEN_SPECIAL=1
   690 	kergulenSpecial=1
   827 	GLOBAL_NORTH_AMERICAN_SPECIAL_SNIPER=1
   691 	namericanSpecial=1
   828 	GLOBAL_NORTH_AMERICAN_SPECIAL_SHOTGUN=false
   692 	asianflame=0
   829 	GLOBAL_NORTH_AMERICAN_SPECIAL_SNIPER_IS_ON=false
   693 	shotgun_s=false
   830 	GLOBAL_EUROPE_SPECIAL=0
   694 	sniper_s_in_use=false
   831 	GLOBAL_VAMPIRIC_IS_ON=0
   695 	europe_s=0
   832 	GLOBAL_EXTRA_DAMAGE_IS_ON=100
   696 	VampOn=0
   833 
   697 	
   834 	GLOBAL_TEMP_VALUE=0
   698 	temp_val=0
   835 
   699 	
   836 	GLOBAL_SUNDALAND_END_HOG=CurrentHedgehog
   700 	turnhog=CurrentHedgehog
   837 
   701 	
       
   702 	--for sabotage
       
   703 	if(disable_moving[CurrentHedgehog]==true)
       
   704 	then
       
   705 		disallowattack=-100
       
   706 		disableRand=GetRandom(3)+5
       
   707 	end
       
   708 	
       
   709 	--when all hogs are "placed"
   838 	--when all hogs are "placed"
   710 	if(GetCurAmmoType()~=amTeleport)
   839 	if(GetCurAmmoType()~=amTeleport)
   711 	then
   840 	then
   712 		--will run once when the game really starts (after placing hogs and so on
   841 		--will run once when the game really starts (after placing hogs and so on
   713 		if(teams_ok[GetHogTeamName(CurrentHedgehog)] == nil)
   842 		if(GLOBAL_INIT_TEAMS[GetHogTeamName(CurrentHedgehog)] == nil)
   714 		then
   843 		then
   715 			AddCaption("["..loc("Select continent!").."]")
   844 			AddCaption("["..loc("Select continent!").."]")
   716 			load_continent_selection(CurrentHedgehog)
   845 			InitWeaponsMenu(CurrentHedgehog)
   717 			continent[GetHogTeamName(CurrentHedgehog)]=0
   846 			GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]=0
   718 			swapweps=true
   847 			GLOBAL_SELECT_CONTINENT_CHECK=true
   719 			teams_ok[GetHogTeamName(CurrentHedgehog)] = 2
   848 			GLOBAL_INIT_TEAMS[GetHogTeamName(CurrentHedgehog)] = 2
   720 			
   849 
   721 			if(disable_moving[CurrentHedgehog]==true)
   850 			if(GLOBAL_SABOTAGE_HOGS[CurrentHedgehog]~=nil and GLOBAL_SABOTAGE_HOGS[CurrentHedgehog]==1)
   722 			then
   851 			then
   723 				disallowattack=-1000
   852 				GLOBAL_SABOTAGE_COUNTER=-750
   724 			end
   853 			end
   725 		else
   854 		else
   726 			--if its not the initialization turn
   855 			--if its not the initialization turn
   727 			swapweps=false
   856 			GLOBAL_SELECT_CONTINENT_CHECK=false
   728 			if(continent[GetHogTeamName(CurrentHedgehog)]==0)
   857 			if(GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]==0)
   729 			then
   858 			then
   730 				continent[GetHogTeamName(CurrentHedgehog)]=GetRandom(table.maxn(weaponsets))+1
   859 				GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]=GetRandom(table.maxn(GLOBAL_CONTINENT_INFORMATION))+1
   731 				setweapons()
   860 				SetContinentWeapons()
   732 			end
   861 			end
   733 			show_continent_info(continent[GetHogTeamName(CurrentHedgehog)],-1,true)
   862 			ShowContinentInfo(GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)],-1,true)
   734 			
   863 
   735 			--give zeelandia-teams new weapons so they can plan for the next turn
   864 			--give zeelandia-teams new weapons so they can plan for the next turn
   736 			runOnGears(get_random_weapon)
   865 			runOnGears(ZealandiaGetWeapons)
   737 			
   866 
   738 			--some specials for some continents (temp_val is from get random weapons)
   867 			--some specials for some continents (GLOBAL_TEMP_VALUE is from get random weapons)
   739 			if(continent[GetHogTeamName(CurrentHedgehog)]==9)
   868 			if(GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]==9)
   740 			then
   869 			then
   741 				setTeamValue(GetHogTeamName(CurrentHedgehog), "rand-done-turn", nil)
   870 				setTeamValue(GetHogTeamName(CurrentHedgehog), "rand-done-turn", nil)
   742 			elseif(continent[GetHogTeamName(CurrentHedgehog)]==7)
   871 			elseif(GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]==7)
   743 			then
   872 			then
   744 				if(getTeamValue(GetHogTeamName(CurrentHedgehog), "Antarctica2-turntick")==nil)
   873 				if(getTeamValue(GetHogTeamName(CurrentHedgehog), "Antarctica2-turntick")==nil)
   745 				then
   874 				then
   746 					setTeamValue(GetHogTeamName(CurrentHedgehog), "Antarctica2-turntick", 1)
   875 					setTeamValue(GetHogTeamName(CurrentHedgehog), "Antarctica2-turntick", 1)
   747 				end
   876 				end
   748 				
   877 
   749 				if(getTeamValue(GetHogTeamName(CurrentHedgehog), "Antarctica2-turntick")>=4)
   878 				if(getTeamValue(GetHogTeamName(CurrentHedgehog), "Antarctica2-turntick")>=4)
   750 				then
   879 				then
   751 					AddAmmo(CurrentHedgehog,amPortalGun)
   880 					AddAmmo(CurrentHedgehog,amPortalGun)
   752 					AddAmmo(CurrentHedgehog,amPortalGun)
   881 					AddAmmo(CurrentHedgehog,amPortalGun)
   753 					AddAmmo(CurrentHedgehog,amSineGun)
   882 					AddAmmo(CurrentHedgehog,amSineGun)
   755 					AddAmmo(CurrentHedgehog,amGirder)
   884 					AddAmmo(CurrentHedgehog,amGirder)
   756 					AddAmmo(CurrentHedgehog,amSnowball)
   885 					AddAmmo(CurrentHedgehog,amSnowball)
   757 					setTeamValue(GetHogTeamName(CurrentHedgehog), "Antarctica2-turntick", 0)
   886 					setTeamValue(GetHogTeamName(CurrentHedgehog), "Antarctica2-turntick", 0)
   758 				end
   887 				end
   759 				setTeamValue(GetHogTeamName(CurrentHedgehog), "Antarctica2-turntick", getTeamValue(GetHogTeamName(CurrentHedgehog), "Antarctica2-turntick")+1)
   888 				setTeamValue(GetHogTeamName(CurrentHedgehog), "Antarctica2-turntick", getTeamValue(GetHogTeamName(CurrentHedgehog), "Antarctica2-turntick")+1)
   760 				
   889 
   761 			elseif(continent[GetHogTeamName(CurrentHedgehog)]==5)
   890 			elseif(GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]==5)
   762 			then
   891 			then
   763 				if(getTeamValue(GetHogTeamName(CurrentHedgehog), "Asia-turntick")==nil)
   892 				if(getTeamValue(GetHogTeamName(CurrentHedgehog), "Asia-turntick")==nil)
   764 				then
   893 				then
   765 					setTeamValue(GetHogTeamName(CurrentHedgehog), "Asia-turntick", 1)
   894 					setTeamValue(GetHogTeamName(CurrentHedgehog), "Asia-turntick", 1)
   766 				end
   895 				end
   767 				
   896 
   768 				if(getTeamValue(GetHogTeamName(CurrentHedgehog), "Asia-turntick")>=2)
   897 				if(getTeamValue(GetHogTeamName(CurrentHedgehog), "Asia-turntick")>=2)
   769 				then
   898 				then
   770 					AddAmmo(CurrentHedgehog,amParachute)
   899 					AddAmmo(CurrentHedgehog,amParachute)
   771 					setTeamValue(GetHogTeamName(CurrentHedgehog), "Asia-turntick", 0)
   900 					setTeamValue(GetHogTeamName(CurrentHedgehog), "Asia-turntick", 0)
   772 				end
   901 				end
   773 				setTeamValue(GetHogTeamName(CurrentHedgehog), "Asia-turntick", getTeamValue(GetHogTeamName(CurrentHedgehog), "Asia-turntick")+1)
   902 				setTeamValue(GetHogTeamName(CurrentHedgehog), "Asia-turntick", getTeamValue(GetHogTeamName(CurrentHedgehog), "Asia-turntick")+1)
   774 			elseif(continent[GetHogTeamName(CurrentHedgehog)]==1)
   903 			elseif(GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]==1)
   775 			then
   904 			then
   776 				if(getTeamValue(GetHogTeamName(CurrentHedgehog), "NA-turntick")==nil)
   905 				AddAmmo(CurrentHedgehog,amSwitch,GetAmmoCount(CurrentHedgehog, amSwitch)+1)
   777 				then
   906 
   778 					setTeamValue(GetHogTeamName(CurrentHedgehog), "NA-turntick", 1)
   907 				ParseCommand("setweap " .. string.char(amSwitch))
   779 				end
   908 				GLOBAL_TEMP_VALUE=87
   780 				
       
   781 				if(getTeamValue(GetHogTeamName(CurrentHedgehog), "NA-turntick")>=5)
       
   782 				then
       
   783 					validate_weapon(CurrentHedgehog,amAirAttack,1)
       
   784 					setTeamValue(GetHogTeamName(CurrentHedgehog), "NA-turntick", 0)
       
   785 				end
       
   786 				setTeamValue(GetHogTeamName(CurrentHedgehog), "NA-turntick", getTeamValue(GetHogTeamName(CurrentHedgehog), "NA-turntick")+1)
       
   787 			end
   909 			end
   788 		end
   910 		end
   789 	end
   911 	end
   790 end
   912 end
   791 
   913 
   792 --what happens when you press "tab" (common button)
   914 --what happens when you press "tab" (common button)
   793 function onSwitch()
   915 function onSwitch()
   794 	
   916 
   795 	--place mine (australia)
   917 	if(GLOBAL_SWITCH_HOG_IS_ON==false)
   796 	if(GetCurAmmoType() == amBaseballBat and australianSpecial==true)
   918 	then
   797 	then
   919 		--place mine (australia)
   798 		temp_val=0
   920 		if(GetCurAmmoType() == amBaseballBat)
   799 		runOnGears(weapon_aust_check)
   921 		then
   800 		
   922 			if(GLOBAL_AUSTRALIAN_SPECIAL==0)
   801 		if(temp_val==0)
   923 			then
   802 		then
   924 				GLOBAL_AUSTRALIAN_SPECIAL = 1
   803 			austmine=AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog)+5, gtMine, 0, 0, 0, 0)
   925 				AddCaption(GLOBAL_WEAPON_TEXTS[5])
   804 			SetHealth(austmine, 100)
   926 			elseif(GLOBAL_AUSTRALIAN_SPECIAL==1)
   805 			SetTimer(austmine, 1000)
   927 			then
   806 			australianSpecial=false
   928 				GLOBAL_AUSTRALIAN_SPECIAL = 2
   807 			swapweps=false
   929 				AddCaption(GLOBAL_WEAPON_TEXTS[2])
   808 		else
   930 			else
   809 			PlaySound(sndDenied)
   931 				GLOBAL_AUSTRALIAN_SPECIAL = 0
   810 		end
   932 				AddCaption(loc("NORMAL"))
   811 
   933 			end
   812 	--Asian special
   934 
   813 	elseif(inpara==1)
   935 		--Asian special
   814 	then
   936 		elseif(GLOBAL_PARACHUTE_IS_ON==1)
   815 		asiabomb=AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog)+3, gtSnowball, 0, 0, 0, 0)
   937 		then
   816 		SetGearMessage(asiabomb, 1)
   938 			asiabomb=AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog)+3, gtSnowball, 0, 0, 0, 0)
   817 
   939 			SetGearMessage(asiabomb, 1)
   818 		inpara=2
   940 
   819 		swapweps=false
   941 			GLOBAL_PARACHUTE_IS_ON=2
   820 
   942 			GLOBAL_SELECT_CONTINENT_CHECK=false
   821 	--africa
   943 
   822 	elseif(GetCurAmmoType() == amSeduction)
   944 		--africa
   823 	then
   945 		elseif(GetCurAmmoType() == amSeduction)
   824 		if(africanSpecial==0)
   946 		then
   825 		then
   947 			if(GLOBAL_AFRICAN_SPECIAL_SEDUCTION==0)
   826 			africanSpecial = 1
   948 			then
   827 			AddCaption(weapontexts[4])
   949 				GLOBAL_AFRICAN_SPECIAL_SEDUCTION = 1
   828 		else
   950 				AddCaption(GLOBAL_WEAPON_TEXTS[4])
   829 			africanSpecial = 0
   951 			else
   830 			AddCaption(loc("NORMAL"))
   952 				GLOBAL_AFRICAN_SPECIAL_SEDUCTION = 0
   831 		end
   953 				AddCaption(loc("NORMAL"))
   832 
   954 			end
   833 	--south america
   955 
   834 	elseif(GetCurAmmoType() == amGasBomb)
   956 		--south america
   835 	then
   957 		elseif(GetCurAmmoType() == amGasBomb)
   836 		if(samericanSpecial==false)
   958 		then
   837 		then
   959 			if(GLOBAL_SOUTH_AMERICAN_SPECIAL==false)
   838 			samericanSpecial = true
   960 			then
   839 			AddCaption(weapontexts[3])
   961 				GLOBAL_SOUTH_AMERICAN_SPECIAL = true
   840 		else
   962 				AddCaption(GLOBAL_WEAPON_TEXTS[3])
   841 			samericanSpecial = false
   963 			else
   842 			AddCaption(loc("NORMAL"))
   964 				GLOBAL_SOUTH_AMERICAN_SPECIAL = false
   843 		end
   965 				AddCaption(loc("NORMAL"))
   844 
   966 			end
   845 	--africa
   967 
   846 	elseif(GetCurAmmoType() == amSMine)
   968 		--africa
   847 	then
   969 		elseif(GetCurAmmoType() == amSMine)
   848 		if(africaspecial2==0)
   970 		then
   849 		then
   971 			if(GLOBAL_AFRICAN_SPECIAL_STICKY==0)
   850 			africaspecial2 = 1
   972 			then
   851 			AddCaption(weapontexts[11])
   973 				GLOBAL_AFRICAN_SPECIAL_STICKY = 1
   852 		elseif(africaspecial2 == 1)
   974 				AddCaption(GLOBAL_WEAPON_TEXTS[11])
   853 		then
   975 			elseif(GLOBAL_AFRICAN_SPECIAL_STICKY == 1)
   854 			africaspecial2 = 2
   976 			then
   855 			AddCaption(weapontexts[12])
   977 				GLOBAL_AFRICAN_SPECIAL_STICKY = 2
   856 		elseif(africaspecial2 == 2)
   978 				AddCaption(GLOBAL_WEAPON_TEXTS[12])
   857 		then
   979 			elseif(GLOBAL_AFRICAN_SPECIAL_STICKY == 2)
   858 			africaspecial2 = 0
   980 			then
   859 			AddCaption(loc("NORMAL"))
   981 				GLOBAL_AFRICAN_SPECIAL_STICKY = 0
   860 		end
   982 				AddCaption(loc("NORMAL"))
   861 
   983 			end
   862 	--north america (sniper)
   984 
   863 	elseif(GetCurAmmoType() == amSniperRifle and sniper_s_in_use==false)
   985 		--north america (sniper)
   864 	then
   986 		elseif(GetCurAmmoType() == amSniperRifle and GLOBAL_NORTH_AMERICAN_SPECIAL_SNIPER_IS_ON==false)
   865 		if(namericanSpecial==2)
   987 		then
   866 		then
   988 			if(GLOBAL_NORTH_AMERICAN_SPECIAL_SNIPER==2)
   867 			namericanSpecial = 1
   989 			then
   868 			AddCaption(loc("NORMAL"))
   990 				GLOBAL_NORTH_AMERICAN_SPECIAL_SNIPER = 1
   869 		elseif(namericanSpecial==1)
   991 				AddCaption(loc("NORMAL"))
   870 		then
   992 			elseif(GLOBAL_NORTH_AMERICAN_SPECIAL_SNIPER==1)
   871 			namericanSpecial = 2
   993 			then
   872 			AddCaption("#"..weapontexts[1])
   994 				GLOBAL_NORTH_AMERICAN_SPECIAL_SNIPER = 2
   873 		end
   995 				AddCaption(GLOBAL_WEAPON_TEXTS[1])
   874 
   996 			end
   875 	--north america (shotgun)
   997 
   876 	elseif(GetCurAmmoType() == amShotgun and shotgun_s~=nil)
   998 		--north america (shotgun)
   877 	then
   999 		elseif(GetCurAmmoType() == amShotgun and GLOBAL_NORTH_AMERICAN_SPECIAL_SHOTGUN~=nil)
   878 		if(shotgun_s==false)
  1000 		then
   879 		then
  1001 			if(GLOBAL_NORTH_AMERICAN_SPECIAL_SHOTGUN==false)
   880 			shotgun_s = true
  1002 			then
   881 			AddCaption(weapontexts[13])
  1003 				GLOBAL_NORTH_AMERICAN_SPECIAL_SHOTGUN = true
   882 		else
  1004 				AddCaption(GLOBAL_WEAPON_TEXTS[13])
   883 			shotgun_s = false
  1005 			else
   884 			AddCaption(loc("NORMAL"))
  1006 				GLOBAL_NORTH_AMERICAN_SPECIAL_SHOTGUN = false
   885 		end
  1007 				AddCaption(loc("NORMAL"))
   886 
  1008 			end
   887 	--europe
  1009 
   888 	elseif(GetCurAmmoType() == amMolotov)
  1010 		--europe
   889 	then
  1011 		elseif(GetCurAmmoType() == amMolotov)
   890 		if(europe_s==0)
  1012 		then
   891 		then
  1013 			if(GLOBAL_EUROPE_SPECIAL==0)
   892 			europe_s = 1
  1014 			then
   893 			AddCaption(weapontexts[14])
  1015 				GLOBAL_EUROPE_SPECIAL = 1
   894 		else
  1016 				AddCaption(GLOBAL_WEAPON_TEXTS[14])
   895 			europe_s = 0
  1017 			else
   896 			AddCaption(loc("NORMAL"))
  1018 				GLOBAL_EUROPE_SPECIAL = 0
   897 		end
  1019 				AddCaption(loc("NORMAL"))
   898 
  1020 			end
       
  1021 
       
  1022 		--kerguelen
       
  1023 		elseif(GetCurAmmoType() == amHammer)
       
  1024 		then
       
  1025 			if(GLOBAL_KERGUELEN_SPECIAL==6)
       
  1026 			then
       
  1027 				GLOBAL_KERGUELEN_SPECIAL = 1
       
  1028 				AddCaption("Normal")
       
  1029 			elseif(GLOBAL_KERGUELEN_SPECIAL==1)
       
  1030 			then
       
  1031 				GLOBAL_KERGUELEN_SPECIAL = 2
       
  1032 				AddCaption("#"..GLOBAL_WEAPON_TEXTS[7])
       
  1033 			elseif(GLOBAL_KERGUELEN_SPECIAL==2 and TotalRounds>=1)
       
  1034 			then
       
  1035 				GLOBAL_KERGUELEN_SPECIAL = 3
       
  1036 				AddCaption("##"..GLOBAL_WEAPON_TEXTS[8])
       
  1037 			elseif(GLOBAL_KERGUELEN_SPECIAL==3 or (GLOBAL_KERGUELEN_SPECIAL==2 and TotalRounds<1))
       
  1038 			then
       
  1039 				GLOBAL_KERGUELEN_SPECIAL = 5
       
  1040 				AddCaption("###"..GLOBAL_WEAPON_TEXTS[10])
       
  1041 			elseif(GLOBAL_KERGUELEN_SPECIAL==5)
       
  1042 			then
       
  1043 				GLOBAL_KERGUELEN_SPECIAL = 6
       
  1044 				AddCaption("####"..GLOBAL_WEAPON_TEXTS[15])
       
  1045 			end
       
  1046 		--for selecting weaponset, this is mostly for old players.
       
  1047 		elseif(GetHogLevel(CurrentHedgehog)==0 and GLOBAL_SELECT_CONTINENT_CHECK==true and (GetCurAmmoType() == amSkip or GetCurAmmoType() == amNothing))
       
  1048 		then
       
  1049 			GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]=GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]+1
       
  1050 
       
  1051 			if(GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]> table.maxn(GLOBAL_CONTINENT_INFORMATION))
       
  1052 			then
       
  1053 				GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]=1
       
  1054 			end
       
  1055 			SetContinentWeapons()
       
  1056 		end
       
  1057 	--if switching out from sabotage.
       
  1058 	elseif(GLOBAL_SABOTAGE_HOGS[CurrentHedgehog]~=nil and GLOBAL_SABOTAGE_HOGS[CurrentHedgehog]==2)
       
  1059 	then
       
  1060 		GLOBAL_SABOTAGE_HOGS[CurrentHedgehog]=1
       
  1061 	end
       
  1062 end
       
  1063 
       
  1064 function onUp()
   899 	--swap forward in the weaponmenu (1.0 style)
  1065 	--swap forward in the weaponmenu (1.0 style)
   900 	elseif(swapweps==true and (GetCurAmmoType() == amSkip or GetCurAmmoType() == amNothing))
  1066 	if(GetHogLevel(CurrentHedgehog)==0 and GLOBAL_SELECT_CONTINENT_CHECK==true and (GetCurAmmoType() == amSkip or GetCurAmmoType() == amNothing))
   901 	then
  1067 	then
   902 		continent[GetHogTeamName(CurrentHedgehog)]=continent[GetHogTeamName(CurrentHedgehog)]+1
  1068 		GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]=GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]+1
   903 		
  1069 
   904 		if(continent[GetHogTeamName(CurrentHedgehog)]> table.maxn(weaponsets))
  1070 		if(GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]> table.maxn(GLOBAL_CONTINENT_INFORMATION))
   905 		then
  1071 		then
   906 			continent[GetHogTeamName(CurrentHedgehog)]=1
  1072 			GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]=1
   907 		end
  1073 		end
   908 		setweapons()
  1074 		SetContinentWeapons()
   909 
  1075 	end
   910 	--kerguelen
  1076 end
   911 	elseif(GetCurAmmoType() == amHammer)
  1077 
   912 	then
  1078 function onDown()
   913 		if(kergulenSpecial==6)
       
   914 		then
       
   915 			kergulenSpecial = 1
       
   916 			AddCaption("Normal")
       
   917 		elseif(kergulenSpecial==1)
       
   918 		then
       
   919 			kergulenSpecial = 2
       
   920 			AddCaption("#"..weapontexts[7])
       
   921 		elseif(kergulenSpecial==2 and TotalRounds>=1)
       
   922 		then
       
   923 			kergulenSpecial = 3
       
   924 			AddCaption("##"..weapontexts[8])
       
   925 		elseif(kergulenSpecial==3 or (kergulenSpecial==2 and TotalRounds<1))
       
   926 		then
       
   927 			kergulenSpecial = 5
       
   928 			AddCaption("###"..weapontexts[10])
       
   929 		elseif(kergulenSpecial==5)
       
   930 		then
       
   931 			kergulenSpecial = 6
       
   932 			AddCaption("####"..weapontexts[15])
       
   933 		end
       
   934 	end
       
   935 end
       
   936 
       
   937 function onPrecise()
       
   938 	--swap backwards in the weaponmenu (1.0 style)
  1079 	--swap backwards in the weaponmenu (1.0 style)
   939 	if(swapweps==true and (GetCurAmmoType() == amSkip or GetCurAmmoType() == amNothing))
  1080 	if(GetHogLevel(CurrentHedgehog)==0 and GLOBAL_SELECT_CONTINENT_CHECK==true and (GetCurAmmoType() == amSkip or GetCurAmmoType() == amNothing))
   940 	then
  1081 	then
   941 		continent[GetHogTeamName(CurrentHedgehog)]=continent[GetHogTeamName(CurrentHedgehog)]-1
  1082 		GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]=GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]-1
   942 		
  1083 
   943 		if(continent[GetHogTeamName(CurrentHedgehog)]<=0)
  1084 		if(GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]<=0)
   944 		then
  1085 		then
   945 			continent[GetHogTeamName(CurrentHedgehog)]=table.maxn(weaponsets)
  1086 			GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]=table.maxn(GLOBAL_CONTINENT_INFORMATION)
   946 		end
  1087 		end
   947 		setweapons()
  1088 		SetContinentWeapons()
   948 	end
  1089 	end
   949 end
  1090 end
   950 
  1091 
   951 function onGameTick20()
  1092 function onGameTick20()
   952 	--if you picked a weaponset from the weaponmenu (icon)
  1093 	--if you picked a weaponset from the weaponmenu (icon)
   953 	if(continent[GetHogTeamName(CurrentHedgehog)]==0)
  1094 	if(GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]==0)
   954 	then
  1095 	then
   955 		if(GetCurAmmoType()==amSwitch)
  1096 		if(GetCurAmmoType()==amSwitch)
   956 		then
  1097 		then
   957 			continent[GetHogTeamName(CurrentHedgehog)]=GetRandom(table.maxn(weaponsets))+1
  1098 			GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]=GetRandom(table.maxn(GLOBAL_CONTINENT_INFORMATION))+1
   958 			setweapons()
  1099 			SetContinentWeapons()
   959 			PlaySound(sndMineTick)
  1100 			PlaySound(sndMineTick)
   960 		else
  1101 		else
   961 			for v,w in pairs(weaponsets) 
  1102 			for v,w in pairs(GLOBAL_CONTINENT_INFORMATION)
   962 			do
  1103 			do
   963 				if(GetCurAmmoType()==weaponsets[v][4])
  1104 				if(GetCurAmmoType()==GLOBAL_CONTINENT_INFORMATION[v][4])
   964 				then
  1105 				then
   965 					continent[GetHogTeamName(CurrentHedgehog)]=v
  1106 					GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]=v
   966 					setweapons()
  1107 					SetContinentWeapons()
   967 					PlaySound(weaponsetssounds[v][1])
  1108 					PlaySound(GLOBAL_CONTINENT_SOUNDS[v][1])
   968 					PlaySound(weaponsetssounds[v][2],CurrentHedgehog)
  1109 					PlaySound(GLOBAL_CONTINENT_SOUNDS[v][2],CurrentHedgehog)
   969 				end
  1110 				end
   970 			end
  1111 			end
   971 		end
  1112 		end
   972 	end
  1113 	end
   973 	
  1114 
   974 	--show the kerguelen ring
  1115 	--show the kerguelen ring
   975 	if(kergulenSpecial > 1 and GetCurAmmoType() == amHammer)
  1116 	if(GLOBAL_KERGUELEN_SPECIAL > 1 and GetCurAmmoType() == amHammer)
   976 	then
  1117 	then
   977 		if(visualcircle==nil)
  1118 		if(GLOBAL_VISUAL_CIRCLE==nil)
   978 		then
  1119 		then
   979 			visualcircle=AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtCircle, 0, true)
  1120 			GLOBAL_VISUAL_CIRCLE=AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtCircle, 0, true)
   980 		end
  1121 		end
   981 		
  1122 
   982 		if(kergulenSpecial == 2) --walrus scream
  1123 		if(GLOBAL_KERGUELEN_SPECIAL == 2) --walrus scream
   983 		then
  1124 		then
   984 			SetVisualGearValues(visualcircle, GetX(CurrentHedgehog), GetY(CurrentHedgehog),20, 200, 0, 0, 100, 120, 4, 0xff0000ee)
  1125 			SetVisualGearValues(GLOBAL_VISUAL_CIRCLE, GetX(CurrentHedgehog), GetY(CurrentHedgehog),20, 200, 0, 0, 100, 120, 4, 0xff0000ee)
   985 		elseif(kergulenSpecial == 3) --swap hog
  1126 		elseif(GLOBAL_KERGUELEN_SPECIAL == 3) --swap hog
   986 		then
  1127 		then
   987 			SetVisualGearValues(visualcircle, GetX(CurrentHedgehog), GetY(CurrentHedgehog),20, 200, 0, 0, 100, 450, 3, 0xffff00ee)
  1128 			SetVisualGearValues(GLOBAL_VISUAL_CIRCLE, GetX(CurrentHedgehog), GetY(CurrentHedgehog),20, 200, 0, 0, 100, 420, 3, 0xffff00ee)
   988 		elseif(kergulenSpecial == 5) --cries
  1129 		elseif(GLOBAL_KERGUELEN_SPECIAL == 5) --cries
   989 		then
  1130 		then
   990 			SetVisualGearValues(visualcircle, GetX(CurrentHedgehog), GetY(CurrentHedgehog),20, 200, 0, 0, 100, 500, 1, 0x0000ffee)
  1131 			SetVisualGearValues(GLOBAL_VISUAL_CIRCLE, GetX(CurrentHedgehog), GetY(CurrentHedgehog),20, 200, 0, 0, 100, 550, 1, 0x0000ffee)
   991 		elseif(kergulenSpecial == 6) --sabotage
  1132 		elseif(GLOBAL_KERGUELEN_SPECIAL == 6) --sabotage
   992 		then
  1133 		then
   993 			SetVisualGearValues(visualcircle, GetX(CurrentHedgehog), GetY(CurrentHedgehog),20, 200, 0, 0, 100, 80, 10, 0x00ff00ee)
  1134 			SetVisualGearValues(GLOBAL_VISUAL_CIRCLE, GetX(CurrentHedgehog), GetY(CurrentHedgehog),20, 200, 0, 0, 100, 80, 10, 0x00ff00ee)
   994 		end
  1135 		end
   995 	
  1136 
   996 	elseif(visualcircle~=nil)
  1137 	elseif(GLOBAL_VISUAL_CIRCLE~=nil)
   997 	then
  1138 	then
   998 		DeleteVisualGear(visualcircle)
  1139 		DeleteVisualGear(GLOBAL_VISUAL_CIRCLE)
   999 		visualcircle=nil
  1140 		GLOBAL_VISUAL_CIRCLE=nil
  1000 	end
  1141 	end
  1001 	
  1142 
  1002 	--sabotage
  1143 	--sabotage
  1003 	if(disable_moving[CurrentHedgehog]==true)
  1144 	if(GLOBAL_SABOTAGE_HOGS[CurrentHedgehog]~=nil and GLOBAL_SABOTAGE_HOGS[CurrentHedgehog]>=1)
  1004 	then
  1145 	then
  1005 	
  1146 		--for sabotage
  1006 		if(TurnTimeLeft<=150)
  1147 		if(GLOBAL_SABOTAGE_HOGS[CurrentHedgehog]==1)
  1007 		then
  1148 		then
  1008 			disable_moving[CurrentHedgehog]=false
  1149 			local RND=GetRandom(2)
  1009 			SetInputMask(0xFFFFFFFF)
  1150 			if(RND==0)
  1010 		elseif(disallowattack >= (25*disableRand)+5)
  1151 			then
  1011 		then
  1152 				AddCaption(loc("You are sabotaged, RUN!"))
  1012 			temp_val=0
  1153 			else
  1013 			
  1154 				AddCaption(loc("WARNING: Sabotage detected!"))
  1014 			AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog)-10, gtCluster, 0, 0, -160000, 40)
  1155 			end
  1015 			
  1156 			PlaySound(sndHellish)
  1016 			disallowattack=0
  1157 			GLOBAL_SABOTAGE_COUNTER=-50
  1017 		elseif(disallowattack % 20 == 0 and disallowattack>0)
  1158 			--update the constant at the top also to something in between
  1018 		then
  1159 			GLOBAL_SABOTAGE_FREQUENCY=(25*(RND))+70
  1019 			SetInputMask(band(0xFFFFFFFF, bnot(gmLJump + gmHJump)))
  1160 			GLOBAL_SABOTAGE_GRAVITY_SWITCH=true
  1020 			AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtSmokeWhite, 0, false)
  1161 
  1021 			disallowattack=disallowattack+1
  1162 			GLOBAL_SABOTAGE_HOGS[CurrentHedgehog]=2
       
  1163 		end
       
  1164 
       
  1165 		if(GLOBAL_SABOTAGE_COUNTER >0)
       
  1166 		then
       
  1167 			if(GLOBAL_SABOTAGE_GRAVITY_SWITCH)
       
  1168 			then
       
  1169 				SetGravityFromScale(div(100*GLOBAL_SABOTAGE_COUNTER,GLOBAL_SABOTAGE_FREQUENCY))
       
  1170 			else
       
  1171 				SetGravityFromScale(100-div(100*GLOBAL_SABOTAGE_COUNTER,GLOBAL_SABOTAGE_FREQUENCY))
       
  1172 			end
       
  1173 
       
  1174 			if(GLOBAL_SABOTAGE_COUNTER % 20 == 0)
       
  1175 			then
       
  1176 				AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtSmokeWhite, 0, false)
       
  1177 			end
       
  1178 		end
       
  1179 
       
  1180 		if(TurnTimeLeft<(GetAwayTime*10) or band(GetState(CurrentHedgehog),gstAttacked)==1)
       
  1181 		then
       
  1182 			GLOBAL_SABOTAGE_HOGS[CurrentHedgehog]=0
       
  1183 			SetGravity(100)
       
  1184 		elseif(GLOBAL_SABOTAGE_COUNTER >= GLOBAL_SABOTAGE_FREQUENCY)
       
  1185 		then
       
  1186 			if(GLOBAL_SABOTAGE_GRAVITY_SWITCH==true)
       
  1187 			then
       
  1188 				GLOBAL_SABOTAGE_GRAVITY_SWITCH=false
       
  1189 			else
       
  1190 				--AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog)-10, gtCluster, 0, 0, -160000, 30)
       
  1191 				GLOBAL_SABOTAGE_GRAVITY_SWITCH=true
       
  1192 			end
       
  1193 
       
  1194 			if(GetHealth(CurrentHedgehog)<=2)
       
  1195 			then
       
  1196 				SetHealth(CurrentHedgehog, 0)
       
  1197 				GLOBAL_SABOTAGE_HOGS[CurrentHedgehog]=0
       
  1198 				SetGravity(100)
       
  1199 			else
       
  1200 				SetHealth(CurrentHedgehog, GetHealth(CurrentHedgehog)-2)
       
  1201 			end
       
  1202 			ShowDamageTag(CurrentHedgehog,2)
       
  1203 
       
  1204 			GLOBAL_SABOTAGE_COUNTER=0
  1022 		else
  1205 		else
  1023 			SetInputMask(0xFFFFFFFF)
  1206 			GLOBAL_SABOTAGE_COUNTER=GLOBAL_SABOTAGE_COUNTER+1
  1024 			disallowattack=disallowattack+1
  1207 		end
  1025 		end
  1208 	end
  1026 	
  1209 
  1027 	end
  1210 	if(GetCurAmmoType() == amSwitch and GLOBAL_TEMP_VALUE==87)
  1028 	
  1211 	then
       
  1212 		SetGearMessage(CurrentHedgehog,gmAttack)
       
  1213 		GLOBAL_TEMP_VALUE=0
       
  1214 	end
       
  1215 
       
  1216 	if(GLOBAL_SHOW_SMALL_INFO>0)
       
  1217 	then
       
  1218 		if(GLOBAL_SHOW_SMALL_INFO==1)
       
  1219 		then
       
  1220 			ShowContinentInfo(GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)],-1,true)
       
  1221 		end
       
  1222 
       
  1223 		GLOBAL_SHOW_SMALL_INFO=GLOBAL_SHOW_SMALL_INFO-1
       
  1224 	end
       
  1225 end
       
  1226 
       
  1227 --some ppl complained :P
       
  1228 function onSlot(slot)
       
  1229 	if(GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]==0)
       
  1230 	then
       
  1231 		ParseCommand("setweap " .. string.char(amSkip))
       
  1232 	end
  1029 end
  1233 end
  1030 
  1234 
  1031 --if you used hogswitch or any similar weapon, dont enable any weaponchange
  1235 --if you used hogswitch or any similar weapon, dont enable any weaponchange
  1032 function onAttack()
  1236 function onAttack()
  1033 	swapweps=false
  1237 	GLOBAL_SELECT_CONTINENT_CHECK=false
  1034 	
  1238 
  1035 	--african special
  1239 	--african special
  1036 	if(africanSpecial == 1 and GetCurAmmoType() == amSeduction and band(GetState(CurrentHedgehog),gstAttacked)==0)
  1240 	if(GLOBAL_AFRICAN_SPECIAL_SEDUCTION == 1 and GetCurAmmoType() == amSeduction and band(GetState(CurrentHedgehog),gstAttacked)==0)
  1037 	then
  1241 	then
  1038 		--SetState(CurrentHedgehog, gstAttacked)
       
  1039 		EndTurn()
  1242 		EndTurn()
  1040 		
  1243 
  1041 		temp_val=0
  1244 		GLOBAL_TEMP_VALUE=0
  1042 		runOnGears(weapon_duststorm)
  1245 		runOnGears(AfricaSpecialSeduction)
  1043 		SetHealth(CurrentHedgehog, GetHealth(CurrentHedgehog)+temp_val)
  1246 		SetHealth(CurrentHedgehog, GetHealth(CurrentHedgehog)+GLOBAL_TEMP_VALUE)
  1044 
  1247 
  1045 		--visual stuff
  1248 		--visual stuff
  1046 		visual_gear_explosion(250,GetX(CurrentHedgehog), GetY(CurrentHedgehog),vgtSmoke,vgtSmokeWhite)
  1249 		VisualExplosion(250,GetX(CurrentHedgehog), GetY(CurrentHedgehog),vgtSmoke,vgtSmokeWhite)
  1047 		PlaySound(sndParachute)
  1250 		PlaySound(sndParachute)
  1048 		
  1251 
  1049 		RemoveWeapon(CurrentHedgehog,amSeduction)
  1252 		RemoveWeapon(CurrentHedgehog,amSeduction)
  1050 
  1253 
  1051 	--Kerguelen specials
  1254 	--Kerguelen specials
  1052 	elseif(GetCurAmmoType() == amHammer and kergulenSpecial > 1 and band(GetState(CurrentHedgehog),gstAttacked)==0)
  1255 	elseif(GetCurAmmoType() == amHammer and GLOBAL_KERGUELEN_SPECIAL > 1 and band(GetState(CurrentHedgehog),gstAttacked)==0)
  1053 	then
  1256 	then
  1054 		--SetState(CurrentHedgehog, gstAttacked)
       
  1055 		
       
  1056 		
       
  1057 		--scream
  1257 		--scream
  1058 		if(kergulenSpecial == 2)
  1258 		if(GLOBAL_KERGUELEN_SPECIAL == 2)
  1059 		then
  1259 		then
  1060 			temp_val=0
  1260 			GLOBAL_TEMP_VALUE=0
  1061 			runOnGears(weapon_scream_pen)
  1261 			runOnGears(KerguelenSpecialRed)
  1062 			SetHealth(CurrentHedgehog, GetHealth(CurrentHedgehog)+temp_val)
  1262 			SetHealth(CurrentHedgehog, GetHealth(CurrentHedgehog)+GLOBAL_TEMP_VALUE)
  1063 			PlaySound(sndHellish)
  1263 			PlaySound(sndHellish)
  1064 		
  1264 
  1065 		--swap
  1265 		--swap
  1066 		elseif(kergulenSpecial == 3 and TotalRounds>=1)
  1266 		elseif(GLOBAL_KERGUELEN_SPECIAL == 3 and TotalRounds>=1)
  1067 		then
  1267 		then
  1068 			runOnGears(weapon_swap_kerg)
  1268 			GLOBAL_TEMP_VALUE=0
  1069 			PlaySound(sndPiano3)
  1269 			runOnGears(KerguelenSpecialYellowCountHogs)
  1070 			
  1270 			if(GLOBAL_TEMP_VALUE>0)
       
  1271 			then
       
  1272 				GLOBAL_TEMP_VALUE=GetRandom(GLOBAL_TEMP_VALUE)
       
  1273 				runOnGears(KerguelenSpecialYellowSwap)
       
  1274 				PlaySound(sndPiano3)
       
  1275 			else
       
  1276 				PlaySound(sndPiano6)
       
  1277 			end
       
  1278 
  1071 		--cries
  1279 		--cries
  1072 		elseif(kergulenSpecial == 5)
  1280 		elseif(GLOBAL_KERGUELEN_SPECIAL == 5)
  1073 		then
  1281 		then
  1074 			runOnGears(weapon_cries_a)
  1282 			runOnGears(KerguelenSpecialBlueCheck)
  1075 			if(kergulenSpecial~=-1)
  1283 			if(GLOBAL_KERGUELEN_SPECIAL~=-1)
  1076 			then
  1284 			then
  1077 				AddGear(0, 0, gtWaterUp, 0, 0,0,0)
  1285 				AddGear(0, 0, gtWaterUp, 0, 0,0,0)
  1078 				PlaySound(sndWarp)
  1286 				PlaySound(sndWarp)
  1079 				PlaySound(sndMolotov)
  1287 				PlaySound(sndMolotov)
  1080 				
  1288 
  1081 				temp_val=0
  1289 				GLOBAL_TEMP_VALUE=0
  1082 				runOnGears(weapon_cries_b)
  1290 				runOnGears(KerguelenSpecialBlueActivate)
  1083 				SetHealth(CurrentHedgehog, GetHealth(CurrentHedgehog)+temp_val)
  1291 				SetHealth(CurrentHedgehog, GetHealth(CurrentHedgehog)+GLOBAL_TEMP_VALUE)
  1084 			else
  1292 			else
  1085 				HogSay(CurrentHedgehog, loc("Hogs in sight!"), SAY_SAY)
  1293 				HogSay(CurrentHedgehog, loc("Hogs in sight!"), SAY_SAY)
  1086 			end
  1294 			end
  1087 		
  1295 
  1088 		--sabotage
  1296 		--sabotage
  1089 		elseif(kergulenSpecial == 6)
  1297 		elseif(GLOBAL_KERGUELEN_SPECIAL == 6)
  1090 		then
  1298 		then
  1091 			temp_val=0
  1299 			GLOBAL_TEMP_VALUE=0
  1092 			runOnGears(weapon_sabotage)
  1300 			runOnGears(KerguelenSpecialGreen)
  1093 			if(temp_val==0)
  1301 			if(GLOBAL_TEMP_VALUE==0)
  1094 			then
  1302 			then
  1095 				PlaySound(sndThrowRelease)
  1303 				PlaySound(sndThrowRelease)
  1096 				AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog)-20, gtCluster, 0, 0, -1000000, 32)
  1304 				AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog)-20, gtCluster, 0, 0, -1000000, 32)
  1097 			end
  1305 			end
  1098 		end
  1306 		end
  1099 		
  1307 
  1100 		EndTurn()
  1308 		EndTurn()
  1101 		
  1309 
  1102 		DeleteVisualGear(visualcircle)
  1310 		DeleteVisualGear(GLOBAL_VISUAL_CIRCLE)
  1103 		visualcircle=nil
  1311 		GLOBAL_VISUAL_CIRCLE=nil
  1104 		kergulenSpecial=0
  1312 		GLOBAL_KERGUELEN_SPECIAL=0
  1105 		
  1313 
  1106 		RemoveWeapon(CurrentHedgehog,amHammer)
  1314 		RemoveWeapon(CurrentHedgehog,amHammer)
  1107 		
  1315 
  1108 	elseif(GetCurAmmoType() == amVampiric)
  1316 	elseif(GetCurAmmoType() == amVampiric)
  1109 	then
  1317 	then
  1110 		VampOn=75
  1318 		GLOBAL_VAMPIRIC_IS_ON=75
  1111 	end
  1319 	elseif(GetCurAmmoType() == amExtraDamage)
  1112 	--Australian special
  1320 	then
  1113 	if(GetGearType(austmine) == gtMine and austmine ~= nil)
  1321 		GLOBAL_EXTRA_DAMAGE_IS_ON=150
  1114 	then
  1322 	end
  1115 		temp_val=0
       
  1116 		runOnGears(weapon_aust_check)
       
  1117 		
       
  1118 		if(gearIsInCircle(austmine,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 30, false)==false or temp_val==1)
       
  1119 		then
       
  1120 			AddVisualGear(GetX(austmine), GetY(austmine), vgtDust, 0, false)
       
  1121 			DeleteGear(austmine)
       
  1122 			PlaySound(sndDenied)
       
  1123 		end
       
  1124 		
       
  1125 		austmine=nil
       
  1126 	end
       
  1127 	
       
  1128 	australianSpecial=false
       
  1129 end
  1323 end
  1130 
  1324 
  1131 function onGearAdd(gearUid)
  1325 function onGearAdd(gearUid)
  1132 	swapweps=false
  1326 	GLOBAL_SELECT_CONTINENT_CHECK=false
  1133 	
  1327 
  1134 	--track the gears im using
  1328 	--track the gears im using
  1135 	if(GetGearType(gearUid) == gtHedgehog or GetGearType(gearUid) == gtMine or GetGearType(gearUid) == gtExplosives) 
  1329 	if(GetGearType(gearUid) == gtHedgehog or GetGearType(gearUid) == gtMine or GetGearType(gearUid) == gtExplosives)
  1136 	then
  1330 	then
  1137 		trackGear(gearUid)
  1331 		trackGear(gearUid)
  1138 	end
  1332 	end
  1139 	
  1333 
  1140 	--remove gasclouds on gasbombspecial
  1334 	--remove gasclouds on gasbombspecial
  1141 	if(GetGearType(gearUid)==gtPoisonCloud and samericanSpecial == true)
  1335 	if(GetGearType(gearUid)==gtPoisonCloud and GLOBAL_SOUTH_AMERICAN_SPECIAL == true)
  1142 	then
  1336 	then
  1143 		DeleteGear(gearUid)
  1337 		DeleteGear(gearUid)
  1144 
  1338 	--african special
  1145 	elseif(GetGearType(gearUid)==gtSMine)
  1339 	elseif(GetGearType(gearUid)==gtSMine)
  1146 	then
  1340 	then
  1147 		vx,vy=GetGearVelocity(gearUid)
  1341 		vx,vy=GetGearVelocity(gearUid)
  1148 		if(africaspecial2 == 1)
  1342 		if(GLOBAL_AFRICAN_SPECIAL_STICKY == 1)
  1149 		then
  1343 		then
  1150 			SetState(CurrentHedgehog, gstHHDriven+gstMoving)
  1344 			SetState(CurrentHedgehog, gstHHDriven+gstMoving)
  1151 			SetGearPosition(CurrentHedgehog, GetX(CurrentHedgehog),GetY(CurrentHedgehog)-3)
  1345 			SetGearPosition(CurrentHedgehog, GetX(CurrentHedgehog),GetY(CurrentHedgehog)-3)
  1152 			SetGearVelocity(CurrentHedgehog, vx, vy)
  1346 			SetGearVelocity(CurrentHedgehog, vx, vy)
  1153 			DeleteGear(gearUid)
  1347 			DeleteGear(gearUid)
  1154 			
  1348 
  1155 		elseif(africaspecial2 == 2)
  1349 		elseif(GLOBAL_AFRICAN_SPECIAL_STICKY == 2)
  1156 		then
  1350 		then
  1157 			fire_gear(CurrentHedgehog,gtNapalmBomb, vx, vy, 0)
  1351 			FireGear(CurrentHedgehog,gtNapalmBomb, vx, vy, 0)
  1158 			DeleteGear(gearUid)
  1352 			DeleteGear(gearUid)
  1159 		end
  1353 		end
  1160 
  1354 	--north american special
  1161 	elseif(GetGearType(gearUid)==gtSniperRifleShot)
  1355 	elseif(GetGearType(gearUid)==gtSniperRifleShot)
  1162 	then
  1356 	then
  1163 		sniper_s_in_use=true
  1357 		GLOBAL_NORTH_AMERICAN_SPECIAL_SNIPER_IS_ON=true
  1164 		if(namericanSpecial~=1)
  1358 		if(GLOBAL_NORTH_AMERICAN_SPECIAL_SNIPER~=1)
  1165 		then
  1359 		then
  1166 			SetHealth(gearUid, 1)
  1360 			SetHealth(gearUid, 1)
  1167 		end
  1361 		end
  1168 
  1362 	--north american special
  1169 	elseif(GetGearType(gearUid)==gtShotgunShot)
  1363 	elseif(GetGearType(gearUid)==gtShotgunShot)
  1170 	then
  1364 	then
  1171 		if(shotgun_s==true)
  1365 		if(GLOBAL_NORTH_AMERICAN_SPECIAL_SHOTGUN==true)
  1172 		then
  1366 		then
  1173 			AddVisualGear(GetX(gearUid), GetY(gearUid), vgtFeather, 0, false)
  1367 			AddVisualGear(GetX(gearUid), GetY(gearUid), vgtFeather, 0, false)
  1174 			AddVisualGear(GetX(gearUid), GetY(gearUid), vgtFeather, 0, false)
  1368 			AddVisualGear(GetX(gearUid), GetY(gearUid), vgtFeather, 0, false)
  1175 			AddVisualGear(GetX(gearUid), GetY(gearUid), vgtFeather, 0, false)
  1369 			AddVisualGear(GetX(gearUid), GetY(gearUid), vgtFeather, 0, false)
  1176 			PlaySound(sndBirdyLay)
  1370 			PlaySound(sndBirdyLay)
  1177 		else
  1371 		else
  1178 			shotgun_s=nil
  1372 			GLOBAL_NORTH_AMERICAN_SPECIAL_SHOTGUN=nil
  1179 		end
  1373 		end
  1180 		
  1374 	--european special
  1181 	elseif(GetGearType(gearUid)==gtMolotov and europe_s==1)
  1375 	elseif(GetGearType(gearUid)==gtMolotov and GLOBAL_EUROPE_SPECIAL==1)
  1182 	then
  1376 	then
  1183 		vx,vy=GetGearVelocity(gearUid)
  1377 		vx,vy=GetGearVelocity(gearUid)
  1184 		e_health=fire_gear(CurrentHedgehog,gtCluster, vx, vy, 1)
  1378 		e_health=FireGear(CurrentHedgehog,gtCluster, vx, vy, 1)
  1185 		SetGearMessage(e_health, 2)
  1379 		SetGearMessage(e_health, 2)
  1186 		DeleteGear(gearUid)
  1380 		DeleteGear(gearUid)
  1187 		
  1381 	--australian specials
       
  1382 	elseif(GetGearType(gearUid)==gtShover and GLOBAL_AUSTRALIAN_SPECIAL~=0)
       
  1383 	then
       
  1384 		GLOBAL_TEMP_VALUE=0
       
  1385 		runOnGears(AustraliaSpecialCheckHogs)
       
  1386 
       
  1387 		if(GLOBAL_TEMP_VALUE==0)
       
  1388 		then
       
  1389 			vx,vy=GetGearVelocity(gearUid)
       
  1390 
       
  1391 			if(GLOBAL_AUSTRALIAN_SPECIAL==1)
       
  1392 			then
       
  1393 				local austmine=FireGear(CurrentHedgehog,gtMine, vx, vy, 0)
       
  1394 				SetHealth(austmine, 100)
       
  1395 				SetTimer(austmine, 1000)
       
  1396 			else
       
  1397 				local austmine=FireGear(CurrentHedgehog,gtEgg, vx, vy, 10)
       
  1398 				--SetHealth(austmine, 2000)
       
  1399 				SetTimer(austmine, 6000)
       
  1400 				SetGearMessage(austmine, 3)
       
  1401 			end
       
  1402 		else
       
  1403 			PlaySound(sndDenied)
       
  1404 		end
  1188 	elseif(GetGearType(gearUid)==gtParachute)
  1405 	elseif(GetGearType(gearUid)==gtParachute)
  1189 	then
  1406 	then
  1190 		inpara=1
  1407 		GLOBAL_PARACHUTE_IS_ON=1
       
  1408 	elseif(GetGearType(gearUid)==gtSwitcher)
       
  1409 	then
       
  1410 		GLOBAL_SWITCH_HOG_IS_ON=true
  1191 	end
  1411 	end
  1192 end
  1412 end
  1193 
  1413 
  1194 function onGearDelete(gearUid)
  1414 function onGearDelete(gearUid)
  1195 
  1415 
  1196 	if(GetGearType(gearUid) == gtHedgehog or GetGearType(gearUid) == gtMine or GetGearType(gearUid) == gtExplosives) 
  1416 	if(GetGearType(gearUid) == gtHedgehog or GetGearType(gearUid) == gtMine or GetGearType(gearUid) == gtExplosives)
  1197 	then
  1417 	then
  1198 		trackDeletion(gearUid)
  1418 		trackDeletion(gearUid)
  1199 		
  1419 
  1200 		--sundaland special
  1420 		--sundaland special
  1201 		if(GetGearType(gearUid) == gtHedgehog and continent[GetHogTeamName(turnhog)]==10)
  1421 		if(GetGearType(gearUid) == gtHedgehog and GLOBAL_TEAM_CONTINENT[GetHogTeamName(GLOBAL_SUNDALAND_END_HOG)]==10)
  1202 		then
  1422 		then
  1203 			if(turnhog==CurrentHedgehog)
  1423 			if(GLOBAL_SUNDALAND_END_HOG==CurrentHedgehog)
  1204 			then
  1424 			then
  1205 				runOnGears(find_other_hog_in_team)
  1425 				runOnGears(SundalandFindOtherHogInTeam)
  1206 			end
  1426 			end
  1207 		
  1427 
  1208 			get_random_weapon_on_death(turnhog)
  1428 			SundalandGetWeapons(GLOBAL_SUNDALAND_END_HOG)
  1209 		end
  1429 		end
  1210 	end
  1430 	end
  1211 	
  1431 
  1212 	--north american lipstick
  1432 	--north american lipstick
  1213 	if(GetGearType(gearUid)==gtSniperRifleShot )
  1433 	if(GetGearType(gearUid)==gtSniperRifleShot )
  1214 	then
  1434 	then
  1215 		sniper_s_in_use=false
  1435 		GLOBAL_NORTH_AMERICAN_SPECIAL_SNIPER_IS_ON=false
  1216 		if(namericanSpecial==2)
  1436 		if(GLOBAL_NORTH_AMERICAN_SPECIAL_SNIPER==2)
  1217 		then
  1437 		then
  1218 			temp_val=gearUid
  1438 			GLOBAL_TEMP_VALUE=gearUid
  1219 			runOnGears(weapon_lipstick)
  1439 			runOnGears(NorthAmericaSpecialSniper)
  1220 		end
  1440 		end
  1221 	--north american eagle eye
  1441 	--north american eagle eye
  1222 	elseif(GetGearType(gearUid)==gtShotgunShot and shotgun_s==true)
  1442 	elseif(GetGearType(gearUid)==gtShotgunShot and GLOBAL_NORTH_AMERICAN_SPECIAL_SHOTGUN==true)
  1223 	then
  1443 	then
  1224 		SetState(CurrentHedgehog, gstMoving)
  1444 		EndTurn()
  1225 		SetGearPosition(CurrentHedgehog, GetX(gearUid), GetY(gearUid)+7)
  1445 		SetGearPosition(CurrentHedgehog, GetX(gearUid), GetY(gearUid)+7)
  1226 		PlaySound(sndWarp)
  1446 		PlaySound(sndWarp)
  1227 
       
  1228 	--south american special
  1447 	--south american special
  1229 	elseif(GetGearType(gearUid)==gtGasBomb and samericanSpecial == true)
  1448 	elseif(GetGearType(gearUid)==gtGasBomb and GLOBAL_SOUTH_AMERICAN_SPECIAL == true)
  1230 	then
  1449 	then
  1231 		temp_val=gearUid
  1450 		GLOBAL_TEMP_VALUE=gearUid
  1232 		runOnGears(weapon_anno_south)
  1451 		runOnGears(SouthAmericaSpecialCheeseExplosion)
  1233 		AddVisualGear(GetX(gearUid), GetY(gearUid), vgtExplosion, 0, false)
  1452 		AddVisualGear(GetX(gearUid), GetY(gearUid), vgtExplosion, 0, false)
  1234 	
  1453 
  1235 	--asian special
  1454 	--asian special
  1236 	elseif(GetGearType(gearUid)==gtSnowball and GetGearMessage(gearUid)==1)
  1455 	elseif(GetGearType(gearUid)==gtSnowball and GetGearMessage(gearUid)==1)
  1237 	then
  1456 	then
  1238 		AddGear(GetX(gearUid), GetY(gearUid), gtCluster, 0, 0, 0, 22)
  1457 		AddGear(GetX(gearUid), GetY(gearUid), gtCluster, 0, 0, 0, 22)
  1239 	
  1458 
  1240 	--europe special
  1459 	--europe special
  1241 	elseif(GetGearType(gearUid)==gtCluster and GetGearMessage(gearUid)==2)
  1460 	elseif(GetGearType(gearUid)==gtCluster and GetGearMessage(gearUid)==2)
  1242 	then
  1461 	then
  1243 		temp_val=gearUid
  1462 		GLOBAL_TEMP_VALUE=gearUid
  1244 		runOnGears(weapon_health)
  1463 		runOnGears(EuropeSpecialMolotovHit)
  1245 		visual_gear_explosion(100,GetX(gearUid), GetY(gearUid),vgtSmokeWhite,vgtSmokeWhite)
  1464 		VisualExplosion(100,GetX(gearUid), GetY(gearUid),vgtSmokeWhite,vgtSmokeWhite)
  1246 		AddVisualGear(GetX(gearUid), GetY(gearUid), vgtExplosion, 0, false)
  1465 		AddVisualGear(GetX(gearUid), GetY(gearUid), vgtExplosion, 0, false)
  1247 		PlaySound(sndGraveImpact)
  1466 		PlaySound(sndGraveImpact)
  1248 	
  1467 	--australian special
       
  1468 	elseif(GetGearType(gearUid)==gtEgg and GetGearMessage(gearUid)==3)
       
  1469 	then
       
  1470 		GLOBAL_TEMP_VALUE=gearUid
       
  1471 		runOnGears(AustraliaSpecialEggHit)
       
  1472 		GLOBAL_TEMP_VALUE=0
  1249 	--asia (using para)
  1473 	--asia (using para)
  1250 	elseif(GetGearType(gearUid)==gtParachute)
  1474 	elseif(GetGearType(gearUid)==gtParachute)
  1251 	then
  1475 	then
  1252 		inpara=false
  1476 		GLOBAL_PARACHUTE_IS_ON=false
  1253 	end
  1477 	elseif(GetGearType(gearUid)==gtSwitcher)
  1254 end
  1478 	then
  1255 --[[sources (populations & area):
  1479 		GLOBAL_SWITCH_HOG_IS_ON=false
  1256 Own calculations
  1480 	end
  1257 Some are approximations.]]
  1481 end
       
  1482 
       
  1483 --[[
       
  1484 	sources (populations & area):
       
  1485 	Own calculations from wikipedia.
       
  1486 	Some are approximations.
       
  1487 ]]