function Initialise()  
        MyPositions = 0

	lib_SetupMultiplayer()
	SendMessage("WormManager.Reinitialise")

   for NumberTeam = 0 ,3 do
     local lock, inventory = EditContainer("Inventory.Alliance0" .. (NumberTeam)) 
       inventory.Airstrike = 0
       inventory.Shotgun = 0
       inventory.HomingMissile = 0
       inventory.Sheep = 0
       inventory.ConcreteDonkey = 0
       inventory.SuperSheep = 0
       inventory.NinjaRope = -1
       inventory.Parachute = -1
       inventory.Jetpack = 0
       inventory.Starburst = 0
       inventory.Redbull = 0
       inventory.AlienAbduction = 0
       inventory.Fatkins = 0
       inventory.Scouser = 0
       inventory.NoMoreNails = -1
       inventory.SentryGun = 0
       inventory.SniperRifle = 0
       inventory.SuperAirstrike = 0
       inventory.Bazooka = 0
       inventory.Grenade = 0
       inventory.ClusterGrenade = 0
       inventory.Dynamite = 0
       inventory.HolyHandGrenade = 0
       inventory.BananaBomb = 0
       inventory.BaseballBat = -1
       inventory.Prod = -1
       inventory.FirePunch = -1
       inventory.Flood = 0
       inventory.GasCanister = 0
       inventory.OldWoman = 0
       inventory.Girder = 0
       inventory.Surrender = 0
       inventory.ChangeWorm = 0
       inventory.WeaponFactoryWeapon = 0
       inventory.PoisonArrow = 0
       inventory.BubbleTrouble = 0
     CloseContainer(lock)
   end	

	SetData("TurnTime", 60000)
	SetData("RoundTime", 1200000)

	StartFirstTurn()
    lock, scheme = EditContainer("GM.SchemeData")
    scheme.WeaponChance = 0
    scheme.UtilityChance = 0
    scheme.MysteryChance = 0
    scheme.HealthChance = 0
    CloseContainer(lock)

        n=15
        x=math.random(n)
        if x==1 then
         lib_SpawnCrate("c1")
         SendIntMessage("Crate.RadarHide", 1)
       end
        if x==2 then
         lib_SpawnCrate("c2")
         SendIntMessage("Crate.RadarHide", 2)
       end
        if x==3 then
         lib_SpawnCrate("c3")
         SendIntMessage("Crate.RadarHide", 3)
       end
        if x==4 then
         lib_SpawnCrate("c4")
         SendIntMessage("Crate.RadarHide", 4)
       end
        if x==5 then
         lib_SpawnCrate("c5")
         SendIntMessage("Crate.RadarHide", 5)
       end
        if x==6 then
         lib_SpawnCrate("c6")
         SendIntMessage("Crate.RadarHide", 6)
       end
        if x==7 then
         lib_SpawnCrate("c7")
         SendIntMessage("Crate.RadarHide", 7)
       end
        if x==8 then
         lib_SpawnCrate("c8")
         SendIntMessage("Crate.RadarHide", 8)
       end
        if x==9 then
         lib_SpawnCrate("c9")
         SendIntMessage("Crate.RadarHide", 9)
       end
        if x==10 then
         lib_SpawnCrate("c10")
         SendIntMessage("Crate.RadarHide", 10)
       end
        if x==11 then
         lib_SpawnCrate("c20")
         SendIntMessage("Crate.RadarHide", 20)
       end
        if x==12 then
         lib_SpawnCrate("c73")
         SendIntMessage("Crate.RadarHide", 73)
       end
        if x==13 then
         lib_SpawnCrate("c15")
         SendIntMessage("Crate.RadarHide", 15)
       end
        if x==14 then
         lib_SpawnCrate("c108")
         SendIntMessage("Crate.RadarHide", 108)
       end
        if x==15 then
         lib_SpawnCrate("c44")
         SendIntMessage("Crate.RadarHide", 44)
       end

end


function TurnStarted()
n=60
x=math.random(n)
if x==1 then
lib_CreateExplosion("bomb1", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb11", 0, 2.35, 50, 100, 100)
end
if x==2 then
lib_CreateExplosion("bomb2", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb12", 0, 2.35, 50, 100, 100)
end
if x==3 then
lib_CreateExplosion("bomb3", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb13", 0, 2.35, 50, 100, 100)
end
if x==4 then
lib_CreateExplosion("bomb4", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb14", 0, 2.35, 50, 100, 100)
end
if x==5 then
lib_CreateExplosion("bomb5", 0, 2.35, 50, 100, 100)
end
if x==6 then
lib_CreateExplosion("bomb6", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb16", 0, 2.35, 50, 100, 100)
end
if x==7 then
lib_CreateExplosion("bomb7", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb17", 0, 2.35, 50, 100, 100)
end
if x==8 then
lib_CreateExplosion("bomb8", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb18", 0, 2.35, 50, 100, 100)
end
if x==9 then
lib_CreateExplosion("bomb9", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb19", 0, 2.35, 50, 100, 100)
end
if x==10 then
lib_CreateExplosion("bomb10", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb20", 0, 2.35, 50, 100, 100)
end
if x==11 then
lib_CreateExplosion("bomb31", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb41", 0, 2.35, 50, 100, 100)
end
if x==12 then
lib_CreateExplosion("bomb32", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb42", 0, 2.35, 50, 100, 100)
end
if x==13 then
lib_CreateExplosion("bomb33", 0, 2.35, 50, 100, 100)
end
if x==14 then
lib_CreateExplosion("bomb43", 0, 2.35, 50, 100, 100)
end
if x==15 then
lib_CreateExplosion("bomb35", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb45", 0, 2.35, 50, 100, 100)
end
if x==16 then
lib_CreateExplosion("bomb36", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb46", 0, 2.35, 50, 100, 100)
end
if x==17 then
lib_CreateExplosion("bomb37", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb47", 0, 2.35, 50, 100, 100)
end
if x==18 then
lib_CreateExplosion("bomb38", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb48", 0, 2.35, 50, 100, 100)
end
if x==19 then
lib_CreateExplosion("bomb39", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb49", 0, 2.35, 50, 100, 100)
end
if x==20 then
lib_CreateExplosion("bomb40", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb50", 0, 2.35, 50, 100, 100)
end
if x==21 then
lib_CreateExplosion("bomb61", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb71", 0, 2.35, 50, 100, 100)
end
if x==22 then
lib_CreateExplosion("bomb62", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb72", 0, 2.35, 50, 100, 100)
end
if x==23 then
lib_CreateExplosion("bomb63", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb73", 0, 2.35, 50, 100, 100)
end
if x==24 then
lib_CreateExplosion("bomb64", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb74", 0, 2.35, 50, 100, 100)
end
if x==25 then
lib_CreateExplosion("bomb65", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb75", 0, 2.35, 50, 100, 100)
end
if x==26 then
lib_CreateExplosion("bomb66", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb76", 0, 2.35, 50, 100, 100)
end
if x==27 then
lib_CreateExplosion("bomb67", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb77", 0, 2.35, 50, 100, 100)
end
if x==28 then
lib_CreateExplosion("bomb68", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb78", 0, 2.35, 50, 100, 100)
end
if x==29 then
lib_CreateExplosion("bomb69", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb79", 0, 2.35, 50, 100, 100)
end
if x==30 then
lib_CreateExplosion("bomb70", 0, 2.35, 50, 100, 100)
end
if x==31 then
lib_CreateExplosion("bomb80", 0, 2.35, 50, 100, 100)
end
if x==32 then
lib_CreateExplosion("bomb92", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb102", 0, 2.35, 50, 100, 100)
end
if x==33 then
lib_CreateExplosion("bomb93", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb103", 0, 2.35, 50, 100, 100)
end
if x==34 then
lib_CreateExplosion("bomb94", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb104", 0, 2.35, 50, 100, 100)
end
if x==35 then
lib_CreateExplosion("bomb95", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb105", 0, 2.35, 50, 100, 100)
end
if x==36 then
lib_CreateExplosion("bomb96", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb106", 0, 2.35, 50, 100, 100)
end
if x==37 then
lib_CreateExplosion("bomb97", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb107", 0, 2.35, 50, 100, 100)
end
if x==38 then
lib_CreateExplosion("bomb98", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb108", 0, 2.35, 50, 100, 100)
end
if x==39 then
lib_CreateExplosion("bomb99", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb109", 0, 2.35, 50, 100, 100)
end
if x==40 then
lib_CreateExplosion("bomb100", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb110", 0, 2.35, 50, 100, 100)
end
if x==41 then
lib_CreateExplosion("bomb89", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb90", 0, 2.35, 50, 100, 100)
end
if x==42 then
lib_CreateExplosion("bomb87", 0, 2.35, 50, 100, 100)
end
if x==43 then
lib_CreateExplosion("bomb88", 0, 2.35, 50, 100, 100)
end
if x==44 then
lib_CreateExplosion("bomb83", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb84", 0, 2.35, 50, 100, 100)
end
if x==45 then
lib_CreateExplosion("bomb81", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb82", 0, 2.35, 50, 100, 100)
end
if x==46 then
lib_CreateExplosion("bomb59", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb60", 0, 2.35, 50, 100, 100)
end
if x==47 then
lib_CreateExplosion("bomb56", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb57", 0, 2.35, 50, 100, 100)
end
if x==48 then
lib_CreateExplosion("bomb58", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb55", 0, 2.35, 50, 100, 100)
end
if x==49 then
lib_CreateExplosion("bomb53", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb54", 0, 2.35, 50, 100, 100)
end
if x==50 then
lib_CreateExplosion("bomb51", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb52", 0, 2.35, 50, 100, 100)
end
if x==51 then
lib_CreateExplosion("bomb29", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb30", 0, 2.35, 50, 100, 100)
end
if x==52 then
lib_CreateExplosion("bomb27", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb28", 0, 2.35, 50, 100, 100)
end
if x==53 then
lib_CreateExplosion("bomb25", 0, 2.35, 50, 100, 100)
end
if x==54 then
lib_CreateExplosion("bomb23", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb24", 0, 2.35, 50, 100, 100)
end
if x==55 then
lib_CreateExplosion("bomb21", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb22", 0, 2.35, 50, 100, 100)
end
if x==56 then
lib_CreateExplosion("bomb26", 0, 2.35, 50, 100, 100)
end
if x==57 then
lib_CreateExplosion("bomb15", 0, 2.35, 50, 100, 100)
end
if x==58 then
lib_CreateExplosion("bomb85", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb86", 0, 2.35, 50, 100, 100)
end
if x==59 then
lib_CreateExplosion("bomb91", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb101", 0, 2.35, 50, 100, 100)
end
if x==60 then
lib_CreateExplosion("bomb34", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb44", 0, 2.35, 50, 100, 100)
end
end
function TurnStarted()
x=math.random(1,61)
if x==1 then
lib_CreateExplosion("bomb1", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb11", 0, 2.35, 50, 100, 100)
end
if x==2 then
lib_CreateExplosion("bomb2", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb12", 0, 2.35, 50, 100, 100)
end
if x==3 then
lib_CreateExplosion("bomb3", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb13", 0, 2.35, 50, 100, 100)
end
if x==4 then
lib_CreateExplosion("bomb4", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb14", 0, 2.35, 50, 100, 100)
end
if x==5 then
lib_CreateExplosion("bomb5", 0, 2.35, 50, 100, 100)
end
if x==6 then
lib_CreateExplosion("bomb6", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb16", 0, 2.35, 50, 100, 100)
end
if x==7 then
lib_CreateExplosion("bomb7", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb17", 0, 2.35, 50, 100, 100)
end
if x==8 then
lib_CreateExplosion("bomb8", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb18", 0, 2.35, 50, 100, 100)
end
if x==9 then
lib_CreateExplosion("bomb9", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb19", 0, 2.35, 50, 100, 100)
end
if x==10 then
lib_CreateExplosion("bomb10", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb20", 0, 2.35, 50, 100, 100)
end
if x==11 then
lib_CreateExplosion("bomb31", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb41", 0, 2.35, 50, 100, 100)
end
if x==12 then
lib_CreateExplosion("bomb32", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb42", 0, 2.35, 50, 100, 100)
end
if x==13 then
lib_CreateExplosion("bomb33", 0, 2.35, 50, 100, 100)
end
if x==14 then
lib_CreateExplosion("bomb43", 0, 2.35, 50, 100, 100)
end
if x==15 then
lib_CreateExplosion("bomb35", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb45", 0, 2.35, 50, 100, 100)
end
if x==16 then
lib_CreateExplosion("bomb36", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb46", 0, 2.35, 50, 100, 100)
end
if x==17 then
lib_CreateExplosion("bomb37", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb47", 0, 2.35, 50, 100, 100)
end
if x==18 then
lib_CreateExplosion("bomb38", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb48", 0, 2.35, 50, 100, 100)
end
if x==19 then
lib_CreateExplosion("bomb39", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb49", 0, 2.35, 50, 100, 100)
end
if x==20 then
lib_CreateExplosion("bomb40", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb50", 0, 2.35, 50, 100, 100)
end
if x==21 then
lib_CreateExplosion("bomb61", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb71", 0, 2.35, 50, 100, 100)
end
if x==22 then
lib_CreateExplosion("bomb62", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb72", 0, 2.35, 50, 100, 100)
end
if x==23 then
lib_CreateExplosion("bomb63", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb73", 0, 2.35, 50, 100, 100)
end
if x==24 then
lib_CreateExplosion("bomb64", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb74", 0, 2.35, 50, 100, 100)
end
if x==25 then
lib_CreateExplosion("bomb65", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb75", 0, 2.35, 50, 100, 100)
end
if x==26 then
lib_CreateExplosion("bomb66", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb76", 0, 2.35, 50, 100, 100)
end
if x==27 then
lib_CreateExplosion("bomb67", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb77", 0, 2.35, 50, 100, 100)
end
if x==28 then
lib_CreateExplosion("bomb68", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb78", 0, 2.35, 50, 100, 100)
end
if x==29 then
lib_CreateExplosion("bomb69", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb79", 0, 2.35, 50, 100, 100)
end
if x==30 then
lib_CreateExplosion("bomb70", 0, 2.35, 50, 100, 100)
end
if x==31 then
lib_CreateExplosion("bomb80", 0, 2.35, 50, 100, 100)
end
if x==32 then
lib_CreateExplosion("bomb92", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb102", 0, 2.35, 50, 100, 100)
end
if x==33 then
lib_CreateExplosion("bomb93", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb103", 0, 2.35, 50, 100, 100)
end
if x==34 then
lib_CreateExplosion("bomb94", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb104", 0, 2.35, 50, 100, 100)
end
if x==35 then
lib_CreateExplosion("bomb95", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb105", 0, 2.35, 50, 100, 100)
end
if x==36 then
lib_CreateExplosion("bomb96", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb106", 0, 2.35, 50, 100, 100)
end
if x==37 then
lib_CreateExplosion("bomb97", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb107", 0, 2.35, 50, 100, 100)
end
if x==38 then
lib_CreateExplosion("bomb98", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb108", 0, 2.35, 50, 100, 100)
end
if x==39 then
lib_CreateExplosion("bomb99", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb109", 0, 2.35, 50, 100, 100)
end
if x==40 then
lib_CreateExplosion("bomb100", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb110", 0, 2.35, 50, 100, 100)
end
if x==41 then
lib_CreateExplosion("bomb89", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb90", 0, 2.35, 50, 100, 100)
end
if x==42 then
lib_CreateExplosion("bomb87", 0, 2.35, 50, 100, 100)
end
if x==43 then
lib_CreateExplosion("bomb88", 0, 2.35, 50, 100, 100)
end
if x==44 then
lib_CreateExplosion("bomb83", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb84", 0, 2.35, 50, 100, 100)
end
if x==45 then
lib_CreateExplosion("bomb81", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb82", 0, 2.35, 50, 100, 100)
end
if x==46 then
lib_CreateExplosion("bomb59", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb60", 0, 2.35, 50, 100, 100)
end
if x==47 then
lib_CreateExplosion("bomb56", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb57", 0, 2.35, 50, 100, 100)
end
if x==48 then
lib_CreateExplosion("bomb58", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb55", 0, 2.35, 50, 100, 100)
end
if x==49 then
lib_CreateExplosion("bomb53", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb54", 0, 2.35, 50, 100, 100)
end
if x==50 then
lib_CreateExplosion("bomb51", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb52", 0, 2.35, 50, 100, 100)
end
if x==51 then
lib_CreateExplosion("bomb29", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb30", 0, 2.35, 50, 100, 100)
end
if x==52 then
lib_CreateExplosion("bomb27", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb28", 0, 2.35, 50, 100, 100)
end
if x==53 then
lib_CreateExplosion("bomb25", 0, 2.35, 50, 100, 100)
end
if x==54 then
lib_CreateExplosion("bomb23", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb24", 0, 2.35, 50, 100, 100)
end
if x==55 then
lib_CreateExplosion("bomb21", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb22", 0, 2.35, 50, 100, 100)
end
if x==56 then
lib_CreateExplosion("bomb26", 0, 2.35, 50, 100, 100)
end
if x==57 then
lib_CreateExplosion("bomb15", 0, 2.35, 50, 100, 100)
end
if x==58 then
lib_CreateExplosion("bomb85", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb86", 0, 2.35, 50, 100, 100)
end
if x==59 then
lib_CreateExplosion("bomb91", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb101", 0, 2.35, 50, 100, 100)
end
if x==60 then
lib_CreateExplosion("bomb34", 0, 2.35, 50, 100, 100)
lib_CreateExplosion("bomb44", 0, 2.35, 50, 100, 100)
end
end

function Crate_Collected()

SendMessage("GameLogic.Draw")
SetData("Text.TestComment",'Победа!!!')
lib_Comment("Text.TestComment")

local CurrentWorm = GetData("ActiveWormIndex")
local wormdataname = lib_GetWormContainerName(CurrentWorm)

local lock, worm = EditContainer(wormdataname)
TimIndx = worm.TeamIndex
CloseContainer(lock)

WinningTeam = TimIndx
SendIntMessage("GameLogic.Win", WinningTeam)

end


function TurnEnded()
   local RoundTimeRemaining = GetData("RoundTimeRemaining")
   if RoundTimeRemaining == 0 then
    lib_CreateExplosion("death", 0, 2.35, 50, 1000000, 100)
    RoundOver()
    SendMessage("GameLogic.Draw")
   else
      CheckOneTeamVictory()      
   end
end


function Stockpile()
   -- record the remaining stock for future rounds
   CopyContainer("Inventory.Alliance00", "Inventory.Stockpile00")
   CopyContainer("Inventory.Alliance01", "Inventory.Stockpile01")
   CopyContainer("Inventory.Alliance02", "Inventory.Stockpile02")
   CopyContainer("Inventory.Alliance03", "Inventory.Stockpile03")
end



function RoundOver()
   Stockpile()
end