share/hedgewars/Data/Scripts/Multiplayer/Random_Weapon.lua
author Henek
Sat, 22 Jan 2011 22:31:05 +0100
changeset 4869 7a720b5d2247
parent 4590 d9fed5a816e9
child 4893 353781305c07
permissions -rw-r--r--
added GetGearRaduis and minor Tracker things
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4590
d9fed5a816e9 added MapHasBorder function for lua and finnished Random Weapons gameplay, might still change though
Henek
parents: 4551
diff changeset
     1
loadfile(GetDataPath() .. "Scripts/Locale.lua")()
d9fed5a816e9 added MapHasBorder function for lua and finnished Random Weapons gameplay, might still change though
Henek
parents: 4551
diff changeset
     2
4551
05c32ee166b6 added replacement of "_" to " " in gameplay scripts
Henek
parents:
diff changeset
     3
local weapons = { amGrenade, amClusterBomb, amBazooka, amBee, amShotgun,
05c32ee166b6 added replacement of "_" to " " in gameplay scripts
Henek
parents:
diff changeset
     4
            amMine, amDEagle, amDynamite, amFirePunch, amWhip, amPickHammer,
4590
d9fed5a816e9 added MapHasBorder function for lua and finnished Random Weapons gameplay, might still change though
Henek
parents: 4551
diff changeset
     5
            amBaseballBat, amTeleport, amMortar, amCake, amSeduction,
d9fed5a816e9 added MapHasBorder function for lua and finnished Random Weapons gameplay, might still change though
Henek
parents: 4551
diff changeset
     6
            amWatermelon, amHellishBomb, amDrill, amBallgun, amRCPlane,
d9fed5a816e9 added MapHasBorder function for lua and finnished Random Weapons gameplay, might still change though
Henek
parents: 4551
diff changeset
     7
            amSniperRifle, amMolotov, amBirdy, amBlowTorch, amGasBomb,
d9fed5a816e9 added MapHasBorder function for lua and finnished Random Weapons gameplay, might still change though
Henek
parents: 4551
diff changeset
     8
            amFlamethrower, amSMine, amHammer, amSnowball }
4551
05c32ee166b6 added replacement of "_" to " " in gameplay scripts
Henek
parents:
diff changeset
     9
4590
d9fed5a816e9 added MapHasBorder function for lua and finnished Random Weapons gameplay, might still change though
Henek
parents: 4551
diff changeset
    10
local airweapons = { amAirAttack, amMineStrike, amNapalm, amDrillStrike }
d9fed5a816e9 added MapHasBorder function for lua and finnished Random Weapons gameplay, might still change though
Henek
parents: 4551
diff changeset
    11
4551
05c32ee166b6 added replacement of "_" to " " in gameplay scripts
Henek
parents:
diff changeset
    12
05c32ee166b6 added replacement of "_" to " " in gameplay scripts
Henek
parents:
diff changeset
    13
function onGameInit()
05c32ee166b6 added replacement of "_" to " " in gameplay scripts
Henek
parents:
diff changeset
    14
    GameFlags = band(bor(GameFlags, gfResetWeps), bnot(gfInfAttack + gfPerHogAmmo))
05c32ee166b6 added replacement of "_" to " " in gameplay scripts
Henek
parents:
diff changeset
    15
end
05c32ee166b6 added replacement of "_" to " " in gameplay scripts
Henek
parents:
diff changeset
    16
4590
d9fed5a816e9 added MapHasBorder function for lua and finnished Random Weapons gameplay, might still change though
Henek
parents: 4551
diff changeset
    17
function onGameStart()
d9fed5a816e9 added MapHasBorder function for lua and finnished Random Weapons gameplay, might still change though
Henek
parents: 4551
diff changeset
    18
    if MapHasBorder() == false then
d9fed5a816e9 added MapHasBorder function for lua and finnished Random Weapons gameplay, might still change though
Henek
parents: 4551
diff changeset
    19
        for i, w in pairs(airweapons) do
d9fed5a816e9 added MapHasBorder function for lua and finnished Random Weapons gameplay, might still change though
Henek
parents: 4551
diff changeset
    20
            table.insert(weapons, w)
d9fed5a816e9 added MapHasBorder function for lua and finnished Random Weapons gameplay, might still change though
Henek
parents: 4551
diff changeset
    21
        end
d9fed5a816e9 added MapHasBorder function for lua and finnished Random Weapons gameplay, might still change though
Henek
parents: 4551
diff changeset
    22
    end
d9fed5a816e9 added MapHasBorder function for lua and finnished Random Weapons gameplay, might still change though
Henek
parents: 4551
diff changeset
    23
d9fed5a816e9 added MapHasBorder function for lua and finnished Random Weapons gameplay, might still change though
Henek
parents: 4551
diff changeset
    24
    ShowMission(loc("Random Weapons"), loc("A game of luck"), loc("There has been a mix-up with your gear and now you|have to utilize whatever is coming your way!"), -amSkip, 0)
d9fed5a816e9 added MapHasBorder function for lua and finnished Random Weapons gameplay, might still change though
Henek
parents: 4551
diff changeset
    25
end
d9fed5a816e9 added MapHasBorder function for lua and finnished Random Weapons gameplay, might still change though
Henek
parents: 4551
diff changeset
    26
4551
05c32ee166b6 added replacement of "_" to " " in gameplay scripts
Henek
parents:
diff changeset
    27
function onAmmoStoreInit()
05c32ee166b6 added replacement of "_" to " " in gameplay scripts
Henek
parents:
diff changeset
    28
    SetAmmo(amSkip, 9, 0, 0, 0)
05c32ee166b6 added replacement of "_" to " " in gameplay scripts
Henek
parents:
diff changeset
    29
05c32ee166b6 added replacement of "_" to " " in gameplay scripts
Henek
parents:
diff changeset
    30
    SetAmmo(amParachute, 0, 1, 0, 1)
05c32ee166b6 added replacement of "_" to " " in gameplay scripts
Henek
parents:
diff changeset
    31
    SetAmmo(amGirder, 0, 1, 0, 2)
05c32ee166b6 added replacement of "_" to " " in gameplay scripts
Henek
parents:
diff changeset
    32
    SetAmmo(amSwitch, 0, 1, 0, 1)
05c32ee166b6 added replacement of "_" to " " in gameplay scripts
Henek
parents:
diff changeset
    33
    SetAmmo(amLowGravity, 0, 1, 0, 1)
05c32ee166b6 added replacement of "_" to " " in gameplay scripts
Henek
parents:
diff changeset
    34
    SetAmmo(amExtraDamage, 0, 1, 0, 1)
05c32ee166b6 added replacement of "_" to " " in gameplay scripts
Henek
parents:
diff changeset
    35
    SetAmmo(amInvulnerable, 0, 1, 0, 1)
05c32ee166b6 added replacement of "_" to " " in gameplay scripts
Henek
parents:
diff changeset
    36
    SetAmmo(amExtraTime, 0, 1, 0, 1)
05c32ee166b6 added replacement of "_" to " " in gameplay scripts
Henek
parents:
diff changeset
    37
    SetAmmo(amLaserSight, 0, 1, 0, 1)
05c32ee166b6 added replacement of "_" to " " in gameplay scripts
Henek
parents:
diff changeset
    38
    SetAmmo(amVampiric, 0, 1, 0, 1)
05c32ee166b6 added replacement of "_" to " " in gameplay scripts
Henek
parents:
diff changeset
    39
    SetAmmo(amJetpack, 0, 1, 0, 1)
05c32ee166b6 added replacement of "_" to " " in gameplay scripts
Henek
parents:
diff changeset
    40
    SetAmmo(amPortalGun, 0, 1, 0, 1)
05c32ee166b6 added replacement of "_" to " " in gameplay scripts
Henek
parents:
diff changeset
    41
    SetAmmo(amResurrector, 0, 1, 0, 1)
05c32ee166b6 added replacement of "_" to " " in gameplay scripts
Henek
parents:
diff changeset
    42
05c32ee166b6 added replacement of "_" to " " in gameplay scripts
Henek
parents:
diff changeset
    43
    for i, w in pairs(weapons) do
05c32ee166b6 added replacement of "_" to " " in gameplay scripts
Henek
parents:
diff changeset
    44
        SetAmmo(w, 0, 0, 0, 1)
05c32ee166b6 added replacement of "_" to " " in gameplay scripts
Henek
parents:
diff changeset
    45
    end
4590
d9fed5a816e9 added MapHasBorder function for lua and finnished Random Weapons gameplay, might still change though
Henek
parents: 4551
diff changeset
    46
d9fed5a816e9 added MapHasBorder function for lua and finnished Random Weapons gameplay, might still change though
Henek
parents: 4551
diff changeset
    47
    for i, w in pairs(airweapons) do
d9fed5a816e9 added MapHasBorder function for lua and finnished Random Weapons gameplay, might still change though
Henek
parents: 4551
diff changeset
    48
        SetAmmo(w, 0, 0, 0, 1)
d9fed5a816e9 added MapHasBorder function for lua and finnished Random Weapons gameplay, might still change though
Henek
parents: 4551
diff changeset
    49
    end
4551
05c32ee166b6 added replacement of "_" to " " in gameplay scripts
Henek
parents:
diff changeset
    50
end
05c32ee166b6 added replacement of "_" to " " in gameplay scripts
Henek
parents:
diff changeset
    51
05c32ee166b6 added replacement of "_" to " " in gameplay scripts
Henek
parents:
diff changeset
    52
function onNewTurn()
4590
d9fed5a816e9 added MapHasBorder function for lua and finnished Random Weapons gameplay, might still change though
Henek
parents: 4551
diff changeset
    53
    AddAmmo(CurrentHedgehog, weapons[GetRandom(table.maxn(weapons)) + 1])
4551
05c32ee166b6 added replacement of "_" to " " in gameplay scripts
Henek
parents:
diff changeset
    54
end