share/hedgewars/Data/Scripts/Multiplayer/Mutant.lua
changeset 13108 f3f8d017f994
parent 13105 b14cac8ac56c
child 13172 159004144897
equal deleted inserted replaced
13107:7b3bc9a4dfb9 13108:f3f8d017f994
   142 end
   142 end
   143 
   143 
   144 
   144 
   145 function limitHogs(gear)
   145 function limitHogs(gear)
   146     cnthhs = cnthhs + 1
   146     cnthhs = cnthhs + 1
   147         if cnthhs > 1 then
   147     if cnthhs > 1 then
   148             hogLimitHit = true
   148         hogLimitHit = true
   149             SetEffect(gear, heResurrectable, false)
   149         SetEffect(gear, heResurrectable, 0)
   150             SetGearPosition(gear, -100,LAND_HEIGHT)
   150         setGearValue(gear, "excess", true)
   151         end
   151         DeleteGear(gear)
       
   152     end
   152 end
   153 end
   153 
   154 
   154 function onGameStart()
   155 function onGameStart()
   155     SendHealthStatsOff()
   156     SendHealthStatsOff()
   156     SendRankingStatsOff()
   157     SendRankingStatsOff()
   163     for i=0 , TeamsCount - 1 do
   164     for i=0 , TeamsCount - 1 do
   164         cnthhs = 0
   165         cnthhs = 0
   165         runOnHogsInTeam(limitHogs, teams[i])
   166         runOnHogsInTeam(limitHogs, teams[i])
   166     end
   167     end
   167     if hogLimitHit then
   168     if hogLimitHit then
   168         AddCaption(loc("Only one hog per team allowed! Excess hogs will be removed"), 0xFFFFFFFF, capgrpGameState)
   169         WriteLnToChat(loc("Only one hog per team allowed! Excess hogs will be removed."))
   169     end
   170     end
   170     showStartingInfo()
   171     showStartingInfo()
   171 end
   172 end
   172 
   173 
   173 
   174 
   361     setGearValue(gear,"Hat",GetHogHat(gear))
   362     setGearValue(gear,"Hat",GetHogHat(gear))
   362 end
   363 end
   363 
   364 
   364 function armageddon(gear)
   365 function armageddon(gear)
   365     SetState(gear, gstLoser)
   366     SetState(gear, gstLoser)
   366     SetEffect(gear, heResurrectable, false)
   367     SetEffect(gear, heResurrectable, 0)
   367     SetHealth(gear, 0)
   368     SetHealth(gear, 0)
   368 end
   369 end
   369 
   370 
   370 function renderScores()
   371 function renderScores()
   371     for i=0, TeamsCount-1 do
   372     for i=0, TeamsCount-1 do
   757                 teams[i] = teams[i + 1]
   758                 teams[i] = teams[i + 1]
   758             end
   759             end
   759             teams[TeamsCount - 1] = nil
   760             teams[TeamsCount - 1] = nil
   760             TeamsCount = TeamsCount - 1
   761             TeamsCount = TeamsCount - 1
   761         end
   762         end
   762         AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false)
   763         if getGearValue(gear, "excess") ~= true then
       
   764             AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false)
       
   765         end
   763         trackDeletion(gear)
   766         trackDeletion(gear)
   764     elseif GetGearType(gear) == gtCase then
   767     elseif GetGearType(gear) == gtCase then
   765         -- Check if a crate has been collected
   768         -- Check if a crate has been collected
   766         if band(GetGearMessage(gear), gmDestroy) ~= 0 and CurrentHedgehog ~= nil then
   769         if band(GetGearMessage(gear), gmDestroy) ~= 0 and CurrentHedgehog ~= nil then
   767             -- Update crate collection achievement
   770             -- Update crate collection achievement