From 669760e12b2ae79c8221dca9a47077a65295fb3c Mon Sep 17 00:00:00 2001 From: Faceless192x Date: Tue, 8 Nov 2022 12:28:44 +0900 Subject: [PATCH 1/3] =?UTF-8?q?=E9=AB=98=E6=8F=9A(UP)=E3=82=B3=E3=83=9E?= =?UTF-8?q?=E3=83=B3=E3=83=89=E3=81=AB=E4=BF=AE=E6=AD=A3=E5=80=A4=E3=81=AE?= =?UTF-8?q?=E9=81=A9=E7=94=A8=E3=81=8C=E5=87=BA=E6=9D=A5=E3=82=8B=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB=E6=8B=A1=E5=BC=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bcdice/game_system/TorgEternity.rb | 47 ++++++++++++++++++++++---- test/data/TorgEternity.toml | 29 ++++++++++++++++ 2 files changed, 70 insertions(+), 6 deletions(-) diff --git a/lib/bcdice/game_system/TorgEternity.rb b/lib/bcdice/game_system/TorgEternity.rb index 59cb8fb46..c8428f4bb 100644 --- a/lib/bcdice/game_system/TorgEternity.rb +++ b/lib/bcdice/game_system/TorgEternity.rb @@ -123,27 +123,62 @@ def getRolld20DiceCommandResult(command) # ロールコマンド (高揚ロール) def getUpRollDiceCommandResult(command) debug("Torg Eternity Dice Roll ( UP ) Command ? ", command) - m = /(^|\s)(S)?(UP)$/i.match(command) + m = /(^|\s)(S)?(UP)(\d*)(\s|$)/i.match(command) unless m return nil end + sequence = [] + mod = m[4].to_i skilled1, unskilled1, dice_str1, mishap = torg_eternity_dice(false, true) if mishap == 1 - output = "d20ロール(高揚) > 1d20[#{dice_str1}] > Mishap! 絶対失敗!" + sequence = [ + "d20ロール(高揚)", + "1d20[#{dice_str1}]", + "Mishap! 絶対失敗!", + ].compact else skilled2, unskilled2, dice_str2, = torg_eternity_dice(false, false) subtotal_skilled = skilled1 + skilled2 subtotal_unskilled = unskilled1 + unskilled2 value_skilled = format("%+d", get_torg_eternity_bonus(subtotal_skilled)) - if subtotal_skilled != subtotal_unskilled - value_unskilled = format("%+d", get_torg_eternity_bonus(subtotal_unskilled)) - output = "d20ロール(高揚) > 1d20[#{dice_str1}] + 1d20[#{dice_str2}] > #{value_skilled}[#{subtotal_skilled}](技能有) / #{value_unskilled}[#{subtotal_unskilled}](技能無)" + value_unskilled = format("%+d", get_torg_eternity_bonus(subtotal_unskilled)) + + if mod <= 0 + if subtotal_skilled != subtotal_unskilled + sequence = [ + "d20ロール(高揚)", + "1d20[#{dice_str1}] + 1d20[#{dice_str2}]", + "#{value_skilled}[#{subtotal_skilled}](技能有) / #{value_unskilled}[#{subtotal_unskilled}](技能無)", + ].compact + else + sequence = [ + "d20ロール(高揚)", + "1d20[#{dice_str1}] + 1d20[#{dice_str2}]", + "#{value_skilled}[#{subtotal_skilled}]", + ].compact + end else - output = "d20ロール(高揚) > 1d20[#{dice_str1}] + 1d20[#{dice_str2}] > #{value_skilled}[#{subtotal_skilled}]" + if subtotal_skilled != subtotal_unskilled + sequence = [ + "d20ロール(高揚)", + "1d20[#{dice_str1}] + 1d20[#{dice_str2}] + #{mod}", + "#{value_skilled}[#{subtotal_skilled}]+#{mod}(技能有) / #{value_unskilled}[#{subtotal_unskilled}]+#{mod}(技能無)", + format("%+d", (value_skilled.to_i + mod)) + "(技能有) / " + format("%+d", (value_unskilled.to_i + mod)) + "(技能無)", + ].compact + else + sequence = [ + "d20ロール(高揚)", + "1d20[#{dice_str1}] + 1d20[#{dice_str2}] + #{mod}", + "#{value_skilled}[#{subtotal_skilled}]+#{mod}", + format("%+d", (value_skilled.to_i + mod)), + ].compact + end end end + output = sequence.join(" > ") + return output end diff --git a/test/data/TorgEternity.toml b/test/data/TorgEternity.toml index 96941318c..541474bfb 100644 --- a/test/data/TorgEternity.toml +++ b/test/data/TorgEternity.toml @@ -633,6 +633,35 @@ rands = [ { sides = 20, value = 1 }, ] +[[ test ]] +game_system = "TorgEternity" +input = "UP10 #高揚修正付き" +output = "d20ロール(高揚) > 1d20[5] + 1d20[10,20,11] + 10 > +13[46]+10(技能有) / +10[35]+10(技能無) > +23(技能有) / +20(技能無)" +rands = [ + { sides = 20, value = 5 }, + { sides = 20, value = 10 }, + { sides = 20, value = 20 }, + { sides = 20, value = 11 }, +] + +[[ test ]] +game_system = "TorgEternity" +input = "UP10 #高揚修正付き" +output = "d20ロール(高揚) > 1d20[17] + 1d20[1] + 10 > +5[18]+10 > +15" +rands = [ + { sides = 20, value = 17 }, + { sides = 20, value = 1 }, +] + +[[ test ]] +game_system = "TorgEternity" +input = "UP3 #高揚修正付き" +output = "d20ロール(高揚) > 1d20[2] + 1d20[1] + 3 > -6[3]+3 > -3" +rands = [ + { sides = 20, value = 2 }, + { sides = 20, value = 1 }, +] + [[ test ]] game_system = "TorgEternity" input = "UP1+2+3" From e308adba0a284e8f9359bff100499db6436c5832 Mon Sep 17 00:00:00 2001 From: Faceless192x Date: Tue, 8 Nov 2022 14:23:31 +0900 Subject: [PATCH 2/3] =?UTF-8?q?=E9=AB=98=E6=8F=9A(UP)=E3=82=B3=E3=83=9E?= =?UTF-8?q?=E3=83=B3=E3=83=89=E3=81=AE=E3=83=98=E3=83=AB=E3=83=97=E3=82=92?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bcdice/game_system/TorgEternity.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/bcdice/game_system/TorgEternity.rb b/lib/bcdice/game_system/TorgEternity.rb index c8428f4bb..6971e44b0 100644 --- a/lib/bcdice/game_system/TorgEternity.rb +++ b/lib/bcdice/game_system/TorgEternity.rb @@ -22,7 +22,8 @@ class TorgEternity < Base   振り足しを自動で行い、20の出目が出たときには技能無し値も並記します。   出目1の時には「Mishap! 自動失敗!」と出力されます。  ・UP -   "UP"で高揚状態のロール(通常の1d20に加え、1d20を追加で振り足し)を行います。 +   "UP[m]"で高揚状態のロール(通常の1d20に加え、1d20を追加で振り足し)を行います。 +   mは技能基本値を入れて下さい。   各ロールでの振り足しを自動で行い、20の出目が出たときには技能無し値も並記します。   一投目で出目1の時には「Mishap! 自動失敗!」と出力され、二投目は行われません。  ・POS From 6202c93317ca2c064f6136b291670137703e1e1e Mon Sep 17 00:00:00 2001 From: Faceless192x Date: Thu, 10 Nov 2022 22:30:02 +0900 Subject: [PATCH 3/3] =?UTF-8?q?UP=E3=82=B3=E3=83=9E=E3=83=B3=E3=83=89?= =?UTF-8?q?=E3=81=AE=E3=83=98=E3=83=AB=E3=83=97=E3=83=A1=E3=83=83=E3=82=BB?= =?UTF-8?q?=E3=83=BC=E3=82=B8=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bcdice/game_system/TorgEternity.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bcdice/game_system/TorgEternity.rb b/lib/bcdice/game_system/TorgEternity.rb index 6971e44b0..eb6d35bd4 100644 --- a/lib/bcdice/game_system/TorgEternity.rb +++ b/lib/bcdice/game_system/TorgEternity.rb @@ -23,7 +23,7 @@ class TorgEternity < Base   出目1の時には「Mishap! 自動失敗!」と出力されます。  ・UP   "UP[m]"で高揚状態のロール(通常の1d20に加え、1d20を追加で振り足し)を行います。 -   mは技能基本値を入れて下さい。 +   []内は省略可能。mは技能基本値を入れて下さい。   各ロールでの振り足しを自動で行い、20の出目が出たときには技能無し値も並記します。   一投目で出目1の時には「Mishap! 自動失敗!」と出力され、二投目は行われません。  ・POS