-
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
ワンダーオブワンダラーダイスbot作成 #748
base: master
Are you sure you want to change the base?
ワンダーオブワンダラーダイスbot作成 #748
Conversation
lib/bcdice/game_system/WoW.rb
Outdated
|
||
# ダイスボットの使い方 | ||
HELP_MESSAGE = <<~INFO_MESSAGE_TEXT | ||
行為判定 nWW12@s#f>=x |
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.
不等号の向きが実際とのコマンドとは逆に記載されているようなので、他の部分も含めて再確認の上、修正お願いします。
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.
ありがとうございます。こちら修正いたしました。どうぞよろしくお願いいたします!
lib/bcdice/game_system/WoW.rb
Outdated
def evaluate_expression(command) | ||
# 数式の加算・減算部分をすべて評価 | ||
while command.match(/(\d+[+-]\d+)/) | ||
command.gsub!(/(\d+[+-]\d+)/) do |expression| |
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.
文字列に対する破壊的メソッドは用いないようにしてください。
lib/bcdice/game_system/WoW.rb
Outdated
end | ||
|
||
# 加算と減算の単純な式を計算するメソッド | ||
def eval_simple_expression(expression) |
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では四則演算の計算用メソッド Arithmetic.eval
を用意していますので、自前実装はせずにそちらを利用してください。
lib/bcdice/game_system/WoW.rb
Outdated
|
||
def roll_wow(command) | ||
# コマンド内の数式の評価を行う | ||
command = process_command(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.
eval_game_system_specific_command
に渡される時点で command
はカッコ内の数式は全て計算された状態になっています。こちらの処理は不要かと思います。
こちら、対応いたしました!ありがとうございます |
『シティ・ポップ・ファンタジーTRPG ワンダーオブワンダラー』のダイスbotを作成しました。
公式サイトは以下
https://ssproject.lsv.jp/wow/public/
作成が初めてなので至らない点があるかもしれませんが、どうぞよろしくお願いいたします。