class BCDice::GameSystem::JamesBond

Constants

HELP_MESSAGE

ダイスボットの使い方

ID

ゲームシステムの識別子

NAME

ゲームシステム名

SORT_KEY

ゲームシステム名の読みがな

Public Instance Methods

result_1d100(total, _dice_total, cmp_op, target) click to toggle source
# File lib/bcdice/game_system/JamesBond.rb, line 22
def result_1d100(total, _dice_total, cmp_op, target) # ゲーム別成功度判定(1d100)
  return Result.nothing if target == '?'
  return nil unless cmp_op == :<=

  base = ((target + 9) / 10).floor

  if total >= 100
    # 100は常に失敗
    Result.failure("失敗")
  elsif total <= base
    Result.success("効果1(完璧)")
  elsif total <= base * 2
    Result.success("効果2(かなり良い)")
  elsif total <= base * 5
    Result.success("効果3(良)")
  elsif total <= target
    Result.success("効果4(まあまあ)")
  else
    Result.failure("失敗")
  end
end