Construction Mode: Fix giving round energy boost at first round
authorWuzzy <almikes@aol.com>
Wed, 13 Apr 2016 01:26:46 +0200
changeset 11721 8c1a30d4cbc8
parent 11720 5cb2f245ee2f
child 11722 fc4909039db8
Construction Mode: Fix giving round energy boost at first round
share/hedgewars/Data/Scripts/Multiplayer/Construction_Mode.lua
--- a/share/hedgewars/Data/Scripts/Multiplayer/Construction_Mode.lua	Wed Apr 13 01:19:37 2016 +0200
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Construction_Mode.lua	Wed Apr 13 01:26:46 2016 +0200
@@ -29,7 +29,7 @@
 -- key is a word and each value is non-negative integer.
 --
 -- Possible keys:
---- initialenergy: Amount of energy that each team starts with (default: 500)
+--- initialenergy: Amount of energy that each team starts with (default: 550)
 --- energyperround: Amount of energy that each team gets per round (default: 50)
 --- maxenergy: Maximum amount of energy each team can hold (default: 1000)
 
@@ -169,6 +169,7 @@
 clanLGearIndex = {}
 clanUsedExtraTime = {}
 clanCratesSpawned = {}
+clanFirstTurn = {}
 
 effectTimer = 0
 
@@ -186,7 +187,7 @@
 checkForSpecialWeaponsIn = -1
 
 -- Config variables (script parameter)
-conf_initialEnergy = 500
+conf_initialEnergy = 550
 conf_energyPerRound = 50
 conf_maxEnergy = 1000
 
@@ -1577,7 +1578,7 @@
 		clanLGearIndex[i] = 1
 		clanUsedExtraTime[i] = false
 		clanCratesSpawned[i] = 0
-
+		clanFirstTurn[i] = true
 
 	end
 
@@ -1610,9 +1611,13 @@
 function onNewTurn()
 
 	local clan = GetHogClan(CurrentHedgehog)
-	clanPower[clan] = clanPower[clan] + conf_energyPerRound
-	if clanPower[clan] > conf_maxEnergy then
-		clanPower[clan] = conf_maxEnergy
+	if clanFirstTurn[clan] then
+		clanFirstTurn[clan] = false
+	else
+		clanPower[clan] = clanPower[clan] + conf_energyPerRound
+		if clanPower[clan] > conf_maxEnergy then
+			clanPower[clan] = conf_maxEnergy
+		end
 	end
 	clanUsedExtraTime[clan] = false
 	clanCratesSpawned[clan] = 0