Fixed scoring exploit on Control and removed user branding from the map
authormikade
Tue, 22 Feb 2011 18:51:22 +0200
changeset 4953 ebd3dae634ca
parent 4952 df752b69a142
child 4971 98c5b7a0630a
Fixed scoring exploit on Control and removed user branding from the map Changed hog positioning code on CTF_Blizzard so that each side is positioned in the same manner, and gets to move in the same order Fixed version control fail in CTF_Blizzard
share/hedgewars/Data/Maps/CTF_Blizzard/map.lua
share/hedgewars/Data/Maps/Control/map.lua
--- a/share/hedgewars/Data/Maps/CTF_Blizzard/map.lua	Sat Feb 19 04:04:34 2011 +0100
+++ b/share/hedgewars/Data/Maps/CTF_Blizzard/map.lua	Tue Feb 22 18:51:22 2011 +0200
@@ -1,5 +1,5 @@
 --------------------------------
--- CTF_BLIZZARD 0.6
+-- CTF_BLIZZARD 0.8
 --------------------------------
 
 ---------
@@ -73,9 +73,16 @@
 ------------
 
 -- hopefully fixed a bug with the teleporters
+-- added a fix for crate possibly getting imbedded in land when it was near the water line
 
--- added a fix for crate possibly getting imbedded in land when it was near
--- the water line
+-----------
+-- 0.8
+------------
+
+-- fixed version control fail with missing check on onGearDelete
+
+-- changed hog placements code so that they start in the same place for both teams
+-- and hogs move in the same order, not backwards to each other.
 
 loadfile(GetDataPath() .. "Scripts/Locale.lua")()
 
@@ -591,7 +598,7 @@
 					team1Placed = 0
 				end
 			elseif GetHogClan(hhs[g]) == 1 then
-				SetGearPosition(hhs[g],2230+ ((team2Placed+1)*50),1570)
+				SetGearPosition(hhs[g],2691- ((team2Placed+1)*50),1570)
 				team2Placed = team2Placed +1
 				if team2Placed > 6 then
 					team2Placed = 0
@@ -707,6 +714,8 @@
 
 	SetAmmo(amFirePunch, 9, 0, 0, 0)
 	SetAmmo(amBaseballBat, 2, 0, 0, 0)
+	--SetAmmo(amKamikaze, 2, 0, 0, 0)
+
 
 	SetAmmo(amDynamite,2,0,0,1)
 	SetAmmo(amSMine,4,0,0,0)
@@ -788,4 +797,18 @@
 		ropeGear = nil
 	end
 
+	if GetGearType(gear) == gtHedgehog then
+		for i = 0, (numhhs-1) do
+			if gear == hhs[i] then
+				
+				for k = 0,1 do
+					if gear == fThief[k] then
+						FlagThiefDead(gear)
+					end
+				end				
+				hhs[i] = nil	
+			end		
+		end
+	end
+
 end
--- a/share/hedgewars/Data/Maps/Control/map.lua	Sat Feb 19 04:04:34 2011 +0100
+++ b/share/hedgewars/Data/Maps/Control/map.lua	Tue Feb 22 18:51:22 2011 +0200
@@ -1,8 +1,6 @@
---------------------------------
--- CONTROL 0.3
 --------------------------------
-
--- in this version
+-- CONTROL 0.5
+--------------------------------
 
 ---------
 -- 0.2
@@ -30,6 +28,13 @@
 
 -- added scaling scoring based on clans: 300 points to win - 25 per team in game
 
+--------
+-- 0.5
+--------
+
+-- removed user branding
+-- fixed infinite attack time exploit
+
 -----------------
 --script begins
 -----------------
@@ -42,13 +47,15 @@
 ----------to read about tables properly
 ------------------ "Oh well, they probably have the memory"
 
+local TimeCounter = 0
+
 local gameWon = false
 local pointLimit = 300
 
 local vCirc = {}
 local vCircCount = 0
 
-local hGCount = 0
+--local hGCount = 0
 
 local vCircX = {}
 local vCircY = {}
@@ -288,8 +295,6 @@
 
 function onGameStart()
 
-	
-
 	-- build zones
 	cPoint[0] = CreateZone(571,47,120,80)
 	cPoint[1] = CreateZone(1029,643,120,80)
@@ -347,7 +352,7 @@
 		--AddCaption(zz) -- number of times it took to work
 	end
 
-	ShowMission(loc("CONTROL v0.3"), loc("by mikade"), loc("Control pillars to score points.") .. "|" .. loc("Goal:") .. " " .. pointLimit .. " " .. loc("points"), 0, 0)
+	ShowMission(loc("CONTROL v0.3"), loc(""), loc("Control pillars to score points.") .. "|" .. loc("Goal:") .. " " .. pointLimit .. " " .. loc("points"), 0, 0)
 
 
 end
@@ -355,6 +360,8 @@
 
 function onNewTurn()
 
+	-- reset the time counter so that it will get set to TurnTimeLeft in onGameTick	
+	TimeCounter = 0
 		
 	if lastTeam ~= GetHogTeamName(CurrentHedgehog) then
 		lastTeam = GetHogTeamName(CurrentHedgehog)
@@ -426,11 +433,26 @@
 
 	end
 
-	hGCount = hGCount + 1
-	if (hGCount >= 2000) and (gameWon == false) then
-		hGCount = 0
-		AwardPoints()
-	end
+	-- set TimeCounter to starting time if it is uninitialised (from onNewTurn)	
+	if (TimeCounter == 0) and (TurnTimeLeft > 0) then
+		TimeCounter = TurnTimeLeft	
+	end	
+	
+	-- has it ACTUALLY been 2 seconds since we last did this?	
+	if (TimeCounter - TurnTimeLeft) >= 2000 then
+		TimeCounter = TurnTimeLeft
+		
+		if (gameWon == false) then
+			AwardPoints()		
+		end	
+	end	
+	
+	--AddCaption(TimeCounter)	
+	--hGCount = hGCount + 1
+	--if (hGCount >= 2000) and (gameWon == false) then
+	--	hGCount = 0
+	--	AwardPoints()
+	--end
 
 end