-
Notifications
You must be signed in to change notification settings - Fork 190
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
SW2.5のモンストラスロアで追加された森羅魔法のダメージ算出ダイスに対応 #372
Merged
Merged
Changes from 9 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
42c13fd
SW2.5のモンストラスロアで追加されたドルイド魔法に特異なダメージ算出ダイスに対応
h-mikisato 4f88d83
スペルミス
h-mikisato 347a9be
正規表現の抜け
h-mikisato d89ffeb
rubocop lint
h-mikisato d82f7ee
レビュー反映
h-mikisato 539ce5d
修正位置間違い
h-mikisato a135e36
実際に入力されたコマンドを結果に表示する
h-mikisato 5192dfe
regexpを定数にして使い回す
h-mikisato c9c5d21
威力表などのダイス表示に合わせて、「2D」の部分は威力ではなくダイスの出目の合計を表示する
h-mikisato 6888b84
正規表現の使い回しを止める
h-mikisato ade88e3
コマンドパーサの方にキャプチャは不要
h-mikisato File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,9 +66,31 @@ class SwordWorld2_5 < SwordWorld2_0 | |
|
||
・絡み効果表 (TT) | ||
絡み効果表を出すことができます。 | ||
|
||
・ドルイドの物理魔法用表 (Dru[2-6の値,7-9の値,10-12の値]) | ||
例)Dru[0,3,6]+10-3 | ||
INFO_MESSAGE_TEXT | ||
|
||
register_prefix('H?K\d+.*', 'Gr(\d+)?', '2D6?@\d+.*', 'FT', 'TT') | ||
register_prefix('H?K\d+.*', 'Gr(\d+)?', '2D6?@\d+.*', 'FT', 'TT', 'Dru\[\d+,\d+,\d+\].*') | ||
|
||
DRUID_DICE_RE = /^dru\[(\d+),(\d+),(\d+)\]/i.freeze | ||
|
||
def eval_game_system_specific_command(command) | ||
case command | ||
when DRUID_DICE_RE | ||
power_list = Regexp.last_match.captures.map(&:to_i) | ||
druid_parser = Command::Parser.new(DRUID_DICE_RE, round_type: BCDice::RoundType::CEIL) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
cmd = druid_parser.parse(command) | ||
unless cmd | ||
return nil | ||
end | ||
|
||
druid_dice(cmd, power_list) | ||
else | ||
super(command) | ||
end | ||
end | ||
|
||
# コマンド実行前にメッセージを置換する | ||
# @param [String] string 受信したメッセージ | ||
|
@@ -82,6 +104,30 @@ def replace_text(string) | |
end | ||
end | ||
|
||
def druid_dice(command, power_list) | ||
dice_list = @randomizer.roll_barabara(2, 6) | ||
dice_total = dice_list.sum() | ||
offset = | ||
case dice_total | ||
when 2..6 | ||
0 | ||
when 7..9 | ||
1 | ||
when 10..12 | ||
2 | ||
end | ||
power = power_list[offset] | ||
total = power + command.modify_number | ||
sequence = [ | ||
"(#{command.command.capitalize}#{Format.modifier(command.modify_number)})", | ||
"2D[#{dice_list.join(',')}]=#{dice_total}", | ||
"#{power}#{Format.modifier(command.modify_number)}", | ||
total | ||
] | ||
|
||
return sequence.join(" > ") | ||
end | ||
|
||
def getRatingCommandStrings | ||
super + "aA" | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Command::Parser
で使いまわさないため、定数で使いまわさずにリテラルを直接指定してください