diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2023-10-21 17:51:02 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2023-10-21 17:51:02 +0200 |
commit | 211d6c0666ce58aa0330091e9eb076d3f231b57a (patch) | |
tree | 50633a372bc71f1da67cb19759db66c735701539 | |
parent | fc89b01224150bd0e4e32e92494539e890dc90ae (diff) | |
download | colonial-twilight-211d6c0666ce58aa0330091e9eb076d3f231b57a.zip colonial-twilight-211d6c0666ce58aa0330091e9eb076d3f231b57a.tar.gz |
Spaces : #shift raise if out of limits, set @independent add #terror?
-rw-r--r-- | lib/colonial_twilight/spaces.rb | 17 |
1 files 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 |