class BCDice::GameSystem::InfiniteFantasia

Constants

HELP_MESSAGE

ダイスボットの使い方

ID

ゲームシステムの識別子

NAME

ゲームシステム名

SORT_KEY

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

Public Instance Methods

result_1d20(total, _dice_total, cmp_op, target) click to toggle source

ゲーム別成功度判定(1d20)

# File lib/bcdice/game_system/InfiniteFantasia.rb, line 19
def result_1d20(total, _dice_total, cmp_op, target)
  return Result.nothing if target == '?'
  return nil unless cmp_op == :<=

  if total > target
    return Result.failure("失敗")
  end

  output =
    if total <= (target / 32)
      "32レベル成功(32Lv+)"
    elsif total <= (target / 16)
      "16レベル成功(16Lv+)"
    elsif total <= (target / 8)
      "8レベル成功"
    elsif total <= (target / 4)
      "4レベル成功"
    elsif total <= (target / 2)
      "2レベル成功"
    else
      "1レベル成功"
    end

  Result.new.tap do |r|
    r.text = output
    r.success = true
    if total <= 1
      r.critical = true
      r.text += "/クリティカル"
    end
  end
end