share/hedgewars/Data/Scripts/Multiplayer/Continental_supplies.lua
changeset 9805 1795c34ab8db
parent 8618 7e71dba4e7f3
child 10453 7e90d5856d56
equal deleted inserted replaced
9803:0773ec65dfc2 9805:1795c34ab8db
     1 --[[
     1 --[[
     2 Version 1.1c
     2 Made for 0.9.20
     3 
     3 
     4 Copyright (C) 2012 Vatten
     4 Copyright (C) 2012 Vatten
     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 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:
     7 
     7 
    42 	else
    42 	else
    43 		return 1
    43 		return 1
    44 	end
    44 	end
    45 end
    45 end
    46 
    46 
       
    47 function EndTurn(baseRetreatTime)
       
    48 	local retreatTimePercentage = 100
       
    49 	SetState(CurrentHedgehog,bor(GetState(CurrentHedgehog),gstAttacked))
       
    50 	TurnTimeLeft = baseRetreatTime / 100 * retreatTimePercentage
       
    51  end
       
    52 
       
    53 --for sundaland
       
    54 local turnhog=0
       
    55 
    47 local teams_ok = {}
    56 local teams_ok = {}
    48 local wepcode_teams={}
    57 local wepcode_teams={}
    49 local swapweps=false
    58 local swapweps=false
    50 
    59 
    51 --variables for seeing if you have swaped around on a weapon
    60 --variables for seeing if you have swaped around on a weapon
    52 local australianSpecial=false
    61 local australianSpecial=false
    53 local africanSpecial=0
    62 local africanSpecial=0
    54 local africaspecial2=0
    63 local africaspecial2=0
    55 local asianSpecial=false
       
    56 local samericanSpecial=false
    64 local samericanSpecial=false
    57 local namericanSpecial=1
    65 local namericanSpecial=1
    58 local sniper_s_in_use=false
    66 local sniper_s_in_use=false
    59 local kergulenSpecial=1
    67 local kergulenSpecial=1
    60 local shotgun_s=false
    68 local shotgun_s=false
    70 local temp_val=0
    78 local temp_val=0
    71 
    79 
    72 --for sabotage
    80 --for sabotage
    73 local disallowattack=0
    81 local disallowattack=0
    74 local disable_moving={}
    82 local disable_moving={}
    75 local disableoffsetai=0
    83 local disableRand=0
       
    84 --local disableoffsetai=0
    76 local onsabotageai=false
    85 local onsabotageai=false
    77 
    86 
    78 local continent = {}
    87 local continent = {}
    79 
    88 
    80 local generalinfo=loc("- Per team weapons|- 9 weaponschemes|- Unique new weapons| |Select continent first round with the Weapon Menu or by ([switch/tab]=Increase,[presice/left shift]=Decrease) on Skip|Some weapons have a second option. Find them with [switch/tab]")
    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").."]"
    81 
    90 
    82 local weapontexts = {
    91 local weapontexts = {
    83 loc("Green lipstick bullet: [Is poisonous]"),
    92 loc("Green lipstick bullet: [Poisonous, deals no damage]"),
    84 loc("PiƱata bullet: [Contains some sweet candy!]"),
    93 loc("REMOVED"),
    85 loc("Anno 1032: [The explosion will make a strong push ~ wide range, wont affect hogs close to the target]"),
    94 loc("Anno 1032: [The explosion will make a strong push ~ Wide range, wont affect hogs close to the target]"),
    86 loc("Dust storm: [Deals 15 damage to all enemies in the circle]"),
    95 loc("Dust storm: [Deals 15 damage to all enemies in the circle]"),
    87 loc("Fire a mine: [Does what it says ~ Cant be dropped close to an enemy ~ 1 sec]"),
    96 loc("Cricket time: [Drop a fireable mine! ~ Will work if fired close to your hog & far away from enemy ~ 1 sec]"),
    88 loc("Drop a bomb: [drop some heroic wind that will turn into a bomb on impact ~ once per turn]"),
    97 loc("Drop a bomb: [Drop some heroic wind that will turn into a bomb on impact]"),
    89 loc("Scream from a Walrus: [Deal 20 damage + 10% of your hogs health to all hogs around you and get half back]"),
    98 loc("Penguin roar: [Deal 15 damage + 15% of your hogs health to all hogs around you and get 2/3 back]"),
    90 loc("Disguise as a Rockhopper Penguin: [Swap place with a random enemy hog in the circle]"),
    99 loc("Disguise as a Rockhopper Penguin: [Swap place with a random enemy hog in the circle]"),
    91 loc("Flare: [fire up some bombs depending on hogs depending on hogs in the circle"),
   100 loc("REMOVED"),
    92 loc("Lonely Cries: [Rise the water if no hog is in the circle and deal 7 damage to all enemy hogs]"),
   101 loc("Lonely Cries: [Rise the water if no hog is in the circle and deal 7 damage to all enemy hogs]"),
    93 loc("Hedgehog projectile: [fire your hog like a Sticky Bomb]"),
   102 loc("Hedgehog projectile: [Fire your hog like a Sticky Bomb]"),
    94 loc("Napalm rocket: [Fire a bomb with napalm!]"),
   103 loc("Napalm rocket: [Fire a bomb with napalm!]"),
    95 loc("Eagle Eye: [Blink to the impact ~ one shot]"),
   104 loc("Eagle Eye: [Blink to the impact ~ One shot]"),
    96 loc("Medicine: [Fire some exploding medicine that will heal all hogs effected by the explosion]"),
   105 loc("Medicine: [Fire some exploding medicine that will heal all hogs effected by the explosion]"),
    97 loc("Sabotage: [Sabotage all hogs in the circle and deal ~10 dmg]")
   106 loc("Sabotage/Flare: [Sabotage all hogs in the circle and deal ~1 dmg OR Fire a cluster up into the air]")
    98 }
   107 }
    99 
   108 
   100 local weaponsets = 
   109 local weaponsets = 
   101 {
   110 {
   102 {loc("North America"),"Area: 24,709,000 km2, Population: 528,720,588",loc("Special Weapons:").."|"..loc("Shotgun")..": "..weapontexts[13].."|"..loc("Sniper Rifle")..": "..weapontexts[1].."|"..loc("Sniper Rifle")..": "..weapontexts[2],amSniperRifle,
   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,
   103 {{amShotgun,100},{amDEagle,100},{amLaserSight,4},{amSniperRifle,100},{amCake,1},{amAirAttack,2},{amSwitch,6}}},
   112 {{amShotgun,100},{amDEagle,100},{amLaserSight,4},{amSniperRifle,100},{amCake,1},{amAirAttack,2},{amSwitch,5}}},
   104 
   113 
   105 {loc("South America"),"Area: 17,840,000 km2, Population: 387,489,196 ",loc("Special Weapons:").."|"..loc("GasBomb")..": "..weapontexts[3],amGasBomb,
   114 {loc("South America"),loc("Area")..": 17,840,000 km2, "..loc("Population")..": 387,000,000",loc("Special Weapons:").."|"..loc("GasBomb")..": "..weapontexts[3],amGasBomb,
   106 {{amBirdy,6},{amHellishBomb,1},{amBee,100},{amWhip,100},{amGasBomb,100},{amFlamethrower,100},{amNapalm,1},{amExtraDamage,2}}},
   115 {{amBirdy,100},{amHellishBomb,1},{amBee,100},{amGasBomb,100},{amFlamethrower,100},{amNapalm,1},{amExtraDamage,3}}},
   107 
   116 
   108 {loc("Europe"),"Area: 10,180,000 km2, Population: 739,165,030",loc("Special Weapons:").."|"..loc("Molotov")..": "..weapontexts[14],amBazooka,
   117 {loc("Europe"),loc("Area")..": 10,180,000 km2, "..loc("Population")..": 740,000,000",loc("Special Weapons:").."|"..loc("Molotov")..": "..weapontexts[14],amBazooka,
   109 {{amBazooka,100},{amGrenade,100},{amMortar,100},{amClusterBomb,5},{amMolotov,5},{amVampiric,4},{amPiano,1},{amResurrector,2},{amJetpack,2}}},
   118 {{amBazooka,100},{amGrenade,100},{amMortar,100},{amMolotov,100},{amVampiric,3},{amPiano,1},{amResurrector,2},{amJetpack,4}}},
   110 
   119 
   111 {loc("Africa"),"Area: 30,221,532 km2, Population: 1,032,532,974",loc("Special Weapons:").."|"..loc("Seduction")..": "..weapontexts[4].."|"..loc("Sticky Mine")..": "..weapontexts[11].."|"..loc("Sticky Mine")..": "..weapontexts[12],amSMine,
   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,
   112 {{amSMine,100},{amWatermelon,1},{amDrillStrike,1},{amExtraTime,2},{amDrill,100},{amLandGun,3},{amSeduction,100}}},
   121 {{amSMine,100},{amWatermelon,1},{amDrillStrike,1},{amDrill,100},{amInvulnerable,4},{amSeduction,100},{amLandGun,2}}},
   113 
   122 
   114 {loc("Asia"),"Area: 44,579,000 km2, Population: 3,879,000,000",loc("- Will give you a parachute each turn.").."|"..loc("Special Weapons:").."|"..loc("Parachute")..": "..weapontexts[6],amRope,
   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,
   115 {{amKamikaze,4},{amRope,100},{amFirePunch,100},{amParachute,1},{amKnife,2},{amDynamite,1}}},
   124 {{amRope,100},{amFirePunch,100},{amParachute,1},{amKnife,2},{amDynamite,1}}},
   116 
   125 
   117 {loc("Australia"),"Area:  8,468,300 km2, Population: 31,260,000",loc("Special Weapons:").."|"..loc("Baseballbat")..": "..weapontexts[5],amBaseballBat,
   126 {loc("Australia"),loc("Area")..": 8,468,000 km2, "..loc("Population")..": 31,000,000",loc("Special Weapons:").."|"..loc("Baseballbat")..": "..weapontexts[5],amBaseballBat,
   118 {{amBaseballBat,100},{amMine,100},{amLowGravity,6},{amBlowTorch,100},{amRCPlane,2},{amTardis,100}}},
   127 {{amBaseballBat,100},{amMine,100},{amLowGravity,4},{amBlowTorch,100},{amRCPlane,2},{amTeleport,3}}},
   119 
   128 
   120 {loc("Antarctica"),"Area: 14,000,000 km2, Population: ~1,000",loc("- Will give you a portalgun every second turn."),amTeleport,
   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,
   121 {{amSnowball,4},{amTeleport,2},{amInvulnerable,6},{amPickHammer,100},{amSineGun,100},{amGirder,3},{amPortalGun,2}}},
   130 {{amSnowball,2},{amIceGun,2},{amPickHammer,100},{amSineGun,4},{amGirder,2},{amExtraTime,2},{amPortalGun,2}}},
   122 
   131 
   123 {loc("Kerguelen"),"Area: 1,100,000 km2, Population: ~70",loc("Special Weapons:").."|"..loc("Hammer")..": "..weapontexts[7].."|"..loc("Hammer")..": "..weapontexts[8].." ("..loc("Duration")..": 2)|"..loc("Hammer")..": "..weapontexts[9].."|"..loc("Hammer")..": "..weapontexts[10].."|"..loc("Hammer")..": "..weapontexts[15],amHammer,
   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,
   124 {{amHammer,100},{amMineStrike,2},{amBallgun,1},{amIceGun,2}}},
   133 {{amHammer,100},{amMineStrike,2},{amBallgun,1}}},
   125 
   134 
   126 {loc("Zealandia"),"Area: 3,500,000 km2, Population: 4,650,000",loc("- Will Get 1-3 random weapons"),amInvulnerable,
   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,
   127 {{amBazooka,1},{amBlowTorch,1},{amSwitch,1}}}
   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}}},
       
   137 
       
   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,
       
   139 {{amClusterBomb,3},{amTardis,4},{amWhip,100},{amKamikaze,4}}}
       
   140 
   128 }
   141 }
   129 
   142 
   130 local weaponsetssounds=
   143 local weaponsetssounds=
   131 {
   144 {
   132 {sndShotgunFire,sndCover},
   145 	{sndShotgunFire,sndCover},
   133 {sndEggBreak,sndLaugh},
   146 	{sndEggBreak,sndLaugh},
   134 {sndExplosion,sndEnemyDown},
   147 	{sndExplosion,sndEnemyDown},
   135 {sndMelonImpact,sndHello},
   148 	{sndMelonImpact,sndCoward},
   136 {sndRopeAttach,sndComeonthen},
   149 	{sndRopeAttach,sndComeonthen},
   137 {sndBaseballBat,sndNooo},
   150 	{sndBaseballBat,sndNooo},
   138 {sndSineGun,sndOops},
   151 	{sndSineGun,sndOops},
   139 {sndPiano5,sndStupid},
   152 	{sndPiano5,sndStupid},
   140 {sndSplash,sndFirstBlood}
   153 	{sndSplash,sndFirstBlood},
       
   154 	{sndWarp,sndSameTeam}
   141 }
   155 }
   142 
   156 
   143 --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)
   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)
   144 local weapons_dmg = {
   158 local weapons_dmg = {
   145 	{amKamikaze, 0, 1, 0, 1, 0},
   159 	{amKamikaze, 0, 1, 0, 1, 0},
   146 	{amSineGun, 0, 1, 0, 1, 1},
   160 	{amSineGun, 0, 1, 0, 1, 1},
   147 	{amBazooka, 0, 1, 0, 1, 0},
   161 	{amBazooka, 0, 1, 0, 1, 0},
   148 	{amMineStrike, 0, 1, 5, 1, 2},
   162 	{amMineStrike, 0, 1, 5, 1, 2},
   149 	{amGrenade, 0, 1, 0, 1, 0},
   163 	{amGrenade, 0, 1, 0, 1, 0},
   150 	{amPiano, 0, 1, 5, 1, 1},
   164 	{amPiano, 0, 1, 5, 1, 0},
   151 	{amClusterBomb, 0, 1, 0, 1, 0},
   165 	{amClusterBomb, 0, 1, 0, 1, 0},
   152 	{amBee, 0, 1, 0, 1, 0},
   166 	{amBee, 0, 1, 0, 1, 0},
   153 	{amShotgun, 0, 0, 0, 1, 1},
   167 	{amShotgun, 0, 0, 0, 1, 1},
   154 	{amMine, 0, 1, 0, 1, 0},
   168 	{amMine, 0, 1, 0, 1, 0},
   155 	{amSniperRifle, 0, 1, 0, 1, 1},
   169 	{amSniperRifle, 0, 1, 0, 1, 1},
   166 	{amSeduction, 0, 0, 0, 1, 0},
   180 	{amSeduction, 0, 0, 0, 1, 0},
   167 	{amWatermelon, 0, 1, 5, 1, 2},
   181 	{amWatermelon, 0, 1, 5, 1, 2},
   168 	{amDrill, 0, 1, 0, 1, 0},
   182 	{amDrill, 0, 1, 0, 1, 0},
   169 	{amBallgun, 0, 1, 5, 1, 2},
   183 	{amBallgun, 0, 1, 5, 1, 2},
   170 	{amMolotov, 0, 1, 0, 1, 0},
   184 	{amMolotov, 0, 1, 0, 1, 0},
   171 	{amBirdy, 0, 1, 1, 1, 1},
   185 	{amBirdy, 0, 1, 0, 1, 0},
   172 	{amBlowTorch, 0, 1, 0, 1, 0},
   186 	{amBlowTorch, 0, 1, 0, 1, 0},
   173 	{amRCPlane, 0, 1, 5, 1, 2},
   187 	{amRCPlane, 0, 1, 5, 1, 2},
   174 	{amGasBomb, 0, 0, 0, 1, 0},
   188 	{amGasBomb, 0, 0, 0, 1, 0},
   175 	{amAirAttack, 0, 1, 4, 1, 1},
   189 	{amAirAttack, 0, 1, 4, 1, 1},
   176 	{amFlamethrower, 0, 1, 0, 1, 0},
   190 	{amFlamethrower, 0, 1, 0, 1, 0},
   177 	{amSMine, 0, 1, 0, 1, 1},
   191 	{amSMine, 0, 1, 0, 1, 1},
   178 	{amHammer, 0, 1, 0, 1, 0},
   192 	{amHammer, 0, 1, 0, 1, 0},
   179 	{amDrillStrike, 0, 1, 4, 1, 2},
   193 	{amDrillStrike, 0, 1, 4, 1, 2},
   180 	{amSnowball, 0, 1, 0, 1, 0}
   194 	{amSnowball, 0, 1, 0, 1, 0}
   181 	--{amStructure, 0, 0, 0, 1, 1}
       
   182 }
   195 }
   183 local weapons_supp = {
   196 local weapons_supp = {
   184 	{amParachute, 0, 1, 0, 1, 0},
   197 	{amParachute, 0, 1, 0, 1, 0},
   185 	{amGirder, 0, 1, 0, 1, 0},
   198 	{amGirder, 0, 1, 0, 1, 0},
   186 	{amSwitch, 0, 1, 0, 1, 0},
   199 	{amSwitch, 0, 1, 0, 1, 0},
   203 
   216 
   204 --will check after borders and stuff
   217 --will check after borders and stuff
   205 function validate_weapon(hog,weapon,amount)
   218 function validate_weapon(hog,weapon,amount)
   206 	if(MapHasBorder() == false or (MapHasBorder() == true and weapon ~= amAirAttack and weapon ~= amMineStrike and weapon ~= amNapalm and weapon ~= amDrillStrike and weapon ~= amPiano))
   219 	if(MapHasBorder() == false or (MapHasBorder() == true and weapon ~= amAirAttack and weapon ~= amMineStrike and weapon ~= amNapalm and weapon ~= amDrillStrike and weapon ~= amPiano))
   207 	then
   220 	then
   208 		AddAmmo(hog, weapon,amount)
   221 		if(amount==1)
       
   222 		then
       
   223 			AddAmmo(hog, weapon)
       
   224 		else
       
   225 			AddAmmo(hog, weapon,amount)
       
   226 		end
       
   227 	end
       
   228 end
       
   229 
       
   230 function RemoveWeapon(hog,weapon)
       
   231 
       
   232 	if(GetAmmoCount(hog, weapon)<100)
       
   233 	then
       
   234 		AddAmmo(hog,weapon,GetAmmoCount(hog, weapon)-1)
   209 	end
   235 	end
   210 end
   236 end
   211 
   237 
   212 --reset all weapons for a team
   238 --reset all weapons for a team
   213 function cleanweps(hog)
   239 function cleanweps(hog)
   231 	end
   257 	end
   232 end
   258 end
   233 
   259 
   234 --list up all weapons from the icons for each continent
   260 --list up all weapons from the icons for each continent
   235 function load_continent_selection(hog)
   261 function load_continent_selection(hog)
   236 	for v,w in pairs(weaponsets) 
   262 
   237 	do
   263 	if(GetHogLevel(hog)==0)
   238 		validate_weapon(hog, weaponsets[v][4],1)
   264 	then
   239 	end
   265 		for v,w in pairs(weaponsets) 
   240 	AddAmmo(hog,amSwitch) --random continent
   266 		do
       
   267 			validate_weapon(hog, weaponsets[v][4],1)
       
   268 		end
       
   269 		AddAmmo(hog,amSwitch) --random continent
       
   270 	
       
   271 	--for the computers
       
   272 	else
       
   273 		--europe
       
   274 		validate_weapon(hog, weaponsets[3][4],1)
       
   275 		--north america
       
   276 		validate_weapon(hog, weaponsets[1][4],1)
       
   277 	end
   241 end
   278 end
   242 
   279 
   243 --shows the continent info
   280 --shows the continent info
   244 function show_continent_info(continent,time,generalinf)
   281 function show_continent_info(continent,time,generalinf)
   245 	local geninftext=""
   282 	local geninftext=""
   291 		local rand_weaponset_power = 0
   328 		local rand_weaponset_power = 0
   292 		
   329 		
   293 		local numberof_weapons_supp=table.maxn(weapons_supp)
   330 		local numberof_weapons_supp=table.maxn(weapons_supp)
   294 		local numberof_weapons_dmg=table.maxn(weapons_dmg)
   331 		local numberof_weapons_dmg=table.maxn(weapons_dmg)
   295 		
   332 		
   296 		local rand1=GetRandom(table.maxn(weapons_supp))+1
   333 		local rand1=math.abs(GetRandom(numberof_weapons_supp)+1)
   297 		local rand2=GetRandom(table.maxn(weapons_dmg))+1
   334 		local rand2=math.abs(GetRandom(numberof_weapons_dmg)+1)
   298 		
   335 		
   299 		random_weapon = GetRandom(table.maxn(weapons_dmg))+1
   336 		random_weapon = math.abs(GetRandom(table.maxn(weapons_dmg))+1)
   300 		
   337 		
   301 		while(weapons_dmg[random_weapon][4]>TotalRounds)
   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)))
   302 		do
   339 		do
   303 			if(random_weapon>=numberof_weapons_dmg)
   340 			if(random_weapon>=numberof_weapons_dmg)
   304 			then
   341 			then
   305 				random_weapon=0
   342 				random_weapon=0
   306 			end
   343 			end
   326 		end
   363 		end
   327 		--check again if  the power is enough
   364 		--check again if  the power is enough
   328 		if(rand_weaponset_power <1)
   365 		if(rand_weaponset_power <1)
   329 		then
   366 		then
   330 			random_weapon = rand2
   367 			random_weapon = rand2
   331 			while(weapons_dmg[random_weapon][4]>TotalRounds or old_rand_weap == random_weapon or weapons_dmg[random_weapon][6]>0)
   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)))
   332 			do
   369 			do
   333 				if(random_weapon>=numberof_weapons_dmg)
   370 				if(random_weapon>=numberof_weapons_dmg)
   334 				then
   371 				then
   335 					random_weapon=0
   372 					random_weapon=0
   336 				end
   373 				end
   341 			
   378 			
   342 		setTeamValue(GetHogTeamName(hog), "rand-done-turn", true)
   379 		setTeamValue(GetHogTeamName(hog), "rand-done-turn", true)
   343 	end
   380 	end
   344 end
   381 end
   345 
   382 
       
   383 --sundaland add weps
       
   384 function get_random_weapon_on_death(hog)
       
   385 	
       
   386 		local random_weapon = 0
       
   387 		local old_rand_weap = 0
       
   388 		local rand_weaponset_power = 0
       
   389 		
       
   390 		local firstTurn=0
       
   391 		
       
   392 		local numberof_weapons_supp=table.maxn(weapons_supp)
       
   393 		local numberof_weapons_dmg=table.maxn(weapons_dmg)
       
   394 		
       
   395 		local rand1=GetRandom(numberof_weapons_supp)+1
       
   396 		local rand2=GetRandom(numberof_weapons_dmg)+1
       
   397 		local rand3=GetRandom(numberof_weapons_dmg)+1
       
   398 		
       
   399 		random_weapon = GetRandom(numberof_weapons_dmg)+1
       
   400 		
       
   401 		if(TotalRounds<0)
       
   402 		then
       
   403 			firstTurn=-TotalRounds
       
   404 		end
       
   405 		
       
   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)))
       
   407 		do
       
   408 			if(random_weapon>=numberof_weapons_dmg)
       
   409 			then
       
   410 				random_weapon=0
       
   411 			end
       
   412 			random_weapon = random_weapon+1
       
   413 		end
       
   414 		validate_weapon(hog, weapons_dmg[random_weapon][1],1)
       
   415 		rand_weaponset_power=weapons_dmg[random_weapon][6]
       
   416 		old_rand_weap = random_weapon
       
   417 		
       
   418 		random_weapon = rand1
       
   419 		while(weapons_supp[random_weapon][4]>(TotalRounds+firstTurn) or rand_weaponset_power+weapons_supp[random_weapon][6]>2)
       
   420 		do
       
   421 			if(random_weapon>=numberof_weapons_supp)
       
   422 			then
       
   423 				random_weapon=0
       
   424 			end
       
   425 			random_weapon = random_weapon+1
       
   426 		end
       
   427 		validate_weapon(hog, weapons_supp[random_weapon][1],1)
       
   428 		rand_weaponset_power=rand_weaponset_power+weapons_supp[random_weapon][6]
       
   429 		
       
   430 		--check again if  the power is enough
       
   431 		if(rand_weaponset_power <2)
       
   432 		then
       
   433 			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)))
       
   435 			do
       
   436 				if(random_weapon>=numberof_weapons_dmg)
       
   437 				then
       
   438 					random_weapon=0
       
   439 				end
       
   440 				random_weapon = random_weapon+1
       
   441 			end
       
   442 			validate_weapon(hog, weapons_dmg[random_weapon][1],1)
       
   443 			rand_weaponset_power=weapons_dmg[random_weapon][6]
       
   444 		end
       
   445 		
       
   446 		if(rand_weaponset_power <1)
       
   447 		then
       
   448 			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)))
       
   450 			do
       
   451 				if(random_weapon>=numberof_weapons_dmg)
       
   452 				then
       
   453 					random_weapon=0
       
   454 				end
       
   455 				random_weapon = random_weapon+1
       
   456 			end
       
   457 			validate_weapon(hog, weapons_dmg[random_weapon][1],1)
       
   458 		end
       
   459 		
       
   460 		AddVisualGear(GetX(hog), GetY(hog)-30, vgtEvilTrace,0, false)
       
   461 		PlaySound(sndReinforce,hog)
       
   462 end
       
   463 
       
   464 
   346 --this will take that hogs settings for the weapons and add them
   465 --this will take that hogs settings for the weapons and add them
   347 function setweapons()
   466 function setweapons()
   348 
   467 
   349 	cleanweps(CurrentHedgehog)
   468 	cleanweps(CurrentHedgehog)
   350 	load_weaponset(CurrentHedgehog,continent[GetHogTeamName(CurrentHedgehog)])
   469 	load_weaponset(CurrentHedgehog,continent[GetHogTeamName(CurrentHedgehog)])
   400 		end
   519 		end
   401 	end
   520 	end
   402 end
   521 end
   403 
   522 
   404 --kerguelen special on structure 
   523 --kerguelen special on structure 
   405 function weapon_scream_walrus(hog)
   524 function weapon_scream_pen(hog)
   406 	if(GetGearType(hog) == gtHedgehog)
   525 	if(GetGearType(hog) == gtHedgehog)
   407 	then
   526 	then
   408 		if(gearIsInCircle(hog,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 120, false)==true and GetHogClan(hog) ~= GetHogClan(CurrentHedgehog))
   527 		if(gearIsInCircle(hog,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 120, false)==true and GetHogClan(hog) ~= GetHogClan(CurrentHedgehog))
   409 		then
   528 		then
   410 			if(GetHealth(hog)>(20+GetHealth(CurrentHedgehog)*0.1))
   529 			local dmg=15+GetHealth(CurrentHedgehog)*0.15
   411 			then
   530 		
   412 				temp_val=temp_val+10+(GetHealth(CurrentHedgehog)*0.05)+div((20+GetHealth(CurrentHedgehog)*0.1)*VampOn,100)
   531 			if(GetHealth(hog)>dmg)
   413 				SetHealth(hog, GetHealth(hog)-(20+GetHealth(CurrentHedgehog)*0.1))
   532 			then
       
   533 				temp_val=temp_val+div(dmg*2,3)+div(dmg*VampOn*2,100*3)
       
   534 				SetHealth(hog, GetHealth(hog)-dmg)
   414 			else
   535 			else
   415 				temp_val=temp_val+(GetHealth(hog)*0.5)+(GetHealth(CurrentHedgehog)*0.05)+div((GetHealth(hog)+(GetHealth(CurrentHedgehog)*0.1))*VampOn,100)
   536 				temp_val=temp_val+(GetHealth(hog)*0.75)+(GetHealth(CurrentHedgehog)*0.1)+div((GetHealth(hog)+(GetHealth(CurrentHedgehog)*0.15))*VampOn,100)
   416 				SetHealth(hog, 0)
   537 				SetHealth(hog, 0)
   417 			end
   538 			end
   418 			show_damage_tag(hog,(20+GetHealth(CurrentHedgehog)*0.1))
   539 			show_damage_tag(hog,dmg)
   419 			AddVisualGear(GetX(hog), GetY(hog), vgtExplosion, 0, false)
   540 			AddVisualGear(GetX(hog), GetY(hog), vgtExplosion, 0, false)
   420 			AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtSmokeWhite, 0, false)
   541 			AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtSmokeWhite, 0, false)
   421 		end
   542 		end
   422 	end
   543 	end
   423 end
   544 end
   435 			kergulenSpecial=-1
   556 			kergulenSpecial=-1
   436 		end
   557 		end
   437 	end
   558 	end
   438 end
   559 end
   439 
   560 
   440 --kerguelen special on structure
       
   441 function weapon_flare(hog)
       
   442 	if(GetGearType(hog) == gtHedgehog)
       
   443 	then
       
   444 		if(GetHogClan(hog) ~= GetHogClan(CurrentHedgehog) and gearIsInCircle(hog,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 45, false))
       
   445 		then
       
   446 			if(GetX(hog)<=GetX(CurrentHedgehog))
       
   447 			then
       
   448 				dirker=1
       
   449 			else
       
   450 				dirker=-1
       
   451 			end
       
   452 			AddVisualGear(GetX(hog), GetY(hog), vgtFire, 0, false)
       
   453 			SetGearPosition(CurrentHedgehog, GetX(CurrentHedgehog), GetY(CurrentHedgehog)-5)
       
   454 			SetGearVelocity(CurrentHedgehog, 100000*dirker, -300000)
       
   455 			AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog)-20, gtCluster, 0, -10000*dirker, -1000000, 35)
       
   456 			PlaySound(sndHellishImpact2)
       
   457 		end
       
   458 	end
       
   459 end
       
   460 
       
   461 --kerguelen special will apply sabotage
   561 --kerguelen special will apply sabotage
   462 function weapon_sabotage(hog)
   562 function weapon_sabotage(hog)
   463 	if(GetGearType(hog) == gtHedgehog)
   563 	if(GetGearType(hog) == gtHedgehog)
   464 	then
   564 	then
   465 		if(GetHogClan(hog) ~= GetHogClan(CurrentHedgehog) and gearIsInCircle(hog,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 100, false))
   565 		if(CurrentHedgehog~=hog and gearIsInCircle(hog,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 80, false))
   466 		then
   566 		then
       
   567 			temp_val=1
   467 			disable_moving[hog]=true
   568 			disable_moving[hog]=true
   468 			AddGear(GetX(hog), GetY(hog), gtCluster, 0, 0, 0, 10)
   569 			AddGear(GetX(hog), GetY(hog), gtCluster, 0, 0, 0, 1)
   469 			PlaySound(sndNooo,hog)
   570 			PlaySound(sndNooo,hog)
   470 		end
   571 		end
   471 	end
   572 	end
   472 end
   573 end
   473 
   574 
   534 function weapon_health(hog)
   635 function weapon_health(hog)
   535 	if(GetGearType(hog) == gtHedgehog)
   636 	if(GetGearType(hog) == gtHedgehog)
   536 	then
   637 	then
   537 		if(gearIsInCircle(temp_val,GetX(hog), GetY(hog), 100, false))
   638 		if(gearIsInCircle(temp_val,GetX(hog), GetY(hog), 100, false))
   538 		then
   639 		then
   539 			SetHealth(hog, GetHealth(hog)+25)
   640 			SetHealth(hog, GetHealth(hog)+25+(div(25*VampOn,100)))
   540 			SetEffect(hog, hePoisoned, false)
   641 			SetEffect(hog, hePoisoned, false)
       
   642 		end
       
   643 	end
       
   644 end
       
   645 
       
   646 --for sundaland
       
   647 function find_other_hog_in_team(hog)
       
   648 	if(GetGearType(hog) == gtHedgehog)
       
   649 	then
       
   650 		if(GetHogTeamName(turnhog)==GetHogTeamName(hog))
       
   651 		then
       
   652 			turnhog=hog
   541 		end
   653 		end
   542 	end
   654 	end
   543 end
   655 end
   544 --============================================================================
   656 --============================================================================
   545 
   657 
   560 end
   672 end
   561 
   673 
   562 function onGameStart()
   674 function onGameStart()
   563 	--trackTeams()
   675 	--trackTeams()
   564 
   676 
   565 	ShowMission(loc("Continental supplies").." 1.1c",loc("Let a Continent provide your weapons!"),
   677 	ShowMission(loc("Continental supplies"),loc("Let a Continent provide your weapons!"),
   566 	loc(generalinfo), -amLowGravity, 0)
   678 	loc(generalinfo), -amLowGravity, 0)
   567 end
   679 end
   568 
   680 
   569 --what happen when a turn starts
   681 --what happen when a turn starts
   570 function onNewTurn()
   682 function onNewTurn()
   571 	
   683 	
   572 	--will refresh the info on each tab weapon
   684 	--will refresh the info on each tab weapon
   573 	australianSpecial=true
   685 	australianSpecial=true
   574 	asianSpecial=false
       
   575 	austmine=nil
   686 	austmine=nil
   576 	africanSpecial=0
   687 	africanSpecial=0
   577 	samericanSpecial=false
   688 	samericanSpecial=false
   578 	africaspecial2=0
   689 	africaspecial2=0
   579 	kergulenSpecial=1
   690 	kergulenSpecial=1
   584 	europe_s=0
   695 	europe_s=0
   585 	VampOn=0
   696 	VampOn=0
   586 	
   697 	
   587 	temp_val=0
   698 	temp_val=0
   588 	
   699 	
       
   700 	turnhog=CurrentHedgehog
       
   701 	
   589 	--for sabotage
   702 	--for sabotage
   590 	disallowattack=0
       
   591 	if(disable_moving[CurrentHedgehog]==true)
   703 	if(disable_moving[CurrentHedgehog]==true)
   592 	then
   704 	then
   593 		disableoffsetai=GetHogLevel(CurrentHedgehog)
   705 		disallowattack=-100
       
   706 		disableRand=GetRandom(3)+5
   594 	end
   707 	end
   595 	
   708 	
   596 	--when all hogs are "placed"
   709 	--when all hogs are "placed"
   597 	if(GetCurAmmoType()~=amTeleport)
   710 	if(GetCurAmmoType()~=amTeleport)
   598 	then
   711 	then
   599 		--will run once when the game really starts (after placing hogs and so on
   712 		--will run once when the game really starts (after placing hogs and so on
   600 		if(teams_ok[GetHogTeamName(CurrentHedgehog)] == nil)
   713 		if(teams_ok[GetHogTeamName(CurrentHedgehog)] == nil)
   601 		then
   714 		then
   602 			disable_moving[CurrentHedgehog]=false
       
   603 			AddCaption("["..loc("Select continent!").."]")
   715 			AddCaption("["..loc("Select continent!").."]")
   604 			load_continent_selection(CurrentHedgehog)
   716 			load_continent_selection(CurrentHedgehog)
   605 			continent[GetHogTeamName(CurrentHedgehog)]=0
   717 			continent[GetHogTeamName(CurrentHedgehog)]=0
   606 			swapweps=true
   718 			swapweps=true
   607 			teams_ok[GetHogTeamName(CurrentHedgehog)] = 2
   719 			teams_ok[GetHogTeamName(CurrentHedgehog)] = 2
       
   720 			
       
   721 			if(disable_moving[CurrentHedgehog]==true)
       
   722 			then
       
   723 				disallowattack=-1000
       
   724 			end
   608 		else
   725 		else
   609 			--if its not the initialization turn
   726 			--if its not the initialization turn
   610 			swapweps=false
   727 			swapweps=false
   611 			if(continent[GetHogTeamName(CurrentHedgehog)]==0)
   728 			if(continent[GetHogTeamName(CurrentHedgehog)]==0)
   612 			then
   729 			then
   622 			if(continent[GetHogTeamName(CurrentHedgehog)]==9)
   739 			if(continent[GetHogTeamName(CurrentHedgehog)]==9)
   623 			then
   740 			then
   624 				setTeamValue(GetHogTeamName(CurrentHedgehog), "rand-done-turn", nil)
   741 				setTeamValue(GetHogTeamName(CurrentHedgehog), "rand-done-turn", nil)
   625 			elseif(continent[GetHogTeamName(CurrentHedgehog)]==7)
   742 			elseif(continent[GetHogTeamName(CurrentHedgehog)]==7)
   626 			then
   743 			then
   627 				if(getTeamValue(GetHogTeamName(CurrentHedgehog), "Antarctica-turntick")==nil)
   744 				if(getTeamValue(GetHogTeamName(CurrentHedgehog), "Antarctica2-turntick")==nil)
   628 				then
   745 				then
   629 					setTeamValue(GetHogTeamName(CurrentHedgehog), "Antarctica-turntick", 1)
   746 					setTeamValue(GetHogTeamName(CurrentHedgehog), "Antarctica2-turntick", 1)
   630 				end
   747 				end
   631 				
   748 				
   632 				if(getTeamValue(GetHogTeamName(CurrentHedgehog), "Antarctica-turntick")>=2)
   749 				if(getTeamValue(GetHogTeamName(CurrentHedgehog), "Antarctica2-turntick")>=4)
   633 				then
   750 				then
   634 					AddAmmo(CurrentHedgehog,amPortalGun)
   751 					AddAmmo(CurrentHedgehog,amPortalGun)
   635 					setTeamValue(GetHogTeamName(CurrentHedgehog), "Antarctica-turntick", 0)
   752 					AddAmmo(CurrentHedgehog,amPortalGun)
       
   753 					AddAmmo(CurrentHedgehog,amSineGun)
       
   754 					AddAmmo(CurrentHedgehog,amSineGun)
       
   755 					AddAmmo(CurrentHedgehog,amGirder)
       
   756 					AddAmmo(CurrentHedgehog,amSnowball)
       
   757 					setTeamValue(GetHogTeamName(CurrentHedgehog), "Antarctica2-turntick", 0)
   636 				end
   758 				end
   637 				setTeamValue(GetHogTeamName(CurrentHedgehog), "Antarctica-turntick", getTeamValue(GetHogTeamName(CurrentHedgehog), "Antarctica-turntick")+1)
   759 				setTeamValue(GetHogTeamName(CurrentHedgehog), "Antarctica2-turntick", getTeamValue(GetHogTeamName(CurrentHedgehog), "Antarctica2-turntick")+1)
   638 				
   760 				
   639 			elseif(continent[GetHogTeamName(CurrentHedgehog)]==5)
   761 			elseif(continent[GetHogTeamName(CurrentHedgehog)]==5)
   640 			then
   762 			then
   641 				AddAmmo(CurrentHedgehog,amParachute)
   763 				if(getTeamValue(GetHogTeamName(CurrentHedgehog), "Asia-turntick")==nil)
       
   764 				then
       
   765 					setTeamValue(GetHogTeamName(CurrentHedgehog), "Asia-turntick", 1)
       
   766 				end
       
   767 				
       
   768 				if(getTeamValue(GetHogTeamName(CurrentHedgehog), "Asia-turntick")>=2)
       
   769 				then
       
   770 					AddAmmo(CurrentHedgehog,amParachute)
       
   771 					setTeamValue(GetHogTeamName(CurrentHedgehog), "Asia-turntick", 0)
       
   772 				end
       
   773 				setTeamValue(GetHogTeamName(CurrentHedgehog), "Asia-turntick", getTeamValue(GetHogTeamName(CurrentHedgehog), "Asia-turntick")+1)
       
   774 			elseif(continent[GetHogTeamName(CurrentHedgehog)]==1)
       
   775 			then
       
   776 				if(getTeamValue(GetHogTeamName(CurrentHedgehog), "NA-turntick")==nil)
       
   777 				then
       
   778 					setTeamValue(GetHogTeamName(CurrentHedgehog), "NA-turntick", 1)
       
   779 				end
       
   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)
   642 			end
   787 			end
   643 		end
   788 		end
   644 	end
   789 	end
   645 end
   790 end
   646 
   791 
   661 			australianSpecial=false
   806 			australianSpecial=false
   662 			swapweps=false
   807 			swapweps=false
   663 		else
   808 		else
   664 			PlaySound(sndDenied)
   809 			PlaySound(sndDenied)
   665 		end
   810 		end
   666 	end
   811 
   667 	
       
   668 	--Asian special
   812 	--Asian special
   669 	if(asianSpecial==false and inpara~=false)
   813 	elseif(inpara==1)
   670 	then
   814 	then
   671 		asiabomb=AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog)+3, gtSnowball, 0, 0, 0, 0)
   815 		asiabomb=AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog)+3, gtSnowball, 0, 0, 0, 0)
   672 		SetGearMessage(asiabomb, 1)
   816 		SetGearMessage(asiabomb, 1)
   673 		asianSpecial=true
   817 
       
   818 		inpara=2
   674 		swapweps=false
   819 		swapweps=false
   675 	end
   820 
   676 	
       
   677 	--africa
   821 	--africa
   678 	if(GetCurAmmoType() == amSeduction)
   822 	elseif(GetCurAmmoType() == amSeduction)
   679 	then
   823 	then
   680 		if(africanSpecial==0)
   824 		if(africanSpecial==0)
   681 		then
   825 		then
   682 			africanSpecial = 1
   826 			africanSpecial = 1
   683 			AddCaption(weapontexts[4])
   827 			AddCaption(weapontexts[4])
   684 		else
   828 		else
   685 			africanSpecial = 0
   829 			africanSpecial = 0
   686 			AddCaption(loc("NORMAL"))
   830 			AddCaption(loc("NORMAL"))
   687 		end
   831 		end
   688 	end
   832 
   689 	--south america
   833 	--south america
   690 	if(GetCurAmmoType() == amGasBomb)
   834 	elseif(GetCurAmmoType() == amGasBomb)
   691 	then
   835 	then
   692 		if(samericanSpecial==false)
   836 		if(samericanSpecial==false)
   693 		then
   837 		then
   694 			samericanSpecial = true
   838 			samericanSpecial = true
   695 			AddCaption(weapontexts[3])
   839 			AddCaption(weapontexts[3])
   696 		else
   840 		else
   697 			samericanSpecial = false
   841 			samericanSpecial = false
   698 			AddCaption(loc("NORMAL"))
   842 			AddCaption(loc("NORMAL"))
   699 		end
   843 		end
   700 	end
   844 
   701 	--africa
   845 	--africa
   702 	if(GetCurAmmoType() == amSMine)
   846 	elseif(GetCurAmmoType() == amSMine)
   703 	then
   847 	then
   704 		if(africaspecial2==0)
   848 		if(africaspecial2==0)
   705 		then
   849 		then
   706 			africaspecial2 = 1
   850 			africaspecial2 = 1
   707 			AddCaption(weapontexts[11])
   851 			AddCaption(weapontexts[11])
   712 		elseif(africaspecial2 == 2)
   856 		elseif(africaspecial2 == 2)
   713 		then
   857 		then
   714 			africaspecial2 = 0
   858 			africaspecial2 = 0
   715 			AddCaption(loc("NORMAL"))
   859 			AddCaption(loc("NORMAL"))
   716 		end
   860 		end
   717 	end
   861 
   718 	
       
   719 	--north america (sniper)
   862 	--north america (sniper)
   720 	if(GetCurAmmoType() == amSniperRifle and sniper_s_in_use==false)
   863 	elseif(GetCurAmmoType() == amSniperRifle and sniper_s_in_use==false)
   721 	then
   864 	then
   722 		if(namericanSpecial==3)
   865 		if(namericanSpecial==2)
   723 		then
   866 		then
   724 			namericanSpecial = 1
   867 			namericanSpecial = 1
   725 			AddCaption(loc("NORMAL"))
   868 			AddCaption(loc("NORMAL"))
   726 		elseif(namericanSpecial==1)
   869 		elseif(namericanSpecial==1)
   727 		then
   870 		then
   728 			namericanSpecial = 2
   871 			namericanSpecial = 2
   729 			AddCaption("#"..weapontexts[1])
   872 			AddCaption("#"..weapontexts[1])
   730 		elseif(namericanSpecial==2)
   873 		end
   731 		then
   874 
   732 			namericanSpecial = 3
       
   733 			AddCaption("##"..weapontexts[2])
       
   734 		end
       
   735 	end
       
   736 	
       
   737 	--north america (shotgun)
   875 	--north america (shotgun)
   738 	if(GetCurAmmoType() == amShotgun and shotgun_s~=nil)
   876 	elseif(GetCurAmmoType() == amShotgun and shotgun_s~=nil)
   739 	then
   877 	then
   740 		if(shotgun_s==false)
   878 		if(shotgun_s==false)
   741 		then
   879 		then
   742 			shotgun_s = true
   880 			shotgun_s = true
   743 			AddCaption(weapontexts[13])
   881 			AddCaption(weapontexts[13])
   744 		else
   882 		else
   745 			shotgun_s = false
   883 			shotgun_s = false
   746 			AddCaption(loc("NORMAL"))
   884 			AddCaption(loc("NORMAL"))
   747 		end
   885 		end
   748 	end
   886 
   749 	
       
   750 	--europe
   887 	--europe
   751 	if(GetCurAmmoType() == amMolotov)
   888 	elseif(GetCurAmmoType() == amMolotov)
   752 	then
   889 	then
   753 		if(europe_s==0)
   890 		if(europe_s==0)
   754 		then
   891 		then
   755 			europe_s = 1
   892 			europe_s = 1
   756 			AddCaption(weapontexts[14])
   893 			AddCaption(weapontexts[14])
   757 		else
   894 		else
   758 			europe_s = 0
   895 			europe_s = 0
   759 			AddCaption(loc("NORMAL"))
   896 			AddCaption(loc("NORMAL"))
   760 		end
   897 		end
   761 	end
   898 
   762 	
       
   763 	--swap forward in the weaponmenu (1.0 style)
   899 	--swap forward in the weaponmenu (1.0 style)
   764 	if(swapweps==true and (GetCurAmmoType() == amSkip or GetCurAmmoType() == amNothing))
   900 	elseif(swapweps==true and (GetCurAmmoType() == amSkip or GetCurAmmoType() == amNothing))
   765 	then
   901 	then
   766 		continent[GetHogTeamName(CurrentHedgehog)]=continent[GetHogTeamName(CurrentHedgehog)]+1
   902 		continent[GetHogTeamName(CurrentHedgehog)]=continent[GetHogTeamName(CurrentHedgehog)]+1
   767 		
   903 		
   768 		if(continent[GetHogTeamName(CurrentHedgehog)]> table.maxn(weaponsets))
   904 		if(continent[GetHogTeamName(CurrentHedgehog)]> table.maxn(weaponsets))
   769 		then
   905 		then
   770 			continent[GetHogTeamName(CurrentHedgehog)]=1
   906 			continent[GetHogTeamName(CurrentHedgehog)]=1
   771 		end
   907 		end
   772 		setweapons()
   908 		setweapons()
   773 	end
   909 
   774 	
       
   775 	--kerguelen
   910 	--kerguelen
   776 	if(GetCurAmmoType() == amHammer)
   911 	elseif(GetCurAmmoType() == amHammer)
   777 	then
   912 	then
   778 		if(kergulenSpecial==6)
   913 		if(kergulenSpecial==6)
   779 		then
   914 		then
   780 			kergulenSpecial = 1
   915 			kergulenSpecial = 1
   781 			AddCaption("Normal")
   916 			AddCaption("Normal")
   787 		then
   922 		then
   788 			kergulenSpecial = 3
   923 			kergulenSpecial = 3
   789 			AddCaption("##"..weapontexts[8])
   924 			AddCaption("##"..weapontexts[8])
   790 		elseif(kergulenSpecial==3 or (kergulenSpecial==2 and TotalRounds<1))
   925 		elseif(kergulenSpecial==3 or (kergulenSpecial==2 and TotalRounds<1))
   791 		then
   926 		then
   792 			kergulenSpecial = 4
       
   793 			AddCaption("###"..weapontexts[9])
       
   794 		elseif(kergulenSpecial==4)
       
   795 		then
       
   796 			kergulenSpecial = 5
   927 			kergulenSpecial = 5
   797 			AddCaption("####"..weapontexts[10])
   928 			AddCaption("###"..weapontexts[10])
   798 		elseif(kergulenSpecial==5)
   929 		elseif(kergulenSpecial==5)
   799 		then
   930 		then
   800 			kergulenSpecial = 6
   931 			kergulenSpecial = 6
   801 			AddCaption("#####"..weapontexts[15])
   932 			AddCaption("####"..weapontexts[15])
   802 		end
   933 		end
   803 	end
   934 	end
   804 end
   935 end
   805 
   936 
   806 function onPrecise()
   937 function onPrecise()
   809 	then
   940 	then
   810 		continent[GetHogTeamName(CurrentHedgehog)]=continent[GetHogTeamName(CurrentHedgehog)]-1
   941 		continent[GetHogTeamName(CurrentHedgehog)]=continent[GetHogTeamName(CurrentHedgehog)]-1
   811 		
   942 		
   812 		if(continent[GetHogTeamName(CurrentHedgehog)]<=0)
   943 		if(continent[GetHogTeamName(CurrentHedgehog)]<=0)
   813 		then
   944 		then
   814 			continent[GetHogTeamName(CurrentHedgehog)]=9
   945 			continent[GetHogTeamName(CurrentHedgehog)]=table.maxn(weaponsets)
   815 		end
   946 		end
   816 		setweapons()
   947 		setweapons()
   817 	end
   948 	end
   818 end
   949 end
   819 
   950 
   843 	--show the kerguelen ring
   974 	--show the kerguelen ring
   844 	if(kergulenSpecial > 1 and GetCurAmmoType() == amHammer)
   975 	if(kergulenSpecial > 1 and GetCurAmmoType() == amHammer)
   845 	then
   976 	then
   846 		if(visualcircle==nil)
   977 		if(visualcircle==nil)
   847 		then
   978 		then
   848 			visualcircle=AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtCircle, 0, false)
   979 			visualcircle=AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtCircle, 0, true)
   849 		end
   980 		end
   850 		
   981 		
   851 		if(kergulenSpecial == 2) --walrus scream
   982 		if(kergulenSpecial == 2) --walrus scream
   852 		then
   983 		then
   853 			SetVisualGearValues(visualcircle, GetX(CurrentHedgehog), GetY(CurrentHedgehog),20, 200, 0, 0, 100, 120, 4, 0xff0000ee)
   984 			SetVisualGearValues(visualcircle, GetX(CurrentHedgehog), GetY(CurrentHedgehog),20, 200, 0, 0, 100, 120, 4, 0xff0000ee)
   854 		elseif(kergulenSpecial == 3) --swap hog
   985 		elseif(kergulenSpecial == 3) --swap hog
   855 		then
   986 		then
   856 			SetVisualGearValues(visualcircle, GetX(CurrentHedgehog), GetY(CurrentHedgehog),20, 200, 0, 0, 100, 450, 3, 0xffff00ee)
   987 			SetVisualGearValues(visualcircle, GetX(CurrentHedgehog), GetY(CurrentHedgehog),20, 200, 0, 0, 100, 450, 3, 0xffff00ee)
   857 		elseif(kergulenSpecial == 4) --flare
       
   858 		then
       
   859 			SetVisualGearValues(visualcircle, GetX(CurrentHedgehog), GetY(CurrentHedgehog),20, 200, 0, 0, 100, 45, 6, 0x00ff00ee)
       
   860 		elseif(kergulenSpecial == 5) --cries
   988 		elseif(kergulenSpecial == 5) --cries
   861 		then
   989 		then
   862 			SetVisualGearValues(visualcircle, GetX(CurrentHedgehog), GetY(CurrentHedgehog),20, 200, 0, 0, 100, 500, 1, 0x0000ffee)
   990 			SetVisualGearValues(visualcircle, GetX(CurrentHedgehog), GetY(CurrentHedgehog),20, 200, 0, 0, 100, 500, 1, 0x0000ffee)
   863 		elseif(kergulenSpecial == 6) --sabotage
   991 		elseif(kergulenSpecial == 6) --sabotage
   864 		then
   992 		then
   865 			SetVisualGearValues(visualcircle, GetX(CurrentHedgehog), GetY(CurrentHedgehog),20, 200, 0, 0, 100, 100, 10, 0xeeeeeeee)
   993 			SetVisualGearValues(visualcircle, GetX(CurrentHedgehog), GetY(CurrentHedgehog),20, 200, 0, 0, 100, 80, 10, 0x00ff00ee)
   866 		end
   994 		end
   867 	
   995 	
   868 	elseif(visualcircle~=nil)
   996 	elseif(visualcircle~=nil)
   869 	then
   997 	then
   870 		DeleteVisualGear(visualcircle)
   998 		DeleteVisualGear(visualcircle)
   876 	then
  1004 	then
   877 	
  1005 	
   878 		if(TurnTimeLeft<=150)
  1006 		if(TurnTimeLeft<=150)
   879 		then
  1007 		then
   880 			disable_moving[CurrentHedgehog]=false
  1008 			disable_moving[CurrentHedgehog]=false
   881 			SetHogLevel(CurrentHedgehog,disableoffsetai)
  1009 			SetInputMask(0xFFFFFFFF)
   882 			onsabotageai=false
  1010 		elseif(disallowattack >= (25*disableRand)+5)
   883 		elseif(disallowattack>=15 and disallowattack >= 20)
  1011 		then
   884 		then
  1012 			temp_val=0
       
  1013 			
       
  1014 			AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog)-10, gtCluster, 0, 0, -160000, 40)
       
  1015 			
   885 			disallowattack=0
  1016 			disallowattack=0
   886 			onsabotageai=true
  1017 		elseif(disallowattack % 20 == 0 and disallowattack>0)
   887 			SetHogLevel(CurrentHedgehog,1)
  1018 		then
       
  1019 			SetInputMask(band(0xFFFFFFFF, bnot(gmLJump + gmHJump)))
   888 			AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtSmokeWhite, 0, false)
  1020 			AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtSmokeWhite, 0, false)
   889 		elseif(onsabotageai==true)
  1021 			disallowattack=disallowattack+1
   890 		then
       
   891 			SetHogLevel(CurrentHedgehog,disableoffsetai)
       
   892 			onsabotageai=false
       
   893 		else
  1022 		else
       
  1023 			SetInputMask(0xFFFFFFFF)
   894 			disallowattack=disallowattack+1
  1024 			disallowattack=disallowattack+1
   895 		end
  1025 		end
   896 	
  1026 	
   897 	end
  1027 	end
   898 	
  1028 	
   901 --if you used hogswitch or any similar weapon, dont enable any weaponchange
  1031 --if you used hogswitch or any similar weapon, dont enable any weaponchange
   902 function onAttack()
  1032 function onAttack()
   903 	swapweps=false
  1033 	swapweps=false
   904 	
  1034 	
   905 	--african special
  1035 	--african special
   906 	if(africanSpecial == 1 and GetCurAmmoType() == amSeduction)
  1036 	if(africanSpecial == 1 and GetCurAmmoType() == amSeduction and band(GetState(CurrentHedgehog),gstAttacked)==0)
   907 	then
  1037 	then
   908 		SetState(CurrentHedgehog, gstAttacked)
  1038 		--SetState(CurrentHedgehog, gstAttacked)
       
  1039 		EndTurn(3000)
   909 		
  1040 		
   910 		temp_val=0
  1041 		temp_val=0
   911 		runOnGears(weapon_duststorm)
  1042 		runOnGears(weapon_duststorm)
   912 		SetHealth(CurrentHedgehog, GetHealth(CurrentHedgehog)+temp_val)
  1043 		SetHealth(CurrentHedgehog, GetHealth(CurrentHedgehog)+temp_val)
   913 
  1044 
   914 		--visual stuff
  1045 		--visual stuff
   915 		visual_gear_explosion(250,GetX(CurrentHedgehog), GetY(CurrentHedgehog),vgtSmoke,vgtSmokeWhite)
  1046 		visual_gear_explosion(250,GetX(CurrentHedgehog), GetY(CurrentHedgehog),vgtSmoke,vgtSmokeWhite)
   916 		PlaySound(sndParachute)
  1047 		PlaySound(sndParachute)
       
  1048 		
       
  1049 		RemoveWeapon(CurrentHedgehog,amSeduction)
   917 
  1050 
   918 	--Kerguelen specials
  1051 	--Kerguelen specials
   919 	elseif(GetCurAmmoType() == amHammer and kergulenSpecial > 1)
  1052 	elseif(GetCurAmmoType() == amHammer and kergulenSpecial > 1 and band(GetState(CurrentHedgehog),gstAttacked)==0)
   920 	then
  1053 	then
   921 		SetState(CurrentHedgehog, gstAttacked)
  1054 		--SetState(CurrentHedgehog, gstAttacked)
       
  1055 		
       
  1056 		
   922 		--scream
  1057 		--scream
   923 		if(kergulenSpecial == 2)
  1058 		if(kergulenSpecial == 2)
   924 		then
  1059 		then
   925 			temp_val=0
  1060 			temp_val=0
   926 			runOnGears(weapon_scream_walrus)
  1061 			runOnGears(weapon_scream_pen)
   927 			SetHealth(CurrentHedgehog, GetHealth(CurrentHedgehog)+temp_val)
  1062 			SetHealth(CurrentHedgehog, GetHealth(CurrentHedgehog)+temp_val)
   928 			PlaySound(sndHellish)
  1063 			PlaySound(sndHellish)
   929 		
  1064 		
   930 		--swap
  1065 		--swap
   931 		elseif(kergulenSpecial == 3 and TotalRounds>=1)
  1066 		elseif(kergulenSpecial == 3 and TotalRounds>=1)
   932 		then
  1067 		then
   933 			runOnGears(weapon_swap_kerg)
  1068 			runOnGears(weapon_swap_kerg)
   934 			PlaySound(sndPiano3)
  1069 			PlaySound(sndPiano3)
   935 			
  1070 			
   936 		--flare
       
   937 		elseif(kergulenSpecial == 4)
       
   938 		then
       
   939 			runOnGears(weapon_flare)
       
   940 			PlaySound(sndThrowRelease)
       
   941 			AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtSmokeWhite, 0, false)
       
   942 			AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog)-20, gtCluster, 0, 0, -1000000, 34)
       
   943 		
       
   944 		--cries
  1071 		--cries
   945 		elseif(kergulenSpecial == 5)
  1072 		elseif(kergulenSpecial == 5)
   946 		then
  1073 		then
   947 			runOnGears(weapon_cries_a)
  1074 			runOnGears(weapon_cries_a)
   948 			if(kergulenSpecial~=-1)
  1075 			if(kergulenSpecial~=-1)
   959 			end
  1086 			end
   960 		
  1087 		
   961 		--sabotage
  1088 		--sabotage
   962 		elseif(kergulenSpecial == 6)
  1089 		elseif(kergulenSpecial == 6)
   963 		then
  1090 		then
       
  1091 			temp_val=0
   964 			runOnGears(weapon_sabotage)
  1092 			runOnGears(weapon_sabotage)
   965 		end
  1093 			if(temp_val==0)
       
  1094 			then
       
  1095 				PlaySound(sndThrowRelease)
       
  1096 				AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog)-20, gtCluster, 0, 0, -1000000, 32)
       
  1097 			end
       
  1098 		end
       
  1099 		
       
  1100 		EndTurn(3000)
       
  1101 		
   966 		DeleteVisualGear(visualcircle)
  1102 		DeleteVisualGear(visualcircle)
   967 		visualcircle=nil
  1103 		visualcircle=nil
       
  1104 		kergulenSpecial=0
       
  1105 		
       
  1106 		RemoveWeapon(CurrentHedgehog,amHammer)
   968 		
  1107 		
   969 	elseif(GetCurAmmoType() == amVampiric)
  1108 	elseif(GetCurAmmoType() == amVampiric)
   970 	then
  1109 	then
   971 		VampOn=75
  1110 		VampOn=75
   972 	end
  1111 	end
   982 			DeleteGear(austmine)
  1121 			DeleteGear(austmine)
   983 			PlaySound(sndDenied)
  1122 			PlaySound(sndDenied)
   984 		end
  1123 		end
   985 		
  1124 		
   986 		austmine=nil
  1125 		austmine=nil
   987 	end
       
   988 	
       
   989 	--stop sabotage (avoiding a bug)
       
   990 	if(disable_moving[CurrentHedgehog]==true)
       
   991 	then
       
   992 		disable_moving[CurrentHedgehog]=false
       
   993 		onsabotageai=false
       
   994 		SetHogLevel(CurrentHedgehog,disableoffsetai)
       
   995 	end
  1126 	end
   996 	
  1127 	
   997 	australianSpecial=false
  1128 	australianSpecial=false
   998 end
  1129 end
   999 
  1130 
  1054 		SetGearMessage(e_health, 2)
  1185 		SetGearMessage(e_health, 2)
  1055 		DeleteGear(gearUid)
  1186 		DeleteGear(gearUid)
  1056 		
  1187 		
  1057 	elseif(GetGearType(gearUid)==gtParachute)
  1188 	elseif(GetGearType(gearUid)==gtParachute)
  1058 	then
  1189 	then
  1059 		inpara=gearUid
  1190 		inpara=1
  1060 	end
  1191 	end
  1061 end
  1192 end
  1062 
  1193 
  1063 function onGearDelete(gearUid)
  1194 function onGearDelete(gearUid)
  1064 
  1195 
  1065 	if(GetGearType(gearUid) == gtHedgehog or GetGearType(gearUid) == gtMine or GetGearType(gearUid) == gtExplosives) 
  1196 	if(GetGearType(gearUid) == gtHedgehog or GetGearType(gearUid) == gtMine or GetGearType(gearUid) == gtExplosives) 
  1066 	then
  1197 	then
  1067 		trackDeletion(gearUid)
  1198 		trackDeletion(gearUid)
       
  1199 		
       
  1200 		--sundaland special
       
  1201 		if(GetGearType(gearUid) == gtHedgehog and continent[GetHogTeamName(turnhog)]==10)
       
  1202 		then
       
  1203 			if(turnhog==CurrentHedgehog)
       
  1204 			then
       
  1205 				runOnGears(find_other_hog_in_team)
       
  1206 			end
       
  1207 		
       
  1208 			get_random_weapon_on_death(turnhog)
       
  1209 		end
  1068 	end
  1210 	end
  1069 	
  1211 	
  1070 	--north american lipstick
  1212 	--north american lipstick
  1071 	if(GetGearType(gearUid)==gtSniperRifleShot )
  1213 	if(GetGearType(gearUid)==gtSniperRifleShot )
  1072 	then
  1214 	then
  1073 		sniper_s_in_use=false
  1215 		sniper_s_in_use=false
  1074 		if(namericanSpecial==2)
  1216 		if(namericanSpecial==2)
  1075 		then
  1217 		then
  1076 			temp_val=gearUid
  1218 			temp_val=gearUid
  1077 			runOnGears(weapon_lipstick)
  1219 			runOnGears(weapon_lipstick)
  1078 			
  1220 		end
  1079 		elseif(namericanSpecial==3)
       
  1080 		then
       
  1081 			AddVisualGear(GetX(gearUid), GetY(gearUid), vgtExplosion, 0, false)
       
  1082 			
       
  1083 			pinata=AddGear(GetX(gearUid), GetY(gearUid), gtCluster, 0, 0, 0, 5)
       
  1084 			SetGearMessage(pinata,1)
       
  1085 		end
       
  1086 		
       
  1087 	--north american pinata
       
  1088 	elseif(GetGearType(gearUid)==gtCluster and GetGearMessage(gearUid)==1 and namericanSpecial==3)
       
  1089 	then
       
  1090 		AddGear(GetX(gearUid), GetY(gearUid), gtCluster, 0, 0, 0, 20)
       
  1091 	
       
  1092 	--north american eagle eye
  1221 	--north american eagle eye
  1093 	elseif(GetGearType(gearUid)==gtShotgunShot and shotgun_s==true)
  1222 	elseif(GetGearType(gearUid)==gtShotgunShot and shotgun_s==true)
  1094 	then
  1223 	then
  1095 		SetState(CurrentHedgehog, gstMoving)
  1224 		SetState(CurrentHedgehog, gstMoving)
  1096 		SetGearPosition(CurrentHedgehog, GetX(gearUid), GetY(gearUid)+7)
  1225 		SetGearPosition(CurrentHedgehog, GetX(gearUid), GetY(gearUid)+7)
  1121 	elseif(GetGearType(gearUid)==gtParachute)
  1250 	elseif(GetGearType(gearUid)==gtParachute)
  1122 	then
  1251 	then
  1123 		inpara=false
  1252 		inpara=false
  1124 	end
  1253 	end
  1125 end
  1254 end
  1126 --[[
  1255 --[[sources (populations & area):
  1127 sources (populations & area):
       
  1128 Wikipedia
       
  1129 Own calculations
  1256 Own calculations
  1130 if you think they are wrong, then please tell me :)
  1257 Some are approximations.]]
  1131 ]]