summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2023-11-19 12:14:21 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2023-11-19 12:14:21 +0100
commit6829aa96f06ee2fc3eb20cb124611827928d16a3 (patch)
tree951ff5209f0aa8fa920347adbd24c41e3858c28e /lib
parentf3779466615840bbe5a77d5ff18cf9c3b70b8658 (diff)
downloadcolonial-twilight-6829aa96f06ee2fc3eb20cb124611827928d16a3.zip
colonial-twilight-6829aa96f06ee2fc3eb20cb124611827928d16a3.tar.gz
Spaces/Forces : add #activate(num) && specs
Diffstat (limited to 'lib')
-rw-r--r--lib/colonial_twilight/forces.rb7
-rw-r--r--lib/colonial_twilight/spaces.rb4
2 files changed, 11 insertions, 0 deletions
diff --git a/lib/colonial_twilight/forces.rb b/lib/colonial_twilight/forces.rb
index f2b4149..6d26dea 100644
--- a/lib/colonial_twilight/forces.rb
+++ b/lib/colonial_twilight/forces.rb
@@ -119,6 +119,13 @@ module ColonialTwilight
update_control
end
+ def activate(num)
+ raise "can't activate #{num}" if @fln_underground < num
+
+ @fln_underground -= num
+ @fln_active += num
+ end
+
private
def add_base(type, num = 1)
diff --git a/lib/colonial_twilight/spaces.rb b/lib/colonial_twilight/spaces.rb
index d85954f..83d9082 100644
--- a/lib/colonial_twilight/spaces.rb
+++ b/lib/colonial_twilight/spaces.rb
@@ -177,6 +177,10 @@ module ColonialTwilight
raise "unknown shift direction : #{towards}"
end
end
+
+ def activate(num)
+ @forces.activate(num)
+ end
end
class City < Sector