From 1120cbd2167ebec74ef8b252a9940bfc3fdcf4bb Mon Sep 17 00:00:00 2001 From: Hideyo Mikisato Date: Thu, 26 May 2022 21:07:15 +0900 Subject: [PATCH 1/4] =?UTF-8?q?=E5=90=8C=E4=BA=BA=E3=82=B7=E3=82=B9?= =?UTF-8?q?=E3=83=86=E3=83=A0=E3=81=AE=E5=8D=83=E5=B9=BB=E6=8A=84=E3=82=92?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0=20https://wikiwiki.jp/sengensyou/?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ダイスコマンドとしてクリ・ファンのある3D6の命中のみ実装 https://discord.com/channels/597133335243784192/597133335243784194/978981650362937365 --- lib/bcdice/game_system.rb | 1 + lib/bcdice/game_system/Sengensyou.rb | 59 ++++++++++++++++++++++++++ test/data/Sengensyou.toml | 63 ++++++++++++++++++++++++++++ 3 files changed, 123 insertions(+) create mode 100644 lib/bcdice/game_system/Sengensyou.rb create mode 100644 test/data/Sengensyou.toml diff --git a/lib/bcdice/game_system.rb b/lib/bcdice/game_system.rb index 9bfd7fe1e..e4ab62bc8 100644 --- a/lib/bcdice/game_system.rb +++ b/lib/bcdice/game_system.rb @@ -172,6 +172,7 @@ require "bcdice/game_system/Satasupe" require "bcdice/game_system/ScreamHighSchool" require "bcdice/game_system/SevenFortressMobius" +require "bcdice/game_system/Sengensyou" require "bcdice/game_system/ShadowRun" require "bcdice/game_system/ShadowRun4" require "bcdice/game_system/ShadowRun5" diff --git a/lib/bcdice/game_system/Sengensyou.rb b/lib/bcdice/game_system/Sengensyou.rb new file mode 100644 index 000000000..bcda3f984 --- /dev/null +++ b/lib/bcdice/game_system/Sengensyou.rb @@ -0,0 +1,59 @@ +# frozen_string_literal: true + +module BCDice + module GameSystem + class Sengensyou < Base + # ゲームシステムの識別子 + ID = 'Sengensyou' + + # ゲームシステム名 + NAME = '千幻抄' + + # ゲームシステム名の読みがな + SORT_KEY = 'せんけんしよう' + + # ダイスボットの使い方 + HELP_MESSAGE = <<~INFO_MESSAGE_TEXT + ・SGS 命中判定 + INFO_MESSAGE_TEXT + + register_prefix('SGS') + + def eval_game_system_specific_command(command) + # 命中判定 + parser = Command::Parser.new('SGS', round_type: @round_type) + command = parser.parse(command) + + unless command + return nil + end + + dice_list = @randomizer.roll_barabara(3, 6) + dice_total = dice_list.sum() + is_critical = dice_total >= 16 + is_fumble = dice_total <= 5 + additional_text = + if is_critical + "クリティカル" + elsif is_fumble + "ファンブル" + end + modify_text = "#{dice_total}#{Format.modifier(command.modify_number)}" if command.modify_number != 0 + sequence = [ + "(3D6#{Format.modifier(command.modify_number)})", + "#{dice_total}[#{dice_list.join(',')}]", + modify_text, + (dice_total + command.modify_number).to_s, + additional_text, + ].compact + + result = Result.new.tap do |r| + r.text = sequence.join(" > ") + r.critical = is_critical + r.fumble = is_fumble + end + return result + end + end + end +end diff --git a/test/data/Sengensyou.toml b/test/data/Sengensyou.toml new file mode 100644 index 000000000..077deb044 --- /dev/null +++ b/test/data/Sengensyou.toml @@ -0,0 +1,63 @@ +[[ test ]] +game_system = "Sengensyou" +input = "SGS" +output = "(3D6) > 8[4,1,3] > 8" +rands = [ + { sides = 6, value = 4 }, + { sides = 6, value = 1 }, + { sides = 6, value = 3 }, +] + +[[ test ]] +game_system = "Sengensyou" +input = "SGS" +output = "(3D6) > 16[5,5,6] > 16 > クリティカル" +critical = true +rands = [ + { sides = 6, value = 5 }, + { sides = 6, value = 5 }, + { sides = 6, value = 6 }, +] + +[[ test ]] +game_system = "Sengensyou" +input = "SGS" +output = "(3D6) > 5[1,2,2] > 5 > ファンブル" +fumble = true +rands = [ + { sides = 6, value = 1 }, + { sides = 6, value = 2 }, + { sides = 6, value = 2 }, +] + +[[ test ]] +game_system = "Sengensyou" +input = "SGS+4+6" +output = "(3D6+10) > 8[4,1,3] > 8+10 > 18" +rands = [ + { sides = 6, value = 4 }, + { sides = 6, value = 1 }, + { sides = 6, value = 3 }, +] + +[[ test ]] +game_system = "Sengensyou" +input = "SGS+4+6" +output = "(3D6+10) > 16[5,5,6] > 16+10 > 26 > クリティカル" +critical = true +rands = [ + { sides = 6, value = 5 }, + { sides = 6, value = 5 }, + { sides = 6, value = 6 }, +] + +[[ test ]] +game_system = "Sengensyou" +input = "SGS+4+6" +output = "(3D6+10) > 5[1,2,2] > 5+10 > 15 > ファンブル" +fumble = true +rands = [ + { sides = 6, value = 1 }, + { sides = 6, value = 2 }, + { sides = 6, value = 2 }, +] From 87f7f983d63adbb60a7cd33f527232e9512edd93 Mon Sep 17 00:00:00 2001 From: Hideyo Mikisato Date: Fri, 27 May 2022 21:41:44 +0900 Subject: [PATCH 2/4] =?UTF-8?q?=E5=9B=9E=E9=81=BF=E5=88=A4=E5=AE=9A?= =?UTF-8?q?=E3=81=AB=E3=81=A4=E3=81=84=E3=81=A6=E3=81=AE=E6=96=87=E8=A8=80?= =?UTF-8?q?=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bcdice/game_system/Sengensyou.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bcdice/game_system/Sengensyou.rb b/lib/bcdice/game_system/Sengensyou.rb index bcda3f984..ccf7a9143 100644 --- a/lib/bcdice/game_system/Sengensyou.rb +++ b/lib/bcdice/game_system/Sengensyou.rb @@ -14,7 +14,7 @@ class Sengensyou < Base # ダイスボットの使い方 HELP_MESSAGE = <<~INFO_MESSAGE_TEXT - ・SGS 命中判定 + ・SGS 命中判定・回避判定 INFO_MESSAGE_TEXT register_prefix('SGS') From 0c1c225a35ab7f8d4414b1f836c6c6b151629c2e Mon Sep 17 00:00:00 2001 From: Hideyo Mikisato Date: Sun, 29 May 2022 20:47:11 +0900 Subject: [PATCH 3/4] =?UTF-8?q?=E3=83=AC=E3=83=93=E3=83=A5=E3=83=BC?= =?UTF-8?q?=E5=8F=8D=E6=98=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bcdice/game_system.rb | 2 +- lib/bcdice/game_system/Sengensyou.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/bcdice/game_system.rb b/lib/bcdice/game_system.rb index e4ab62bc8..69136c40c 100644 --- a/lib/bcdice/game_system.rb +++ b/lib/bcdice/game_system.rb @@ -171,8 +171,8 @@ require "bcdice/game_system/SamsaraBallad" require "bcdice/game_system/Satasupe" require "bcdice/game_system/ScreamHighSchool" -require "bcdice/game_system/SevenFortressMobius" require "bcdice/game_system/Sengensyou" +require "bcdice/game_system/SevenFortressMobius" require "bcdice/game_system/ShadowRun" require "bcdice/game_system/ShadowRun4" require "bcdice/game_system/ShadowRun5" diff --git a/lib/bcdice/game_system/Sengensyou.rb b/lib/bcdice/game_system/Sengensyou.rb index ccf7a9143..83fed015c 100644 --- a/lib/bcdice/game_system/Sengensyou.rb +++ b/lib/bcdice/game_system/Sengensyou.rb @@ -20,7 +20,7 @@ class Sengensyou < Base register_prefix('SGS') def eval_game_system_specific_command(command) - # 命中判定 + # 命中判定・回避判定 parser = Command::Parser.new('SGS', round_type: @round_type) command = parser.parse(command) From 23da11f7a3eb4a7906a0838dd2525e5d3a3b77cd Mon Sep 17 00:00:00 2001 From: SAKATA Sinji Date: Sat, 20 Aug 2022 15:52:24 +0900 Subject: [PATCH 4/4] =?UTF-8?q?[Sengensyou]=20=E6=AF=94=E8=BC=83=E8=A8=98?= =?UTF-8?q?=E5=8F=B7=E3=82=92=E5=8F=97=E3=81=91=E5=85=A5=E3=82=8C=E3=81=AA?= =?UTF-8?q?=E3=81=84=E3=82=88=E3=81=86=E3=81=AB=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bcdice/game_system/Sengensyou.rb | 2 +- test/data/Sengensyou.toml | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/bcdice/game_system/Sengensyou.rb b/lib/bcdice/game_system/Sengensyou.rb index 83fed015c..365b0435c 100644 --- a/lib/bcdice/game_system/Sengensyou.rb +++ b/lib/bcdice/game_system/Sengensyou.rb @@ -21,7 +21,7 @@ class Sengensyou < Base def eval_game_system_specific_command(command) # 命中判定・回避判定 - parser = Command::Parser.new('SGS', round_type: @round_type) + parser = Command::Parser.new('SGS', round_type: @round_type).restrict_cmp_op_to(nil) command = parser.parse(command) unless command diff --git a/test/data/Sengensyou.toml b/test/data/Sengensyou.toml index 077deb044..b9ddc4949 100644 --- a/test/data/Sengensyou.toml +++ b/test/data/Sengensyou.toml @@ -61,3 +61,9 @@ rands = [ { sides = 6, value = 2 }, { sides = 6, value = 2 }, ] + +[[ test ]] +game_system = "Sengensyou" +input = "SGS>=5" +output = "" +rands = []