From 211d6c0666ce58aa0330091e9eb076d3f231b57a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Sat, 21 Oct 2023 17:51:02 +0200 Subject: Spaces : #shift raise if out of limits, set @independent add #terror? --- lib/colonial_twilight/spaces.rb | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/colonial_twilight/spaces.rb b/lib/colonial_twilight/spaces.rb index bc0bfbd..14d95a4 100644 --- a/lib/colonial_twilight/spaces.rb +++ b/lib/colonial_twilight/spaces.rb @@ -12,14 +12,10 @@ module ColonialTwilight @max = max end - # FIXME: is that needed ? - # def shift(val) - # w = @v + val - # return false if w.negative? || w > @max - # - # @v = w - # true - # end + def shift(val) + @v += val + raise "out of track #{@v}" if @v.negative? || @v > @max + end def clamp(val) @v = (@v + val).clamp(0, @max) @@ -117,6 +113,10 @@ module ColonialTwilight (@attrs & MOUNTAIN) == MOUNTAIN end + def terror? + @terror.positive? + end + def support? @alignment == :support end @@ -189,6 +189,7 @@ module ColonialTwilight def initialize(name) super(name, nil, nil, 1, MOUNTAIN | BORDER | COASTAL) + @independent = false @descr += ' : French' end -- cgit v1.1-2-g2b99