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

ワンダーオブワンダラーダイスbot作成 #748

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

UselessArts
Copy link

『シティ・ポップ・ファンタジーTRPG ワンダーオブワンダラー』のダイスbotを作成しました。

    行為判定 nWW12@s#f>=x
    n: ダイス数
    @s = 大成功値(省略可:デフォルトは1)
    #f = 大失敗値(省略可:デフォルトは12)
    x = 目標値(省略可:デフォルトは6)
    例)1WW12 5WW12<=6 6WW12@5#3<=7+1

    ランダムギフトガチャ表 GG
    ランダムギフトガチャ表(アルファベット指定) GGx 例)GGA GGB

    ファンブル表 FT

公式サイトは以下
https://ssproject.lsv.jp/wow/public/

作成が初めてなので至らない点があるかもしれませんが、どうぞよろしくお願いいたします。


# ダイスボットの使い方
HELP_MESSAGE = <<~INFO_MESSAGE_TEXT
行為判定 nWW12@s#f>=x
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不等号の向きが実際とのコマンドとは逆に記載されているようなので、他の部分も含めて再確認の上、修正お願いします。

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ありがとうございます。こちら修正いたしました。どうぞよろしくお願いいたします!

def evaluate_expression(command)
# 数式の加算・減算部分をすべて評価
while command.match(/(\d+[+-]\d+)/)
command.gsub!(/(\d+[+-]\d+)/) do |expression|
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

文字列に対する破壊的メソッドは用いないようにしてください。

end

# 加算と減算の単純な式を計算するメソッド
def eval_simple_expression(expression)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BCDiceでは四則演算の計算用メソッド Arithmetic.eval を用意していますので、自前実装はせずにそちらを利用してください。


def roll_wow(command)
# コマンド内の数式の評価を行う
command = process_command(command)
Copy link
Member

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 はカッコ内の数式は全て計算された状態になっています。こちらの処理は不要かと思います。

@UselessArts
Copy link
Author

こちら、対応いたしました!ありがとうございます

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants