class BCDice::GameSystem::NSSQ
Constants
- HELP_MESSAGE
- ID
- NAME
- SORT_KEY
Public Instance Methods
eval_game_system_specific_command(command)
click to toggle source
# File lib/bcdice/game_system/NSSQ.rb, line 35 def eval_game_system_specific_command(command) roll_sq(command) || damage_roll(command) || heal_roll(command) || collecting_roll(command) end
Private Instance Methods
additional_damage_roll(increase_critical_dice, resist)
click to toggle source
# File lib/bcdice/game_system/NSSQ.rb, line 93 def additional_damage_roll(increase_critical_dice, resist) dice_count = increase_critical_dice ? 8 : 4 dice_list = @randomizer.roll_barabara(dice_count, 6) "(#{dice_count}DR#{resist}) > [#{dice_list.join(',')}]#{resist} > #{damage(dice_list, resist)}ダメージ" end
collecting_roll(command)
click to toggle source
採取ロール
# File lib/bcdice/game_system/NSSQ.rb, line 118 def collecting_roll(command) m = /([TSG])C([+\-\d]+)?/i.match(command) return nil unless m type = m[1] modifier = ArithmeticEvaluator.eval(m[2]) aatto_param = case type when "T" 3 when "S" 4 when "G" 5 end roll_times = aatto_param - 2 + modifier return nil if roll_times <= 0 results = Array.new(roll_times) do |i| dice_list = @randomizer.roll_barabara(2, 6) dice = dice_list.sum() "(#{command}) > #{dice}[#{dice_list.join(',')}]: #{result_collecting(i, dice, aatto_param)}" end results.join("\n") end
damage(dice_list, resist)
click to toggle source
# File lib/bcdice/game_system/NSSQ.rb, line 113 def damage(dice_list, resist) dice_list.count { |x| x > resist } end
damage_roll(command)
click to toggle source
ダメージロール
# File lib/bcdice/game_system/NSSQ.rb, line 70 def damage_roll(command) m = /(\d+)DR(C)?(\+)?(\d+)/i.match(command) return nil unless m dice_count = m[1].to_i critical_up = !m[2].nil? # 強化効果 クリティカルアップ increase_critical_dice = !m[3].nil? resist = m[4].to_i dice_list = @randomizer.roll_barabara(dice_count, 6) result = "(#{command}) > [#{dice_list.join(',')}]#{resist} > #{damage(dice_list, resist)}ダメージ" critical_target = critical_up ? 1 : 2 if dice_list.count(6) - dice_list.count(1) >= critical_target result += " クリティカル!\n" result += additional_damage_roll(increase_critical_dice, resist) end return result end
heal_roll(command)
click to toggle source
回復ロール
# File lib/bcdice/game_system/NSSQ.rb, line 101 def heal_roll(command) m = /^(\d+)HR(\d+)?$/i.match(command) return nil unless m dice_count = m[1].to_i resist = m[2]&.to_i || 3 dice_list = @randomizer.roll_barabara(dice_count, 6) return "(#{command}) > [#{dice_list.join(',')}]#{resist} > #{damage(dice_list, resist)}回復" end
result_collecting(i, dice, aatto)
click to toggle source
# File lib/bcdice/game_system/NSSQ.rb, line 148 def result_collecting(i, dice, aatto) if (dice <= aatto) && (aatto - 2 > i) "!ああっと!" elsif aatto - 2 <= i "成功(追加分)" else "成功" end end
roll_sq(command)
click to toggle source
判定
# File lib/bcdice/game_system/NSSQ.rb, line 42 def roll_sq(command) m = /(\d+)SQ([+\-\d]+)?/i.match(command) return nil unless m dice_count = m[1].to_i modifier = ArithmeticEvaluator.eval(m[2]) dice_list = @randomizer.roll_barabara(dice_count, 6) largest_two = dice_list.sort.reverse.take(2) total = largest_two.sum + modifier additional_result = if largest_two == [6, 6] " クリティカル!" elsif largest_two == [1, 1] " ファンブル!" end sequence = [ "(#{command})", "[#{dice_list.join(',')}]#{Format.modifier(modifier)}", "#{total}[#{largest_two.join(',')}]#{additional_result}", ] return sequence.join(" > ") end