class BCDice::GameSystem::OrgaRain
Constants
- HELP_MESSAGE
ダイスボットの使い方
- ID
ゲームシステムの識別子
- NAME
ゲームシステム名
- SORT_KEY
ゲームシステム名の読みがな
Public Class Methods
new(command)
click to toggle source
Calls superclass method
BCDice::Base::new
# File lib/bcdice/game_system/OrgaRain.rb, line 28 def initialize(command) super(command) @sort_add_dice = true # ダイスのソート有 end
Public Instance Methods
check_roll(dice_count, count_no)
click to toggle source
# File lib/bcdice/game_system/OrgaRain.rb, line 46 def check_roll(dice_count, count_no) dice_array = @randomizer.roll_barabara(dice_count, 10).sort dice_text = dice_array.join(',') result_array = [] success = 0 dice_array.map { |x| x == 10 ? 0 : x }.each do |i| multiple = count_no.count(i) if multiple > 0 result_array.push("#{i}(x#{multiple})") success += multiple else result_array.push("×") end end count_text = count_no.join(',') result_text = result_array.join(',') return "#{dice_count}D10(命数:#{count_text}) > #{dice_text} > #{result_text} > 成功数:#{success}" end
eval_game_system_specific_command(command)
click to toggle source
# File lib/bcdice/game_system/OrgaRain.rb, line 37 def eval_game_system_specific_command(command) m = command.match(/(\d+)?OR(\d{0,6})$/i) return nil unless m dice_count = (m[1] || 1).to_i count_no = (m[2] || "").each_char.map(&:to_i).sort return check_roll(dice_count, count_no) end