From af6dec2f198671ea01b654b6589d41ddeb8ba9c9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Kore=C4=8Dek?= <korecek@matfyz.cz>
Date: Sun, 18 Sep 2022 21:03:11 +0200
Subject: [PATCH] =?UTF-8?q?Strategick=C3=A1:=20Line=C3=A1rn=C3=AD=20budget?=
 =?UTF-8?q?=20funkce?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

+ None jako action opět znamená i zůstání na místě.
---
 server/hra/game.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/server/hra/game.py b/server/hra/game.py
index c4358a1..5b1d296 100644
--- a/server/hra/game.py
+++ b/server/hra/game.py
@@ -27,6 +27,7 @@ class Logic:
 @add_logic
 class Occupy(Logic):
     MOVE_VECTORS = {
+        None: (0, 0),
         "stay": (0, 0),
         "left": (0, -1),
         "right": (0, 1),
@@ -60,8 +61,10 @@ class Occupy(Logic):
             "remaining_rounds": 1
         }
 
+    # zero_state spawnuje jednoho vojáka, poslední (použitelný, takže
+    # předposlední) spawn umožňuje budget na `last_spawn` nových vojáků
     def budget_for_round(self, round_id):
-        return (self.last_spawn * self.spawn_price * (round_id + 1)**2) // (self.rounds_total**2)
+        return self.spawn_price + ((round_id * self.spawn_price * self.last_spawn) // self.rounds_total)
     
     # Počáteční stav
     def zero_state(self) -> Any: