From a67fa65e73945eb61fe2db7787f3f0bc77d0a542 Mon Sep 17 00:00:00 2001 From: GenKuzumochi Date: Mon, 24 Aug 2020 16:18:01 +0900 Subject: [PATCH 1/3] =?UTF-8?q?=E5=86=97=E9=95=B7=E3=81=AA=E5=88=A4?= =?UTF-8?q?=E5=AE=9A=E5=80=A4=E8=A1=A8=E7=A4=BA=E3=82=92=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/diceBot/CodeLayerd.rb | 2 +- src/test/data/CodeLayerd.txt | 28 ++++++++++++++-------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/diceBot/CodeLayerd.rb b/src/diceBot/CodeLayerd.rb index 2bc3514c2..63f0110e3 100644 --- a/src/diceBot/CodeLayerd.rb +++ b/src/diceBot/CodeLayerd.rb @@ -85,7 +85,7 @@ def getRollResultString(diceList, target, criticalTarget, diff, modifier) successTotal = successCount + criticalCount + modifier result = "" - result += "判定値[#{target}] " + result += "判定値[#{target}] " unless target == 6 result += "クリティカル値[#{criticalTarget}] " unless criticalTarget == 1 result += "達成値[#{successCount}]" result += "+クリティカル[#{criticalCount}]" if criticalCount > 0 diff --git a/src/test/data/CodeLayerd.txt b/src/test/data/CodeLayerd.txt index 0a1c1714f..0b4d9e912 100644 --- a/src/test/data/CodeLayerd.txt +++ b/src/test/data/CodeLayerd.txt @@ -1,13 +1,13 @@ input: 7CL>=6 CodeLayerd output: -CodeLayerd : 7CL>=6 > (7d10) > [2,2,3,4,5,6,7] > 判定値[6] 達成値[6] > 成功 +CodeLayerd : 7CL>=6 > (7d10) > [2,2,3,4,5,6,7] > 達成値[6] > 成功 rand:2/10,2/10,3/10,4/10,5/10,6/10,7/10 ============================ input: 7CL CodeLayerd output: -CodeLayerd : 7CL > (7d10) > [2,2,3,4,5,6,7] > 判定値[6] 達成値[6] > 6 +CodeLayerd : 7CL > (7d10) > [2,2,3,4,5,6,7] > 達成値[6] > 6 rand:2/10,2/10,3/10,4/10,5/10,6/10,7/10 ============================ input: @@ -19,37 +19,37 @@ rand:2/10,2/10,3/10,4/10,5/10,6/10,7/10 input: (3+4)CL>=(3+3) CodeLayerd output: -CodeLayerd : 7CL>=6 > (7d10) > [2,2,3,4,5,6,7] > 判定値[6] 達成値[6] > 成功 +CodeLayerd : 7CL>=6 > (7d10) > [2,2,3,4,5,6,7] > 達成値[6] > 成功 rand:2/10,2/10,3/10,4/10,5/10,6/10,7/10 ============================ input: 4CL>=5 クリティカル CodeLayerd output: -CodeLayerd : 4CL>=5 > (4d10) > [1,2,3,4] > 判定値[6] 達成値[4]+クリティカル[1]=[5] > 成功 +CodeLayerd : 4CL>=5 > (4d10) > [1,2,3,4] > 達成値[4]+クリティカル[1]=[5] > 成功 rand:1/10,2/10,3/10,4/10 ============================ input: 4CL>=5 ファンブル CodeLayerd output: -CodeLayerd : 4CL>=5 > (4d10) > [7,8,9,10] > 判定値[6] 達成値[0] > ファンブル! +CodeLayerd : 4CL>=5 > (4d10) > [7,8,9,10] > 達成値[0] > ファンブル! rand:7/10,8/10,9/10,10/10 ============================ input: 4CL>=5 CodeLayerd output: -CodeLayerd : 4CL>=5 > (4d10) > [7,8,9,10] > 判定値[6] 達成値[0] > ファンブル! +CodeLayerd : 4CL>=5 > (4d10) > [7,8,9,10] > 達成値[0] > ファンブル! rand:7/10,8/10,9/10,10/10 ============================ input: 7CL+5>=6 CodeLayerd output: -CodeLayerd : 7CL+5>=6 > (7d10+5) > [2,2,3,4,5,6,7]+5 > 判定値[6] 達成値[6]+5=[11] > 成功 +CodeLayerd : 7CL+5>=6 > (7d10+5) > [2,2,3,4,5,6,7]+5 > 達成値[6]+5=[11] > 成功 rand:2/10,2/10,3/10,4/10,5/10,6/10,7/10 ============================ input: 7CL-2 CodeLayerd output: -CodeLayerd : 7CL-2 > (7d10-2) > [2,2,3,4,5,6,7]-2 > 判定値[6] 達成値[6]-2=[4] > 4 +CodeLayerd : 7CL-2 > (7d10-2) > [2,2,3,4,5,6,7]-2 > 達成値[6]-2=[4] > 4 rand:2/10,2/10,3/10,4/10,5/10,6/10,7/10 ============================ input: @@ -73,35 +73,35 @@ rand:2/10,2/10,3/10,4/10,5/10,6/10,7/10 input: 4CL+5>=5 クリティカル CodeLayerd output: -CodeLayerd : 4CL+5>=5 > (4d10+5) > [1,2,3,4]+5 > 判定値[6] 達成値[4]+クリティカル[1]+5=[10] > 成功 +CodeLayerd : 4CL+5>=5 > (4d10+5) > [1,2,3,4]+5 > 達成値[4]+クリティカル[1]+5=[10] > 成功 rand:1/10,2/10,3/10,4/10 ============================ input: 4CL-5@6+5>=5 CodeLayerd output: -CodeLayerd : 4CL-5@6+5>=5 > (4d10) > [7,8,9,10] > 判定値[6] 達成値[0] > ファンブル! +CodeLayerd : 4CL-5@6+5>=5 > (4d10) > [7,8,9,10] > 達成値[0] > ファンブル! rand:7/10,8/10,9/10,10/10 ============================ input: 7CL+2@6-8 CodeLayerd output: -CodeLayerd : 7CL+2@6-8 > (7d10-6) > [2,2,3,4,5,6,7]-6 > 判定値[6] 達成値[6]-6=[0] > ファンブル! +CodeLayerd : 7CL+2@6-8 > (7d10-6) > [2,2,3,4,5,6,7]-6 > 達成値[6]-6=[0] > ファンブル! rand:2/10,2/10,3/10,4/10,5/10,6/10,7/10 ============================ input: 7CL-(6+1) CodeLayerd output: -CodeLayerd : 7CL-7 > (7d10-7) > [2,2,3,4,5,6,7]-7 > 判定値[6] 達成値[6]-7=[-1] > ファンブル! +CodeLayerd : 7CL-7 > (7d10-7) > [2,2,3,4,5,6,7]-7 > 達成値[6]-7=[-1] > ファンブル! rand:2/10,2/10,3/10,4/10,5/10,6/10,7/10 ============================ input: 4CL[3]>=5 クリティカル CodeLayerd output: -CodeLayerd : 4CL[3]>=5 > (4d10) > [1,2,3,4] > 判定値[6] クリティカル値[3] 達成値[4]+クリティカル[3]=[7] > 成功 +CodeLayerd : 4CL[3]>=5 > (4d10) > [1,2,3,4] > クリティカル値[3] 達成値[4]+クリティカル[3]=[7] > 成功 rand:1/10,2/10,3/10,4/10 ============================ input: 7CL+2@6[2]-8 CodeLayerd output: -CodeLayerd : 7CL+2@6[2]-8 > (7d10-6) > [1,2,3,4,5,6,7]-6 > 判定値[6] クリティカル値[2] 達成値[6]+クリティカル[2]-6=[2] > 2 +CodeLayerd : 7CL+2@6[2]-8 > (7d10-6) > [1,2,3,4,5,6,7]-6 > クリティカル値[2] 達成値[6]+クリティカル[2]-6=[2] > 2 rand:1/10,2/10,3/10,4/10,5/10,6/10,7/10 From c90ea686b1f1a50d1729e1c520896b71bfcfc2c6 Mon Sep 17 00:00:00 2001 From: GenKuzumochi Date: Mon, 24 Aug 2020 16:44:38 +0900 Subject: [PATCH 2/3] =?UTF-8?q?=E3=83=95=E3=82=A1=E3=83=B3=E3=83=96?= =?UTF-8?q?=E3=83=AB=E5=88=A4=E5=AE=9A=E3=81=AE=E3=83=AB=E3=83=BC=E3=83=AB?= =?UTF-8?q?=E3=83=9F=E3=82=B9=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/diceBot/CodeLayerd.rb | 8 +++++++- src/test/data/CodeLayerd.txt | 16 +++++++++++----- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/diceBot/CodeLayerd.rb b/src/diceBot/CodeLayerd.rb index 63f0110e3..7a8a58485 100644 --- a/src/diceBot/CodeLayerd.rb +++ b/src/diceBot/CodeLayerd.rb @@ -88,6 +88,13 @@ def getRollResultString(diceList, target, criticalTarget, diff, modifier) result += "判定値[#{target}] " unless target == 6 result += "クリティカル値[#{criticalTarget}] " unless criticalTarget == 1 result += "達成値[#{successCount}]" + + # 出目がすべて判定値より大きければ固定値に関わらずファンブル + if successCount <= 0 + result += " > ファンブル!" + return result + end + result += "+クリティカル[#{criticalCount}]" if criticalCount > 0 result += format_modifier(modifier) result += "=[#{successTotal}]" if criticalCount > 0 || modifier != 0 @@ -99,7 +106,6 @@ def getRollResultString(diceList, target, criticalTarget, diff, modifier) end def getSuccessResultText(successTotal, diff) - return "ファンブル!" if successTotal <= 0 return successTotal.to_s if diff == 0 return "成功" if successTotal >= diff diff --git a/src/test/data/CodeLayerd.txt b/src/test/data/CodeLayerd.txt index 0b4d9e912..17eac8035 100644 --- a/src/test/data/CodeLayerd.txt +++ b/src/test/data/CodeLayerd.txt @@ -77,24 +77,30 @@ CodeLayerd : 4CL+5>=5 > (4d10+5) > [1,2,3,4]+5 > 達成値[4]+クリティ rand:1/10,2/10,3/10,4/10 ============================ input: -4CL-5@6+5>=5 CodeLayerd +4CL-5@6+5>=5 CodeLayerd ファンブル output: CodeLayerd : 4CL-5@6+5>=5 > (4d10) > [7,8,9,10] > 達成値[0] > ファンブル! rand:7/10,8/10,9/10,10/10 ============================ input: -7CL+2@6-8 CodeLayerd +7CL+2@6-8 CodeLayerd 達成値が0でもファンブルではない output: -CodeLayerd : 7CL+2@6-8 > (7d10-6) > [2,2,3,4,5,6,7]-6 > 達成値[6]-6=[0] > ファンブル! +CodeLayerd : 7CL+2@6-8 > (7d10-6) > [2,2,3,4,5,6,7]-6 > 達成値[6]-6=[0] > 0 rand:2/10,2/10,3/10,4/10,5/10,6/10,7/10 ============================ input: -7CL-(6+1) CodeLayerd +7CL-(6+1) CodeLayerd 達成値がマイナスでもファンブルではない output: -CodeLayerd : 7CL-7 > (7d10-7) > [2,2,3,4,5,6,7]-7 > 達成値[6]-7=[-1] > ファンブル! +CodeLayerd : 7CL-7 > (7d10-7) > [2,2,3,4,5,6,7]-7 > 達成値[6]-7=[-1] > -1 rand:2/10,2/10,3/10,4/10,5/10,6/10,7/10 ============================ input: +4CL+10 CodeLayerd 固定値があっても成功ダイスが無いならファンブル +output: +CodeLayerd : 4CL+10 > (4d10+10) > [7,8,9,10]+10 > 達成値[0] > ファンブル! +rand:7/10,8/10,9/10,10/10 +============================ +input: 4CL[3]>=5 クリティカル CodeLayerd output: CodeLayerd : 4CL[3]>=5 > (4d10) > [1,2,3,4] > クリティカル値[3] 達成値[4]+クリティカル[3]=[7] > 成功 From 9ca723ad3f01d20d377029a24a9e722ba6182d55 Mon Sep 17 00:00:00 2001 From: GenKuzumochi Date: Mon, 24 Aug 2020 17:00:09 +0900 Subject: [PATCH 3/3] =?UTF-8?q?0=E4=BB=A5=E4=B8=8B=E3=81=AE=E5=88=A4?= =?UTF-8?q?=E5=AE=9A=E3=82=92=E5=AE=9F=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/diceBot/CodeLayerd.rb | 12 ++++++++---- src/test/data/CodeLayerd.txt | 12 ++++++++++++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/diceBot/CodeLayerd.rb b/src/diceBot/CodeLayerd.rb index 7a8a58485..46d5b3a85 100644 --- a/src/diceBot/CodeLayerd.rb +++ b/src/diceBot/CodeLayerd.rb @@ -21,14 +21,16 @@ class CodeLayerd < DiceBot @m,[c],+xは省略可能。(@6[1]として処理) n個のD10でmを判定値、cをクリティカル値とした行為判定を行う。 + nが0以下のときはクリティカルしない1CL判定を行う。(1CL[0]と同一) 例) 7CL>=5 :サイコロ7個で判定値6のロールを行い、目標値5に対して判定 4CL@7 :サイコロ4個で判定値7のロールを行い達成値を出す 4CL+2@7 または 4CL@7+2 :サイコロ4個で判定値7のロールを行い達成値を出し、修正値2を足す。 4CL[2] :サイコロ4個でクリティカル値2のロールを行う。 + 0CL : 1CL[0]と同じ判定 MESSAGETEXT - setPrefixes(['\d*CL([+-]\d+)?[@\d]*.*']) + setPrefixes(['[+-]?\d*CL([+-]\d+)?[@\d]*.*']) def isGetOriginalMessage true @@ -40,7 +42,7 @@ def rollDiceCommand(command) result = '' case command - when /(\d+)?CL([+-]\d+)?(\@(\d))?(\[(\d+)\])?([+-]\d+)?(>=(\d+))?/i + when /([+-]?\d+)?CL([+-]\d+)?(\@(\d))?(\[(\d+)\])?([+-]\d+)?(>=(\d+))?/i m = Regexp.last_match base = (m[1] || 1).to_i modifier1 = m[2].to_i @@ -62,8 +64,10 @@ def checkRoll(base, target, criticalTarget, diff, modifier) base = getValue(base) target = getValue(target) criticalTarget = getValue(criticalTarget) - - return result if base < 1 + if base <= 0 + criticalTarget = 0 + base = 1 + end target = 10 if target > 10 diff --git a/src/test/data/CodeLayerd.txt b/src/test/data/CodeLayerd.txt index 17eac8035..7e4a6422d 100644 --- a/src/test/data/CodeLayerd.txt +++ b/src/test/data/CodeLayerd.txt @@ -111,3 +111,15 @@ input: output: CodeLayerd : 7CL+2@6[2]-8 > (7d10-6) > [1,2,3,4,5,6,7]-6 > クリティカル値[2] 達成値[6]+クリティカル[2]-6=[2] > 2 rand:1/10,2/10,3/10,4/10,5/10,6/10,7/10 +============================ +input: +0CL ダイス数が0以下になると1CL[0]相当 +output: +CodeLayerd : 0CL > (1d10) > [1] > クリティカル値[0] 達成値[1] > 1 +rand:1/10 +============================ +input: +(10-15)CL+5 ダイス数が0以下になると1CL[0]相当 +output: +CodeLayerd : -5CL+5 > (1d10+5) > [8]+5 > クリティカル値[0] 達成値[0] > ファンブル! +rand:8/10