class BCDice::GameSystem::SharedFantasia

Constants

HELP_MESSAGE

ダイスボットの使い方

ID

ゲームシステムの識別子

NAME

ゲームシステム名

SORT_KEY

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

Public Instance Methods

change_text(string) click to toggle source
# File lib/bcdice/game_system/SharedFantasia.rb, line 26
def change_text(string)
  string.gsub(/S[FT]/i, "2D6")
end
result_2d6(total, dice_total, _dice_list, cmp_op, target) click to toggle source
# File lib/bcdice/game_system/SharedFantasia.rb, line 30
def result_2d6(total, dice_total, _dice_list, cmp_op, target)
  return Result.nothing if target == '?'
  return nil unless [:>=, :>].include?(cmp_op)

  critical = false
  fumble   = false

  if dice_total == 12
    critical = true
  elsif dice_total == 2
    fumble = true
  end

  totalValueBonus = (cmp_op == :>= ? 1 : 0)

  if (total + totalValueBonus) > target
    if critical
      Result.critical("自動成功(劇的成功)")
    elsif fumble
      Result.failure("自動失敗")
    else
      Result.success("成功")
    end
  else
    if critical
      Result.success("自動成功")
    elsif fumble
      Result.fumble("自動失敗(致命的失敗)")
    else
      Result.failure("失敗")
    end
  end
end