diff -r 7d772358dc22 -r e27540ad33bd share/hedgewars/Data/Scripts/Multiplayer/Continental_supplies.lua --- a/share/hedgewars/Data/Scripts/Multiplayer/Continental_supplies.lua Thu May 03 11:58:07 2018 +0200 +++ b/share/hedgewars/Data/Scripts/Multiplayer/Continental_supplies.lua Thu May 03 15:18:28 2018 +0200 @@ -47,17 +47,18 @@ end --Will end the turn + give escape time -function EndTurn(seconds) - SetState(CurrentHedgehog,bor(GetState(CurrentHedgehog),gstAttacked)) - --set espace time +function EndTurnCS(seconds) + --set escape time TurnTimeLeft = GetAwayTime*10*seconds + if TurnTimeLeft > 0 then + Retreat(TurnTimeLeft, false) + end end --show health tag (will mostly be used when a hog is damaged) function ShowDamageTag(hog,damage) - healthtag=AddVisualGear(GetX(hog), GetY(hog), vgtHealthTag, damage, false) - v1, v2, v3, v4, v5, v6, v7, v8, v9, v10 = GetVisualGearValues(healthtag) - SetVisualGearValues(healthtag, v1, v2, v3, v4, v5, v6, v7, v8, v9, GetClanColor(GetHogClan(hog))) + local healthtag=AddVisualGear(GetX(hog), GetY(hog), vgtHealthTag, damage, false) + SetVisualGearValues(healthtag, nil, nil, nil, nil, nil, nil, nil, nil, nil, GetClanColor(GetHogClan(hog))) end --will use IntegerSqrt @@ -66,127 +67,299 @@ return AddGear(div((GetGearRadius(hedgehog)*2*vx),hypo)+GetX(hedgehog), div((GetGearRadius(hedgehog)*2*vy),hypo)+GetY(hedgehog), geartype, 0, vx, vy, timer) end ---====MISC GLOBALS==== +function CollectMultiAmmo(hog, ammoList, noAddAmmo) + local x, y = GetGearPosition(hog) + x = x + 2 + y = y + 32 + local ammoStr = "" + local ammoLength = 0 + for _, _ in pairs(ammoList) do + ammoLength = ammoLength + 1 + end + local a = 1 + for ammo, count in pairs(ammoList) do + if not noAddAmmo then + local oldCount = GetAmmoCount(hog, ammo) + local newCount = oldCount + count + -- Make sure that finite ammo stays finite + if count < 100 and oldCount < 100 and newCount >= 100 then + newCount = 99 + end + AddAmmo(hog, ammo, newCount) + end + if IsHogLocal(hog) then + x = x + 2 + y = y + 32 + local vgear = AddVisualGear(x, y, vgtAmmo, 0, true) + if vgear ~= nil then + local vgtFrame = ammo + SetVisualGearValues(vgear, nil, nil, nil, nil, nil, vgtFrame) + end + + ammoStr = ammoStr .. string.format(loc("%s (+%d)"), GetAmmoName(ammo), count) + if a < ammoLength then + ammoStr = ammoStr .. " • " + end + end + a = a + 1 + end + if ammoLength > 0 then + PlaySound(sndShotgunReload) + -- Show collected ammo + if IsHogLocal(hog) then + AddCaption(ammoStr, GetClanColor(GetHogClan(hog)), capgrpAmmoinfo) + end + end +end + +function SetAttackState(state) + if state==true then + SetInputMask(bor(GetInputMask(), gmAttack)) + else + SetInputMask(band(GetInputMask(), bnot(gmAttack))) + end +end + +--====MISC_TIMER GLOBALS==== +local CS = {} --for selecting continent -local GLOBAL_INIT_TEAMS = {} -local GLOBAL_SELECT_CONTINENT_CHECK=false -local GLOBAL_START_TIME=0 -local GLOBAL_HOG_HEALTH=100 -local GLOBAL_TEAM_CONTINENT = {} + +CS.INIT_TEAMS = {} +CS.GAME_STARTED = false +CS.SELECT_CONTINENT_CHECK=false +CS.START_TIME=0 +CS.HOG_HEALTH=100 +CS.TEAM_CONTINENT = {} --variables for seeing if you have swaped around on a weapon -local GLOBAL_AUSTRALIAN_SPECIAL=0 -local GLOBAL_AFRICAN_SPECIAL_SEDUCTION=0 -local GLOBAL_AFRICAN_SPECIAL_STICKY=0 -local GLOBAL_SOUTH_AMERICAN_SPECIAL=false -local GLOBAL_NORTH_AMERICAN_SPECIAL_SNIPER=1 -local GLOBAL_NORTH_AMERICAN_SPECIAL_SNIPER_IS_ON=false -local GLOBAL_KERGUELEN_SPECIAL=1 -local GLOBAL_NORTH_AMERICAN_SPECIAL_SHOTGUN=false -local GLOBAL_EUROPE_SPECIAL=0 -local GLOBAL_ANTARCTICA_SPECIAL=0 -local GLOBAL_SEDUCTION_INCREASER=0 +CS.AUSTRALIAN_SPECIAL=0 +CS.AFRICAN_SPECIAL_SEDUCTION=0 +CS.AFRICAN_SPECIAL_STICKY=0 +CS.SOUTH_AMERICAN_SPECIAL=false +CS.NORTH_AMERICAN_SPECIAL_SNIPER=1 +CS.NORTH_AMERICAN_SPECIAL_SNIPER_IS_ON=false +CS.KERGUELEN_SPECIAL=1 +CS.NORTH_AMERICAN_SPECIAL_SHOTGUN=false +CS.EUROPE_SPECIAL=0 +CS.ANTARCTICA_SPECIAL=0 +CS.SEDUCTION_INCREASER=0 --detection if something is activated -local GLOBAL_SWITCH_HOG_IS_ON=false -local GLOBAL_VAMPIRIC_IS_ON=0 -local GLOBAL_EXTRA_DAMAGE_IS_ON=100 -local GLOBAL_PARACHUTE_IS_ON=false +CS.SWITCH_HOG_IS_ON=false +CS.VAMPIRIC_IS_ON=0 +CS.EXTRA_DAMAGE_IS_ON=100 +CS.PARACHUTE_IS_ON=false +CS.PRECISE=false + +CS.CONTINENT_LABEL_TIMER=-1 +CS.SPEECH_TIMER=-1 +CS.HANDLE_SPECIAL_WEAPON_MISC_TIMER=-1 +CS.CONFIRM_CONTINENT_SELECTION=-1 --the visual circle for kerguelen -local GLOBAL_VISUAL_CIRCLE=nil +CS.VISUAL_CIRCLE=nil + +--the global temporary value +CS.TEMP_VALUE=0 ---the global temp value -local GLOBAL_TEMP_VALUE=0 +--true if player used any sticky mine mine mode besides hedgehog projectile in this turn +CS.AFRICAN_SPECIAL_NON_PROJECTILE_USED=false + +-- “constants” +CS.SABOTAGE_GRAVITY=350 +CS.SABOTAGE_GRAVITY_LOW=175 +CS.SABOTAGE_DAMAGE=2 +CS.SABOTAGE_FREQUENCY=100 --for sabotage -local GLOBAL_SABOTAGE_COUNTER=0 -local GLOBAL_SABOTAGE_HOGS={} -local GLOBAL_SABOTAGE_FREQUENCY=0 - -local GLOBAL_CRATE_TEST=-1 +CS.SABOTAGE_COUNTER=0 +CS.SABOTAGE_HOGS={} +CS.SABOTAGE_FREQUENCY_NOW=0 --for sundaland -local GLOBAL_SUNDALAND_END_HOG_CONTINENT_NAME +CS.SUNDALAND_END_HOG_CONTINENT_NAME=nil -local OPTION_NO_SPECIALS=false +--misc. +CS.OPTION_NO_SPECIALS=false --====GENERAL GLOBALS (useful for handling continents)==== -local GLOBAL_SNIPER_SPECIAL_INFO = loc("Green lipstick bullet: [Poisonous, deals no damage]") -local GLOBAL_BASEBALLBAT_BOOMERANG_INFO = loc("Bouncy boomerang: [Launch your bouncy boomerang ~ Turns into a present on explosion]") -local GLOBAL_CHEESE_SPECIAL_INFO = loc("Anno 1032: [The explosion will make a strong push ~ No poison]") -local GLOBAL_SEDUCTION_SPECIAL_INFO = loc("Dust storm: [Deals 15 + %s damage to all enemies in the circle]") -local GLOBAL_INVULNERABLE_SPECIAL_INFO = loc("Temporarily increase the damage of duststorm with +7%s, Removes 1 Invurnurable%s") -local GLOBAL_BASEBALLBAT_CRICKET_INFO = loc("Cricket time: [Fire away a 1 sec mine! ~ Cannot be fired close to another hog]") -local GLOBAL_PARACHUTE_SPECIAL_INFO = loc("Drop a bomb: [Drop some heroic wind that will turn into a bomb on impact ~ wont end turn]") -local GLOBAL_HAMMER_ROAR_INFO = loc("Penguin roar: [Deal 15 damage + 10% of your hog’s health to all hogs around you and get 2/3 back]") -local GLOBAL_HAMMER_SWAP_INFO = loc("Disguise as a Rockhopper Penguin: [Swap place with a random enemy hog in the circle]") -local GLOBAL_HAMMER_LONELY_INFO = loc("Lonely Cries: [Rise the water if no hog is in the circle and deal 6 damage to all enemy hogs.]") -local GLOBAL_STICKY_PROJECTILE_INFO = loc("Hedgehog projectile: [Fire your hog like a Sticky Bomb]") -local GLOBAL_STICKY_NAPALM_INFO = loc("Napalm rocket: [Fire a bomb with napalm!]") -local GLOBAL_SHOTGUN_SPECIAL_INFO = loc("Eagle Eye: [Blink to the impact ~ One shot]") -local GLOBAL_MOLOTOV_SPECIAL_INFO = loc("Medicine: [Fire some exploding medicine that will heal 15 hp to all hogs effected by the explosion]") -local GLOBAL_HAMMER_SABOTAGE_INFO = loc("Flare: [Sabotage all hogs in the circle (dmg over time and high gravity) and fire one cluster above you]") -local GLOBAL_PICKHAMMER_SPECIAL_INFO = loc("World wrap: [Will teleport you to the top of the map, expect fall damage]") +CS.SNIPER_SPECIAL_NAME = loc("Green Lipstick Bullet") +CS.BASEBALLBAT_BOOMERANG_NAME = loc("Bouncy Boomerang") +CS.CHEESE_SPECIAL_NAME = loc("Anno 1032") +CS.SEDUCTION_SPECIAL_NAME = loc("Dust Storm") +CS.BASEBALLBAT_CRICKET_NAME = loc("Cricket Time") +CS.PARACHUTE_SPECIAL_NAME = loc("Heroic Wind") +CS.HAMMER_ROAR_NAME = loc("Penguin Roar") +CS.HAMMER_SWAP_NAME = loc("Disguise as a Rockhopper Penguin") +CS.HAMMER_LONELY_NAME = loc("Lonely Cries") +CS.STICKY_PROJECTILE_NAME = loc("Hedgehog Projectile") +CS.STICKY_NAPALM_NAME = loc("Napalm Rocket") +CS.SHOTGUN_SPECIAL_NAME = loc("Eagle Eye") +CS.MOLOTOV_SPECIAL_NAME = loc("Medicine") +CS.HAMMER_SABOTAGE_NAME = loc("Flare") +CS.PICKHAMMER_SPECIAL_NAME = loc("Upside-Down World") + +CS.SNIPER_SPECIAL_DESC = loc("Poisonous, deals no damage.") +CS.BASEBALLBAT_BOOMERANG_DESC = loc("Launch a bouncy ball which explodes into a crate.") +CS.CHEESE_SPECIAL_DESC = loc("Strong knockback, but no poison.") +CS.SEDUCTION_SPECIAL_DESC = loc("Deals 15 damage to all enemies in the circle.") +CS.BASEBALLBAT_CRICKET_DESC = loc("Throw a 1 second mine!") +CS.PARACHUTE_SPECIAL_DESC = loc("Drop a ball of dirt which turns into a|cluster on impact. Doesn’t end turn.") +CS.HAMMER_ROAR_DESC = loc("Deal 15 damage + 10% of your hog’s health to all hogs around you and get 2/3 back.") +CS.HAMMER_SWAP_DESC = loc("Swap place with a random enemy in the circle.") +CS.HAMMER_LONELY_DESC = loc("Rise the water if nobody else is in the circle and deal 6 damage to all enemy hogs.") +CS.STICKY_PROJECTILE_DESC = loc("Fire your hedgehog like a sticky mine.") +CS.STICKY_NAPALM_DESC = loc("Fire a rocket with napalm.") +CS.SHOTGUN_SPECIAL_DESC = loc("Teleport to the impact location.") +CS.MOLOTOV_SPECIAL_DESC = loc("Fire some exploding medicine that will heal 15 health to all hogs in its effect radius.") +CS.HAMMER_SABOTAGE_DESC = loc("Sabotage all hogs in the circle and fire a cluster above you.|Sabotaged hogs lose health and have to deal with a very high gravity during their turn.") +CS.PICKHAMMER_SPECIAL_DESC = loc("Teleport to the top of the map, expect fall damage!") -local GLOBAL_ALL_SPECIALS_INFO = loc("Weapons with specials: ")..loc("Shotgun")..", "..loc("Sniper Rifle")..", "..loc("GasBomb")..", "..loc("Molotov")..", "..loc("Parachute")..", "..loc("Seduction")..", "..loc("Sticky Mine").." (2),"..loc("Baseballbat (2)")..", "..loc("Hammer (4)") +CS.INVULNERABLE_SPECIAL_CAPTION = loc("15+%d damage, %d invulnerable left") +-- Make info +local minfo = function(name, desc) + return string.format(loc("%s: %s"), name, desc) +end +CS.SNIPER_SPECIAL_INFO = minfo(CS.SNIPER_SPECIAL_NAME, CS.SNIPER_SPECIAL_DESC) +CS.BASEBALLBAT_BOOMERANG_INFO = minfo(CS.BASEBALLBAT_BOOMERANG_NAME, CS.BASEBALLBAT_BOOMERANG_DESC) +CS.CHEESE_SPECIAL_INFO = minfo(CS.CHEESE_SPECIAL_NAME, CS.CHEESE_SPECIAL_DESC) +CS.SEDUCTION_SPECIAL_INFO = minfo(CS.SEDUCTION_SPECIAL_NAME, CS.SEDUCTION_SPECIAL_DESC) +CS.INVULNERABLE_SPECIAL_INFO = loc("Increase the dust storm damage by sacrificing|your invulnerable ammo.") +CS.INVULNERABLE_SPECIAL_CTRL = loc("Up/Down: Adjust dust storm damage") +CS.BASEBALLBAT_CRICKET_INFO = minfo(CS.BASEBALLBAT_CRICKET_NAME, CS.BASEBALLBAT_CRICKET_DESC) +CS.PARACHUTE_SPECIAL_INFO = minfo(CS.PARACHUTE_SPECIAL_NAME, CS.PARACHUTE_SPECIAL_DESC) +CS.HAMMER_ROAR_INFO = minfo(CS.HAMMER_ROAR_NAME, CS.HAMMER_ROAR_DESC) +CS.HAMMER_SWAP_INFO = minfo(CS.HAMMER_SWAP_NAME, CS.HAMMER_SWAP_DESC) +CS.HAMMER_LONELY_INFO = minfo(CS.HAMMER_LONELY_NAME, CS.HAMMER_LONELY_DESC) +CS.STICKY_PROJECTILE_INFO = minfo(CS.STICKY_PROJECTILE_NAME, CS.STICKY_PROJECTILE_DESC) +CS.STICKY_NAPALM_INFO = minfo(CS.STICKY_NAPALM_NAME, CS.STICKY_NAPALM_DESC) +CS.SHOTGUN_SPECIAL_INFO = minfo(CS.SHOTGUN_SPECIAL_NAME, CS.SHOTGUN_SPECIAL_DESC) +CS.MOLOTOV_SPECIAL_INFO = minfo(CS.MOLOTOV_SPECIAL_NAME, CS.MOLOTOV_SPECIAL_DESC) +CS.HAMMER_SABOTAGE_INFO = minfo(CS.HAMMER_SABOTAGE_NAME, CS.HAMMER_SABOTAGE_DESC) +CS.PICKHAMMER_SPECIAL_INFO = minfo(CS.PICKHAMMER_SPECIAL_NAME, CS.PICKHAMMER_SPECIAL_DESC) -local GLOBAL_SELECT_WEP_INFORMATION=loc("Select your continent with: the \"Up\" or \"Down\" keys, or by selecting a representative weapon.") -local GLOBAL_GENERAL_INFORMATION="- "..loc("Per team weapons").."|- "..loc("10 weapon schemes").."|- "..loc("Unique new weapons").."| |"..GLOBAL_SELECT_WEP_INFORMATION.."|"..loc("Note: Some weapons have a second option (See continent information). Find and use them with the \"")..loc("switch").."\" "..loc("key").." (↹).|"..GLOBAL_ALL_SPECIALS_INFO.."|"..loc("Tip: See the \"esc\" key (this menu) if you want to see the currently playing teams continent, or that continents specials." .. "|") +CS.SELECT_WEP_INFORMATION=loc("Select your continent with [Up]/[Down] or by selecting a representative weapon.").."|".. + loc("Press [Attack] to confirm.") +CS.SELECT_WEP_INFORMATION_SHORT=loc("%s, select your continent!") -local GLOBAL_CONTINENT_INFORMATION = +function GeneralInformation() + local select_wep, quit_hint + if not CS.GAME_STARTED then + select_wep = "| |"..CS.SELECT_WEP_INFORMATION + quit_hint = "|"..loc("Hint: Use the quit key to see the team’s continent.") + else + select_wep = "" + quit_hint = "" + end + local general_information = + loc("Continents: Select a continent at the beginning.").."|".. + loc("Supplies: Each continent gives you unique weapons, specials and health.").."|".. + loc("Weapon specials: Some weapons have special modes (see weapon description).").. + select_wep.. + quit_hint + return general_information +end + +CS.CONTINENT_INFORMATION = { -{loc("North America"),"["..loc("Difficulty: ")..loc("EASY").."] ",loc("- You can switch between hogs at the start of your turns. (Not first one)").."|"..loc("Special Weapons:").."|"..loc("Shotgun")..": "..GLOBAL_SHOTGUN_SPECIAL_INFO.."|"..loc("Sniper Rifle")..": "..GLOBAL_SNIPER_SPECIAL_INFO,{amSniperRifle,1}, +{loc("North America"), +loc("The continent of firearms"), +loc("The Union: You can select a hedgehog at the start of your turns.").."| |".. +loc("Special weapons:").."|".. +GetAmmoName(amShotgun)..": "..CS.SHOTGUN_SPECIAL_INFO.."|".. +GetAmmoName(amSniperRifle)..": "..CS.SNIPER_SPECIAL_INFO, +{amSniperRifle,1}, {{amShotgun,100},{amDEagle,100},{amLaserSight,2},{amSniperRifle,100},{amCake,1},{amAirAttack,2},{amSwitch,2}}, -}, ---{sndShotgunFire,sndCover},100}, +{sndShotgunFire,sndCover},100}, -{loc("South America"),"["..loc("Difficulty: ")..loc("MEDIUM").."] ",loc("Special Weapons:").."|"..loc("GasBomb")..": "..GLOBAL_CHEESE_SPECIAL_INFO,{amGasBomb,2}, +{loc("South America"), +loc("The continent of guerilla tactics"), +"| |"..loc("Special weapons:").."|" +..GetAmmoName(amGasBomb)..": "..CS.CHEESE_SPECIAL_INFO, +{amGasBomb,2}, {{amBirdy,100},{amHellishBomb,1},{amBee,100},{amGasBomb,100},{amFlamethrower,100},{amNapalm,2},{amExtraDamage,3}}, {sndEggBreak,sndLaugh},125}, -{loc("Europe"),"["..loc("Difficulty: ")..loc("EASY").."] ",loc("Special Weapons:").."|"..loc("Molotov")..": "..GLOBAL_MOLOTOV_SPECIAL_INFO,{amBazooka,3}, +{loc("Europe"), +loc("The continent of medicine"), +"| |"..loc("Special weapons:").."|" +..GetAmmoName(amMolotov)..": "..CS.MOLOTOV_SPECIAL_INFO, +{amBazooka,3}, {{amBazooka,100},{amGrenade,100},{amMortar,100},{amMolotov,100},{amVampiric,4},{amPiano,1},{amResurrector,2},{amJetpack,4}}, {sndExplosion,sndEnemyDown},100}, -{loc("Africa"),"["..loc("Difficulty: ")..loc("MEDIUM").."] ",loc("Special Weapons:").."|"..loc("Seduction")..": "..string.format(GLOBAL_SEDUCTION_SPECIAL_INFO,loc("(*see below)")).."|- "..string.format(GLOBAL_INVULNERABLE_SPECIAL_INFO,"","").."|- "..loc("You can modify the damage/invulnerables with the up/down keys on dust storm.").."|"..loc("Sticky Mine")..": "..GLOBAL_STICKY_PROJECTILE_INFO.."|"..loc("Sticky Mine")..": "..GLOBAL_STICKY_NAPALM_INFO,{amSMine,4}, +{loc("Africa"), +loc("The continent of dust"), +"| |"..loc("Special weapons:").."|".. +GetAmmoName(amSeduction)..": "..CS.SEDUCTION_SPECIAL_INFO.."|".. +CS.INVULNERABLE_SPECIAL_INFO.."|".. +GetAmmoName(amSMine)..": "..CS.STICKY_PROJECTILE_INFO.."|".. +GetAmmoName(amSMine)..": "..CS.STICKY_NAPALM_INFO, +{amSMine,4}, {{amSMine,100},{amWatermelon,1},{amDrillStrike,1},{amDrill,100},{amInvulnerable,7},{amSeduction,100},{amLandGun,3}}, {sndMelonImpact,sndCoward},125}, -{loc("Asia"),"["..loc("Difficulty: ")..loc("MEDIUM").."] ",loc("- Will give you a parachute every third turn.").."|"..loc("Special Weapons:").."|"..loc("Parachute")..": "..GLOBAL_PARACHUTE_SPECIAL_INFO,{amRope,5}, +{loc("Asia"), +loc("The continent of ninjas"), +loc("Textile industry: Will give you a parachute every second turn.").."| |".. +loc("Special weapons:").."|".. +GetAmmoName(amParachute)..": "..CS.PARACHUTE_SPECIAL_INFO, +{amRope,5}, {{amRope,100},{amFirePunch,100},{amParachute,1},{amKnife,2},{amDynamite,1}}, {sndRopeAttach,sndComeonthen},50}, -{loc("Australia"),"["..loc("Difficulty: ")..loc("EASY").."] ",loc("Special Weapons:").."|"..loc("Baseballbat")..": "..GLOBAL_BASEBALLBAT_CRICKET_INFO.."|"..loc("Baseballbat")..": "..GLOBAL_BASEBALLBAT_BOOMERANG_INFO,{amBaseballBat,6}, +{loc("Australia"), +loc("The continent of sports"), +"| |"..loc("Special weapons:").."|".. +GetAmmoName(amBaseballBat)..": "..CS.BASEBALLBAT_CRICKET_INFO.."|".. +GetAmmoName(amBaseballBat)..": "..CS.BASEBALLBAT_BOOMERANG_INFO.."|".. +loc("Baseball bat specials cannot be used close to other hogs."), +{amBaseballBat,6}, {{amBaseballBat,100},{amMine,100},{amLowGravity,4},{amBlowTorch,100},{amRCPlane,2},{amRubber,4}}, {sndBaseballBat,sndNooo},100}, -{loc("Antarctica"),"["..loc("Difficulty: ")..loc("HARD").."] ",loc("Antarctic summer: - Will give you girders=1,mudballs=1,sineguns=2,portals=1 every fourth turn.").."|"..loc("Special Weapons:").."|"..loc("Pick hammer")..": "..GLOBAL_PICKHAMMER_SPECIAL_INFO,{amIceGun,7}, +{loc("Antarctica"), +loc("The continent of ice and science"), +loc("Antarctic summer: Every 4th turn you get 1 girder, 1 mudball, 2 sine guns and 1 portable portal device.").."| |".. +loc("Special weapons:").."|".. +GetAmmoName(amPickHammer)..": "..CS.PICKHAMMER_SPECIAL_INFO, +{amIceGun,7}, {{amSnowball,2},{amPickHammer,100},{amSineGun,4},{amGirder,1},{amExtraTime,1},{amIceGun,1},{amPortalGun,2}}, {sndSineGun,sndOops},75}, -{loc("Kerguelen"),"["..loc("Difficulty: ")..loc("EASY").."] ",loc("Special Weapons:").."|"..loc("Hammer")..": "..GLOBAL_HAMMER_ROAR_INFO.."|"..loc("Hammer")..": "..GLOBAL_HAMMER_SWAP_INFO.."|"..loc("Hammer")..": "..GLOBAL_HAMMER_LONELY_INFO.."|"..loc("Hammer")..": "..GLOBAL_HAMMER_SABOTAGE_INFO,{amHammer,8}, +{loc("Kerguelen"), +loc("The continent of cowards"), +"| |"..loc("Special weapons:").."|".. +GetAmmoName(amHammer)..": "..CS.HAMMER_ROAR_INFO.."|".. +GetAmmoName(amHammer)..": "..CS.HAMMER_SWAP_INFO.."|".. +GetAmmoName(amHammer)..": "..CS.HAMMER_LONELY_INFO.."|".. +GetAmmoName(amHammer)..": "..CS.HAMMER_SABOTAGE_INFO, +{amHammer,8}, {{amHammer,100},{amMineStrike,1},{amBallgun,1},{amTeleport,1}}, {sndPiano5,sndStupid},75}, -{loc("Zealandia"),"["..loc("Difficulty: ")..loc("MEDIUM").."] ",loc("- Will Get 1-3 random weapons") .. "|" .. loc("- Massive weapon bonus on first turn|You will lose all your weapons each turn."),{amInvulnerable,9}, +{loc("Zealandia"), +loc("The forgotten continent"), +loc("Surprise supplies: Get 1-3 random weapons each turn.") .. "|" .. +loc("Treasure: Massive weapon bonus in first turn.").."|".. +loc("Forgetfulness: You will lose all your weapons each turn."), +{amInvulnerable,9}, {{amBazooka,1},{amGrenade,1},{amBlowTorch,1},{amSwitch,1},{amRope,1},{amDrill,1},{amDEagle,1},{amPickHammer,1},{amFirePunch,1},{amWhip,1},{amMortar,1},{amSnowball,1},{amExtraTime,1},{amInvulnerable,1},{amVampiric,1},{amFlamethrower,1},{amBee,1},{amClusterBomb,1},{amTeleport,1},{amLowGravity,1},{amJetpack,1},{amGirder,1},{amLandGun,1},{amBirdy,1},{amAirMine,1},{amTardis,1},{amLaserSight,1},{amAirMine,1}}, {sndSplash,sndFirstBlood},100}, -{loc("Sundaland"),"["..loc("Difficulty: ")..loc("HARD").."] ",loc("- You will recieve 6 weapons on each kill! (Even on own hogs)"),{amTardis,10}, -{{amClusterBomb,5},{amTardis,100},{amWhip,100},{amKamikaze,100},{amAirMine,2},{amDuck,2}}, +{loc("Sundaland"), +loc("The continent of greed"), +loc("Bounty: Get 6 weapons for each kill (even on own hogs)."), +{amTardis,10}, +{{amClusterBomb,5},{amTardis,100},{amWhip,100},{amKamikaze,100},{amAirMine,2}}, {sndWarp,sndSameTeam},100} } ---very strange bug -GLOBAL_CONTINENT_INFORMATION[1][7]=100 -GLOBAL_CONTINENT_INFORMATION[1][6]={sndShotgunFire,sndCover} - --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) -local GLOBAL_WEAPONS_DAMAGE = { +CS.WEAPONS_DAMAGE = { {amKamikaze, 0, 1, 0, 1, 0}, {amSineGun, 0, 1, 0, 1, 0}, {amMineStrike, 0, 1, 6, 1, 1}, @@ -225,9 +398,8 @@ {amDrillStrike, 0, 1, 5, 1, 1}, {amBazooka, 0, 1, 0, 1, 0}, {amAirMine, 0, 1, 0, 1, 0}, - {amDuck, 0, 1, 0, 1, 0} } -local GLOBAL_WEAPONS_SUPPORT = { +CS.WEAPONS_SUPPORT = { {amParachute, 0, 1, 0, 1, 0}, {amGirder, 0, 1, 0, 1, 0}, {amSwitch, 0, 1, 0, 1, 0}, @@ -273,25 +445,25 @@ end function SpawnRandomCrate(x,y,strength) - local tot=table.maxn(GLOBAL_WEAPONS_SUPPORT)+table.maxn(GLOBAL_WEAPONS_DAMAGE) + local tot=table.maxn(CS.WEAPONS_SUPPORT)+table.maxn(CS.WEAPONS_DAMAGE) local rand=GetRandom(tot)+1 - if(rand>table.maxn(GLOBAL_WEAPONS_SUPPORT)) + if(rand>table.maxn(CS.WEAPONS_SUPPORT)) then - local weapon=rand-table.maxn(GLOBAL_WEAPONS_SUPPORT) + local weapon=rand-table.maxn(CS.WEAPONS_SUPPORT) - while(wepNotValidBorder(GLOBAL_WEAPONS_DAMAGE[weapon][1])==false) + while(wepNotValidBorder(CS.WEAPONS_DAMAGE[weapon][1])==false) do - if(weapon>=table.maxn(GLOBAL_WEAPONS_DAMAGE)) + if(weapon>=table.maxn(CS.WEAPONS_DAMAGE)) then weapon=0 end weapon = weapon+1 end - SpawnAmmoCrate(x, y, GLOBAL_WEAPONS_DAMAGE[weapon][1]) + SpawnAmmoCrate(x, y, CS.WEAPONS_DAMAGE[weapon][1]) else - SpawnUtilityCrate(x, y, GLOBAL_WEAPONS_SUPPORT[rand][1]) + SpawnUtilityCrate(x, y, CS.WEAPONS_SUPPORT[rand][1]) end end @@ -307,45 +479,42 @@ --reset all weapons for a team function CleanWeapons(hog) - local i=1 - --+1 for skip - while(i<=table.maxn(GLOBAL_WEAPONS_SUPPORT)+table.maxn(GLOBAL_WEAPONS_DAMAGE)+1) - do - AddAmmo(hog,i,0) - i=i+1 + for w=1, #CS.WEAPONS_SUPPORT do + AddAmmo(hog, CS.WEAPONS_SUPPORT[w][1], 0) end - - AddAmmo(hog,amSkip,100) + for w=1, #CS.WEAPONS_DAMAGE do + AddAmmo(hog, CS.WEAPONS_DAMAGE[w][1], 0) + end end --get the weapons from a weaponset function LoadWeaponset(hog, num) - for v,w in pairs(GLOBAL_CONTINENT_INFORMATION[num][5]) + for v,w in pairs(CS.CONTINENT_INFORMATION[num][5]) do ValidateWeapon(hog, w[1],w[2]) end - GLOBAL_TEMP_VALUE=GLOBAL_CONTINENT_INFORMATION[num][7] + CS.TEMP_VALUE=CS.CONTINENT_INFORMATION[num][7] runOnGears(SetHogHealth) end --list up all weapons from the icons for each continent function InitWeaponsMenu(hog) - if(GetHogLevel(hog)==0 or GLOBAL_CONTINENT_INFORMATION[1][6][1]==sndFrozenHogImpact) + if(GetHogLevel(hog)==0 or CS.CONTINENT_INFORMATION[1][6][1]==sndFrozenHogImpact) then - for v,w in pairs(GLOBAL_CONTINENT_INFORMATION) + for v,w in pairs(CS.CONTINENT_INFORMATION) do - ValidateWeapon(hog, GLOBAL_CONTINENT_INFORMATION[v][4][1],1) + ValidateWeapon(hog, CS.CONTINENT_INFORMATION[v][4][1], 100) end - AddAmmo(hog,amSwitch) --random continent + AddAmmo(hog, amSwitch, 100) --random continent --for the computers else --europe - ValidateWeapon(hog, GLOBAL_CONTINENT_INFORMATION[3][4][1],1) + ValidateWeapon(hog, CS.CONTINENT_INFORMATION[3][4][1], 100) --north america - ValidateWeapon(hog, GLOBAL_CONTINENT_INFORMATION[1][4][1],1) + ValidateWeapon(hog, CS.CONTINENT_INFORMATION[1][4][1], 100) end end @@ -360,13 +529,21 @@ end if(generalinf) then - geninftext="| |"..loc("General information")..": |"..GLOBAL_GENERAL_INFORMATION + geninftext="| |"..loc("General information:").."|"..GeneralInformation() + else + geninftext="| |"..loc("Press [Attack] to select this continent!") end - ShowMission(GLOBAL_CONTINENT_INFORMATION[continent][1],GLOBAL_CONTINENT_INFORMATION[continent][2]..loc(" Starting HP: ")..GLOBAL_CONTINENT_INFORMATION[continent][7],GLOBAL_CONTINENT_INFORMATION[continent][3]..geninftext, GLOBAL_CONTINENT_INFORMATION[continent][4][2], time) + ShowMission(CS.CONTINENT_INFORMATION[continent][1], + CS.CONTINENT_INFORMATION[continent][2], + string.format(loc("Initial health: %d"), CS.CONTINENT_INFORMATION[continent][7]) .. "|".. + CS.CONTINENT_INFORMATION[continent][3]..geninftext, + CS.CONTINENT_INFORMATION[continent][4][2], time) if(ns) then HideMission() + elseif not CS.GAME_STARTED then + AddCaption(CS.CONTINENT_INFORMATION[continent][1], GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmoinfo) end end @@ -426,11 +603,11 @@ function RandomContinentsGetWeapons(hog) if(GetGearType(hog) == gtHedgehog) then - local currCont=GLOBAL_TEAM_CONTINENT[GetHogTeamName(hog)] + local currCont=CS.TEAM_CONTINENT[GetHogTeamName(hog)] if(currCont~=0) then - local checkDefCont=GLOBAL_CONTINENT_INFORMATION[currCont][4][2] + local checkDefCont=CS.CONTINENT_INFORMATION[currCont][4][2] --for sunda local wepamount=getTeamValue(GetHogTeamName(hog), "sundaland-count") @@ -440,11 +617,10 @@ CleanWeapons(hog) local rand_weaponset_power = 0 - local currwep - rand_weaponset_power, currwep=GetRandomWeapon(hog,GLOBAL_WEAPONS_DAMAGE,100,true,false,rand_weaponset_power) - rand_weaponset_power, currwep=GetRandomWeapon(hog,GLOBAL_WEAPONS_SUPPORT,2,true,false,rand_weaponset_power) - rand_weaponset_power, currwep=GetRandomWeapon(hog,GLOBAL_WEAPONS_DAMAGE,1,true,false,rand_weaponset_power) + rand_weaponset_power=GetRandomWeapon(hog,CS.WEAPONS_DAMAGE,100,true,false,rand_weaponset_power) + rand_weaponset_power=GetRandomWeapon(hog,CS.WEAPONS_SUPPORT,2,true,false,rand_weaponset_power) + rand_weaponset_power=GetRandomWeapon(hog,CS.WEAPONS_DAMAGE,1,true,false,rand_weaponset_power) setTeamValue(GetHogTeamName(hog), "rand-done-turn", true) @@ -454,14 +630,30 @@ while(loci dmg) then - GLOBAL_TEMP_VALUE=GLOBAL_TEMP_VALUE+div(dmg*GLOBAL_VAMPIRIC_IS_ON,100) + CS.TEMP_VALUE=CS.TEMP_VALUE+div(dmg*CS.VAMPIRIC_IS_ON,100) SetHealth(hog, GetHealth(hog)-dmg) else - GLOBAL_TEMP_VALUE=GLOBAL_TEMP_VALUE+div(GetHealth(hog)*GLOBAL_VAMPIRIC_IS_ON,100) + CS.TEMP_VALUE=CS.TEMP_VALUE+div(GetHealth(hog)*CS.VAMPIRIC_IS_ON,100) SetHealth(hog, 0) end + HogOuch(hog) ShowDamageTag(hog,dmg) end end @@ -539,16 +747,17 @@ then if(gearIsInCircle(hog,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 120, false)==true and GetHogClan(hog) ~= GetHogClan(CurrentHedgehog)) then - local dmg=div((15+div(GetHealth(CurrentHedgehog)*10,100))*GLOBAL_EXTRA_DAMAGE_IS_ON,100) + local dmg=div((15+div(GetHealth(CurrentHedgehog)*10,100))*CS.EXTRA_DAMAGE_IS_ON,100) if(GetHealth(hog)>dmg) then - GLOBAL_TEMP_VALUE=GLOBAL_TEMP_VALUE+div(dmg*2,3)+div(dmg*GLOBAL_VAMPIRIC_IS_ON*2,100*3) + CS.TEMP_VALUE=CS.TEMP_VALUE+div(dmg*2,3)+div(dmg*CS.VAMPIRIC_IS_ON*2,100*3) SetHealth(hog, GetHealth(hog)-dmg) else - 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) + CS.TEMP_VALUE=CS.TEMP_VALUE+(div(GetHealth(hog)*75,100))+(div(GetHealth(CurrentHedgehog)*10,100))+div((GetHealth(hog)+div(GetHealth(CurrentHedgehog)*10,100))*CS.VAMPIRIC_IS_ON,100) SetHealth(hog, 0) end + HogOuch(hog) ShowDamageTag(hog,dmg) AddVisualGear(GetX(hog), GetY(hog), vgtExplosion, 0, false) AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtSmokeWhite, 0, false) @@ -562,7 +771,7 @@ then if(GetHogClan(hog) ~= GetHogClan(CurrentHedgehog) and gearIsInCircle(hog,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 390, false)) then - GLOBAL_TEMP_VALUE=GLOBAL_TEMP_VALUE+1 + CS.TEMP_VALUE=CS.TEMP_VALUE+1 end end end @@ -570,17 +779,17 @@ function KerguelenSpecialYellowSwap(hog) if(GetGearType(hog) == gtHedgehog) then - if(GLOBAL_KERGUELEN_SPECIAL ~= -1 and GetHogClan(hog) ~= GetHogClan(CurrentHedgehog) and gearIsInCircle(hog,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 420, false)) + if(CS.KERGUELEN_SPECIAL ~= -1 and GetHogClan(hog) ~= GetHogClan(CurrentHedgehog) and gearIsInCircle(hog,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 420, false)) then - if(GLOBAL_TEMP_VALUE==0) + if(CS.TEMP_VALUE==0) then local thisX=GetX(CurrentHedgehog) local thisY=GetY(CurrentHedgehog) SetGearPosition(CurrentHedgehog, GetX(hog), GetY(hog)) SetGearPosition(hog, thisX, thisY) - GLOBAL_KERGUELEN_SPECIAL=-1 + CS.KERGUELEN_SPECIAL=-1 else - GLOBAL_TEMP_VALUE=GLOBAL_TEMP_VALUE-1 + CS.TEMP_VALUE=CS.TEMP_VALUE-1 end end end @@ -592,8 +801,8 @@ then if(CurrentHedgehog~=hog and gearIsInCircle(hog,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 80, false)) then - GLOBAL_TEMP_VALUE=1 - GLOBAL_SABOTAGE_HOGS[hog]=1 + CS.TEMP_VALUE=1 + CS.SABOTAGE_HOGS[hog]=1 AddGear(GetX(hog), GetY(hog), gtCluster, 0, 0, 0, 1) PlaySound(sndNooo,hog) end @@ -602,9 +811,9 @@ --first part on kerguelen special (lonely cries) function KerguelenSpecialBlueCheck(hog) - if(GetGearType(hog) == gtHedgehog and hog ~= CurrentHedgehog and gearIsInCircle(hog,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 500, false)) + if(GetGearType(hog) == gtHedgehog and hog ~= CurrentHedgehog and GetHealth(CurrentHedgehog) and gearIsInCircle(hog,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 500, false)) then - GLOBAL_TEMP_VALUE=1 + CS.TEMP_VALUE=1 end end @@ -612,17 +821,18 @@ function KerguelenSpecialBlueActivate(hog) if(GetGearType(hog) == gtHedgehog) then - local dmg=div(6*GLOBAL_EXTRA_DAMAGE_IS_ON,100) + local dmg=div(6*CS.EXTRA_DAMAGE_IS_ON,100) if(GetHogClan(hog) ~= GetHogClan(CurrentHedgehog)) then if(GetHealth(hog) > dmg) then - GLOBAL_TEMP_VALUE=GLOBAL_TEMP_VALUE+div(dmg*GLOBAL_VAMPIRIC_IS_ON,100) + CS.TEMP_VALUE=CS.TEMP_VALUE+div(dmg*CS.VAMPIRIC_IS_ON,100) SetHealth(hog, GetHealth(hog)-dmg) else - GLOBAL_TEMP_VALUE=GLOBAL_TEMP_VALUE+div(GetHealth(hog)*GLOBAL_VAMPIRIC_IS_ON,100) + CS.TEMP_VALUE=CS.TEMP_VALUE+div(GetHealth(hog)*CS.VAMPIRIC_IS_ON,100) SetHealth(hog, 0) end + HogOuch(hog, "moan") ShowDamageTag(hog,dmg) AddVisualGear(GetX(hog), GetY(hog)-30, vgtEvilTrace, 0, false) @@ -637,15 +847,15 @@ local power_radius_outer=230 local power_sa=700000 local hypo=0 - if(gearIsInCircle(hog,GetX(GLOBAL_TEMP_VALUE), GetY(GLOBAL_TEMP_VALUE), power_radius_outer, false)) + if(gearIsInCircle(hog,GetX(CS.TEMP_VALUE), GetY(CS.TEMP_VALUE), power_radius_outer, false)) then if(hog == CurrentHedgehog) then SetState(CurrentHedgehog, gstMoving) end SetGearPosition(hog, GetX(hog),GetY(hog)-3) - hypo=Norm(math.abs(GetX(hog)-GetX(GLOBAL_TEMP_VALUE)),math.abs(GetY(hog)-GetY(GLOBAL_TEMP_VALUE))) - 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)) + hypo=Norm(math.abs(GetX(hog)-GetX(CS.TEMP_VALUE)),math.abs(GetY(hog)-GetY(CS.TEMP_VALUE))) + SetGearVelocity(hog, div((power_radius_outer-hypo)*power_sa*GetIfNegative(GetX(hog)-GetX(CS.TEMP_VALUE)),power_radius_outer), div((power_radius_outer-hypo)*power_sa*GetIfNegative(GetY(hog)-GetY(CS.TEMP_VALUE)),power_radius_outer)) end end end @@ -654,10 +864,11 @@ function NorthAmericaSpecialSniper(hog) if(GetGearType(hog) == gtHedgehog) then - if(gearIsInCircle(GLOBAL_TEMP_VALUE,GetX(hog), GetY(hog), 20, false)) + if(gearIsInCircle(CS.TEMP_VALUE,GetX(hog), GetY(hog), 20, false)) then SetEffect(hog, hePoisoned, 5) PlaySound(sndBump) + SetSoundMask(sndMissed, true) end end end @@ -666,12 +877,13 @@ function EuropeSpecialMolotovHit(hog) if(GetGearType(hog) == gtHedgehog) then - if(gearIsInCircle(GLOBAL_TEMP_VALUE,GetX(hog), GetY(hog), 100, false)) + if(gearIsInCircle(CS.TEMP_VALUE,GetX(hog), GetY(hog), 100, false)) then local healthadd=15 - HealHog(hog, healthadd+(div(healthadd*GLOBAL_VAMPIRIC_IS_ON,100)), hog == CurrentHedgehog) + HealHog(hog, healthadd+(div(healthadd*CS.VAMPIRIC_IS_ON,100)), hog == CurrentHedgehog) SetEffect(hog, hePoisoned, false) - GLOBAL_SABOTAGE_HOGS[hog]=0 + CS.SABOTAGE_HOGS[hog]=0 + SetSoundMask(sndMissed, true) end end end @@ -690,15 +902,15 @@ continentinfo[4]={} if(icon==1000) then - local mid=table.maxn(GLOBAL_WEAPONS_DAMAGE) - local max=mid+table.maxn(GLOBAL_WEAPONS_SUPPORT) + local mid=table.maxn(CS.WEAPONS_DAMAGE) + local max=mid+table.maxn(CS.WEAPONS_SUPPORT) local ic=(string.byte(string) % max)+1 if(ic>mid) then - ic=GLOBAL_WEAPONS_SUPPORT[ic-mid][1] + ic=CS.WEAPONS_SUPPORT[ic-mid][1] else - ic=GLOBAL_WEAPONS_DAMAGE[ic][1] + ic=CS.WEAPONS_DAMAGE[ic][1] end continentinfo[4][1]=ic @@ -756,9 +968,10 @@ if(continentinfo[5]~=nil and continentinfo[5][1]~=nil) then - continentinfo[3]="- "..continentinfo[1]..loc(" was extracted from the scheme|- This continent will be able to use the specials from the other continents!") + continentinfo[3] = + string.format(loc("%s was extracted from the scheme"), continentinfo[1]) - table.insert(GLOBAL_CONTINENT_INFORMATION, continentinfo) + table.insert(CS.CONTINENT_INFORMATION, continentinfo) end return nil @@ -782,7 +995,7 @@ if(continentinfo~=nil) then - table.insert(GLOBAL_CONTINENT_INFORMATION, continentinfo) + table.insert(CS.CONTINENT_INFORMATION, continentinfo) end return end @@ -808,7 +1021,7 @@ if(match~=nil) then - GLOBAL_TEMP_VALUE=1 + CS.TEMP_VALUE=1 ScriptParam=string.gsub(ScriptParam,"(,?)"..searchfor.."(,?)","") end @@ -818,7 +1031,7 @@ if(match~=nil) then - OPTION_NO_SPECIALS=true + CS.OPTION_NO_SPECIALS=true ScriptParam=string.gsub(ScriptParam,"(,?)"..searchfor.."(,?)","") end @@ -828,7 +1041,7 @@ if(match~=nil) then - GLOBAL_CONTINENT_INFORMATION={} + CS.CONTINENT_INFORMATION={} ScriptParam=string.gsub(ScriptParam,"(,?)"..searchfor.."(,?)","") end @@ -839,7 +1052,7 @@ if(continentinfo~=nil) then - table.insert(GLOBAL_CONTINENT_INFORMATION, continentinfo) + table.insert(CS.CONTINENT_INFORMATION, continentinfo) end end end @@ -849,36 +1062,95 @@ SetAmmo(amSkip, 9, 0, 0, 0) - for v,w in pairs(GLOBAL_WEAPONS_DAMAGE) + for v,w in pairs(CS.WEAPONS_DAMAGE) do SetAmmo(w[1], w[2], w[3], w[4], w[5]) end - for v,w in pairs(GLOBAL_WEAPONS_SUPPORT) + for v,w in pairs(CS.WEAPONS_SUPPORT) do SetAmmo(w[1], w[2], w[3], w[4], w[5]) end end +function SetCSAmmoDescriptions(mode) + if mode == "continents" then + for c=1, #CS.CONTINENT_INFORMATION do + local cont = CS.CONTINENT_INFORMATION[c] + local hp = string.format(loc("Initial health: %d"), cont[7]) + SetAmmoTexts(cont[4][1], cont[1], cont[2], hp .."|" .. cont[3]) + SetAmmoDescriptionAppendix(cont[4][1], nil) + end + SetAmmoTexts(amSwitch, loc("Random continent"), loc("If you just don't care …"), loc("Select this item for a random continent.")) + + elseif mode == "weapons" then + local specSelect = loc("Switch: Select weapon special") + local specHeader = loc("Available weapon specials:") + local specText="|".. + specSelect.."| |".. + specHeader.."|" + + SetAmmoDescriptionAppendix(amSniperRifle, + specText.. + CS.SNIPER_SPECIAL_INFO) + SetAmmoDescriptionAppendix(amBaseballBat, + specText.. + CS.BASEBALLBAT_BOOMERANG_INFO .. "|" .. + CS.BASEBALLBAT_CRICKET_INFO .. "|" .. + loc("These weapon specials cannot be used close to other hogs.")) + SetAmmoDescriptionAppendix(amGasBomb, + specText.. + CS.CHEESE_SPECIAL_INFO) + SetAmmoDescriptionAppendix(amSeduction, + specSelect .. "|" .. + CS.INVULNERABLE_SPECIAL_CTRL .. "| |" .. + specHeader .. "|" .. + CS.SEDUCTION_SPECIAL_INFO .. "|" .. + CS.INVULNERABLE_SPECIAL_INFO) + SetAmmoDescriptionAppendix(amParachute, + loc("Switch: Drop ball of dirt from parachute (once)") .. "| |" .. + specHeader .. "|" .. + CS.PARACHUTE_SPECIAL_INFO) + SetAmmoDescriptionAppendix(amHammer, + specText.. + CS.HAMMER_ROAR_INFO .. "|" .. + CS.HAMMER_SWAP_INFO .. "|" .. + CS.HAMMER_LONELY_INFO .. "|" .. + CS.HAMMER_SABOTAGE_INFO) + SetAmmoDescriptionAppendix(amSMine, + specText.. + CS.STICKY_PROJECTILE_INFO .. "|" .. + CS.STICKY_NAPALM_INFO) + SetAmmoDescriptionAppendix(amShotgun, + specText.. + CS.SHOTGUN_SPECIAL_INFO) + SetAmmoDescriptionAppendix(amMolotov, + specText.. + CS.MOLOTOV_SPECIAL_INFO) + SetAmmoDescriptionAppendix(amPickHammer, + specText.. + CS.PICKHAMMER_SPECIAL_INFO) + + for c=1, #CS.CONTINENT_INFORMATION do + local cont = CS.CONTINENT_INFORMATION[c] + SetAmmoTexts(cont[4][1], nil, nil, nil) + end + SetAmmoTexts(amSwitch, nil, nil, nil) + end + + if mode == "continents" or not CS.GAME_STARTED then + SetAmmoTexts(amSkip, loc("Select continent"), loc("Continent selection"), loc("Select the current continent.") .. "|" .. loc("Choose your continent wisely, as your decision will be permanent.") .. "|" .. loc("Up/Down: Browse through continents") .. "|" .. loc("Attack: Select this continent")) + else + SetAmmoTexts(amSkip, nil, nil, nil) + end +end + --on game start function onGameStart() - ShowMission(loc("Continental supplies"),loc("Let a continent provide your weapons!"),GLOBAL_GENERAL_INFORMATION, -amLowGravity, 0) - - local specText="| |"..loc("Additional feautures for this weapon: (Switch/Tab)").."|" + ShowMission(loc("Continental supplies"),loc("Let a continent provide your weapons!"),GeneralInformation(), 0, 0) + SetCSAmmoDescriptions("continents") - SetAmmoDescriptionAppendix(amSniperRifle,specText..GLOBAL_SNIPER_SPECIAL_INFO) - SetAmmoDescriptionAppendix(amBaseballBat,specText..GLOBAL_BASEBALLBAT_BOOMERANG_INFO .. "|" .. GLOBAL_BASEBALLBAT_CRICKET_INFO) - SetAmmoDescriptionAppendix(amGasBomb,specText..GLOBAL_CHEESE_SPECIAL_INFO) - SetAmmoDescriptionAppendix(amSeduction,specText..GLOBAL_SEDUCTION_SPECIAL_INFO) - SetAmmoDescriptionAppendix(amInvulnerable,specText..GLOBAL_INVULNERABLE_SPECIAL_INFO) - SetAmmoDescriptionAppendix(amParachute,specText..GLOBAL_PARACHUTE_SPECIAL_INFO) - SetAmmoDescriptionAppendix(amHammer,specText..GLOBAL_HAMMER_ROAR_INFO .. "|" .. GLOBAL_HAMMER_SWAP_INFO .. "|" .. GLOBAL_HAMMER_LONELY_INFO .. "|" .. GLOBAL_HAMMER_SABOTAGE_INFO) - SetAmmoDescriptionAppendix(amSMine,specText..GLOBAL_STICKY_PROJECTILE_INFO .. "|" .. GLOBAL_STICKY_NAPALM_INFO) - SetAmmoDescriptionAppendix(amShotgun,specText..GLOBAL_SHOTGUN_SPECIAL_INFO) - SetAmmoDescriptionAppendix(amMolotov,specText..GLOBAL_MOLOTOV_SPECIAL_INFO) - SetAmmoDescriptionAppendix(amPickHammer,specText..GLOBAL_PICKHAMMER_SPECIAL_INFO) - - if(GLOBAL_TEMP_VALUE==1) + if(CS.TEMP_VALUE==1) then runOnGears(HogNameToWeaponset) end @@ -890,74 +1162,83 @@ --what happen when a turn starts function onNewTurn() + --will refresh the info on each tab weapon + CS.AUSTRALIAN_SPECIAL=0 + CS.AFRICAN_SPECIAL_SEDUCTION=0 + CS.SEDUCTION_INCREASER=0 + CS.SOUTH_AMERICAN_SPECIAL=false + CS.AFRICAN_SPECIAL_STICKY=0 + CS.KERGUELEN_SPECIAL=1 + CS.NORTH_AMERICAN_SPECIAL_SNIPER=1 + CS.NORTH_AMERICAN_SPECIAL_SHOTGUN=false + CS.NORTH_AMERICAN_SPECIAL_SNIPER_IS_ON=false + CS.EUROPE_SPECIAL=0 + CS.VAMPIRIC_IS_ON=0 + CS.EXTRA_DAMAGE_IS_ON=100 + CS.SABOTAGE_COUNTER=0 + CS.ANTARCTICA_SPECIAL=0 - --will refresh the info on each tab weapon - GLOBAL_AUSTRALIAN_SPECIAL=0 - GLOBAL_AFRICAN_SPECIAL_SEDUCTION=0 - GLOBAL_SEDUCTION_INCREASER=0 - GLOBAL_SOUTH_AMERICAN_SPECIAL=false - GLOBAL_AFRICAN_SPECIAL_STICKY=0 - GLOBAL_KERGUELEN_SPECIAL=1 - GLOBAL_NORTH_AMERICAN_SPECIAL_SNIPER=1 - GLOBAL_NORTH_AMERICAN_SPECIAL_SHOTGUN=false - GLOBAL_NORTH_AMERICAN_SPECIAL_SNIPER_IS_ON=false - GLOBAL_EUROPE_SPECIAL=0 - GLOBAL_VAMPIRIC_IS_ON=0 - GLOBAL_EXTRA_DAMAGE_IS_ON=100 - GLOBAL_CRATE_TEST=-1 - GLOBAL_SABOTAGE_COUNTER=0 - GLOBAL_ANTARCTICA_SPECIAL=0 + CS.TEMP_VALUE=0 + + CS.SUNDALAND_END_HOG_CONTINENT_NAME=GetHogTeamName(CurrentHedgehog) - GLOBAL_TEMP_VALUE=0 + if TotalRounds >= 1 then + CS.GAME_STARTED = true + end - GLOBAL_SUNDALAND_END_HOG_CONTINENT_NAME=GetHogTeamName(CurrentHedgehog) + SetSoundMask(sndLaugh, false) + SetSoundMask(sndMissed, false) + CS.AFRICAN_SPECIAL_NON_PROJECTILE_USED=false + SetAttackState(true) --when all hogs are "placed" if(GetCurAmmoType()~=amTeleport) then --will run once when the game really starts (after placing hogs and so on - if(GLOBAL_INIT_TEAMS[GetHogTeamName(CurrentHedgehog)] == nil) + if(CS.INIT_TEAMS[GetHogTeamName(CurrentHedgehog)] == nil) then - SetInputMask(band(0xFFFFFFFF,gmWeapon)) + SetInputMask(band(GetInputMask(), gmWeapon)) - if(GLOBAL_START_TIME==0) + if(CS.START_TIME==0) then - GLOBAL_START_TIME=TurnTimeLeft - GLOBAL_HOG_HEALTH=GetHealth(CurrentHedgehog) + CS.START_TIME=TurnTimeLeft + CS.HOG_HEALTH=GetHealth(CurrentHedgehog) end TurnTimeLeft=100000 - AddCaption(GLOBAL_SELECT_WEP_INFORMATION, GetClanColor(GetHogClan(CurrentHedgehog)), capgrpMessage) - ShowMission(loc("Continental supplies"),loc("Let a continent provide your weapons!"),GLOBAL_GENERAL_INFORMATION, -amLowGravity, 0) - HideMission() + AddCaption(string.format(CS.SELECT_WEP_INFORMATION_SHORT, GetHogTeamName(CurrentHedgehog)), 0xFFFFFFFF, capgrpGameState) + AddCaption(loc("No continent selected"), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmoinfo) + CS.SELECT_CONTINENT_CHECK=true + ShowMission(loc("Continental supplies"),loc("Let a continent provide your weapons!"),GeneralInformation(), 0, 0) + SetCSAmmoDescriptions("continents") InitWeaponsMenu(CurrentHedgehog) - GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]=0 - GLOBAL_SELECT_CONTINENT_CHECK=true - GLOBAL_INIT_TEAMS[GetHogTeamName(CurrentHedgehog)] = 2 + CS.TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]=0 + CS.INIT_TEAMS[GetHogTeamName(CurrentHedgehog)] = 2 --- if(GLOBAL_SABOTAGE_HOGS[CurrentHedgehog]==1) --- then --- GLOBAL_SABOTAGE_COUNTER=-750 --- end else --if its not the initialization turn - GLOBAL_SELECT_CONTINENT_CHECK=false - SetInputMask(0xFFFFFFFF) + CS.SELECT_CONTINENT_CHECK=false + SetInputMask(bor(GetInputMask(), bnot(gmWeapon))) - if(GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]==0) + if(CS.TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]==0) then - GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]=GetRandom(table.maxn(GLOBAL_CONTINENT_INFORMATION))+1 + CS.TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]=GetRandom(table.maxn(CS.CONTINENT_INFORMATION))+1 SetContinentWeapons() end - local currCont=GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)] - local checkDefCont=GLOBAL_CONTINENT_INFORMATION[currCont][4][2] + local currCont=CS.TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)] + local checkDefCont=CS.CONTINENT_INFORMATION[currCont][4][2] --give zeelandia-teams new weapons so they can plan for the next turn + -- Use temporary value to store list of collected weapons + CS.TEMP_VALUE = {} runOnGears(RandomContinentsGetWeapons) + for hog, ammoList in pairs(CS.TEMP_VALUE) do + CollectMultiAmmo(hog, ammoList, true) + end - --some specials for some continents (GLOBAL_TEMP_VALUE is from get random weapons) + --some specials for some continents (CS.TEMP_VALUE is from get random weapons) if(checkDefCont==9) then setTeamValue(GetHogTeamName(CurrentHedgehog), "rand-done-turn", false) @@ -969,13 +1250,10 @@ setTeamValue(GetHogTeamName(CurrentHedgehog), "Antarctica2-turntick", 1) end + -- Antarctic summer if(getTeamValue(GetHogTeamName(CurrentHedgehog), "Antarctica2-turntick")>=4) then - AddAmmo(CurrentHedgehog,amPortalGun) - AddAmmo(CurrentHedgehog,amSineGun) - AddAmmo(CurrentHedgehog,amSineGun) - AddAmmo(CurrentHedgehog,amGirder) - AddAmmo(CurrentHedgehog,amSnowball) + CollectMultiAmmo(CurrentHedgehog, {[amPortalGun] = 1, [amSineGun] = 2, [amGirder] = 1, [amSnowball] = 1}) setTeamValue(GetHogTeamName(CurrentHedgehog), "Antarctica2-turntick", 0) end setTeamValue(GetHogTeamName(CurrentHedgehog), "Antarctica2-turntick", getTeamValue(GetHogTeamName(CurrentHedgehog), "Antarctica2-turntick")+1) @@ -990,384 +1268,583 @@ if(getTeamValue(GetHogTeamName(CurrentHedgehog), "Asia-turntick")>=2) then - AddAmmo(CurrentHedgehog,amParachute) + CollectMultiAmmo(CurrentHedgehog, {[amParachute] = 1}) setTeamValue(GetHogTeamName(CurrentHedgehog), "Asia-turntick", 0) end setTeamValue(GetHogTeamName(CurrentHedgehog), "Asia-turntick", getTeamValue(GetHogTeamName(CurrentHedgehog), "Asia-turntick")+1) elseif(checkDefCont==1) then - GLOBAL_TEMP_VALUE=0 + CS.TEMP_VALUE=0 runOnGears(CountHogsInTeam) - if(GLOBAL_TEMP_VALUE>1) + if(CS.TEMP_VALUE>1) then AddAmmo(CurrentHedgehog,amSwitch,GetAmmoCount(CurrentHedgehog, amSwitch)+1) SetWeapon(amSwitch) - GLOBAL_TEMP_VALUE=87 + CS.TEMP_VALUE=87 end end ShowContinentInfo(currCont,-1,true) + SetCSAmmoDescriptions("weapons") end end end +function ShowSpecialWeaponCaption(ammoType) + --place mine (australia) + if(ammoType == amBaseballBat) + then + if(CS.AUSTRALIAN_SPECIAL==1) + then + AddCaption(CS.BASEBALLBAT_CRICKET_NAME, GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmoinfo) + elseif(CS.AUSTRALIAN_SPECIAL==2) + then + AddCaption(CS.BASEBALLBAT_BOOMERANG_NAME, GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmoinfo) + else + AddCaption(GetAmmoName(amBaseballBat), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmoinfo) + end + + --africa + elseif(ammoType == amSeduction) + then + if(CS.AFRICAN_SPECIAL_SEDUCTION==1) + then + AddCaption(CS.SEDUCTION_SPECIAL_NAME, GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmoinfo) + AddCaption(string.format(CS.INVULNERABLE_SPECIAL_CAPTION, CS.SEDUCTION_INCREASER, GetAmmoCount(CurrentHedgehog,amInvulnerable)), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmostate) + else + AddCaption(GetAmmoName(amSeduction), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmoinfo) + end + + --south america + elseif(ammoType == amGasBomb) + then + if(CS.SOUTH_AMERICAN_SPECIAL==true) + then + AddCaption(CS.CHEESE_SPECIAL_NAME, GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmoinfo) + else + AddCaption(GetAmmoName(amGasBomb), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmoinfo) + end + + --africa + elseif(ammoType == amSMine) + then + if(CS.AFRICAN_SPECIAL_STICKY==1) + then + AddCaption(CS.STICKY_PROJECTILE_NAME, GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmoinfo) + elseif(CS.AFRICAN_SPECIAL_STICKY == 2) + then + AddCaption(CS.STICKY_NAPALM_NAME, GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmoinfo) + else + AddCaption(GetAmmoName(amSMine), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmoinfo) + end + + --north america (sniper) + elseif(ammoType == amSniperRifle and CS.NORTH_AMERICAN_SPECIAL_SNIPER_IS_ON==false) + then + if(CS.NORTH_AMERICAN_SPECIAL_SNIPER==1) + then + AddCaption(GetAmmoName(amSniperRifle), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmoinfo) + elseif(CS.NORTH_AMERICAN_SPECIAL_SNIPER==2) + then + AddCaption(CS.SNIPER_SPECIAL_NAME, GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmoinfo) + end + + --north america (shotgun) + elseif(ammoType == amShotgun) + then + if(CS.NORTH_AMERICAN_SPECIAL_SHOTGUN==true) + then + AddCaption(CS.SHOTGUN_SPECIAL_NAME, GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmoinfo) + else + AddCaption(GetAmmoName(amShotgun), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmoinfo) + end + + --europe + elseif(ammoType == amMolotov) + then + if(CS.EUROPE_SPECIAL==1) + then + AddCaption(CS.MOLOTOV_SPECIAL_NAME, GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmoinfo) + else + AddCaption(GetAmmoName(amMolotov), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmoinfo) + end + + --antarctica + elseif(ammoType == amPickHammer) + then + if(CS.ANTARCTICA_SPECIAL==1) + then + AddCaption(CS.PICKHAMMER_SPECIAL_NAME, GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmoinfo) + else + AddCaption(GetAmmoName(amPickHammer), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmoinfo) + end + + --kerguelen + elseif(ammoType == amHammer) + then + if(CS.KERGUELEN_SPECIAL==1) + then + AddCaption(GetAmmoName(amHammer), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmoinfo) + elseif(CS.KERGUELEN_SPECIAL==2) + then + AddCaption(CS.HAMMER_ROAR_NAME, GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmoinfo) + elseif(CS.KERGUELEN_SPECIAL==3) + then + AddCaption(CS.HAMMER_SWAP_NAME, GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmoinfo) + elseif(CS.KERGUELEN_SPECIAL==5) + then + AddCaption(CS.HAMMER_LONELY_NAME, GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmoinfo) + elseif(CS.KERGUELEN_SPECIAL==6) + then + AddCaption(CS.HAMMER_SABOTAGE_NAME, GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmoinfo) + end + end +end + +function onPrecise() + CS.PRECISE = true +end +function onPreciseUp() + CS.PRECISE = false +end + --what happens when you press "tab" (common button) function onSwitch() - if(GLOBAL_SWITCH_HOG_IS_ON==false) + if(CS.SWITCH_HOG_IS_ON==false) then - if(OPTION_NO_SPECIALS==false and GLOBAL_SELECT_CONTINENT_CHECK==false) + if(CS.OPTION_NO_SPECIALS==false and CS.SELECT_CONTINENT_CHECK==false and + band(GetState(CurrentHedgehog), gstAttacked) == 0 and + band(GetState(CurrentHedgehog), gstHHDriven) ~= 0) then --place mine (australia) if(GetCurAmmoType() == amBaseballBat) then - if(GLOBAL_AUSTRALIAN_SPECIAL==0) - then - GLOBAL_AUSTRALIAN_SPECIAL = 1 - AddCaption(GLOBAL_BASEBALLBAT_CRICKET_INFO) - elseif(GLOBAL_AUSTRALIAN_SPECIAL==1) - then - GLOBAL_AUSTRALIAN_SPECIAL = 2 - AddCaption(GLOBAL_BASEBALLBAT_BOOMERANG_INFO) - else - GLOBAL_AUSTRALIAN_SPECIAL = 0 - AddCaption(loc("DEFAULT")) - end + CS.AUSTRALIAN_SPECIAL = CS.AUSTRALIAN_SPECIAL + 1 + CS.AUSTRALIAN_SPECIAL = CS.AUSTRALIAN_SPECIAL % 3 + + SetAttackState(CS.AUSTRALIAN_SPECIAL == 0) --Asian special - elseif(GLOBAL_PARACHUTE_IS_ON==1) + elseif(CS.PARACHUTE_IS_ON==1) then - asiabomb=AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog)+3, gtSnowball, 0, 0, 0, 0) + local asiabomb=AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog)+3, gtSnowball, 0, 0, 0, 0) SetGearMessage(asiabomb, 1) - GLOBAL_PARACHUTE_IS_ON=2 - GLOBAL_SELECT_CONTINENT_CHECK=false + CS.PARACHUTE_IS_ON=2 + CS.SELECT_CONTINENT_CHECK=false --africa elseif(GetCurAmmoType() == amSeduction) then - if(GLOBAL_AFRICAN_SPECIAL_SEDUCTION==0) + if(CS.AFRICAN_SPECIAL_SEDUCTION==0) then - GLOBAL_AFRICAN_SPECIAL_SEDUCTION = 1 - - AddCaption(string.format(GLOBAL_SEDUCTION_SPECIAL_INFO,GLOBAL_SEDUCTION_INCREASER)) + CS.AFRICAN_SPECIAL_SEDUCTION = 1 else - GLOBAL_AFRICAN_SPECIAL_SEDUCTION = 0 - AddCaption(loc("DEFAULT")) + CS.AFRICAN_SPECIAL_SEDUCTION = 0 end --south america elseif(GetCurAmmoType() == amGasBomb) then - if(GLOBAL_SOUTH_AMERICAN_SPECIAL==false) + if(CS.SOUTH_AMERICAN_SPECIAL==false) then - GLOBAL_SOUTH_AMERICAN_SPECIAL = true - AddCaption(GLOBAL_CHEESE_SPECIAL_INFO) + CS.SOUTH_AMERICAN_SPECIAL = true else - GLOBAL_SOUTH_AMERICAN_SPECIAL = false - AddCaption(loc("DEFAULT")) + CS.SOUTH_AMERICAN_SPECIAL = false end --africa elseif(GetCurAmmoType() == amSMine) then - if(GLOBAL_AFRICAN_SPECIAL_STICKY==0) - then - GLOBAL_AFRICAN_SPECIAL_STICKY = 1 - AddCaption(GLOBAL_STICKY_PROJECTILE_INFO) - elseif(GLOBAL_AFRICAN_SPECIAL_STICKY == 1) - then - GLOBAL_AFRICAN_SPECIAL_STICKY = 2 - AddCaption(GLOBAL_STICKY_NAPALM_INFO) - elseif(GLOBAL_AFRICAN_SPECIAL_STICKY == 2) - then - GLOBAL_AFRICAN_SPECIAL_STICKY = 0 - AddCaption(loc("DEFAULT")) - end + CS.AFRICAN_SPECIAL_STICKY = CS.AFRICAN_SPECIAL_STICKY + 1 + CS.AFRICAN_SPECIAL_STICKY = CS.AFRICAN_SPECIAL_STICKY % 3 + SetSoundMask(sndLaugh, CS.AFRICAN_SPECIAL_STICKY ~= 0) --north america (sniper) - elseif(GetCurAmmoType() == amSniperRifle and GLOBAL_NORTH_AMERICAN_SPECIAL_SNIPER_IS_ON==false) + elseif(GetCurAmmoType() == amSniperRifle and CS.NORTH_AMERICAN_SPECIAL_SNIPER_IS_ON==false) then - if(GLOBAL_NORTH_AMERICAN_SPECIAL_SNIPER==2) + if(CS.NORTH_AMERICAN_SPECIAL_SNIPER==2) then - GLOBAL_NORTH_AMERICAN_SPECIAL_SNIPER = 1 - AddCaption(loc("DEFAULT")) - elseif(GLOBAL_NORTH_AMERICAN_SPECIAL_SNIPER==1) + CS.NORTH_AMERICAN_SPECIAL_SNIPER = 1 + elseif(CS.NORTH_AMERICAN_SPECIAL_SNIPER==1) then - GLOBAL_NORTH_AMERICAN_SPECIAL_SNIPER = 2 - AddCaption(GLOBAL_SNIPER_SPECIAL_INFO) + CS.NORTH_AMERICAN_SPECIAL_SNIPER = 2 end --north america (shotgun) elseif(GetCurAmmoType() == amShotgun) then - if(GLOBAL_NORTH_AMERICAN_SPECIAL_SHOTGUN==false) + if(CS.NORTH_AMERICAN_SPECIAL_SHOTGUN==false) then - GLOBAL_NORTH_AMERICAN_SPECIAL_SHOTGUN = true - AddCaption(GLOBAL_SHOTGUN_SPECIAL_INFO) + CS.NORTH_AMERICAN_SPECIAL_SHOTGUN = true else - GLOBAL_NORTH_AMERICAN_SPECIAL_SHOTGUN = false - AddCaption(loc("DEFAULT")) + CS.NORTH_AMERICAN_SPECIAL_SHOTGUN = false end --europe elseif(GetCurAmmoType() == amMolotov) then - if(GLOBAL_EUROPE_SPECIAL==0) + if(CS.EUROPE_SPECIAL==0) then - GLOBAL_EUROPE_SPECIAL = 1 - AddCaption(GLOBAL_MOLOTOV_SPECIAL_INFO) + CS.EUROPE_SPECIAL = 1 else - GLOBAL_EUROPE_SPECIAL = 0 - AddCaption(loc("DEFAULT")) + CS.EUROPE_SPECIAL = 0 end --antarctica elseif(GetCurAmmoType() == amPickHammer) then - if(GLOBAL_ANTARCTICA_SPECIAL==0) + if(CS.ANTARCTICA_SPECIAL==0) then - GLOBAL_ANTARCTICA_SPECIAL = 1 - AddCaption(GLOBAL_PICKHAMMER_SPECIAL_INFO) + CS.ANTARCTICA_SPECIAL = 1 else - GLOBAL_ANTARCTICA_SPECIAL = 0 - AddCaption(loc("DEFAULT")) + CS.ANTARCTICA_SPECIAL = 0 end --kerguelen elseif(GetCurAmmoType() == amHammer) then - if(GLOBAL_KERGUELEN_SPECIAL==6) + if(CS.KERGUELEN_SPECIAL==6) then - GLOBAL_KERGUELEN_SPECIAL = 1 - AddCaption("DEFAULT") - elseif(GLOBAL_KERGUELEN_SPECIAL==1) + CS.KERGUELEN_SPECIAL = 1 + elseif(CS.KERGUELEN_SPECIAL==1) then - GLOBAL_KERGUELEN_SPECIAL = 2 - AddCaption("#"..GLOBAL_HAMMER_ROAR_INFO) - elseif(GLOBAL_KERGUELEN_SPECIAL==2) + CS.KERGUELEN_SPECIAL = 2 + elseif(CS.KERGUELEN_SPECIAL==2) then - GLOBAL_KERGUELEN_SPECIAL = 3 - AddCaption("##"..GLOBAL_HAMMER_SWAP_INFO) - elseif(GLOBAL_KERGUELEN_SPECIAL==3) + CS.KERGUELEN_SPECIAL = 3 + elseif(CS.KERGUELEN_SPECIAL==3) + then + CS.KERGUELEN_SPECIAL = 5 + elseif(CS.KERGUELEN_SPECIAL==5) then - GLOBAL_KERGUELEN_SPECIAL = 5 - AddCaption("###"..GLOBAL_HAMMER_LONELY_INFO) - elseif(GLOBAL_KERGUELEN_SPECIAL==5) - then - GLOBAL_KERGUELEN_SPECIAL = 6 - AddCaption("####"..GLOBAL_HAMMER_SABOTAGE_INFO) + CS.KERGUELEN_SPECIAL = 6 end + SetAttackState(CS.KERGUELEN_SPECIAL == 1) end + ShowSpecialWeaponCaption(GetCurAmmoType()) end --for selecting weaponset, this is mostly for old players. - if(GetHogLevel(CurrentHedgehog)==0 and GLOBAL_SELECT_CONTINENT_CHECK==true and (GetCurAmmoType() == amSkip or GetCurAmmoType() == amNothing)) - then - GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]=GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]+1 + -- Switch: Next continent + -- Precise+Switch: Previous continent + TrySelectNextContinent(CS.PRECISE) + --if switching out from sabotage. + elseif(CS.SABOTAGE_HOGS[CurrentHedgehog]~=nil and CS.SABOTAGE_HOGS[CurrentHedgehog]==2) + then + CS.SABOTAGE_HOGS[CurrentHedgehog]=1 + end +end - if(GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]> table.maxn(GLOBAL_CONTINENT_INFORMATION)) - then - GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]=1 - end - SetContinentWeapons() +function TrySelectNextContinent(reverse) + local direction = 1 + if reverse then + direction = -1 + end + if(GetHogLevel(CurrentHedgehog)==0 and CS.SELECT_CONTINENT_CHECK==true and (GetCurAmmoType() == amSkip or GetCurAmmoType() == amNothing)) + then + CS.TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]=CS.TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)] + direction + + if(CS.TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]> table.maxn(CS.CONTINENT_INFORMATION)) + then + CS.TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]=1 end - --if switching out from sabotage. - elseif(GLOBAL_SABOTAGE_HOGS[CurrentHedgehog]~=nil and GLOBAL_SABOTAGE_HOGS[CurrentHedgehog]==2) - then - GLOBAL_SABOTAGE_HOGS[CurrentHedgehog]=1 + if(CS.TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]<=0) + then + CS.TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]=table.maxn(CS.CONTINENT_INFORMATION) + end + SetContinentWeapons() + + PlaySound(sndSwitchHog) end end function onUp() --swap forward in the weaponmenu (1.0 style) - if(GetHogLevel(CurrentHedgehog)==0 and GLOBAL_SELECT_CONTINENT_CHECK==true and (GetCurAmmoType() == amSkip or GetCurAmmoType() == amNothing)) - then - GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]=GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]+1 + TrySelectNextContinent(false) - if(GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]> table.maxn(GLOBAL_CONTINENT_INFORMATION)) - then - GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]=1 - end - SetContinentWeapons() - end - - if(GetCurAmmoType() == amSeduction and GLOBAL_AFRICAN_SPECIAL_SEDUCTION == 1 and GetAmmoCount(CurrentHedgehog,amInvulnerable)>0) + if(GetCurAmmoType() == amSeduction and CS.AFRICAN_SPECIAL_SEDUCTION == 1 and GetAmmoCount(CurrentHedgehog,amInvulnerable)>0) then - GLOBAL_SEDUCTION_INCREASER=GLOBAL_SEDUCTION_INCREASER+7 + CS.SEDUCTION_INCREASER=CS.SEDUCTION_INCREASER+7 RemoveWeapon(CurrentHedgehog,amInvulnerable) - AddCaption(string.format(GLOBAL_INVULNERABLE_SPECIAL_INFO," ("..(GLOBAL_SEDUCTION_INCREASER+15)..")"," ("..GetAmmoCount(CurrentHedgehog,amInvulnerable)..")")) + AddCaption(string.format(CS.INVULNERABLE_SPECIAL_CAPTION, CS.SEDUCTION_INCREASER, GetAmmoCount(CurrentHedgehog,amInvulnerable)), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmostate) end end function onDown() --swap backwards in the weaponmenu (1.0 style) - if(GetHogLevel(CurrentHedgehog)==0 and GLOBAL_SELECT_CONTINENT_CHECK==true and (GetCurAmmoType() == amSkip or GetCurAmmoType() == amNothing)) - then - GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]=GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]-1 + TrySelectNextContinent(true) - if(GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]<=0) - then - GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]=table.maxn(GLOBAL_CONTINENT_INFORMATION) - end - SetContinentWeapons() - end - - if(GetCurAmmoType() == amSeduction and GLOBAL_AFRICAN_SPECIAL_SEDUCTION == 1 and GLOBAL_SEDUCTION_INCREASER>0) + if(GetCurAmmoType() == amSeduction and CS.AFRICAN_SPECIAL_SEDUCTION == 1 and CS.SEDUCTION_INCREASER>0) then - GLOBAL_SEDUCTION_INCREASER=GLOBAL_SEDUCTION_INCREASER-7 + CS.SEDUCTION_INCREASER=CS.SEDUCTION_INCREASER-7 AddAmmo(CurrentHedgehog,amInvulnerable,GetAmmoCount(CurrentHedgehog, amInvulnerable)+1) - AddCaption(string.format(GLOBAL_INVULNERABLE_SPECIAL_INFO," ("..(GLOBAL_SEDUCTION_INCREASER+15)..")"," ("..GetAmmoCount(CurrentHedgehog,amInvulnerable)..")")) + AddCaption(string.format(CS.INVULNERABLE_SPECIAL_CAPTION, CS.SEDUCTION_INCREASER, GetAmmoCount(CurrentHedgehog,amInvulnerable)), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmostate) + end +end + +-- Spawn sabotage smoke for inactive hogs (red smoke, more subtle than for active hogs) +function SabotageSmokeInactive(gear) + if GetGearType(gear) == gtHedgehog and gear ~= CurrentHedgehog and CS.SABOTAGE_HOGS[gear]~=nil and CS.SABOTAGE_HOGS[gear]>=1 then + local vg = AddVisualGear(GetX(gear), GetY(gear), vgtSmokeWhite, 0, false) + SetVisualGearValues(vg, nil, nil, nil, nil, nil, nil, nil, nil, nil, 0xFF8080B0) + end +end + +function ShowContinentLabel() + if CS.TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)] == 0 then + AddCaption(loc("Random continent"), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmoinfo) + else + AddCaption(CS.CONTINENT_INFORMATION[CS.TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]][1], GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmoinfo) + end +end + +function onGameTick() + -- This is a trick to show the continent label delayed by 1 tick + if CS.CONTINENT_LABEL_TIMER > 0 then + CS.CONTINENT_LABEL_TIMER = CS.CONTINENT_LABEL_TIMER - 1 + end + if CS.CONTINENT_LABEL_TIMER == 0 then + ShowContinentLabel() + CS.CONTINENT_LABEL_TIMER = -1 + end + + if CS.HANDLE_SPECIAL_WEAPON_MISC_TIMER > 0 then + CS.HANDLE_SPECIAL_WEAPON_MISC_TIMER = CS.HANDLE_SPECIAL_WEAPON_MISC_TIMER - 1 + end + if CS.HANDLE_SPECIAL_WEAPON_MISC_TIMER == 0 then + HandleSpecialWeaponMisc() + CS.HANDLE_SPECIAL_WEAPON_MISC_TIMER = -1 + end + + -- See onAttack() + if CS.CONFIRM_CONTINENT_SELECTION > 0 then + CS.CONFIRM_CONTINENT_SELECTION = CS.CONFIRM_CONTINENT_SELECTION - 1 + end + if CS.CONFIRM_CONTINENT_SELECTION == 0 then + CS.SELECT_CONTINENT_CHECK=false + EndTurnCS(0) + PlaySound(sndPlaced) + ShowContinentLabel() + CS.CONFIRM_CONTINENT_SELECTION = -1 + end + + if GameTime % 600 == 0 then + runOnGears(SabotageSmokeInactive) end end function onGameTick20() --if you picked a weaponset from the weaponmenu (icon) - if(GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]==0) + if(CS.TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]==0) then if(GetCurAmmoType()==amSwitch) then - GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]=GetRandom(table.maxn(GLOBAL_CONTINENT_INFORMATION))+1 + CS.TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]=GetRandom(table.maxn(CS.CONTINENT_INFORMATION))+1 SetContinentWeapons() + SetWeapon(amSkip) PlaySound(sndMineTick) + CS.CONTINENT_LABEL_TIMER = 1 else - for v,w in pairs(GLOBAL_CONTINENT_INFORMATION) + for v,w in pairs(CS.CONTINENT_INFORMATION) do - if(GetCurAmmoType()==GLOBAL_CONTINENT_INFORMATION[v][4][1]) + if(GetCurAmmoType()==CS.CONTINENT_INFORMATION[v][4][1]) then - GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]=v + CS.TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]=v SetContinentWeapons() - PlaySound(GLOBAL_CONTINENT_INFORMATION[v][6][1]) - PlaySound(GLOBAL_CONTINENT_INFORMATION[v][6][2],CurrentHedgehog) + SetWeapon(amSkip) + PlaySound(CS.CONTINENT_INFORMATION[v][6][1]) + PlaySound(CS.CONTINENT_INFORMATION[v][6][2],CurrentHedgehog) + CS.CONTINENT_LABEL_TIMER = 1 + break end end end end --show the kerguelen ring - if(GLOBAL_KERGUELEN_SPECIAL > 1 and GetCurAmmoType() == amHammer) + if(CS.KERGUELEN_SPECIAL > 1 and GetCurAmmoType() == amHammer and + band(GetState(CurrentHedgehog), gstAttacked) == 0 and + band(GetState(CurrentHedgehog), gstHHDriven) ~= 0) then - if(GLOBAL_VISUAL_CIRCLE==nil) + if(CS.VISUAL_CIRCLE==nil) then - GLOBAL_VISUAL_CIRCLE=AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtCircle, 0, true) + CS.VISUAL_CIRCLE=AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtCircle, 0, true) end - if(GLOBAL_KERGUELEN_SPECIAL == 2) --walrus scream + if(CS.KERGUELEN_SPECIAL == 2) --walrus scream then - SetVisualGearValues(GLOBAL_VISUAL_CIRCLE, GetX(CurrentHedgehog), GetY(CurrentHedgehog),20, 200, 0, 0, 100, 120, 4, 0xff0000ee) - elseif(GLOBAL_KERGUELEN_SPECIAL == 3) --swap hog + SetVisualGearValues(CS.VISUAL_CIRCLE, GetX(CurrentHedgehog), GetY(CurrentHedgehog),20, 200, 0, 0, 100, 120, 4, 0xff0000ee) + elseif(CS.KERGUELEN_SPECIAL == 3) --swap hog then - SetVisualGearValues(GLOBAL_VISUAL_CIRCLE, GetX(CurrentHedgehog), GetY(CurrentHedgehog),20, 200, 0, 0, 100, 390, 3, 0xffff00ee) - elseif(GLOBAL_KERGUELEN_SPECIAL == 5) --cries + SetVisualGearValues(CS.VISUAL_CIRCLE, GetX(CurrentHedgehog), GetY(CurrentHedgehog),20, 200, 0, 0, 100, 390, 3, 0xffff00ee) + elseif(CS.KERGUELEN_SPECIAL == 5) --cries then - GLOBAL_TEMP_VALUE=0 + CS.TEMP_VALUE=0 runOnGears(KerguelenSpecialBlueCheck) - if(GLOBAL_TEMP_VALUE==0) + if(CS.TEMP_VALUE==0) then - SetVisualGearValues(GLOBAL_VISUAL_CIRCLE, GetX(CurrentHedgehog), GetY(CurrentHedgehog),20, 200, 0, 0, 100, 500, 1, 0x0000ffee) + SetVisualGearValues(CS.VISUAL_CIRCLE, GetX(CurrentHedgehog), GetY(CurrentHedgehog),20, 200, 0, 0, 100, 500, 1, 0x0000ffee) else - SetVisualGearValues(GLOBAL_VISUAL_CIRCLE, GetX(CurrentHedgehog), GetY(CurrentHedgehog),20, 200, 0, 0, 100, 500, 10, 0x0000ffee) + SetVisualGearValues(CS.VISUAL_CIRCLE, GetX(CurrentHedgehog), GetY(CurrentHedgehog),20, 200, 0, 0, 100, 500, 10, 0x0000ffee) end - elseif(GLOBAL_KERGUELEN_SPECIAL == 6) --sabotage + elseif(CS.KERGUELEN_SPECIAL == 6) --sabotage then - SetVisualGearValues(GLOBAL_VISUAL_CIRCLE, GetX(CurrentHedgehog), GetY(CurrentHedgehog),20, 200, 0, 0, 100, 80, 10, 0x00ff00ee) + SetVisualGearValues(CS.VISUAL_CIRCLE, GetX(CurrentHedgehog), GetY(CurrentHedgehog),20, 200, 0, 0, 100, 80, 10, 0x00ff00ee) end - elseif(GLOBAL_VISUAL_CIRCLE~=nil) + elseif(CS.VISUAL_CIRCLE~=nil) then - DeleteVisualGear(GLOBAL_VISUAL_CIRCLE) - GLOBAL_VISUAL_CIRCLE=nil + DeleteVisualGear(CS.VISUAL_CIRCLE) + CS.VISUAL_CIRCLE=nil end --sabotage - if(GLOBAL_SABOTAGE_HOGS[CurrentHedgehog]~=nil and GLOBAL_SABOTAGE_HOGS[CurrentHedgehog]>=1) + if(CS.SABOTAGE_HOGS[CurrentHedgehog]~=nil and CS.SABOTAGE_HOGS[CurrentHedgehog]>=1) then --for sabotage - if(GLOBAL_SABOTAGE_HOGS[CurrentHedgehog]==1) + if(CS.SABOTAGE_HOGS[CurrentHedgehog]==1) then AddCaption(loc("You are sabotaged, RUN!")) PlaySound(sndHellish) --update the constant at the top also to something in between - GLOBAL_SABOTAGE_FREQUENCY=100 - SetGravity(350) + CS.SABOTAGE_FREQUENCY_NOW=CS.SABOTAGE_FREQUENCY + SetGravity(CS.SABOTAGE_GRAVITY) - GLOBAL_SABOTAGE_HOGS[CurrentHedgehog]=2 + CS.SABOTAGE_HOGS[CurrentHedgehog]=2 end - if(GLOBAL_SABOTAGE_COUNTER % 20 == 0) + if(CS.SABOTAGE_COUNTER % 20 == 0) then - AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtSmokeWhite, 0, false) + -- Sabotage effect (red smoke) + local vg = AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtSmokeWhite, 0, false) + SetVisualGearValues(vg, nil, nil, nil, nil, nil, nil, nil, nil, nil, 0xFF4040FF) end if(TurnTimeLeft<(GetAwayTime*10) or band(GetState(CurrentHedgehog),gstAttacked)==1) then - GLOBAL_SABOTAGE_HOGS[CurrentHedgehog]=0 - elseif(GLOBAL_SABOTAGE_COUNTER >= GLOBAL_SABOTAGE_FREQUENCY) + CS.SABOTAGE_HOGS[CurrentHedgehog]=0 + elseif(CS.SABOTAGE_COUNTER >= CS.SABOTAGE_FREQUENCY_NOW) then - - if(GetHealth(CurrentHedgehog)<=2) + -- Sabotage decreases hog health regularily, + -- but invulnerable protects. + -- Also do not decrease health while retreating or attacking. + if(GetEffect(CurrentHedgehog, heInvulnerable) == 0 and + band(GetState(CurrentHedgehog), gstHHDriven) ~= 0 and + band(GetState(CurrentHedgehog), gstAttacked+gstAttacking) == 0) then - SetHealth(CurrentHedgehog, 0) - GLOBAL_SABOTAGE_HOGS[CurrentHedgehog]=0 - else - SetHealth(CurrentHedgehog, GetHealth(CurrentHedgehog)-2) + if(GetHealth(CurrentHedgehog)<=CS.SABOTAGE_DAMAGE) + then + -- All health lost! Sabotage is cruel. + PlaySound(sndPoisonMoan, CurrentHedgehog) + SetHealth(CurrentHedgehog, 0) + CS.SABOTAGE_HOGS[CurrentHedgehog]=0 + -- Take away control so the hog can die in peace. + SetState(CurrentHedgehog, band(GetState(CurrentHedgehog), bnot(gstHHDriven))) + else + local newHealth = GetHealth(CurrentHedgehog)-CS.SABOTAGE_DAMAGE + -- Start moaning if health is at a critical level + if newHealth <= 16 then + PlaySound(sndPoisonMoan, CurrentHedgehog) + elseif newHealth <= 32 then + PlaySound(sndPoisonCough, CurrentHedgehog) + end + SetHealth(CurrentHedgehog, newHealth) + end + ShowDamageTag(CurrentHedgehog,CS.SABOTAGE_DAMAGE) end - ShowDamageTag(CurrentHedgehog,2) - GLOBAL_SABOTAGE_COUNTER=0 + CS.SABOTAGE_COUNTER=0 else - GLOBAL_SABOTAGE_COUNTER=GLOBAL_SABOTAGE_COUNTER+1 + CS.SABOTAGE_COUNTER=CS.SABOTAGE_COUNTER+1 end - elseif(GetGravity()==350 and (GLOBAL_SABOTAGE_HOGS[CurrentHedgehog]==0 or GLOBAL_SABOTAGE_HOGS[CurrentHedgehog]==nil)) + elseif((GetGravity()==CS.SABOTAGE_GRAVITY or GetGravity()==CS.SABOTAGE_GRAVITY_LOW) and (CS.SABOTAGE_HOGS[CurrentHedgehog]==0 or CS.SABOTAGE_HOGS[CurrentHedgehog]==nil)) then + -- Reset gravity SetGravity(100) end --enable switch (north america) - if(GetCurAmmoType() == amSwitch and GLOBAL_TEMP_VALUE==87) + if(GetCurAmmoType() == amSwitch and CS.TEMP_VALUE==87) then SetGearMessage(CurrentHedgehog,gmAttack) - GLOBAL_TEMP_VALUE=0 + CS.TEMP_VALUE=0 + end + + if(CS.SPEECH_TIMER > 0) then + CS.SPEECH_TIMER = CS.SPEECH_TIMER - 20 + end +end + +function HandleSpecialWeaponMisc(ammoType) + if not ammoType then + ammoType = GetCurAmmoType() end + ShowSpecialWeaponCaption(ammoType) + if ammoType == amSMine and CS.AFRICAN_SPECIAL_STICKY ~= 0 then + SetSoundMask(sndLaugh, true) + else + SetSoundMask(sndLaugh, false) + end + if (ammoType == amHammer and CS.KERGUELEN_SPECIAL > 1) or (ammoType == amBaseballBat and CS.AUSTRALIAN_SPECIAL ~= 0) then + SetAttackState(false) + else + SetAttackState(true) + end + end --some ppl complained :P function onSlot(slot) - if(GLOBAL_TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]==0) + if(CS.TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]==0) then SetWeapon(amSkip) end + if CS.GAME_STARTED then + -- Delay calling HandleSpecialWeaponMisc because + -- the CurAmmoType is not updated yet. + CS.HANDLE_SPECIAL_WEAPON_MISC_TIMER = 2 + end +end + +function onSetWeapon(ammoType) + if CS.GAME_STARTED then + HandleSpecialWeaponMisc(ammoType) + end end --if you used hogswitch or any similar weapon, dont enable any weaponchange function onAttack() - if(GLOBAL_SELECT_CONTINENT_CHECK==true) + if(CS.SELECT_CONTINENT_CHECK==true) then if(GetCurAmmoType() == amSkip or GetCurAmmoType() == amNothing) then - GLOBAL_SELECT_CONTINENT_CHECK=false - EndTurn(0) + SetWeapon(amNothing) + -- Delay the real continent selection so the SetWeapon + -- has time to take effect. + CS.CONFIRM_CONTINENT_SELECTION=2 else SetWeapon(amSkip) end end --african special - if(GLOBAL_AFRICAN_SPECIAL_SEDUCTION == 1 and GetCurAmmoType() == amSeduction and band(GetState(CurrentHedgehog),gstAttacked)==0) + if(CS.AFRICAN_SPECIAL_SEDUCTION == 1 and GetCurAmmoType() == amSeduction and band(GetState(CurrentHedgehog),gstAttacked)==0) then - EndTurn(3) + EndTurnCS(3) - GLOBAL_TEMP_VALUE=0 + CS.TEMP_VALUE=0 runOnGears(AfricaSpecialSeduction) - SetHealth(CurrentHedgehog, GetHealth(CurrentHedgehog)+GLOBAL_TEMP_VALUE) + SetHealth(CurrentHedgehog, GetHealth(CurrentHedgehog)+CS.TEMP_VALUE) --visual stuff VisualExplosion(250,GetX(CurrentHedgehog), GetY(CurrentHedgehog),vgtSmoke,vgtSmokeWhite) @@ -1375,38 +1852,39 @@ RemoveWeapon(CurrentHedgehog,amSeduction) - elseif(GLOBAL_ANTARCTICA_SPECIAL == 1 and GetCurAmmoType() == amPickHammer and band(GetState(CurrentHedgehog),gstAttacked)==0) + elseif(CS.ANTARCTICA_SPECIAL == 1 and GetCurAmmoType() == amPickHammer and band(GetState(CurrentHedgehog),gstAttacked)==0) then - EndTurn(10) + EndTurnCS(10) SetGearPosition(CurrentHedgehog,GetX(CurrentHedgehog),0) ParseCommand("hjump") SetGearVelocity(CurrentHedgehog, 0, 100000000) PlaySound(sndPiano8) + PlaySound(sndWarp) RemoveWeapon(CurrentHedgehog,amPickHammer) --Kerguelen specials - elseif(GetCurAmmoType() == amHammer and GLOBAL_KERGUELEN_SPECIAL > 1 and band(GetState(CurrentHedgehog),gstAttacked)==0) + elseif(GetCurAmmoType() == amHammer and CS.KERGUELEN_SPECIAL > 1 and band(GetState(CurrentHedgehog),gstAttacked)==0) then local escapetime=3 --scream - if(GLOBAL_KERGUELEN_SPECIAL == 2) + if(CS.KERGUELEN_SPECIAL == 2) then - GLOBAL_TEMP_VALUE=0 + CS.TEMP_VALUE=0 runOnGears(KerguelenSpecialRed) - HealHog(CurrentHedgehog, GLOBAL_TEMP_VALUE) + HealHog(CurrentHedgehog, CS.TEMP_VALUE) PlaySound(sndHellish) --swap - elseif(GLOBAL_KERGUELEN_SPECIAL == 3) + elseif(CS.KERGUELEN_SPECIAL == 3) then - GLOBAL_TEMP_VALUE=0 + CS.TEMP_VALUE=0 runOnGears(KerguelenSpecialYellowCountHogs) - if(GLOBAL_TEMP_VALUE>0) + if(CS.TEMP_VALUE>0) then - GLOBAL_TEMP_VALUE=GetRandom(GLOBAL_TEMP_VALUE) + CS.TEMP_VALUE=GetRandom(CS.TEMP_VALUE) runOnGears(KerguelenSpecialYellowSwap) PlaySound(sndPiano3) else @@ -1414,56 +1892,85 @@ end --cries - elseif(GLOBAL_KERGUELEN_SPECIAL == 5) + elseif(CS.KERGUELEN_SPECIAL == 5) then - GLOBAL_TEMP_VALUE=0 + CS.TEMP_VALUE=0 runOnGears(KerguelenSpecialBlueCheck) - if(GLOBAL_TEMP_VALUE==0) + if(CS.TEMP_VALUE==0) then AddGear(0, 0, gtWaterUp, 0, 0,0,0) PlaySound(sndWarp) PlaySound(sndMolotov) runOnGears(KerguelenSpecialBlueActivate) - SetHealth(CurrentHedgehog, GetHealth(CurrentHedgehog)+GLOBAL_TEMP_VALUE) + SetHealth(CurrentHedgehog, GetHealth(CurrentHedgehog)+CS.TEMP_VALUE) else - HogSay(CurrentHedgehog, loc("Hogs in sight!"), SAY_SAY) + PlaySound(sndDenied) + escapetime = -1 + if CS.SPEECH_TIMER <= 0 then + HogSay(CurrentHedgehog, loc("Hogs in sight!"), SAY_SAY) + CS.SPEECH_TIMER = 5000 + end end - --sabotage - elseif(GLOBAL_KERGUELEN_SPECIAL == 6) + --flare/sabotage + elseif(CS.KERGUELEN_SPECIAL == 6) then - GLOBAL_TEMP_VALUE=0 + CS.TEMP_VALUE=0 runOnGears(KerguelenSpecialGreen) PlaySound(sndThrowRelease) AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog)-20, gtCluster, 0, 0, -1000000, 32) - if(GLOBAL_TEMP_VALUE==1) + if(CS.TEMP_VALUE==1) then escapetime=10 end end - EndTurn(escapetime) + if escapetime >= 0 then + EndTurnCS(escapetime) + + DeleteVisualGear(CS.VISUAL_CIRCLE) + CS.VISUAL_CIRCLE=nil + CS.KERGUELEN_SPECIAL=0 + + RemoveWeapon(CurrentHedgehog,amHammer) + end - DeleteVisualGear(GLOBAL_VISUAL_CIRCLE) - GLOBAL_VISUAL_CIRCLE=nil - GLOBAL_KERGUELEN_SPECIAL=0 - - RemoveWeapon(CurrentHedgehog,amHammer) + elseif(GetCurAmmoType() == amBaseballBat) + then + if CS.AUSTRALIAN_SPECIAL ~= 0 + then + CS.TEMP_VALUE=0 + runOnGears(AustraliaSpecialCheckHogs) + if CS.TEMP_VALUE == 0 then + SetGearMessage(CurrentHedgehog, bor(GetGearMessage(CurrentHedgehog), gmAttack)) + else + PlaySound(sndDenied) + end + end elseif(GetCurAmmoType() == amVampiric) then - GLOBAL_VAMPIRIC_IS_ON=75 + CS.VAMPIRIC_IS_ON=75 elseif(GetCurAmmoType() == amExtraDamage) then - GLOBAL_EXTRA_DAMAGE_IS_ON=150 + CS.EXTRA_DAMAGE_IS_ON=150 + end +end + +function onHogAttack(ammoType) + -- When a sabotaged hog uses low gravity, overwrite the default low gravity, + -- otherwise it would be too easy. + if(ammoType == amLowGravity and CS.SABOTAGE_HOGS[CurrentHedgehog]~=nil and CS.SABOTAGE_HOGS[CurrentHedgehog]>=1) + then + SetGravity(CS.SABOTAGE_GRAVITY_LOW) end end function onGearAdd(gearUid) - GLOBAL_SELECT_CONTINENT_CHECK=false + CS.SELECT_CONTINENT_CHECK=false --track the gears im using if(GetGearType(gearUid) == gtHedgehog or GetGearType(gearUid) == gtMine or GetGearType(gearUid) == gtExplosives) @@ -1472,37 +1979,47 @@ end --remove gasclouds on gasbombspecial - if(GetGearType(gearUid)==gtPoisonCloud and GLOBAL_SOUTH_AMERICAN_SPECIAL == true) + if(GetGearType(gearUid)==gtPoisonCloud and CS.SOUTH_AMERICAN_SPECIAL == true) then DeleteGear(gearUid) --african special elseif(GetGearType(gearUid)==gtSMine) then - vx,vy=GetGearVelocity(gearUid) - if(GLOBAL_AFRICAN_SPECIAL_STICKY == 1) + local vx,vy=GetGearVelocity(gearUid) + if(CS.AFRICAN_SPECIAL_STICKY == 1) then SetState(CurrentHedgehog, gstHHDriven+gstMoving) SetGearPosition(CurrentHedgehog, GetX(CurrentHedgehog),GetY(CurrentHedgehog)-3) SetGearVelocity(CurrentHedgehog, vx, vy) + PlaySound(sndJump2, CurrentHedgehog) DeleteGear(gearUid) + if (not CS.AFRICAN_SPECIAL_NON_PROJECTILE_USED) then + SetSoundMask(sndMissed, true) + end - elseif(GLOBAL_AFRICAN_SPECIAL_STICKY == 2) + elseif(CS.AFRICAN_SPECIAL_STICKY == 2) then FireGear(CurrentHedgehog,gtNapalmBomb, vx, vy, 0) DeleteGear(gearUid) + CS.AFRICAN_SPECIAL_NON_PROJECTILE_USED=true + SetSoundMask(sndMissed, false) + else + CS.AFRICAN_SPECIAL_NON_PROJECTILE_USED=true + SetSoundMask(sndMissed, false) end --north american special elseif(GetGearType(gearUid)==gtSniperRifleShot) then - GLOBAL_NORTH_AMERICAN_SPECIAL_SNIPER_IS_ON=true - if(GLOBAL_NORTH_AMERICAN_SPECIAL_SNIPER~=1) + CS.NORTH_AMERICAN_SPECIAL_SNIPER_IS_ON=true + if(CS.NORTH_AMERICAN_SPECIAL_SNIPER~=1) then SetHealth(gearUid, 1) + SetGearValues(gearUid, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 0) end --north american special elseif(GetGearType(gearUid)==gtShotgunShot) then - if(GLOBAL_NORTH_AMERICAN_SPECIAL_SHOTGUN==true) + if(CS.NORTH_AMERICAN_SPECIAL_SHOTGUN==true) then AddVisualGear(GetX(gearUid), GetY(gearUid), vgtFeather, 0, false) AddVisualGear(GetX(gearUid), GetY(gearUid), vgtFeather, 0, false) @@ -1510,30 +2027,30 @@ PlaySound(sndBirdyLay) end --european special - elseif(GetGearType(gearUid)==gtMolotov and GLOBAL_EUROPE_SPECIAL==1) + elseif(GetGearType(gearUid)==gtMolotov and CS.EUROPE_SPECIAL==1) then - vx,vy=GetGearVelocity(gearUid) - e_health=FireGear(CurrentHedgehog,gtCluster, vx, vy, 1) + local vx,vy=GetGearVelocity(gearUid) + local e_health=FireGear(CurrentHedgehog,gtCluster, vx, vy, 1) SetGearMessage(e_health, 2) DeleteGear(gearUid) --australian specials - elseif(GetGearType(gearUid)==gtShover and GLOBAL_AUSTRALIAN_SPECIAL~=0) + elseif(GetGearType(gearUid)==gtShover and CS.AUSTRALIAN_SPECIAL~=0) then - GLOBAL_TEMP_VALUE=0 + CS.TEMP_VALUE=0 runOnGears(AustraliaSpecialCheckHogs) - if(GLOBAL_TEMP_VALUE==0) + if(CS.TEMP_VALUE==0) then - vx,vy=GetGearVelocity(gearUid) + local vx,vy=GetGearVelocity(gearUid) - if(GLOBAL_AUSTRALIAN_SPECIAL==1) + if(CS.AUSTRALIAN_SPECIAL==1) then local austmine=FireGear(CurrentHedgehog,gtMine, vx, vy, 0) SetHealth(austmine, 100) SetTimer(austmine, 1000) + PlaySound(sndLaugh, CurrentHedgehog) else local austmine=FireGear(CurrentHedgehog,gtBall, vx, vy, 1) - --SetHealth(austmine, 1) SetTimer(austmine, 1000) SetGearMessage(austmine, 3) end @@ -1542,22 +2059,17 @@ end elseif(GetGearType(gearUid)==gtParachute) then - GLOBAL_PARACHUTE_IS_ON=1 + CS.PARACHUTE_IS_ON=1 elseif(GetGearType(gearUid)==gtSwitcher) then - GLOBAL_SWITCH_HOG_IS_ON=true + CS.SWITCH_HOG_IS_ON=true end end function onGearDamage(gearUid, damage) - if (GetGearType(gearUid) == gtCase) + if(gearUid==CurrentHedgehog and CS.SABOTAGE_HOGS[CurrentHedgehog]==1) then - GLOBAL_CRATE_TEST=gearUid - end - - if(gearUid==CurrentHedgehog and GLOBAL_SABOTAGE_HOGS[CurrentHedgehog]==1) - then - GLOBAL_SABOTAGE_HOGS[CurrentHedgehog]=0 + CS.SABOTAGE_HOGS[CurrentHedgehog]=0 end end @@ -1566,48 +2078,49 @@ if(GetGearType(gearUid) == gtHedgehog or GetGearType(gearUid) == gtMine or GetGearType(gearUid) == gtExplosives) then --sundaland special - if(GetGearType(gearUid) == gtHedgehog and GLOBAL_TEAM_CONTINENT[GLOBAL_SUNDALAND_END_HOG_CONTINENT_NAME]==10) + if(GetGearType(gearUid) == gtHedgehog and CS.TEAM_CONTINENT[CS.SUNDALAND_END_HOG_CONTINENT_NAME]==10) then - local currvalue=getTeamValue(GLOBAL_SUNDALAND_END_HOG_CONTINENT_NAME, "sundaland-count") + local currvalue=getTeamValue(CS.SUNDALAND_END_HOG_CONTINENT_NAME, "sundaland-count") if(currvalue==nil) then currvalue=0 end - setTeamValue(GLOBAL_SUNDALAND_END_HOG_CONTINENT_NAME, "sundaland-count", currvalue+1) - PlaySound(sndReinforce,CurrentHedgehog) + setTeamValue(CS.SUNDALAND_END_HOG_CONTINENT_NAME, "sundaland-count", currvalue+1) end trackDeletion(gearUid) end - --if picking up a health crate - if(GLOBAL_SABOTAGE_HOGS[CurrentHedgehog]~=0 and GetGearType(gearUid) == gtCase and GetHealth(gearUid)~=0 and gearUid~=GLOBAL_CRATE_TEST and gearIsInCircle(CurrentHedgehog,GetX(gearUid), GetY(gearUid), 50, false)==true) + --if picking up a health crate, heal sabotage + if(CS.SABOTAGE_HOGS[CurrentHedgehog]~=0 and GetGearType(gearUid) == gtCase and GetGearPos(gearUid)==2 and band(GetGearMessage(gearUid), gmDestroy) ~= 0) then - GLOBAL_SABOTAGE_HOGS[CurrentHedgehog]=0 + CS.SABOTAGE_HOGS[CurrentHedgehog]=0 end --north american lipstick if(GetGearType(gearUid)==gtSniperRifleShot ) then - GLOBAL_NORTH_AMERICAN_SPECIAL_SNIPER_IS_ON=false - if(GLOBAL_NORTH_AMERICAN_SPECIAL_SNIPER==2) + CS.NORTH_AMERICAN_SPECIAL_SNIPER_IS_ON=false + if(CS.NORTH_AMERICAN_SPECIAL_SNIPER==2) then - GLOBAL_TEMP_VALUE=gearUid + CS.TEMP_VALUE=gearUid runOnGears(NorthAmericaSpecialSniper) end --north american eagle eye - elseif(GetGearType(gearUid)==gtShotgunShot and GLOBAL_NORTH_AMERICAN_SPECIAL_SHOTGUN==true) + elseif(GetGearType(gearUid)==gtShotgunShot and CS.NORTH_AMERICAN_SPECIAL_SHOTGUN==true) then SetGearPosition(CurrentHedgehog, GetX(gearUid), GetY(gearUid)+7) PlaySound(sndWarp) --south american special - elseif(GetGearType(gearUid)==gtGasBomb and GLOBAL_SOUTH_AMERICAN_SPECIAL == true) + elseif(GetGearType(gearUid)==gtGasBomb and CS.SOUTH_AMERICAN_SPECIAL == true) then - GLOBAL_TEMP_VALUE=gearUid - runOnGears(SouthAmericaSpecialCheeseExplosion) - AddVisualGear(GetX(gearUid), GetY(gearUid), vgtExplosion, 0, false) + if band(GetState(gearUid), gstDrowning) == 0 then + CS.TEMP_VALUE=gearUid + runOnGears(SouthAmericaSpecialCheeseExplosion) + AddVisualGear(GetX(gearUid), GetY(gearUid), vgtExplosion, 0, false) + end --asian special elseif(GetGearType(gearUid)==gtSnowball and GetGearMessage(gearUid)==1) @@ -1617,11 +2130,13 @@ --europe special elseif(GetGearType(gearUid)==gtCluster and GetGearMessage(gearUid)==2) then - GLOBAL_TEMP_VALUE=gearUid - runOnGears(EuropeSpecialMolotovHit) - VisualExplosion(100,GetX(gearUid), GetY(gearUid),vgtSmokeWhite,vgtSmokeWhite) - AddVisualGear(GetX(gearUid), GetY(gearUid), vgtExplosion, 0, false) - PlaySound(sndGraveImpact) + if band(GetState(gearUid), gstDrowning) == 0 then + CS.TEMP_VALUE=gearUid + runOnGears(EuropeSpecialMolotovHit) + VisualExplosion(100,GetX(gearUid), GetY(gearUid),vgtSmokeWhite,vgtSmokeWhite) + AddVisualGear(GetX(gearUid), GetY(gearUid), vgtExplosion, 0, false) + PlaySound(sndGraveImpact) + end --australian special elseif(GetGearType(gearUid)==gtBall and GetGearMessage(gearUid)==3) then @@ -1630,16 +2145,10 @@ --asia (using para) elseif(GetGearType(gearUid)==gtParachute) then - GLOBAL_PARACHUTE_IS_ON=false + CS.PARACHUTE_IS_ON=false elseif(GetGearType(gearUid)==gtSwitcher) then - GLOBAL_SWITCH_HOG_IS_ON=false + CS.SWITCH_HOG_IS_ON=false end end ---[[ - sources (populations & area): - Own calculations from wikipedia. - Some are approximations. -]] -