Class: BCDice::GameSystem::OrgaRain
- Defined in:
- lib/bcdice/game_system/OrgaRain.rb
Constant Summary collapse
- ID =
ゲームシステムの識別子
'OrgaRain'
- NAME =
ゲームシステム名
'在りて遍くオルガレイン'
- SORT_KEY =
ゲームシステム名の読みがな
'ありてあまねくおるかれいん'
- HELP_MESSAGE =
ダイスボットの使い方
"\u5224\u5B9A\uFF1A[n]OR(count)\n\n[]\u5185\u306E\u30B3\u30DE\u30F3\u30C9\u306F\u7701\u7565\u53EF\u80FD\u3002\n\u300Cn\u300D\u3067\u30C0\u30A4\u30B9\u6570\u3092\u6307\u5B9A\u3002\u7701\u7565\u6642\u306F\u300C1\u300D\u3002\n(count)\u3067\u547D\u6570\u3092\u6307\u5B9A\u3002\u300C3111\u300D\u306E\u3088\u3046\u306B\u8A18\u8FF0\u3002\u6700\u59276\u3064\u3002\u9806\u4E0D\u540C\u53EF\u3002\n\n\u3010\u66F8\u5F0F\u4F8B\u3011\n\u30FB5OR6042 \u2192 5d\u3067\u547D\u6570\u300C0,2,4,6\u300D\u306E\u5224\u5B9A\n\u30FB6OR33333 \u2192 6d\u3067\u547D\u6570\u300C3,3,3,3,3\u300D\u306E\u5224\u5B9A\u3002\n"
Instance Attribute Summary
Attributes inherited from Base
#d66_sort_type, #default_cmp_op, #default_target_number, #randomizer, #reroll_dice_reroll_threshold, #round_type, #sides_implicit_d, #upper_dice_reroll_threshold
Instance Method Summary collapse
- #check_roll(dice_count, count_no) ⇒ Object
- #eval_game_system_specific_command(command) ⇒ Object
-
#initialize(command) ⇒ OrgaRain
constructor
A new instance of OrgaRain.
Methods inherited from Base
#change_text, #check_result, command_pattern, #enable_debug, #enabled_d9?, #eval, eval, #grich_text, prefixes_pattern, register_prefix, register_prefix_from_super_class, #sort_add_dice?, #sort_barabara_dice?
Methods included from Translate
Constructor Details
#initialize(command) ⇒ OrgaRain
Returns a new instance of OrgaRain.
28 29 30 31 |
# File 'lib/bcdice/game_system/OrgaRain.rb', line 28 def initialize(command) super(command) @sort_add_dice = true # ダイスのソート有 end |
Instance Method Details
#check_roll(dice_count, count_no) ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/bcdice/game_system/OrgaRain.rb', line 46 def check_roll(dice_count, count_no) dice_array = @randomizer.(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) ⇒ Object
37 38 39 40 41 42 43 44 |
# 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 |