Method: BCDice::GameSystem::Arianrhod#result_nd6

Defined in:
lib/bcdice/game_system/Arianrhod.rb

#result_nd6(total, _dice_total, dice_list, cmp_op, target) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/bcdice/game_system/Arianrhod.rb', line 28

def result_nd6(total, _dice_total, dice_list, cmp_op, target)
  n_max = dice_list.count(6)

  if dice_list.count(1) == dice_list.size
    # 全部1の目ならファンブル
    Result.fumble(translate("fumble"))
  elsif n_max >= 2
    # 2個以上6の目があったらクリティカル
    Result.critical(translate("Arianrhod.critical", dice: n_max))
  elsif cmp_op != :>= || target == '?'
    nil
  elsif total >= target
    Result.success(translate("success"))
  else
    Result.failure(translate("failure"))
  end
end