share/hedgewars/Data/Maps/Basketball/map.lua
changeset 12086 ed40d46c9e59
parent 12084 8f222872d432
child 14406 6c21bd8547dd
equal deleted inserted replaced
12085:6c734d8defef 12086:ed40d46c9e59
     1 -- Hedgewars - Basketball for 2+ Players
     1 -- Hedgewars - Basketball for 2+ Players
     2 
     2 
     3 HedgewarsScriptLoad("/Scripts/Locale.lua")
     3 HedgewarsScriptLoad("/Scripts/Locale.lua")
     4 
       
     5 local score = {[0] = 0, [1] = 0, [2] = 0, [3] = 0, [4] = 0, [5] = 0}
       
     6 
     4 
     7 local started = false
     5 local started = false
     8 
     6 
     9 function onGameInit()
     7 function onGameInit()
    10 	GameFlags = gfSolidLand + gfBorder + gfInvulnerable + gfLowGravity
     8 	GameFlags = gfSolidLand + gfBorder + gfInvulnerable + gfLowGravity
    22 function onGameStart()
    20 function onGameStart()
    23 	ShowMission(loc("Basketball"), loc("Not So Friendly Match"), loc("Bat your opponents through the|baskets and out of the map!"), -amBaseballBat, 0)
    21 	ShowMission(loc("Basketball"), loc("Not So Friendly Match"), loc("Bat your opponents through the|baskets and out of the map!"), -amBaseballBat, 0)
    24 	started = true
    22 	started = true
    25 end
    23 end
    26 
    24 
    27 function onGameTick()
       
    28 end
       
    29 
       
    30 function onAmmoStoreInit()
    25 function onAmmoStoreInit()
    31 	SetAmmo(amBaseballBat, 9, 0, 0, 0)
    26 	SetAmmo(amBaseballBat, 9, 0, 0, 0)
    32 	SetAmmo(amSkip, 9, 0, 0, 0)
    27 	SetAmmo(amSkip, 9, 0, 0, 0)
    33 end
    28 end
    34 
    29 
    35 function onGearAdd(gear)
       
    36 end
       
    37 
       
    38 function onGearDelete(gear)
       
    39 	if not started then
       
    40 		return
       
    41 	end
       
    42 	if (GetGearType(gear) == gtHedgehog) and CurrentHedgehog ~= nil then
       
    43 		local clan = GetHogClan(CurrentHedgehog)
       
    44 		local s
       
    45 		if clan ~= nil then
       
    46 			if GetHogClan(CurrentHedgehog) ~= GetHogClan(gear) then
       
    47 				score[clan] = score[clan] + 1
       
    48 				s = string.format(loc("%s is out and Team %d|scored a point!| |Score:"), GetHogName(gear), clan + 1)
       
    49 			else
       
    50 				score[clan] = score[clan] - 1
       
    51 				s = string.format(loc("%s is out and Team %d|scored a penalty!| |Score:"), GetHogName(gear), clan + 1)
       
    52 			end
       
    53 			s = s .. " " .. score[0]
       
    54 			for i = 1, ClansCount - 1 do s = s .. " - " .. score[i] end
       
    55 			ShowMission(loc("Basketball"), loc("Not So Friendly Match"), s, -amBaseballBat, 0)
       
    56 		end
       
    57 	end
       
    58 end
       
    59 
       
    60 function onNewTurn()
    30 function onNewTurn()
    61     SetWeapon(amBaseballBat)
    31     SetWeapon(amBaseballBat)
    62 end
    32 end