From c87345a0324b15e701549fe481921b8b9f2aa307 Mon Sep 17 00:00:00 2001 From: Hideyo Mikisato Date: Thu, 21 May 2020 05:01:55 +0900 Subject: [PATCH 01/14] =?UTF-8?q?=E3=82=B5=E3=83=B3=E3=82=B5=E3=83=BC?= =?UTF-8?q?=E3=83=A9=E3=83=BB=E3=83=90=E3=83=A9=E3=83=83=E3=83=89=E3=81=AE?= =?UTF-8?q?=E3=83=80=E3=82=A4=E3=82=B9=E3=83=9C=E3=83=83=E3=83=88=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/configBcDice.rb | 1 + src/diceBot/DiceBotLoaderList.rb | 1 + src/diceBot/SamsaraBallad.rb | 119 ++++++++++++++++++++++++ src/test/data/SamsaraBallad.txt | 149 +++++++++++++++++++++++++++++++ 4 files changed, 270 insertions(+) create mode 100644 src/diceBot/SamsaraBallad.rb create mode 100644 src/test/data/SamsaraBallad.txt diff --git a/src/configBcDice.rb b/src/configBcDice.rb index 2f0e2f2b3..efff8ad99 100644 --- a/src/configBcDice.rb +++ b/src/configBcDice.rb @@ -159,6 +159,7 @@ Ryutama SMTKakuseihen SRS + SamsaraBallad Satasupe SevenFortressMobius ScreamHighSchool diff --git a/src/diceBot/DiceBotLoaderList.rb b/src/diceBot/DiceBotLoaderList.rb index efa0c2291..bcb798c30 100644 --- a/src/diceBot/DiceBotLoaderList.rb +++ b/src/diceBot/DiceBotLoaderList.rb @@ -147,6 +147,7 @@ def self.find(gameTitle) DiceBotLoader.new('DarkSouls'), DiceBotLoader.new('SterileLife'), DiceBotLoader.new('Paradiso'), + DiceBotLoader.new('SamsaraBallad'), DiceBotLoader.new('None', :filenames => [], :class => :DiceBot) ] end diff --git a/src/diceBot/SamsaraBallad.rb b/src/diceBot/SamsaraBallad.rb new file mode 100644 index 000000000..e8c84194b --- /dev/null +++ b/src/diceBot/SamsaraBallad.rb @@ -0,0 +1,119 @@ +# -*- coding: utf-8 -*- +# frozen_string_literal: true + +class SamsaraBallad < DiceBot + # ゲームシステムの識別子 + ID = 'SamsaraBallad' + + # ゲームシステム名 + NAME = 'サンサーラ・バラッド' + + # ゲームシステム名の読みがな + # + # 「ゲームシステム名の読みがなの設定方法」(docs/dicebot_sort_key.md)を参考にして + # 設定してください + SORT_KEY = 'さんさーらばらっど' + + # ダイスボットの使い方 + HELP_MESSAGE = < y + new_total_n = 10 * y + x + dice_label = "#{total_n} -> #{new_total_n}" + total_n = new_total_n + end + end + + is_fumble = @f_value > 0 && total_n % 10 <= @f_value + is_critical = !is_fumble && @c_value < 10 && total_n % 10 >= @c_value + + if diff > 0 + output = "(1D100<=#{diff})" + output += " > #{dice_label}" + if (total_n <= diff) && (total_n < 100) + if is_fumble + output += " > ファンブル" + elsif is_critical + output += " > クリティカル" + else + output += " > 成功" + end + else + output += " > 失敗" + end + else + output += " > #{dice_label}" + if is_fumble + output += " > ファンブル" + elsif is_critical + output += " > クリティカル" + end + end + + return output + end +end diff --git a/src/test/data/SamsaraBallad.txt b/src/test/data/SamsaraBallad.txt new file mode 100644 index 000000000..1e00141aa --- /dev/null +++ b/src/test/data/SamsaraBallad.txt @@ -0,0 +1,149 @@ +input: +1D100<=90 roll 90 +output: +SamsaraBallad : (1D100<=90) > 99 > 失敗 +rand:99/100 +============================ +input: +SB<=90 roll 90 +output: +SamsaraBallad : (1D100<=90) > 75 > 成功 +rand:75/100 +============================ +input: +SB<=80 roll 80 +output: +SamsaraBallad : (1D100<=80) > 80 > 成功 +rand:80/100 +============================ +input: +SB<=80 roll 79 +output: +SamsaraBallad : (1D100<=80) > 79 > 成功 +rand:79/100 +============================ +input: +SB<=80 roll 80 +output: +SamsaraBallad : (1D100<=80) > 81 > 失敗 +rand:81/100 +============================ +input: +SB<=90 roll 90 +output: +SamsaraBallad : (1D100<=90) > 100 > 失敗 +rand:100/100 +============================ +input: +SBS<=80 roll 80 swap +output: +SamsaraBallad : (1D100<=80) > 89 > 失敗 +rand:89/100 +============================ +input: +SBS<=80 roll 80 swap +output: +SamsaraBallad : (1D100<=80) > 81 -> 18 > 成功 +rand:81/100 +============================ +input: +SBS<=80 roll 80 swap +output: +SamsaraBallad : (1D100<=80) > 79 > 成功 +rand:79/100 +============================ +input: +SBS<=90 roll 90 swap +output: +SamsaraBallad : (1D100<=90) > 100 > 失敗 +rand:100/100 +============================ +input: +SB(2,8)<=90 roll 90 +output: +SamsaraBallad : (1D100<=90) > 54 > 成功 +rand:54/100 +============================ +input: +SB(2,8)<=90 roll 90 +output: +SamsaraBallad : (1D100<=90) > 58 > クリティカル +rand:58/100 +============================ +input: +SB(2,8)<=90 roll 90 +output: +SamsaraBallad : (1D100<=90) > 59 > クリティカル +rand:59/100 +============================ +input: +SB(2,8)<=90 roll 90 +output: +SamsaraBallad : (1D100<=90) > 57 > 成功 +rand:57/100 +============================ +input: +SB(0,9)<=80 roll 80 +output: +SamsaraBallad : (1D100<=80) > 81 > 失敗 +rand:81/100 +============================ +input: +SB(2,8)<=90 roll 90 +output: +SamsaraBallad : (1D100<=90) > 52 > ファンブル +rand:52/100 +============================ +input: +SB(2,8)<=90 roll 90 +output: +SamsaraBallad : (1D100<=90) > 51 > ファンブル +rand:51/100 +============================ +input: +SBS(2,8)<=80 roll 80 +output: +SamsaraBallad : (1D100<=80) > 81 -> 18 > クリティカル +rand:81/100 +============================ +input: +SBS(2,8)<=80 roll 80 +output: +SamsaraBallad : (1D100<=80) > 97 -> 79 > クリティカル +rand:97/100 +============================ +input: +SBS(2,8)<=80 roll 80 +output: +SamsaraBallad : (1D100<=80) > 75 -> 57 > 成功 +rand:75/100 +============================ +input: +SBS(2,8)<=80 roll 80 +output: +SamsaraBallad : (1D100<=80) > 57 > 成功 +rand:57/100 +============================ +input: +SBS(2,8)<=80 roll 80 +output: +SamsaraBallad : (1D100<=80) > 89 > 失敗 +rand:89/100 +============================ +input: +SBS(2,8)<=80 roll 80 +output: +SamsaraBallad : (1D100<=80) > 21 -> 12 > ファンブル +rand:21/100 +============================ +input: +SBS(2,8)<=90 roll 90 +output: +SamsaraBallad : (1D100<=90) > 13 > 成功 +rand:13/100 +============================ +input: +SBS(2,8)<=90 roll 90 +output: +SamsaraBallad : (1D100<=90) > 11 > ファンブル +rand:11/100 From 0a073bdf30bc420ce7f3cfdaf4594261c6c8e40e Mon Sep 17 00:00:00 2001 From: Hideyo Mikisato Date: Thu, 21 May 2020 13:11:20 +0900 Subject: [PATCH 02/14] =?UTF-8?q?=E3=83=AC=E3=83=93=E3=83=A5=E3=83=BC?= =?UTF-8?q?=E5=8F=8D=E6=98=A0:=20C=E5=80=A4=E3=80=81F=E5=80=A4=E3=81=AE?= =?UTF-8?q?=E8=A1=A8=E8=A8=98=E3=82=92=E4=BB=96=E3=82=B7=E3=82=B9=E3=83=86?= =?UTF-8?q?=E3=83=A0=E3=81=AB=E5=90=88=E3=82=8F=E3=81=9B=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/diceBot/SamsaraBallad.rb | 22 ++++++++++---------- src/test/data/SamsaraBallad.txt | 36 +++++++++++++++++++-------------- 2 files changed, 32 insertions(+), 26 deletions(-) diff --git a/src/diceBot/SamsaraBallad.rb b/src/diceBot/SamsaraBallad.rb index e8c84194b..a2511a8f1 100644 --- a/src/diceBot/SamsaraBallad.rb +++ b/src/diceBot/SamsaraBallad.rb @@ -28,12 +28,12 @@ class SamsaraBallad < DiceBot MESSAGETEXT # ダイスボットで使用するコマンドを配列で列挙する - setPrefixes(['SBS?(\(\d,\d\))?.*']) + setPrefixes(['SBS?(@\d#\d)?.*']) def initialize @swap = false - @f_value = -1 @c_value = 10 + @f_value = -1 super end @@ -41,29 +41,29 @@ def rollDiceCommand(command) debug("rollDiceCommand Begin") case command - when /SBS\((\d),(\d)\)/i + when /SBS@(\d)#(\d)/i debug("Swap roll with F and C") @swap = true - @f_value = Regexp.last_match(1).to_i - @c_value = Regexp.last_match(2).to_i + @c_value = Regexp.last_match(1).to_i + @f_value = Regexp.last_match(2).to_i return getCheckResult(command) - when /SB\((\d),(\d)\)/i + when /SB@(\d)#(\d)/i debug("Normal roll with F and C") @swap = false - @f_value = Regexp.last_match(1).to_i - @c_value = Regexp.last_match(2).to_i + @c_value = Regexp.last_match(1).to_i + @f_value = Regexp.last_match(2).to_i return getCheckResult(command) when /SBS/i debug("Swap roll") @swap = true - @f_value = -1 @c_value = 10 + @f_value = -1 return getCheckResult(command) when /SB/i debug("Normal roll") @swap = false - @f_value = -1 @c_value = 10 + @f_value = -1 return getCheckResult(command) end return nil @@ -72,7 +72,7 @@ def rollDiceCommand(command) def getCheckResult(command) diff = 0 - if (m = %r{SBS?(\(\d,\d\))?<=([+-/*\d]+)}i.match(command)) + if (m = %r{SBS?(@\d#\d)?<=([+-/*\d]+)}i.match(command)) diff = ArithmeticEvaluator.new.eval(m[2]) end diff --git a/src/test/data/SamsaraBallad.txt b/src/test/data/SamsaraBallad.txt index 1e00141aa..277209f15 100644 --- a/src/test/data/SamsaraBallad.txt +++ b/src/test/data/SamsaraBallad.txt @@ -59,91 +59,97 @@ SamsaraBallad : (1D100<=90) > 100 > 失敗 rand:100/100 ============================ input: -SB(2,8)<=90 roll 90 +SB@8#2<=90 roll 90 output: SamsaraBallad : (1D100<=90) > 54 > 成功 rand:54/100 ============================ input: -SB(2,8)<=90 roll 90 +SB@8#2<=90 roll 90 output: SamsaraBallad : (1D100<=90) > 58 > クリティカル rand:58/100 ============================ input: -SB(2,8)<=90 roll 90 +SB@8#2<=90 roll 90 output: SamsaraBallad : (1D100<=90) > 59 > クリティカル rand:59/100 ============================ input: -SB(2,8)<=90 roll 90 +SB@8#2<=90 roll 90 output: SamsaraBallad : (1D100<=90) > 57 > 成功 rand:57/100 ============================ input: -SB(0,9)<=80 roll 80 +SB@9#0<=80 roll 80 output: SamsaraBallad : (1D100<=80) > 81 > 失敗 rand:81/100 ============================ input: -SB(2,8)<=90 roll 90 +SB@8#2<=90 roll 90 output: SamsaraBallad : (1D100<=90) > 52 > ファンブル rand:52/100 ============================ input: -SB(2,8)<=90 roll 90 +SB@8#2<=90 roll 90 output: SamsaraBallad : (1D100<=90) > 51 > ファンブル rand:51/100 ============================ input: -SBS(2,8)<=80 roll 80 +SBS@8#2<=80 roll 80 output: SamsaraBallad : (1D100<=80) > 81 -> 18 > クリティカル rand:81/100 ============================ input: -SBS(2,8)<=80 roll 80 +SBS@8#2<=80 roll 80 output: SamsaraBallad : (1D100<=80) > 97 -> 79 > クリティカル rand:97/100 ============================ input: -SBS(2,8)<=80 roll 80 +SBS@8#2<=80 roll 80 output: SamsaraBallad : (1D100<=80) > 75 -> 57 > 成功 rand:75/100 ============================ input: -SBS(2,8)<=80 roll 80 +SBS@8#2<=80 roll 80 output: SamsaraBallad : (1D100<=80) > 57 > 成功 rand:57/100 ============================ input: -SBS(2,8)<=80 roll 80 +SBS@8#2<=80 roll 80 output: SamsaraBallad : (1D100<=80) > 89 > 失敗 rand:89/100 ============================ input: -SBS(2,8)<=80 roll 80 +SBS@8#2<=80 roll 80 output: SamsaraBallad : (1D100<=80) > 21 -> 12 > ファンブル rand:21/100 ============================ input: -SBS(2,8)<=90 roll 90 +SBS@8#2<=90 roll 90 output: SamsaraBallad : (1D100<=90) > 13 > 成功 rand:13/100 ============================ input: -SBS(2,8)<=90 roll 90 +SBS@8#2<=90 roll 90 output: SamsaraBallad : (1D100<=90) > 11 > ファンブル rand:11/100 +============================ +input: +SB@3#5<=90 roll 90 +output: +SamsaraBallad : (1D100<=90) > 24 > ファンブル +rand:24/100 From 2a3e915db452435b924d14e751fab35a267047bc Mon Sep 17 00:00:00 2001 From: Hideyo Mikisato Date: Thu, 21 May 2020 13:16:00 +0900 Subject: [PATCH 03/14] =?UTF-8?q?=E3=83=A1=E3=83=83=E3=82=BB=E3=83=BC?= =?UTF-8?q?=E3=82=B8=E5=A4=89=E6=9B=B4=E5=BF=98=E3=82=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/diceBot/SamsaraBallad.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/diceBot/SamsaraBallad.rb b/src/diceBot/SamsaraBallad.rb index a2511a8f1..1fef151be 100644 --- a/src/diceBot/SamsaraBallad.rb +++ b/src/diceBot/SamsaraBallad.rb @@ -18,13 +18,13 @@ class SamsaraBallad < DiceBot HELP_MESSAGE = < Date: Thu, 21 May 2020 13:53:54 +0900 Subject: [PATCH 04/14] =?UTF-8?q?=E3=82=BD=E3=83=BC=E3=83=88=E3=82=AD?= =?UTF-8?q?=E3=83=BC=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/diceBot/SamsaraBallad.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/diceBot/SamsaraBallad.rb b/src/diceBot/SamsaraBallad.rb index 1fef151be..440d59e7f 100644 --- a/src/diceBot/SamsaraBallad.rb +++ b/src/diceBot/SamsaraBallad.rb @@ -12,7 +12,7 @@ class SamsaraBallad < DiceBot # # 「ゲームシステム名の読みがなの設定方法」(docs/dicebot_sort_key.md)を参考にして # 設定してください - SORT_KEY = 'さんさーらばらっど' + SORT_KEY = 'さんさあらはらつと' # ダイスボットの使い方 HELP_MESSAGE = < Date: Thu, 21 May 2020 14:22:10 +0900 Subject: [PATCH 05/14] =?UTF-8?q?F=E5=80=A4=E3=81=AE=E3=82=B3=E3=83=BC?= =?UTF-8?q?=E3=83=8A=E3=83=BC=E3=82=B1=E3=83=BC=E3=82=B9=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/diceBot/SamsaraBallad.rb | 2 +- src/test/data/SamsaraBallad.txt | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/diceBot/SamsaraBallad.rb b/src/diceBot/SamsaraBallad.rb index 440d59e7f..a7aa535dc 100644 --- a/src/diceBot/SamsaraBallad.rb +++ b/src/diceBot/SamsaraBallad.rb @@ -88,7 +88,7 @@ def getCheckResult(command) end end - is_fumble = @f_value > 0 && total_n % 10 <= @f_value + is_fumble = @f_value >= 0 && total_n % 10 <= @f_value is_critical = !is_fumble && @c_value < 10 && total_n % 10 >= @c_value if diff > 0 diff --git a/src/test/data/SamsaraBallad.txt b/src/test/data/SamsaraBallad.txt index 277209f15..a8a19161a 100644 --- a/src/test/data/SamsaraBallad.txt +++ b/src/test/data/SamsaraBallad.txt @@ -95,6 +95,12 @@ SamsaraBallad : (1D100<=90) > 52 > ファンブル rand:52/100 ============================ input: +SB@8#0<=90 roll 90 +output: +SamsaraBallad : (1D100<=90) > 80 > ファンブル +rand:80/100 +============================ +input: SB@8#2<=90 roll 90 output: SamsaraBallad : (1D100<=90) > 51 > ファンブル From 9be8c28245f7208f3cc6aa30e05d9bacb4d7b928 Mon Sep 17 00:00:00 2001 From: Hideyo Mikisato Date: Thu, 21 May 2020 17:50:58 +0900 Subject: [PATCH 06/14] =?UTF-8?q?=E9=80=9A=E5=B8=B8=E3=83=AD=E3=83=BC?= =?UTF-8?q?=E3=83=AB=E3=81=AE=E5=87=A6=E7=90=86=E3=81=AB=E3=83=9F=E3=82=B9?= =?UTF-8?q?=E3=81=8C=E3=81=82=E3=81=A3=E3=81=9F=E3=81=AE=E3=81=A7=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/diceBot/SamsaraBallad.rb | 2 +- src/test/data/SamsaraBallad.txt | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/diceBot/SamsaraBallad.rb b/src/diceBot/SamsaraBallad.rb index a7aa535dc..7c5a3802d 100644 --- a/src/diceBot/SamsaraBallad.rb +++ b/src/diceBot/SamsaraBallad.rb @@ -106,7 +106,7 @@ def getCheckResult(command) output += " > 失敗" end else - output += " > #{dice_label}" + output = "1D100 > #{dice_label}" if is_fumble output += " > ファンブル" elsif is_critical diff --git a/src/test/data/SamsaraBallad.txt b/src/test/data/SamsaraBallad.txt index a8a19161a..fd28d4637 100644 --- a/src/test/data/SamsaraBallad.txt +++ b/src/test/data/SamsaraBallad.txt @@ -5,6 +5,36 @@ SamsaraBallad : (1D100<=90) > 99 > 失敗 rand:99/100 ============================ input: +SB roll +output: +SamsaraBallad : 1D100 > 75 +rand:75/100 +============================ +input: +SB@8#2 roll +output: +SamsaraBallad : 1D100 > 80 > ファンブル +rand:80/100 +============================ +input: +SB@8#2 roll +output: +SamsaraBallad : 1D100 > 83 +rand:83/100 +============================ +input: +SB@8#2 roll +output: +SamsaraBallad : 1D100 > 89 > クリティカル +rand:89/100 +============================ +input: +SBS roll +output: +SamsaraBallad : 1D100 > 75 -> 57 +rand:75/100 +============================ +input: SB<=90 roll 90 output: SamsaraBallad : (1D100<=90) > 75 > 成功 From 0f96992c1a6931546266a18177da26f4d7742401 Mon Sep 17 00:00:00 2001 From: Hideyo Mikisato Date: Thu, 21 May 2020 20:33:48 +0900 Subject: [PATCH 07/14] =?UTF-8?q?C=E5=80=A4=E3=81=A8F=E5=80=A4=E3=81=AE?= =?UTF-8?q?=E3=82=B3=E3=83=9E=E3=83=B3=E3=83=89=E9=A0=86=E5=BA=8F=E5=85=A5?= =?UTF-8?q?=E3=82=8C=E6=9B=BF=E3=81=88=E3=80=81=E3=82=B9=E3=83=AF=E3=83=83?= =?UTF-8?q?=E3=83=97=E3=83=AD=E3=83=BC=E3=83=AB=E6=99=82=E3=81=AB1d10?= =?UTF-8?q?=E3=82=922=E5=9B=9E=E4=BD=BF=E3=81=86=E3=82=88=E3=81=86?= =?UTF-8?q?=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/diceBot/SamsaraBallad.rb | 52 +++++++----- src/test/data/SamsaraBallad.txt | 140 +++++++++++++++++--------------- 2 files changed, 106 insertions(+), 86 deletions(-) diff --git a/src/diceBot/SamsaraBallad.rb b/src/diceBot/SamsaraBallad.rb index 7c5a3802d..c5fa4fe04 100644 --- a/src/diceBot/SamsaraBallad.rb +++ b/src/diceBot/SamsaraBallad.rb @@ -28,12 +28,12 @@ class SamsaraBallad < DiceBot MESSAGETEXT # ダイスボットで使用するコマンドを配列で列挙する - setPrefixes(['SBS?(@\d#\d)?.*']) + setPrefixes(['SBS?(#\d@\d)?.*']) def initialize @swap = false - @c_value = 10 @f_value = -1 + @c_value = 10 super end @@ -41,29 +41,29 @@ def rollDiceCommand(command) debug("rollDiceCommand Begin") case command - when /SBS@(\d)#(\d)/i + when /SBS#(\d)@(\d)/i debug("Swap roll with F and C") @swap = true - @c_value = Regexp.last_match(1).to_i - @f_value = Regexp.last_match(2).to_i + @f_value = Regexp.last_match(1).to_i + @c_value = Regexp.last_match(2).to_i return getCheckResult(command) - when /SB@(\d)#(\d)/i + when /SB#(\d)@(\d)/i debug("Normal roll with F and C") @swap = false - @c_value = Regexp.last_match(1).to_i - @f_value = Regexp.last_match(2).to_i + @f_value = Regexp.last_match(1).to_i + @c_value = Regexp.last_match(2).to_i return getCheckResult(command) when /SBS/i debug("Swap roll") @swap = true - @c_value = 10 @f_value = -1 + @c_value = 10 return getCheckResult(command) when /SB/i debug("Normal roll") @swap = false - @c_value = 10 @f_value = -1 + @c_value = 10 return getCheckResult(command) end return nil @@ -72,27 +72,35 @@ def rollDiceCommand(command) def getCheckResult(command) diff = 0 - if (m = %r{SBS?(@\d#\d)?<=([+-/*\d]+)}i.match(command)) + if (m = %r{SBS?(#\d@\d)?<=([+-/*\d]+)}i.match(command)) diff = ArithmeticEvaluator.new.eval(m[2]) end - total_n, = roll(1, 100) - dice_label = total_n.to_s - if total_n < 100 && @swap - x = total_n.div(10) - y = total_n % 10 - if x > y - new_total_n = 10 * y + x - dice_label = "#{total_n} -> #{new_total_n}" - total_n = new_total_n + if @swap + d100_n1, = roll(1, 10) + d100_n2, = roll(1, 10) + d100_dice = [d100_n1, d100_n2] + min_n = d100_dice.min + max_n = d100_dice.max + debug(min_n, max_n) + if min_n == 10 + total_n = 100 + elsif max_n == 10 + total_n = min_n + else + total_n = 10 * min_n + max_n end + dice_label = "#{d100_n1},#{d100_n2} > #{total_n}" + else + total_n, = roll(1, 100) + dice_label = total_n.to_s end is_fumble = @f_value >= 0 && total_n % 10 <= @f_value is_critical = !is_fumble && @c_value < 10 && total_n % 10 >= @c_value if diff > 0 - output = "(1D100<=#{diff})" + output = "(D100<=#{diff})" output += " > #{dice_label}" if (total_n <= diff) && (total_n < 100) if is_fumble @@ -106,7 +114,7 @@ def getCheckResult(command) output += " > 失敗" end else - output = "1D100 > #{dice_label}" + output = "D100 > #{dice_label}" if is_fumble output += " > ファンブル" elsif is_critical diff --git a/src/test/data/SamsaraBallad.txt b/src/test/data/SamsaraBallad.txt index fd28d4637..f4fe34786 100644 --- a/src/test/data/SamsaraBallad.txt +++ b/src/test/data/SamsaraBallad.txt @@ -7,185 +7,197 @@ rand:99/100 input: SB roll output: -SamsaraBallad : 1D100 > 75 +SamsaraBallad : D100 > 75 rand:75/100 ============================ input: -SB@8#2 roll +SB#2@8 roll output: -SamsaraBallad : 1D100 > 80 > ファンブル +SamsaraBallad : D100 > 80 > ファンブル rand:80/100 ============================ input: -SB@8#2 roll +SB#2@8 roll output: -SamsaraBallad : 1D100 > 83 +SamsaraBallad : D100 > 83 rand:83/100 ============================ input: -SB@8#2 roll +SB#2@8 roll output: -SamsaraBallad : 1D100 > 89 > クリティカル +SamsaraBallad : D100 > 89 > クリティカル rand:89/100 ============================ input: SBS roll output: -SamsaraBallad : 1D100 > 75 -> 57 -rand:75/100 +SamsaraBallad : D100 > 7,5 > 57 +rand:7/10,5/10 +============================ +input: +SBS roll +output: +SamsaraBallad : D100 > 7,10 > 7 +rand:7/10,10/10 +============================ +input: +SBS roll +output: +SamsaraBallad : D100 > 10,10 > 100 +rand:10/10,10/10 ============================ input: SB<=90 roll 90 output: -SamsaraBallad : (1D100<=90) > 75 > 成功 +SamsaraBallad : (D100<=90) > 75 > 成功 rand:75/100 ============================ input: SB<=80 roll 80 output: -SamsaraBallad : (1D100<=80) > 80 > 成功 +SamsaraBallad : (D100<=80) > 80 > 成功 rand:80/100 ============================ input: SB<=80 roll 79 output: -SamsaraBallad : (1D100<=80) > 79 > 成功 +SamsaraBallad : (D100<=80) > 79 > 成功 rand:79/100 ============================ input: SB<=80 roll 80 output: -SamsaraBallad : (1D100<=80) > 81 > 失敗 +SamsaraBallad : (D100<=80) > 81 > 失敗 rand:81/100 ============================ input: SB<=90 roll 90 output: -SamsaraBallad : (1D100<=90) > 100 > 失敗 +SamsaraBallad : (D100<=90) > 100 > 失敗 rand:100/100 ============================ input: SBS<=80 roll 80 swap output: -SamsaraBallad : (1D100<=80) > 89 > 失敗 -rand:89/100 +SamsaraBallad : (D100<=80) > 8,9 > 89 > 失敗 +rand:8/10,9/10 ============================ input: SBS<=80 roll 80 swap output: -SamsaraBallad : (1D100<=80) > 81 -> 18 > 成功 -rand:81/100 +SamsaraBallad : (D100<=80) > 8,1 > 18 > 成功 +rand:8/10,1/10 ============================ input: SBS<=80 roll 80 swap output: -SamsaraBallad : (1D100<=80) > 79 > 成功 -rand:79/100 +SamsaraBallad : (D100<=80) > 7,9 > 79 > 成功 +rand:7/10,9/10 ============================ input: SBS<=90 roll 90 swap output: -SamsaraBallad : (1D100<=90) > 100 > 失敗 -rand:100/100 +SamsaraBallad : (D100<=90) > 10,10 > 100 > 失敗 +rand:10/10,10/10 ============================ input: -SB@8#2<=90 roll 90 +SB#2@8<=90 roll 90 output: -SamsaraBallad : (1D100<=90) > 54 > 成功 +SamsaraBallad : (D100<=90) > 54 > 成功 rand:54/100 ============================ input: -SB@8#2<=90 roll 90 +SB#2@8<=90 roll 90 output: -SamsaraBallad : (1D100<=90) > 58 > クリティカル +SamsaraBallad : (D100<=90) > 58 > クリティカル rand:58/100 ============================ input: -SB@8#2<=90 roll 90 +SB#2@8<=90 roll 90 output: -SamsaraBallad : (1D100<=90) > 59 > クリティカル +SamsaraBallad : (D100<=90) > 59 > クリティカル rand:59/100 ============================ input: -SB@8#2<=90 roll 90 +SB#2@8<=90 roll 90 output: -SamsaraBallad : (1D100<=90) > 57 > 成功 +SamsaraBallad : (D100<=90) > 57 > 成功 rand:57/100 ============================ input: -SB@9#0<=80 roll 80 +SB#0@9<=80 roll 80 output: -SamsaraBallad : (1D100<=80) > 81 > 失敗 +SamsaraBallad : (D100<=80) > 81 > 失敗 rand:81/100 ============================ input: -SB@8#2<=90 roll 90 +SB#2@8<=90 roll 90 output: -SamsaraBallad : (1D100<=90) > 52 > ファンブル +SamsaraBallad : (D100<=90) > 52 > ファンブル rand:52/100 ============================ input: -SB@8#0<=90 roll 90 +SB#0@8<=90 roll 90 output: -SamsaraBallad : (1D100<=90) > 80 > ファンブル +SamsaraBallad : (D100<=90) > 80 > ファンブル rand:80/100 ============================ input: -SB@8#2<=90 roll 90 +SB#2@8<=90 roll 90 output: -SamsaraBallad : (1D100<=90) > 51 > ファンブル +SamsaraBallad : (D100<=90) > 51 > ファンブル rand:51/100 ============================ input: -SBS@8#2<=80 roll 80 +SBS#2@8<=80 roll 80 output: -SamsaraBallad : (1D100<=80) > 81 -> 18 > クリティカル -rand:81/100 +SamsaraBallad : (D100<=80) > 8,1 > 18 > クリティカル +rand:8/10,1/10 ============================ input: -SBS@8#2<=80 roll 80 +SBS#2@8<=80 roll 80 output: -SamsaraBallad : (1D100<=80) > 97 -> 79 > クリティカル -rand:97/100 +SamsaraBallad : (D100<=80) > 9,7 > 79 > クリティカル +rand:9/10,7/10 ============================ input: -SBS@8#2<=80 roll 80 +SBS#2@8<=80 roll 80 output: -SamsaraBallad : (1D100<=80) > 75 -> 57 > 成功 -rand:75/100 +SamsaraBallad : (D100<=80) > 7,5 > 57 > 成功 +rand:7/10,5/10 ============================ input: -SBS@8#2<=80 roll 80 +SBS#2@8<=80 roll 80 output: -SamsaraBallad : (1D100<=80) > 57 > 成功 -rand:57/100 +SamsaraBallad : (D100<=80) > 5,7 > 57 > 成功 +rand:5/10,7/10 ============================ input: -SBS@8#2<=80 roll 80 +SBS#2@8<=80 roll 80 output: -SamsaraBallad : (1D100<=80) > 89 > 失敗 -rand:89/100 +SamsaraBallad : (D100<=80) > 8,9 > 89 > 失敗 +rand:8/10,9/10 ============================ input: -SBS@8#2<=80 roll 80 +SBS#2@8<=80 roll 80 output: -SamsaraBallad : (1D100<=80) > 21 -> 12 > ファンブル -rand:21/100 +SamsaraBallad : (D100<=80) > 2,1 > 12 > ファンブル +rand:2/10,1/10 ============================ input: -SBS@8#2<=90 roll 90 +SBS#2@8<=90 roll 90 output: -SamsaraBallad : (1D100<=90) > 13 > 成功 -rand:13/100 +SamsaraBallad : (D100<=90) > 1,3 > 13 > 成功 +rand:1/10,3/10 ============================ input: -SBS@8#2<=90 roll 90 +SBS#2@8<=90 roll 90 output: -SamsaraBallad : (1D100<=90) > 11 > ファンブル -rand:11/100 +SamsaraBallad : (D100<=90) > 1,1 > 11 > ファンブル +rand:1/10,1/10 ============================ input: -SB@3#5<=90 roll 90 +SB#5@3<=90 roll 90 output: -SamsaraBallad : (1D100<=90) > 24 > ファンブル +SamsaraBallad : (D100<=90) > 24 > ファンブル rand:24/100 From 4e28ace6e897761c377f243a9acc5e3a53dc9f16 Mon Sep 17 00:00:00 2001 From: Hideyo Mikisato Date: Thu, 21 May 2020 20:37:06 +0900 Subject: [PATCH 08/14] =?UTF-8?q?=E3=83=A1=E3=83=83=E3=82=BB=E3=83=BC?= =?UTF-8?q?=E3=82=B8=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/diceBot/SamsaraBallad.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/diceBot/SamsaraBallad.rb b/src/diceBot/SamsaraBallad.rb index c5fa4fe04..a65b0e645 100644 --- a/src/diceBot/SamsaraBallad.rb +++ b/src/diceBot/SamsaraBallad.rb @@ -18,13 +18,13 @@ class SamsaraBallad < DiceBot HELP_MESSAGE = < Date: Thu, 21 May 2020 20:51:19 +0900 Subject: [PATCH 09/14] =?UTF-8?q?=E3=83=A1=E3=83=83=E3=82=BB=E3=83=BC?= =?UTF-8?q?=E3=82=B8=E3=81=AE=E8=A8=98=E8=BF=B0=E3=82=921d100=20->=20D100?= =?UTF-8?q?=E3=81=A8=E3=81=97=E3=81=A6=E3=83=AB=E3=83=BC=E3=83=AB=E3=83=96?= =?UTF-8?q?=E3=83=83=E3=82=AF=E3=81=AB=E5=90=88=E3=82=8F=E3=81=9B=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/diceBot/SamsaraBallad.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/diceBot/SamsaraBallad.rb b/src/diceBot/SamsaraBallad.rb index a65b0e645..f59fae406 100644 --- a/src/diceBot/SamsaraBallad.rb +++ b/src/diceBot/SamsaraBallad.rb @@ -16,10 +16,10 @@ class SamsaraBallad < DiceBot # ダイスボットの使い方 HELP_MESSAGE = < Date: Thu, 21 May 2020 20:58:59 +0900 Subject: [PATCH 10/14] =?UTF-8?q?F=E5=80=A4=E3=80=81C=E5=80=A4=E3=80=81Swa?= =?UTF-8?q?p=E3=83=95=E3=83=A9=E3=82=B0=E3=81=AF=E3=82=A4=E3=83=B3?= =?UTF-8?q?=E3=82=B9=E3=82=BF=E3=83=B3=E3=82=B9=E5=A4=89=E6=95=B0=E3=81=A7?= =?UTF-8?q?=E3=81=AF=E3=81=AA=E3=81=8F=E3=83=A1=E3=82=BD=E3=83=83=E3=83=89?= =?UTF-8?q?=E3=81=AE=E5=BC=95=E6=95=B0=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/diceBot/SamsaraBallad.rb | 37 +++++++++++------------------------- 1 file changed, 11 insertions(+), 26 deletions(-) diff --git a/src/diceBot/SamsaraBallad.rb b/src/diceBot/SamsaraBallad.rb index f59fae406..6c8ab0e76 100644 --- a/src/diceBot/SamsaraBallad.rb +++ b/src/diceBot/SamsaraBallad.rb @@ -30,53 +30,38 @@ class SamsaraBallad < DiceBot # ダイスボットで使用するコマンドを配列で列挙する setPrefixes(['SBS?(#\d@\d)?.*']) - def initialize - @swap = false - @f_value = -1 - @c_value = 10 - super - end - def rollDiceCommand(command) debug("rollDiceCommand Begin") case command when /SBS#(\d)@(\d)/i debug("Swap roll with F and C") - @swap = true - @f_value = Regexp.last_match(1).to_i - @c_value = Regexp.last_match(2).to_i - return getCheckResult(command) + f_value = Regexp.last_match(1).to_i + c_value = Regexp.last_match(2).to_i + return getCheckResult(command, true, f_value, c_value) when /SB#(\d)@(\d)/i debug("Normal roll with F and C") - @swap = false - @f_value = Regexp.last_match(1).to_i - @c_value = Regexp.last_match(2).to_i - return getCheckResult(command) + f_value = Regexp.last_match(1).to_i + c_value = Regexp.last_match(2).to_i + return getCheckResult(command, false, f_value, c_value) when /SBS/i debug("Swap roll") - @swap = true - @f_value = -1 - @c_value = 10 - return getCheckResult(command) + return getCheckResult(command, true) when /SB/i debug("Normal roll") - @swap = false - @f_value = -1 - @c_value = 10 return getCheckResult(command) end return nil end - def getCheckResult(command) + def getCheckResult(command, is_swap=false, f_value=-1, c_value=10) diff = 0 if (m = %r{SBS?(#\d@\d)?<=([+-/*\d]+)}i.match(command)) diff = ArithmeticEvaluator.new.eval(m[2]) end - if @swap + if is_swap d100_n1, = roll(1, 10) d100_n2, = roll(1, 10) d100_dice = [d100_n1, d100_n2] @@ -96,8 +81,8 @@ def getCheckResult(command) dice_label = total_n.to_s end - is_fumble = @f_value >= 0 && total_n % 10 <= @f_value - is_critical = !is_fumble && @c_value < 10 && total_n % 10 >= @c_value + is_fumble = f_value >= 0 && total_n % 10 <= f_value + is_critical = !is_fumble && c_value < 10 && total_n % 10 >= c_value if diff > 0 output = "(D100<=#{diff})" From 8ecac3c6bd3719fa7498f9337c84ad49e32ca629 Mon Sep 17 00:00:00 2001 From: Hideyo Mikisato Date: Thu, 21 May 2020 21:20:54 +0900 Subject: [PATCH 11/14] =?UTF-8?q?=E6=AD=A3=E8=A6=8F=E8=A1=A8=E7=8F=BE?= =?UTF-8?q?=E3=81=AB=E3=82=88=E3=82=8B=E3=83=91=E3=83=BC=E3=82=B9=E3=82=92?= =?UTF-8?q?=E4=B8=80=E5=BA=A6=E3=81=A7=E5=85=A8=E9=83=A8=E5=87=A6=E7=90=86?= =?UTF-8?q?=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/diceBot/SamsaraBallad.rb | 46 ++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 25 deletions(-) diff --git a/src/diceBot/SamsaraBallad.rb b/src/diceBot/SamsaraBallad.rb index 6c8ab0e76..1c6988813 100644 --- a/src/diceBot/SamsaraBallad.rb +++ b/src/diceBot/SamsaraBallad.rb @@ -28,39 +28,35 @@ class SamsaraBallad < DiceBot MESSAGETEXT # ダイスボットで使用するコマンドを配列で列挙する - setPrefixes(['SBS?(#\d@\d)?.*']) + setPrefixes(['SBS?(#\d@\d)?(<=[+-/*\d]+)?']) def rollDiceCommand(command) debug("rollDiceCommand Begin") - case command - when /SBS#(\d)@(\d)/i - debug("Swap roll with F and C") - f_value = Regexp.last_match(1).to_i - c_value = Regexp.last_match(2).to_i - return getCheckResult(command, true, f_value, c_value) - when /SB#(\d)@(\d)/i - debug("Normal roll with F and C") - f_value = Regexp.last_match(1).to_i - c_value = Regexp.last_match(2).to_i - return getCheckResult(command, false, f_value, c_value) - when /SBS/i - debug("Swap roll") - return getCheckResult(command, true) - when /SB/i - debug("Normal roll") - return getCheckResult(command) - end - return nil - end - - def getCheckResult(command, is_swap=false, f_value=-1, c_value=10) + is_swap = false + f_value = -1 + c_value = 10 diff = 0 - if (m = %r{SBS?(#\d@\d)?<=([+-/*\d]+)}i.match(command)) - diff = ArithmeticEvaluator.new.eval(m[2]) + if (m = %r{SB(S?)(#(\d)@(\d))?(<=([+-/*\d]+))?}i.match(command)) + is_swap = true if m[1] != "" + unless m[2].nil? + f_value = m[3].to_i + c_value = m[4].to_i + end + unless m[5].nil? + diff = ArithmeticEvaluator.new.eval(m[6]) + end + else + debug("command parse failed") + return nil end + debug("SamsaraBallad Roll Param:", is_swap, f_value, c_value, diff) + return getCheckResult(is_swap, f_value, c_value, diff) + end + + def getCheckResult(is_swap, f_value, c_value, diff) if is_swap d100_n1, = roll(1, 10) d100_n2, = roll(1, 10) From b5818f85093eb37d526228be61932624d65b2717 Mon Sep 17 00:00:00 2001 From: Hideyo Mikisato Date: Sat, 23 May 2020 00:41:57 +0900 Subject: [PATCH 12/14] =?UTF-8?q?=E7=AD=89=E5=8F=B7=E3=82=92=E5=90=AB?= =?UTF-8?q?=E3=81=BE=E3=81=AA=E3=81=84=E4=B8=8D=E7=AD=89=E5=8F=B7=E3=81=AE?= =?UTF-8?q?=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/diceBot/SamsaraBallad.rb | 24 ++++--- src/test/data/SamsaraBallad.txt | 120 ++++++++++++++++++++++++++++++++ 2 files changed, 136 insertions(+), 8 deletions(-) diff --git a/src/diceBot/SamsaraBallad.rb b/src/diceBot/SamsaraBallad.rb index 1c6988813..6733c1b5b 100644 --- a/src/diceBot/SamsaraBallad.rb +++ b/src/diceBot/SamsaraBallad.rb @@ -28,7 +28,7 @@ class SamsaraBallad < DiceBot MESSAGETEXT # ダイスボットで使用するコマンドを配列で列挙する - setPrefixes(['SBS?(#\d@\d)?(<=[+-/*\d]+)?']) + setPrefixes(['SBS?(#\d@\d)?(<=?[+-/*\d]+)?']) def rollDiceCommand(command) debug("rollDiceCommand Begin") @@ -37,26 +37,28 @@ def rollDiceCommand(command) f_value = -1 c_value = 10 diff = 0 + is_diff_eq_allowable = true - if (m = %r{SB(S?)(#(\d)@(\d))?(<=([+-/*\d]+))?}i.match(command)) + if (m = %r{SB(S?)(#(\d)@(\d))?(<(=?)([+-/*\d]+))?}i.match(command)) is_swap = true if m[1] != "" unless m[2].nil? f_value = m[3].to_i c_value = m[4].to_i end unless m[5].nil? - diff = ArithmeticEvaluator.new.eval(m[6]) + diff = ArithmeticEvaluator.new.eval(m[7]) + is_diff_eq_allowable = false if m[6] == "" end else debug("command parse failed") return nil end - debug("SamsaraBallad Roll Param:", is_swap, f_value, c_value, diff) - return getCheckResult(is_swap, f_value, c_value, diff) + debug("SamsaraBallad Roll Param:", is_swap, f_value, c_value, diff, is_diff_eq_allowable) + return getCheckResult(is_swap, f_value, c_value, diff, is_diff_eq_allowable) end - def getCheckResult(is_swap, f_value, c_value, diff) + def getCheckResult(is_swap, f_value, c_value, diff, is_diff_eq_allowable) if is_swap d100_n1, = roll(1, 10) d100_n2, = roll(1, 10) @@ -81,9 +83,15 @@ def getCheckResult(is_swap, f_value, c_value, diff) is_critical = !is_fumble && c_value < 10 && total_n % 10 >= c_value if diff > 0 - output = "(D100<=#{diff})" + if is_diff_eq_allowable + output = "(D100<=#{diff})" + cmp = (total_n <= diff) && (total_n < 100) + else + output = "(D100<#{diff})" + cmp = (total_n < diff) && (total_n < 100) + end output += " > #{dice_label}" - if (total_n <= diff) && (total_n < 100) + if cmp if is_fumble output += " > ファンブル" elsif is_critical diff --git a/src/test/data/SamsaraBallad.txt b/src/test/data/SamsaraBallad.txt index f4fe34786..160b2de2d 100644 --- a/src/test/data/SamsaraBallad.txt +++ b/src/test/data/SamsaraBallad.txt @@ -53,18 +53,36 @@ SamsaraBallad : (D100<=90) > 75 > 成功 rand:75/100 ============================ input: +SB<90 roll 90 +output: +SamsaraBallad : (D100<90) > 75 > 成功 +rand:75/100 +============================ +input: SB<=80 roll 80 output: SamsaraBallad : (D100<=80) > 80 > 成功 rand:80/100 ============================ input: +SB<80 roll 80 +output: +SamsaraBallad : (D100<80) > 80 > 失敗 +rand:80/100 +============================ +input: SB<=80 roll 79 output: SamsaraBallad : (D100<=80) > 79 > 成功 rand:79/100 ============================ input: +SB<80 roll 79 +output: +SamsaraBallad : (D100<80) > 79 > 成功 +rand:79/100 +============================ +input: SB<=80 roll 80 output: SamsaraBallad : (D100<=80) > 81 > 失敗 @@ -95,6 +113,18 @@ SamsaraBallad : (D100<=80) > 7,9 > 79 > 成功 rand:7/10,9/10 ============================ input: +SBS<35 roll 35 swap +output: +SamsaraBallad : (D100<35) > 5,3 > 35 > 失敗 +rand:5/10,3/10 +============================ +input: +SBS<=35 roll 35 swap +output: +SamsaraBallad : (D100<=35) > 5,3 > 35 > 成功 +rand:5/10,3/10 +============================ +input: SBS<=90 roll 90 swap output: SamsaraBallad : (D100<=90) > 10,10 > 100 > 失敗 @@ -113,6 +143,12 @@ SamsaraBallad : (D100<=90) > 58 > クリティカル rand:58/100 ============================ input: +SB#2@8<90 roll 90 +output: +SamsaraBallad : (D100<90) > 58 > クリティカル +rand:58/100 +============================ +input: SB#2@8<=90 roll 90 output: SamsaraBallad : (D100<=90) > 59 > クリティカル @@ -125,12 +161,24 @@ SamsaraBallad : (D100<=90) > 57 > 成功 rand:57/100 ============================ input: +SB#2@8<90 roll 90 +output: +SamsaraBallad : (D100<90) > 57 > 成功 +rand:57/100 +============================ +input: SB#0@9<=80 roll 80 output: SamsaraBallad : (D100<=80) > 81 > 失敗 rand:81/100 ============================ input: +SB#0@9<81 roll 81 +output: +SamsaraBallad : (D100<81) > 81 > 失敗 +rand:81/100 +============================ +input: SB#2@8<=90 roll 90 output: SamsaraBallad : (D100<=90) > 52 > ファンブル @@ -143,12 +191,30 @@ SamsaraBallad : (D100<=90) > 80 > ファンブル rand:80/100 ============================ input: +SB#0@8<80 roll 80 +output: +SamsaraBallad : (D100<80) > 80 > 失敗 +rand:80/100 +============================ +input: SB#2@8<=90 roll 90 output: SamsaraBallad : (D100<=90) > 51 > ファンブル rand:51/100 ============================ input: +SB#0@5<=35 roll 35 +output: +SamsaraBallad : (D100<=35) > 35 > クリティカル +rand:35/100 +============================ +input: +SB#0@5<35 roll 35 +output: +SamsaraBallad : (D100<35) > 35 > 失敗 +rand:35/100 +============================ +input: SBS#2@8<=80 roll 80 output: SamsaraBallad : (D100<=80) > 8,1 > 18 > クリティカル @@ -173,18 +239,48 @@ SamsaraBallad : (D100<=80) > 5,7 > 57 > 成功 rand:5/10,7/10 ============================ input: +SBS#2@8<80 roll 80 +output: +SamsaraBallad : (D100<80) > 7,5 > 57 > 成功 +rand:7/10,5/10 +============================ +input: SBS#2@8<=80 roll 80 output: SamsaraBallad : (D100<=80) > 8,9 > 89 > 失敗 rand:8/10,9/10 ============================ input: +SBS#2@8<80 roll 80 +output: +SamsaraBallad : (D100<80) > 8,9 > 89 > 失敗 +rand:8/10,9/10 +============================ +input: +SBS#2@8<=15 roll 15 +output: +SamsaraBallad : (D100<=15) > 1,5 > 15 > 成功 +rand:1/10,5/10 +============================ +input: +SBS#2@8<15 roll 15 +output: +SamsaraBallad : (D100<15) > 1,5 > 15 > 失敗 +rand:1/10,5/10 +============================ +input: SBS#2@8<=80 roll 80 output: SamsaraBallad : (D100<=80) > 2,1 > 12 > ファンブル rand:2/10,1/10 ============================ input: +SBS#2@8<80 roll 80 +output: +SamsaraBallad : (D100<80) > 2,1 > 12 > ファンブル +rand:2/10,1/10 +============================ +input: SBS#2@8<=90 roll 90 output: SamsaraBallad : (D100<=90) > 1,3 > 13 > 成功 @@ -201,3 +297,27 @@ SB#5@3<=90 roll 90 output: SamsaraBallad : (D100<=90) > 24 > ファンブル rand:24/100 +============================ +input: +SBS#0@5<=35 roll 35 +output: +SamsaraBallad : (D100<=35) > 5,3 > 35 > クリティカル +rand:5/10,3/10 +============================ +input: +SBS#0@5<35 roll 35 +output: +SamsaraBallad : (D100<35) > 5,3 > 35 > 失敗 +rand:5/10,3/10 +============================ +input: +SBS#3@8<=23 roll 23 +output: +SamsaraBallad : (D100<=23) > 2,3 > 23 > ファンブル +rand:2/10,3/10 +============================ +input: +SBS#3@8<23 roll 23 +output: +SamsaraBallad : (D100<23) > 2,3 > 23 > 失敗 +rand:2/10,3/10 From d14f3b88c3c34cdca6e7becf30835bec8d4ba7b8 Mon Sep 17 00:00:00 2001 From: Hideyo Mikisato Date: Sun, 24 May 2020 19:15:30 +0900 Subject: [PATCH 13/14] =?UTF-8?q?=E5=8F=97=E5=8B=95=E5=88=A4=E5=AE=9A?= =?UTF-8?q?=EF=BC=88=E5=90=8C=E5=80=A4=E3=81=8C=E5=A4=B1=E6=95=97=EF=BC=89?= =?UTF-8?q?=E3=81=AB=E3=81=A4=E3=81=84=E3=81=A6=E3=81=AE=E3=83=98=E3=83=AB?= =?UTF-8?q?=E3=83=97=E3=83=A1=E3=83=83=E3=82=BB=E3=83=BC=E3=82=B8=E3=82=92?= =?UTF-8?q?=E8=BF=BD=E8=A8=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/diceBot/SamsaraBallad.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/diceBot/SamsaraBallad.rb b/src/diceBot/SamsaraBallad.rb index 6733c1b5b..0b7adc01b 100644 --- a/src/diceBot/SamsaraBallad.rb +++ b/src/diceBot/SamsaraBallad.rb @@ -24,7 +24,9 @@ class SamsaraBallad < DiceBot 例: SB<=85 通常の技能で成功率85%の判定 SBS<=70 習熟を得た技能で成功率70%の判定 -SBS#3@7<=80 習熟を得た技能で、F値3、C値7で成功率80%の判定 +SBS#3@7<=80 習熟を得た技能で、F値3、C値7で成功率80%の攻撃判定 +SB<57 通常の技能で、能動側の達成値が57の受動判定 +SBS<70 習熟を得た技能で、能動側の達成値が70の受動判定 MESSAGETEXT # ダイスボットで使用するコマンドを配列で列挙する From 44aa916dfe0d3a11f8ee6f4ddaab14b080495b6b Mon Sep 17 00:00:00 2001 From: Hideyo Mikisato Date: Sun, 24 May 2020 19:15:52 +0900 Subject: [PATCH 14/14] =?UTF-8?q?=E5=A4=B1=E6=95=97=E3=81=A8=E3=83=95?= =?UTF-8?q?=E3=82=A1=E3=83=B3=E3=83=96=E3=83=AB=E3=81=A7=E3=81=AF=E5=A4=B1?= =?UTF-8?q?=E6=95=97=E3=81=8C=E5=84=AA=E5=85=88=E3=81=A8=E3=81=AA=E3=82=8B?= =?UTF-8?q?=E3=83=86=E3=82=B9=E3=83=88=E3=82=B1=E3=83=BC=E3=82=B9=E3=82=92?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/data/SamsaraBallad.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/test/data/SamsaraBallad.txt b/src/test/data/SamsaraBallad.txt index 160b2de2d..162638a68 100644 --- a/src/test/data/SamsaraBallad.txt +++ b/src/test/data/SamsaraBallad.txt @@ -143,6 +143,12 @@ SamsaraBallad : (D100<=90) > 58 > クリティカル rand:58/100 ============================ input: +SB#5@8<=45 roll 45 +output: +SamsaraBallad : (D100<=45) > 55 > 失敗 +rand:55/100 +============================ +input: SB#2@8<90 roll 90 output: SamsaraBallad : (D100<90) > 58 > クリティカル