Class: BCDice::GameSystem::Shiranui::InifiniteD66Step

Inherits:
Object
  • Object
show all
Defined in:
lib/bcdice/game_system/Shiranui.rb

Instance Method Summary collapse

Constructor Details

#initialize(dices) ⇒ InifiniteD66Step

Returns a new instance of InifiniteD66Step.



90
91
92
# File 'lib/bcdice/game_system/Shiranui.rb', line 90

def initialize(dices)
  @dices = dices.dup.freeze
end

Instance Method Details

#repdigit?Boolean

Returns:

  • (Boolean)


113
114
115
# File 'lib/bcdice/game_system/Shiranui.rb', line 113

def repdigit?
  @dices[0] == @dices[1]
end

#scoreObject



94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/bcdice/game_system/Shiranui.rb', line 94

def score
  if repdigit?
    # ゾロ目の場合

    digit = @dices.first

    if digit == 1
      # 1 のゾロ目なら 0 となる
      0
    else
      # 1 以外のゾロ目なら、数字の 10 倍となる
      digit * 10
    end
  else
    # ゾロ目でない場合は、 D66 様式で値を算出する
    @dices[0] * 10 + @dices[1]
  end
end

#to_continue_diceroll?Boolean

ダイスロールを継続する必要があるか?

Returns:

  • (Boolean)


118
119
120
# File 'lib/bcdice/game_system/Shiranui.rb', line 118

def to_continue_diceroll?
  repdigit? && @dices[0] != 1
end

#to_sObject



122
123
124
# File 'lib/bcdice/game_system/Shiranui.rb', line 122

def to_s
  "[#{@dices[0]},#{@dices[1]}]"
end