From 8637fb640277b46c9e84fd8b0b7f8c9d73abd8b6 Mon Sep 17 00:00:00 2001 From: ocha Date: Sat, 22 May 2021 14:06:44 +0900 Subject: [PATCH 1/2] =?UTF-8?q?NinjaSlayer:=20=E7=B9=B0=E3=82=8A=E8=BF=94?= =?UTF-8?q?=E3=81=97=E5=AE=9F=E8=A1=8C=E6=99=82=E3=81=AE=E3=83=86=E3=82=B9?= =?UTF-8?q?=E3=83=88=E3=82=B1=E3=83=BC=E3=82=B9=E3=82=92=E8=BF=BD=E5=8A=A0?= =?UTF-8?q?=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/data/NinjaSlayer.toml | 68 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) 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]" From 7c89d5bee37bb924941211176896a6afd0ff07c5 Mon Sep 17 00:00:00 2001 From: ocha Date: Sat, 22 May 2021 15:52:36 +0900 Subject: [PATCH 2/2] =?UTF-8?q?NinjaSlayer:=20AT=E3=80=81EL:=20=E7=B9=B0?= =?UTF-8?q?=E3=82=8A=E8=BF=94=E3=81=97=E5=AE=9F=E8=A1=8C=E6=99=82=E3=81=AB?= =?UTF-8?q?=E8=93=84=E7=A9=8D=E3=81=97=E3=81=9F=E5=87=BA=E7=9B=AE=E3=82=92?= =?UTF-8?q?=E7=94=A8=E3=81=84=E3=81=A6=E5=88=A4=E6=96=AD=E3=81=97=E3=81=AA?= =?UTF-8?q?=E3=81=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bcdice/common_command/barabara_dice/node.rb | 4 ++-- lib/bcdice/common_command/barabara_dice/result.rb | 6 ++++++ lib/bcdice/game_system/NinjaSlayer.rb | 5 ++--- 3 files changed, 10 insertions(+), 5 deletions(-) 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 }