-
Notifications
You must be signed in to change notification settings - Fork 191
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
『トレイル・オブ・クトゥルー』専用ダイスを作成しました #728
Conversation
m = /^TC([+\d]*)(>=(\d+))?/.match(command) | ||
return nil unless m | ||
|
||
bonus = ArithmeticEvaluator.eval(m[1]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BCDice::ArithmeticEvaluator.eval()
は不正な式の場合でも 0
を返すため、非推奨です。BCDice::Arithmetic.eval()
を使うようにしてください。また、不正な式の場合にはnilを返してコマンドを実行しないようにするのが理想かと思います。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
了解しました!
式の内容を見て、不正式の場合はnilを返すようにしてみます。
].freeze | ||
|
||
def roll_mythos_madness_table(command) | ||
m = /^MMT(\[?([,\d]+)\]?)?/.match(command) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
この正規表現だと MMT[,]
のような入力をした時に意図しない動作をしそうなので、/^MMT(\[?([1-8],[1-8])\]?)?$/
のように、決め打ちにしてもよいかもしれません。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
了解しました!
そのように修正します。
@Faceless192x |
ありがとうございます! |
『トレイル・オブ・クトゥルー』( https://www.groupsne.co.jp/products/ToC/index.html )の専用ダイスを作成しました。
今度は中身が入っています。
以上の二つのコマンドを実装しました。rubocop通過済み。
お手隙の際にご確認ください。