-
Notifications
You must be signed in to change notification settings - Fork 185
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #549 from h-mikisato/feature/add_sengensyou
同人システムの千幻抄を追加
- Loading branch information
Showing
3 changed files
with
129 additions
and
0 deletions.
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
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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# frozen_string_literal: true | ||
|
||
module BCDice | ||
module GameSystem | ||
class Sengensyou < Base | ||
# ゲームシステムの識別子 | ||
ID = 'Sengensyou' | ||
|
||
# ゲームシステム名 | ||
NAME = '千幻抄' | ||
|
||
# ゲームシステム名の読みがな | ||
SORT_KEY = 'せんけんしよう' | ||
|
||
# ダイスボットの使い方 | ||
HELP_MESSAGE = <<~INFO_MESSAGE_TEXT | ||
・SGS 命中判定・回避判定 | ||
INFO_MESSAGE_TEXT | ||
|
||
register_prefix('SGS') | ||
|
||
def eval_game_system_specific_command(command) | ||
# 命中判定・回避判定 | ||
parser = Command::Parser.new('SGS', round_type: @round_type).restrict_cmp_op_to(nil) | ||
command = parser.parse(command) | ||
|
||
unless command | ||
return nil | ||
end | ||
|
||
dice_list = @randomizer.roll_barabara(3, 6) | ||
dice_total = dice_list.sum() | ||
is_critical = dice_total >= 16 | ||
is_fumble = dice_total <= 5 | ||
additional_text = | ||
if is_critical | ||
"クリティカル" | ||
elsif is_fumble | ||
"ファンブル" | ||
end | ||
modify_text = "#{dice_total}#{Format.modifier(command.modify_number)}" if command.modify_number != 0 | ||
sequence = [ | ||
"(3D6#{Format.modifier(command.modify_number)})", | ||
"#{dice_total}[#{dice_list.join(',')}]", | ||
modify_text, | ||
(dice_total + command.modify_number).to_s, | ||
additional_text, | ||
].compact | ||
|
||
result = Result.new.tap do |r| | ||
r.text = sequence.join(" > ") | ||
r.critical = is_critical | ||
r.fumble = is_fumble | ||
end | ||
return result | ||
end | ||
end | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
[[ test ]] | ||
game_system = "Sengensyou" | ||
input = "SGS" | ||
output = "(3D6) > 8[4,1,3] > 8" | ||
rands = [ | ||
{ sides = 6, value = 4 }, | ||
{ sides = 6, value = 1 }, | ||
{ sides = 6, value = 3 }, | ||
] | ||
|
||
[[ test ]] | ||
game_system = "Sengensyou" | ||
input = "SGS" | ||
output = "(3D6) > 16[5,5,6] > 16 > クリティカル" | ||
critical = true | ||
rands = [ | ||
{ sides = 6, value = 5 }, | ||
{ sides = 6, value = 5 }, | ||
{ sides = 6, value = 6 }, | ||
] | ||
|
||
[[ test ]] | ||
game_system = "Sengensyou" | ||
input = "SGS" | ||
output = "(3D6) > 5[1,2,2] > 5 > ファンブル" | ||
fumble = true | ||
rands = [ | ||
{ sides = 6, value = 1 }, | ||
{ sides = 6, value = 2 }, | ||
{ sides = 6, value = 2 }, | ||
] | ||
|
||
[[ test ]] | ||
game_system = "Sengensyou" | ||
input = "SGS+4+6" | ||
output = "(3D6+10) > 8[4,1,3] > 8+10 > 18" | ||
rands = [ | ||
{ sides = 6, value = 4 }, | ||
{ sides = 6, value = 1 }, | ||
{ sides = 6, value = 3 }, | ||
] | ||
|
||
[[ test ]] | ||
game_system = "Sengensyou" | ||
input = "SGS+4+6" | ||
output = "(3D6+10) > 16[5,5,6] > 16+10 > 26 > クリティカル" | ||
critical = true | ||
rands = [ | ||
{ sides = 6, value = 5 }, | ||
{ sides = 6, value = 5 }, | ||
{ sides = 6, value = 6 }, | ||
] | ||
|
||
[[ test ]] | ||
game_system = "Sengensyou" | ||
input = "SGS+4+6" | ||
output = "(3D6+10) > 5[1,2,2] > 5+10 > 15 > ファンブル" | ||
fumble = true | ||
rands = [ | ||
{ sides = 6, value = 1 }, | ||
{ sides = 6, value = 2 }, | ||
{ sides = 6, value = 2 }, | ||
] | ||
|
||
[[ test ]] | ||
game_system = "Sengensyou" | ||
input = "SGS>=5" | ||
output = "" | ||
rands = [] |