From b40d24f69c725ff7977b3d7ded3d78e60c152ba5 Mon Sep 17 00:00:00 2001 From: weiss Date: Sun, 12 Apr 2020 06:59:30 +0200 Subject: [PATCH] reset building lvl if destroyed --- code_royal/src/Main.purs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/code_royal/src/Main.purs b/code_royal/src/Main.purs index 2c1ecd2..c6abc10 100644 --- a/code_royal/src/Main.purs +++ b/code_royal/src/Main.purs @@ -68,7 +68,9 @@ loop numSites siteInfo gameState = do Just gs -> head $ filter (\s -> s.id == infoS.id) gs.sites Nothing -> Nothing let lvl = case prevSite of - Just site -> site.lvl + Just pSite -> if protoS.owner /= 0 + then 0 -- reset level of all buildings, which are not (any longer) ours + else pSite.lvl Nothing -> 0 pure { id: protoS.id , gold: protoS.gold