diff --git a/lib/bcdice/common_command/barabara_dice/node.rb b/lib/bcdice/common_command/barabara_dice/node.rb index 1c7807b3b..01db876eb 100644 --- a/lib/bcdice/common_command/barabara_dice/node.rb +++ b/lib/bcdice/common_command/barabara_dice/node.rb @@ -43,8 +43,8 @@ def eval(game_system, randomizer) Result.new.tap do |r| r.secret = @secret r.text = sequence.join(" > ") - r.rands = randomizer.rand_results - r.detailed_rands = randomizer.detailed_rand_results + r.last_dice_list_list = dice_list_list + r.last_dice_list = dice_list r.success_num = success_num end end diff --git a/lib/bcdice/common_command/barabara_dice/result.rb b/lib/bcdice/common_command/barabara_dice/result.rb index 8177c6155..dde82308c 100644 --- a/lib/bcdice/common_command/barabara_dice/result.rb +++ b/lib/bcdice/common_command/barabara_dice/result.rb @@ -7,6 +7,10 @@ module CommonCommand module BarabaraDice # バラバラロールの結果を表すクラス class Result < ::BCDice::Result + # @return [Array>] 出目のグループの配列 + attr_accessor :last_dice_list_list + # @return [Array] すべての出目が格納される配列 + attr_accessor :last_dice_list # @return [Integer] 成功数 attr_accessor :success_num @@ -14,6 +18,8 @@ class Result < ::BCDice::Result def initialize(text = nil) super(text) + @last_dice_list_list = [] + @last_dice_list = [] @success_num = 0 end end diff --git a/lib/bcdice/game_system/NinjaSlayer.rb b/lib/bcdice/game_system/NinjaSlayer.rb index ea0c84375..2f0991489 100644 --- a/lib/bcdice/game_system/NinjaSlayer.rb +++ b/lib/bcdice/game_system/NinjaSlayer.rb @@ -176,8 +176,7 @@ def executeAT(at) command = bRollCommand(at.num, at.difficulty) roll_result = BCDice::CommonCommand::BarabaraDice.eval(command, self, @randomizer) - values = roll_result.rands.map { |v, _| v } - num_of_max_values = values.count(6) + num_of_max_values = roll_result.last_dice_list.count(6) parts = [roll_result.text] @@ -195,7 +194,7 @@ def executeEL(el) command = bRollCommand(el.num, el.difficulty) roll_result = BCDice::CommonCommand::BarabaraDice.eval(command, self, @randomizer) - values = roll_result.rands.map { |v, _| v } + values = roll_result.last_dice_list num_of_max_values = values.count(6) sum_of_true_values = values.count { |v| v >= el.difficulty } diff --git a/test/data/NinjaSlayer.toml b/test/data/NinjaSlayer.toml index 37ee343b2..05c9d1740 100644 --- a/test/data/NinjaSlayer.toml +++ b/test/data/NinjaSlayer.toml @@ -373,6 +373,17 @@ rands = [ { sides = 6, value = 6 }, ] +[[ test ]] +game_system = "NinjaSlayer" +input = "AT4" +output = "(4B6>=4) > 1,1,1,1 > 成功数0" +rands = [ + { sides = 6, value = 1 }, + { sides = 6, value = 1 }, + { sides = 6, value = 1 }, + { sides = 6, value = 1 }, +] + [[ test ]] game_system = "NinjaSlayer" input = "AT4" @@ -384,6 +395,29 @@ rands = [ { sides = 6, value = 6 }, ] +[[ test ]] +game_system = "NinjaSlayer" +input = "x2 AT4 繰り返し実行で蓄積した出目を用いて判断しない" +output = """ +#1 +(4B6>=4) > 2,2,6,6 > 成功数2 > サツバツ!! + +#2 +(4B6>=4) > 1,1,1,1 > 成功数0""" +rands = [ + # 1回目 + { sides = 6, value = 2 }, + { sides = 6, value = 2 }, + { sides = 6, value = 6 }, + { sides = 6, value = 6 }, + + # 2回目 + { sides = 6, value = 1 }, + { sides = 6, value = 1 }, + { sides = 6, value = 1 }, + { sides = 6, value = 1 }, +] + [[ test ]] game_system = "NinjaSlayer" input = "AT4[n]" @@ -461,6 +495,17 @@ rands = [ { sides = 6, value = 6 }, ] +[[ test ]] +game_system = "NinjaSlayer" +input = "EL4" +output = "(4B6>=4) > 1,1,1,1 > 成功数0" +rands = [ + { sides = 6, value = 1 }, + { sides = 6, value = 1 }, + { sides = 6, value = 1 }, + { sides = 6, value = 1 }, +] + [[ test ]] game_system = "NinjaSlayer" input = "EL4" @@ -472,6 +517,29 @@ rands = [ { sides = 6, value = 6 }, ] +[[ test ]] +game_system = "NinjaSlayer" +input = "x2 EL4 繰り返し実行で蓄積した出目を用いて判断しない" +output = """ +#1 +(4B6>=4) > 2,2,2,6 > 成功数1 + 1 > 2 + +#2 +(4B6>=4) > 1,1,1,1 > 成功数0""" +rands = [ + # 1回目 + { sides = 6, value = 2 }, + { sides = 6, value = 2 }, + { sides = 6, value = 2 }, + { sides = 6, value = 6 }, + + # 2回目 + { sides = 6, value = 1 }, + { sides = 6, value = 1 }, + { sides = 6, value = 1 }, + { sides = 6, value = 1 }, +] + [[ test ]] game_system = "NinjaSlayer" input = "EL4[n]"