flag crates since waste of time for mutant.
authornemo
Wed, 21 Nov 2018 15:26:54 -0500
changeset 14269 6f3f59266c4c
parent 14268 29d614a5c9eb
child 14270 2b54c956813e
flag crates since waste of time for mutant.
hedgewars/uAIMisc.pas
share/hedgewars/Data/Scripts/Multiplayer/Mutant.lua
--- a/hedgewars/uAIMisc.pas	Wed Nov 21 12:41:55 2018 -0500
+++ b/hedgewars/uAIMisc.pas	Wed Nov 21 15:26:54 2018 -0500
@@ -231,7 +231,8 @@
             , gtMelonPiece
             , gtMolotov: bonuses.activity:= true;
             gtCase:
-                AddBonus(hwRound(Gear^.X), hwRound(Gear^.Y) + 3, 37, 25);
+                if (Gear^.AIHints and aihDoesntMatter) = 0 then
+                    AddBonus(hwRound(Gear^.X), hwRound(Gear^.Y) + 3, 37, 25);
             gtFlame:
                 if (Gear^.State and gsttmpFlag) <> 0 then
                     AddBonus(hwRound(Gear^.X), hwRound(Gear^.Y), 20, -50);
--- a/share/hedgewars/Data/Scripts/Multiplayer/Mutant.lua	Wed Nov 21 12:41:55 2018 -0500
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Mutant.lua	Wed Nov 21 15:26:54 2018 -0500
@@ -32,6 +32,7 @@
 -----------------------]]
 
 local hhs = {}
+local crates = {}
 local numhhs = 0
 local meh = false
 
@@ -103,30 +104,30 @@
 
 function rules()
 
-	local ruleSet = loc("Hedgehogs will be revived after their death.") .. "|" ..
-	string.format(loc("Mines explode after %d s."), div(MinesTime, 1000)) .. "|" ..
-	loc("The first hedgehog to kill someone becomes the Mutant.") .. "|" ..
-	loc("The Mutant has super weapons and a lot of health.") .. "|" ..
-	loc("The Mutant loses health quickly, but gains health by killing.") .. "|" ..
-	" |" ..
-	loc("Score points by killing other hedgehogs.") .. "|" ..
-	loc("The hedgehog with least points (or most deaths) becomes the Bottom Feeder.") .. "|" ..
-	loc("The score and deaths are shown next to the team bar.") .. "|" ..
-	string.format(loc("Goal: Score %d points or more to win!"), winScore) .. "|" ..
+    local ruleSet = loc("Hedgehogs will be revived after their death.") .. "|" ..
+    string.format(loc("Mines explode after %d s."), div(MinesTime, 1000)) .. "|" ..
+    loc("The first hedgehog to kill someone becomes the Mutant.") .. "|" ..
+    loc("The Mutant has super weapons and a lot of health.") .. "|" ..
+    loc("The Mutant loses health quickly, but gains health by killing.") .. "|" ..
+    " |" ..
+    loc("Score points by killing other hedgehogs.") .. "|" ..
+    loc("The hedgehog with least points (or most deaths) becomes the Bottom Feeder.") .. "|" ..
+    loc("The score and deaths are shown next to the team bar.") .. "|" ..
+    string.format(loc("Goal: Score %d points or more to win!"), winScore) .. "|" ..
         " |" ..
-	loc("Scoring: ") .. "|" ..
-	loc("+2 for becoming the Mutant") .. "|" ..
-	loc("+1 to the Mutant for killing anyone") .. "|" ..
-	loc("+1 to the Bottom Feeder for killing anyone") .. "|" ..
-	loc("-1 to anyone for a suicide")
+    loc("Scoring: ") .. "|" ..
+    loc("+2 for becoming the Mutant") .. "|" ..
+    loc("+1 to the Mutant for killing anyone") .. "|" ..
+    loc("+1 to the Bottom Feeder for killing anyone") .. "|" ..
+    loc("-1 to anyone for a suicide")
 
-	return ruleSet
+    return ruleSet
 
 end
 
 function showStartingInfo()
 
-	ShowMission(loc("Mutant"), loc("A Hedgewars tag game"), rules(), 1, 5000)
+    ShowMission(loc("Mutant"), loc("A Hedgewars tag game"), rules(), 1, 5000)
 
 end
 
@@ -511,8 +512,8 @@
     end
 
     if meh == false then
-		meh = true
-	end
+        meh = true
+    end
 
     end
 end
@@ -534,6 +535,13 @@
             SetGearAIHints(hhs[i], aihDoesntMatter)
         end
     end
+    for i = 0, #crates do
+        if CurrentHedgehog == mutant and crate[i] != nil  then
+            SetGearAIHints(crates[i], aihDoesntMatter)
+        else
+            SetGearAIHints(crates[i], aihUsualProcessing)
+        end
+    end
 end
 
 function removeFeeder(gear)
@@ -696,20 +704,20 @@
 end
 
 function onGearDamage(gear, damage)
-	if not gameOver and GetGearType(gear) == gtHedgehog then
-		totalDamage = totalDamage + damage
-	end
+    if not gameOver and GetGearType(gear) == gtHedgehog then
+        totalDamage = totalDamage + damage
+    end
 end
 
 function onSkipTurn()
-	-- Record skips for achievement
-	local team = GetHogTeamName(CurrentHedgehog)
-	increaseTeamValue(team, "Skips")
-	if(getTeamValue(team, "Skips") > recordSkips) then
-		recordSkips = getTeamValue(team, "Skips")
-		recordSkipsHogName = getGearValue(CurrentHedgehog, "Name")
-		recordSkipsTeamName = team
-	end
+    -- Record skips for achievement
+    local team = GetHogTeamName(CurrentHedgehog)
+    increaseTeamValue(team, "Skips")
+    if(getTeamValue(team, "Skips") > recordSkips) then
+        recordSkips = getTeamValue(team, "Skips")
+        recordSkipsHogName = getGearValue(CurrentHedgehog, "Name")
+        recordSkipsTeamName = team
+    end
 end
 
 function onGearAdd(gear)
@@ -720,6 +728,8 @@
         hhs[numhhs] = gear
         numhhs = numhhs + 1
         SetEffect(gear, heResurrectable, 1)
+    elseif GetGearType(gear) == gtCase then
+        crates[#crates] = gear
     elseif GetGearType(gear) == gtATFinishGame then
         if not gameOver then
             local winner = createEndGameStats()
@@ -775,6 +785,7 @@
         end
         trackDeletion(gear)
     elseif GetGearType(gear) == gtCase then
+        crates[gear] = nil
         -- Check if a crate has been collected
         if band(GetGearMessage(gear), gmDestroy) ~= 0 and CurrentHedgehog ~= nil then
             -- Update crate collection achievement