class BCDice::GameSystem::LiveraDoll
Constants
- DECKS
- 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/LiveraDoll.rb, line 49 def initialize(command) super(command) @sort_add_dice = true @sort_barabara_dice = true end
Public Instance Methods
eval_game_system_specific_command(command)
click to toggle source
# File lib/bcdice/game_system/LiveraDoll.rb, line 56 def eval_game_system_specific_command(command) check_roll(command) || card_text(command) end
Private Instance Methods
card_text(command)
click to toggle source
# File lib/bcdice/game_system/LiveraDoll.rb, line 80 def card_text(command) m = /^([CKWRBGE][LDO])(\d+)$/.match(command) return nil unless m deck_type = m[1] card_index = m[2].to_i if card_index == 0 return nil end deck = DECKS[deck_type] return nil unless deck deck[card_index - 1] end
check_roll(command)
click to toggle source
# File lib/bcdice/game_system/LiveraDoll.rb, line 62 def check_roll(command) m = /^(\d+)?ATK([1-6]{0,6})$/.match(command) return nil unless m dice_count = m[1]&.to_i || 1 block_no = m[2].each_char.map(&:to_i).sort.uniq dice_array = @randomizer.roll_barabara(dice_count, 6).sort result_array = dice_array.map { |n| block_no.include?(n) ? "×" : n } success = result_array.count { |n| n.is_a?(Integer) } dice_text = dice_array.join(",") block_text = block_no.join(',') result_text = result_array.join(',') return "#{dice_count}D6(Block:#{block_text}) > #{dice_text} > #{result_text} > 成功数:#{success}" end