share/hedgewars/Data/Scripts/Multiplayer/RandomWeapon.lua
changeset 4588 5ef5415c4ee1
parent 4529 467ab0685890
parent 4586 4ba4f021070f
child 4647 20b982afbe6e
equal deleted inserted replaced
4529:467ab0685890 4588:5ef5415c4ee1
     1 local weapons = { amGrenade, amClusterBomb, amBazooka, amBee, amShotgun,
       
     2             amMine, amDEagle, amDynamite, amFirePunch, amWhip, amPickHammer,
       
     3             amBaseballBat, amAirAttack, amMineStrike, amTeleport, amMortar, amCake,
       
     4             amSeduction, amWatermelon, amHellishBomb, amNapalm, amDrill, amBallgun,
       
     5             amRCPlane, amSniperRifle, amMolotov, amBirdy, amBlowTorch,
       
     6             amGasBomb, amFlamethrower, amSMine, amHammer, amDrillStrike }
       
     7 
       
     8 local lastRound = -1
       
     9 local weapon = 0
       
    10 
       
    11 function onGameInit()
       
    12     GameFlags = band(bor(GameFlags, gfResetWeps), bnot(gfInfAttack + gfPerHogAmmo))
       
    13 end
       
    14 
       
    15 function onAmmoStoreInit()
       
    16     SetAmmo(amSkip, 9, 0, 0, 0)
       
    17 
       
    18     SetAmmo(amParachute, 0, 1, 0, 1)
       
    19     SetAmmo(amGirder, 0, 1, 0, 2)
       
    20     SetAmmo(amSwitch, 0, 1, 0, 1)
       
    21     SetAmmo(amLowGravity, 0, 1, 0, 1)
       
    22     SetAmmo(amExtraDamage, 0, 1, 0, 1)
       
    23     SetAmmo(amInvulnerable, 0, 1, 0, 1)
       
    24     SetAmmo(amExtraTime, 0, 1, 0, 1)
       
    25     SetAmmo(amLaserSight, 0, 1, 0, 1)
       
    26     SetAmmo(amVampiric, 0, 1, 0, 1)
       
    27     SetAmmo(amJetpack, 0, 1, 0, 1)
       
    28     SetAmmo(amPortalGun, 0, 1, 0, 1)
       
    29     SetAmmo(amResurrector, 0, 1, 0, 1)
       
    30 
       
    31     for i, w in pairs(weapons) do
       
    32         SetAmmo(w, 0, 0, 0, 1)
       
    33     end
       
    34 end
       
    35 
       
    36 function onNewTurn()
       
    37     if lastRound ~= TotalRounds then
       
    38         weapon = GetRandom(table.maxn(weapons)) + 1
       
    39         lastRound = TotalRounds
       
    40     end
       
    41     AddAmmo(CurrentHedgehog, weapons[weapon])
       
    42 end