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

NinjaSlayer: NJコマンドでシークレットロールできないのを修正する #126

Merged
merged 1 commit into from
Feb 23, 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
5 changes: 3 additions & 2 deletions src/diceBot/NinjaSlayer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def getHelpMessage
DIFFICULTY_RE = /\[(#{DIFFICULTY_VALUE_RE})\]|@(#{DIFFICULTY_VALUE_RE})/io.freeze

# 通常判定の正規表現
NJ_RE = /\ANJ(\d+)#{DIFFICULTY_RE}?\z/io.freeze
NJ_RE = /\A(S)?NJ(\d+)#{DIFFICULTY_RE}?\z/io.freeze
# 回避判定の正規表現
EV_RE = %r{\AEV(\d+)#{DIFFICULTY_RE}?(?:/(\d+))?\z}io.freeze
# 近接攻撃の正規表現
Expand Down Expand Up @@ -89,7 +89,8 @@ def changeText(str)
m = NJ_RE.match(str)
return str unless m

return bRollCommand(m[1], integerValueOfDifficulty(m[2] || m[3]))
b_roll = bRollCommand(m[2], integerValueOfDifficulty(m[3] || m[4]))
return "#{m[1]}#{b_roll}"
end

def rollDiceCommand(command)
Expand Down
6 changes: 6 additions & 0 deletions src/test/data/NinjaSlayer.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ NinjaSlayer : (4B6>=4) > 2,3,6,4 > 成功数2
rand:2/6,3/6,6/6,4/6
============================
input:
SNJ4
output:
NinjaSlayer : (4B6>=4) > 2,3,6,4 > 成功数2###secret dice###
rand:2/6,3/6,6/6,4/6
============================
input:
NJ4@N
output:
NinjaSlayer : (4B6>=4) > 2,3,6,4 > 成功数2
Expand Down