share/hedgewars/Data/Maps/Control/map.lua
changeset 14982 980a948a5dff
parent 13740 2bb7141496a9
child 14983 89f6a1154f67
equal deleted inserted replaced
14981:1a2dcea1732a 14982:980a948a5dff
     1 --------------------------------
     1 -------------
     2 -- CONTROL 0.6
     2 -- CONTROL --
     3 --------------------------------
     3 -------------
     4 
     4 
     5 ---------
     5 -- Goal: Stand on pillars to score points over time.
     6 -- 0.2
     6 -- First clan to hit the score limit wins!
     7 ---------
     7 
     8 -- fixed score display errrors
     8 -- Rules:
     9 -- added missing resurrection effects
     9 -- * You generate points while standing on a pillar during your turn.
    10 -- moved hogs off control points if thats where they started
    10 -- * Control more pillars for more points
    11 -- added sanity limit for the above
    11 -- * If multiple clans compete for a pillar, no one generates points for this pillar.
    12 -- added tint tags to display clan score on each point as it scors
    12 -- * If you skip turn, you win the same points as if you would have just waited out the turn
    13 -- added gameflags filter
       
    14 -- changed scoring rate
       
    15 -- hogs now only score point DURING THEIR TURN
       
    16 -- map now accepts custom weaponsets and themes 
       
    17 -- changed win limit
       
    18 
       
    19 ---------
       
    20 -- 0.3
       
    21 ---------
       
    22 
       
    23 -- added translation support
       
    24 
       
    25 --------
       
    26 -- 0.4
       
    27 --------
       
    28 
       
    29 -- added scaling scoring based on clans: 300 points to win - 25 per team in game
       
    30 
       
    31 --------
       
    32 -- 0.5
       
    33 --------
       
    34 
       
    35 -- removed user branding
       
    36 -- fixed infinite attack time exploit
       
    37 
       
    38 --------
       
    39 -- 0.6
       
    40 --------
       
    41 
       
    42 -- timebox fix
       
    43 -- support for more players
       
    44 -- remove version numbers
       
    45 -- enable limited sudden death
       
    46 -- using skip go generates as many points as you would have gotten had you sat and waited
       
    47 
    13 
    48 -----------------
    14 -----------------
    49 --script begins
    15 -- script begins
    50 -----------------
    16 -----------------
    51 
    17 
    52 HedgewarsScriptLoad("/Scripts/Locale.lua")
    18 HedgewarsScriptLoad("/Scripts/Locale.lua")
    53 
    19 
    54 ---------------------------------------------------------------
    20 ---------------------------------------------------------------
    55 ----------lots of bad variables and things
    21 -- lots variables and things
    56 ----------because someone is too lazy
    22 ---------------------------------------------------------------
    57 ----------to read about tables properly
       
    58 ------------------ "Oh well, they probably have the memory"
       
    59 
    23 
    60 local TimeCounter = 0
    24 local TimeCounter = 0
    61 
    25 
    62 local gameWon = false
    26 local gameWon = false
    63 local pointLimit = 300
    27 local pointLimit = 300
   167 
   131 
   168 	for i = 0,(zCount-1) do
   132 	for i = 0,(zCount-1) do
   169 		SetVisualGearValues(vCirc[i], vCircX[i], vCircY[i], vCircMinA[i], vCircMaxA[i], vCircType[i], vCircPulse[i], vCircFuckAll[i], vCircRadius[i], vCircWidth[i], 0xffffffff)
   133 		SetVisualGearValues(vCirc[i], vCircX[i], vCircY[i], vCircMinA[i], vCircMaxA[i], vCircType[i], vCircPulse[i], vCircFuckAll[i], vCircRadius[i], vCircWidth[i], 0xffffffff)
   170 		cOwnerClan[i] = nil
   134 		cOwnerClan[i] = nil
   171 		for k = 0, (numhhs-1) do
   135 		for k = 0, (numhhs-1) do
   172 			if (hhs[k] ~= nil) then --and (GetGearType(hhs[k]) ~= nil) then
   136 			if (hhs[k] ~= nil) then
   173                 if (GearIsInZone(hhs[k],i)) == true then
   137                 if (GearIsInZone(hhs[k],i)) == true then
   174 
   138 
   175                     if cOwnerClan[i] ~= nil then
   139                     if cOwnerClan[i] ~= nil then
   176                         if cOwnerClan[i] ~= GetHogClan(hhs[k]) then 
   140                         if cOwnerClan[i] ~= GetHogClan(hhs[k]) then 
   177                             --if the hog now being compared is different to one that is also here and was previously compared
   141                             --if the hog now being compared is different to one that is also here and was previously compared
   178                             
   142                             
   179                             SetVisualGearValues(vCirc[i], vCircX[i], vCircY[i], vCircMinA[i], vCircMaxA[i], vCircType[i], vCircPulse[i], vCircFuckAll[i], vCircRadius[i], vCircWidth[i], 0xffffffff)						
   143                             SetVisualGearValues(vCirc[i], vCircX[i], vCircY[i], vCircMinA[i], vCircMaxA[i], vCircType[i], vCircPulse[i], vCircFuckAll[i], vCircRadius[i], vCircWidth[i], 0xffffffff)						
   180                             --SetVisualGearValues(vCirc[i], 2739, 1378, 20, 255, 1, 10, 0, 300, 5, 0xffffffff)
       
   181         
   144         
   182                             cOwnerClan[i] = 10 -- this means conflicted
   145                             cOwnerClan[i] = 10 -- this means conflicted
   183                         end
   146                         end
   184                     elseif cOwnerClan[i] == nil then
   147                     elseif cOwnerClan[i] == nil then
   185                         cOwnerClan[i] = GetHogClan(hhs[k])
   148                         cOwnerClan[i] = GetHogClan(hhs[k])
   186                         --SetVisualGearValues(vCirc[i], 2739, 1378, 20, 255, 1, 10, 0, 300, 5, GetClanColor( GetHogClan(hhs[k])) )
       
   187                         SetVisualGearValues(vCirc[i], vCircX[i], vCircY[i], vCircMinA[i], vCircMaxA[i], vCircType[i], vCircPulse[i], vCircFuckAll[i], vCircRadius[i], vCircWidth[i], GetClanColor( GetHogClan(hhs[k])))
   149                         SetVisualGearValues(vCirc[i], vCircX[i], vCircY[i], vCircMinA[i], vCircMaxA[i], vCircType[i], vCircPulse[i], vCircFuckAll[i], vCircRadius[i], vCircWidth[i], GetClanColor( GetHogClan(hhs[k])))
   188         
   150         
   189                     end
   151                     end
   190 
   152 
   191                 end
   153                 end
   192            -- else hhs[k] = nil
       
   193 			end
   154 			end
   194 		end
   155 		end
   195 
   156 
   196 	end
   157 	end
   197 
   158 
   199 
   160 
   200 function AwardPoints()
   161 function AwardPoints()
   201 		
   162 		
   202 	for i = 0,(zCount-1) do
   163 	for i = 0,(zCount-1) do
   203 		-- give score to all players controlling points		
   164 		-- give score to all players controlling points		
   204 		--if (cOwnerClan[i] ~= nil) and (cOwnerClan[i] ~= 10) then
       
   205 		--	teamScore[cOwnerClan[i]] = teamScore[cOwnerClan[i]] + 1
       
   206 		--end
       
   207 		
   165 		
   208 		-- only give score to the player currently in control		
   166 		-- only give score to the player currently in control		
   209 		if CurrentHedgehog ~= nil then		
   167 		if CurrentHedgehog ~= nil then		
   210 			if cOwnerClan[i] == GetHogClan(CurrentHedgehog) then
   168 			if cOwnerClan[i] == GetHogClan(CurrentHedgehog) then
   211 				teamScore[cOwnerClan[i]] = teamScore[cOwnerClan[i]] + 1
   169 				teamScore[cOwnerClan[i]] = teamScore[cOwnerClan[i]] + 1
   301 function onAttack()
   259 function onAttack()
   302 
   260 
   303 	if CurrentHedgehog ~= nil then
   261 	if CurrentHedgehog ~= nil then
   304 		if GetCurAmmoType() == amSkip then
   262 		if GetCurAmmoType() == amSkip then
   305 			z = (TurnTimeLeft / 2000) - (TurnTimeLeft / 2000)%2 
   263 			z = (TurnTimeLeft / 2000) - (TurnTimeLeft / 2000)%2 
   306 			--AddCaption("scored: " .. z,GetClanColor(GetHogClan(CurrentHedgehog)),capgrpMessage2)
       
   307 			for i = 0, z do
   264 			for i = 0, z do
   308 				AwardPoints()
   265 				AwardPoints()
   309 			end
   266 			end
   310 		end
   267 		end
   311 	end
   268 	end
   353 		vCircCol[i] = 0xffffffff
   310 		vCircCol[i] = 0xffffffff
   354 
   311 
   355 		SetVisualGearValues(vCirc[i], vCircX[i], vCircY[i], vCircMinA[i], vCircMaxA[i], vCircType[i], vCircPulse[i], vCircFuckAll[i], vCircRadius[i], vCircWidth[i], vCircCol[i])
   312 		SetVisualGearValues(vCirc[i], vCircX[i], vCircY[i], vCircMinA[i], vCircMaxA[i], vCircType[i], vCircPulse[i], vCircFuckAll[i], vCircRadius[i], vCircWidth[i], vCircCol[i])
   356 	end
   313 	end
   357 
   314 
   358 	--zxc = AddVisualGear(fSpawnX[i],fSpawnY[i],vgtCircle,0,true)
       
   359 	--SetVisualGearValues(zxc, 1000,1000, 20, 255, 1,    10,                     0,         100,        1,      GetClanColor(0))
       
   360 					--minO,max0 -glowyornot	--pulsate timer	 -- fuckall      -- radius -- width  -- colour
       
   361 
       
   362 	--new improved placement schematics aw yeah
   315 	--new improved placement schematics aw yeah
   363 	RebuildTeamInfo()
   316 	RebuildTeamInfo()
   364 
   317 
   365 	for i = 0, (numTeams-1) do
   318 	for i = 0, (numTeams-1) do
   366 		pointLimit = pointLimit - 25
   319 		pointLimit = pointLimit - 25
   369 	missionHelp = loc("Control pillars to score points.") .. "|" ..
   322 	missionHelp = loc("Control pillars to score points.") .. "|" ..
   370 		string.format(loc("Score goal: %d"), pointLimit)
   323 		string.format(loc("Score goal: %d"), pointLimit)
   371 	
   324 	
   372 	-- reposition hogs if they are on control points until they are not or sanity limit kicks in
   325 	-- reposition hogs if they are on control points until they are not or sanity limit kicks in
   373 	reN = 0
   326 	reN = 0
   374 	--zz = 0
       
   375 	while (reN < 10) do
   327 	while (reN < 10) do
   376 		if ZonesAreEmpty() == false then
   328 		if ZonesAreEmpty() == false then
   377 			reN = reN + 1	
   329 			reN = reN + 1	
   378 			--zz = zz + 1	
       
   379 			--SetGearPosition(hhs[0], 631, 82) -- put this in here to thwart attempts at repositioning and test sanity limit	
       
   380 		else
   330 		else
   381 			reN = 15		
   331 			reN = 15		
   382 		end
   332 		end
   383 		--AddCaption(zz) -- number of times it took to work
       
   384 	end
   333 	end
   385 
   334 
   386 	for h=1, numhhs do
   335 	for h=1, numhhs do
   387 		-- Tardis screws up the game too much, teams might not get killed correctly after victory
   336 		-- Tardis screws up the game too much, teams might not get killed correctly after victory
   388 		-- if a hog is still in time-travel.
   337 		-- if a hog is still in time-travel.
   437 	if (vCircCount >= 500) and (gameWon == false) then
   386 	if (vCircCount >= 500) and (gameWon == false) then
   438 		vCircCount = 0
   387 		vCircCount = 0
   439 		CheckZones()
   388 		CheckZones()
   440 	end	
   389 	end	
   441 
   390 
   442 	-- things we wanna check often
       
   443 	if (CurrentHedgehog ~= nil) then
       
   444 	--	AddCaption(GetX(CurrentHedgehog) .. "; " .. GetY(CurrentHedgehog))
       
   445 		--AddCaption(teamNameArr[0] .. " : " .. teamScore[0])
       
   446 		--AddCaption(GetHogTeamName(CurrentHedgehog) .. " : " .. teamScore[GetHogClan(CurrentHedgehog)]) -- this end up 1?
       
   447 		
       
   448 		-- huh? the first clan added seems to be clan 1, not 0 ??
       
   449 
       
   450 	end
       
   451 
       
   452 	-- set TimeCounter to starting time if it is uninitialised (from onNewTurn)	
   391 	-- set TimeCounter to starting time if it is uninitialised (from onNewTurn)	
   453 	if (TimeCounter == 0) and (TurnTimeLeft > 0) then
   392 	if (TimeCounter == 0) and (TurnTimeLeft > 0) then
   454 		TimeCounter = TurnTimeLeft	
   393 		TimeCounter = TurnTimeLeft	
   455 	end	
   394 	end	
   456 	
   395 	
   461 		if (gameWon == false) then
   400 		if (gameWon == false) then
   462 			AwardPoints()		
   401 			AwardPoints()		
   463 		end	
   402 		end	
   464 	end	
   403 	end	
   465 	
   404 	
   466 	--AddCaption(TimeCounter)	
       
   467 	--hGCount = hGCount + 1
       
   468 	--if (hGCount >= 2000) and (gameWon == false) then
       
   469 	--	hGCount = 0
       
   470 	--	AwardPoints()
       
   471 	--end
       
   472 
       
   473 end
   405 end
   474 
   406 
   475 function InABetterPlaceNow(gear)
   407 function InABetterPlaceNow(gear)
   476 	for i = 0, (numhhs-1) do
   408 	for i = 0, (numhhs-1) do
   477 		if gear == hhs[i] then
   409 		if gear == hhs[i] then
   487 function onHogRestore(gear)
   419 function onHogRestore(gear)
   488 	match = false
   420 	match = false
   489 	for i = 0, (numhhs-1) do
   421 	for i = 0, (numhhs-1) do
   490 		if (hhs[i] == nil) and (match == false) then
   422 		if (hhs[i] == nil) and (match == false) then
   491 			hhs[i] = gear
   423 			hhs[i] = gear
   492 			--AddCaption(GetHogName(gear) .. " has reappeared it seems!")
       
   493 			--FollowGear(gear)
       
   494 			match = true
   424 			match = true
   495 		end
   425 		end
   496 	end
   426 	end
   497 end
   427 end
   498 
   428