Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NightWizardで成功失敗判定ができない問題を修正 #168

Merged
merged 3 commits into from
Apr 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/diceBot/NightWizard.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# -*- coding: utf-8 -*-
# frozen_string_literal: true

require "utils/normalize"

class NightWizard < DiceBot
# ゲームシステムの識別子
ID = 'NightWizard'
Expand Down Expand Up @@ -65,7 +67,7 @@ def checkRoll(string, nick_e)

crit = "0"
fumble = "0"
signOfInequality = ""
cmp_op = nil
diff = 0

if criticalText
Expand All @@ -78,7 +80,7 @@ def checkRoll(string, nick_e)
if judgeText
diff = judgeValue
debug('judgeOperator', judgeOperator)
signOfInequality = marshalSignOfInequality(judgeOperator)
cmp_op = Normalize.comparison_operator(judgeOperator)
end

base, modify = base_and_modify.split(/,/)
Expand All @@ -89,8 +91,8 @@ def checkRoll(string, nick_e)
total, out_str = nw_dice(base, modify, crit, fumble)

output = "#{nick_e}: (#{string}) > #{out_str}"
if signOfInequality != "" # 成功度判定処理
output += check_result(total, 0, signOfInequality, diff, 3, 6, 0, 0)
if cmp_op
output += check_nDx(total, cmp_op, diff)
end

return output
Expand Down
211 changes: 13 additions & 198 deletions src/test/data/NightWizard.txt
Original file line number Diff line number Diff line change
@@ -1,184 +1,4 @@
input:
2d6>=2
output:
NightWizard : (2D6>=2) > 12[6,6] > 12 > 成功
rand:6/6,6/6
============================
input:
2d6>=2
output:
NightWizard : (2D6>=2) > 8[6,2] > 8 > 成功
rand:6/6,2/6
============================
input:
2d6>=2
output:
NightWizard : (2D6>=2) > 3[2,1] > 3 > 成功
rand:2/6,1/6
============================
input:
2d6>=2
output:
NightWizard : (2D6>=2) > 8[4,4] > 8 > 成功
rand:4/6,4/6
============================
input:
2d6>=2
output:
NightWizard : (2D6>=2) > 3[2,1] > 3 > 成功
rand:2/6,1/6
============================
input:
2d6>=2
output:
NightWizard : (2D6>=2) > 8[2,6] > 8 > 成功
rand:2/6,6/6
============================
input:
2d6>=2
output:
NightWizard : (2D6>=2) > 5[4,1] > 5 > 成功
rand:4/6,1/6
============================
input:
2d6>=2
output:
NightWizard : (2D6>=2) > 5[3,2] > 5 > 成功
rand:3/6,2/6
============================
input:
2d6>=2
output:
NightWizard : (2D6>=2) > 5[1,4] > 5 > 成功
rand:1/6,4/6
============================
input:
2d6>=2
output:
NightWizard : (2D6>=2) > 6[5,1] > 6 > 成功
rand:5/6,1/6
============================
input:
2d6>=10
output:
NightWizard : (2D6>=10) > 8[3,5] > 8 > 失敗
rand:3/6,5/6
============================
input:
2d6>=10
output:
NightWizard : (2D6>=10) > 7[1,6] > 7 > 失敗
rand:1/6,6/6
============================
input:
2d6>=10
output:
NightWizard : (2D6>=10) > 11[5,6] > 11 > 成功
rand:5/6,6/6
============================
input:
2d6>=10
output:
NightWizard : (2D6>=10) > 11[6,5] > 11 > 成功
rand:6/6,5/6
============================
input:
2d6>=10
output:
NightWizard : (2D6>=10) > 7[6,1] > 7 > 失敗
rand:6/6,1/6
============================
input:
2d6>=10
output:
NightWizard : (2D6>=10) > 7[6,1] > 7 > 失敗
rand:6/6,1/6
============================
input:
2d6>=10
output:
NightWizard : (2D6>=10) > 10[5,5] > 10 > 成功
rand:5/6,5/6
============================
input:
2d6>=10
output:
NightWizard : (2D6>=10) > 6[4,2] > 6 > 失敗
rand:4/6,2/6
============================
input:
2d6>=10
output:
NightWizard : (2D6>=10) > 9[5,4] > 9 > 失敗
rand:5/6,4/6
============================
input:
2d6>=10
output:
NightWizard : (2D6>=10) > 3[2,1] > 3 > 失敗
rand:2/6,1/6
============================
input:
2d6>=7
output:
NightWizard : (2D6>=7) > 2[1,1] > 2 > 失敗
rand:1/6,1/6
============================
input:
2d6>=7
output:
NightWizard : (2D6>=7) > 3[1,2] > 3 > 失敗
rand:1/6,2/6
============================
input:
2d6>=7
output:
NightWizard : (2D6>=7) > 8[2,6] > 8 > 成功
rand:2/6,6/6
============================
input:
2d6>=7
output:
NightWizard : (2D6>=7) > 9[4,5] > 9 > 成功
rand:4/6,5/6
============================
input:
2d6>=7
output:
NightWizard : (2D6>=7) > 12[6,6] > 12 > 成功
rand:6/6,6/6
============================
input:
2d6>=7
output:
NightWizard : (2D6>=7) > 5[4,1] > 5 > 失敗
rand:4/6,1/6
============================
input:
2d6>=7
output:
NightWizard : (2D6>=7) > 3[2,1] > 3 > 失敗
rand:2/6,1/6
============================
input:
2d6>=7
output:
NightWizard : (2D6>=7) > 10[5,5] > 10 > 成功
rand:5/6,5/6
============================
input:
2d6>=7
output:
NightWizard : (2D6>=7) > 11[6,5] > 11 > 成功
rand:6/6,5/6
============================
input:
2d6>=7
output:
NightWizard : (2D6>=7) > 4[2,2] > 4 > 失敗
rand:2/6,2/6
============================
input:
12NW-5@7#2
output:
NightWizard : (2R6M[12-5]C[7]F[2]) > 7-10[1,1] > ファンブル > -3
Expand All @@ -199,12 +19,6 @@ rand:2/6,6/6
input:
12NW-5@7#2
output:
NightWizard : (2R6M[12-5]C[7]F[2]) > 7+8[2,6] > 15
rand:2/6,6/6
============================
input:
12NW-5@7#2
output:
NightWizard : (2R6M[12-5]C[7]F[2]) > 7+10[5,2]+10[5,5] > クリティカル > 27
rand:5/6,2/6,5/6,5/6
============================
Expand All @@ -217,12 +31,6 @@ rand:1/6,2/6
input:
12NW-5@7#2
output:
NightWizard : (2R6M[12-5]C[7]F[2]) > 7+10[4,6] > 17
rand:4/6,6/6
============================
input:
12NW-5@7#2
output:
NightWizard : (2R6M[12-5]C[7]F[2]) > 7+5[3,2] > 12
rand:3/6,2/6
============================
Expand Down Expand Up @@ -293,12 +101,6 @@ NightWizard : (2R6M[1]) > 1+7[6,1] > 8
rand:6/6,1/6
============================
input:
1NW
output:
NightWizard : (2R6M[1]) > 1+8[2,6] > 9
rand:2/6,6/6
============================
input:
50nw+5@7,10#2,5
output:
NightWizard : (2R6M[50+5]C[7,10]F[2,5]) > 55-10[3,2] > ファンブル > 45
Expand Down Expand Up @@ -483,3 +285,16 @@ input:
output:
NightWizard : (2R6M[0+5,+3]C[8]F[6]) > 8+10[5,3]+7[5,2] > クリティカル > 25
rand:5/6,3/6,5/6,2/6
============================
input:
50nw+5@7,10#2,5>=66
output:
NightWizard : (2R6M[50+5]C[7,10]F[2,5]>=66) > 55-10[3,2] > ファンブル > 45 > 失敗
rand:3/6,2/6
============================
input:
50nw+5@7,10#2,5>=66
output:
NightWizard : (2R6M[50+5]C[7,10]F[2,5]>=66) > 55+11[5,6] > 66 > 成功
rand:5/6,6/6
============================