Skip to content

Commit

Permalink
Merge 8f30a3b into 1609f8a
Browse files Browse the repository at this point in the history
  • Loading branch information
ViVi-shark authored May 12, 2021
2 parents 1609f8a + 8f30a3b commit 7ca23e2
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/bcdice/game_system/StellarKnights.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,15 @@ def eval_game_system_specific_command(command)
# @param [Integer | nil] defence
# @param [String] dice_change_text
# @param [String] command
# @return [String]
# @return [Result, String]
def resolute_action(num_dices, defence, dice_change_text, command)
dices = @randomizer.roll_barabara(num_dices, 6).sort
dice_text = dices.join(",")

output = "(#{command}) > #{dice_text}"
if dices.empty?
return output + "ダイスが 0 個です(アタック判定が発生しません)"
end

# FAQによると、ダイスの置き換えは宣言された順番に適用されていく
dice_change_rules = parse_dice_change_rules(dice_change_text)
Expand Down
24 changes: 24 additions & 0 deletions test/data/StellarKnights.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ rands = [
{ sides = 6, value = 4 },
]

[[ test ]]
game_system = "StellarKnights"
input = "0SK"
output = "(0SK) > ダイスが 0 個です(アタック判定が発生しません)"
rands = []

[[ test ]]
game_system = "StellarKnights"
input = "5SK3"
Expand All @@ -33,6 +39,12 @@ rands = [
{ sides = 6, value = 2 },
]

[[ test ]]
game_system = "StellarKnights"
input = "0SK6"
output = "(0SK6) > ダイスが 0 個です(アタック判定が発生しません)"
rands = []

[[ test ]]
game_system = "StellarKnights"
input = "3SK,1>6"
Expand Down Expand Up @@ -81,6 +93,18 @@ rands = [
{ sides = 6, value = 6 },
]

[[ test ]]
game_system = "StellarKnights"
input = "0SK,1>6"
output = "(0SK,1>6) > ダイスが 0 個です(アタック判定が発生しません)"
rands = []

[[ test ]]
game_system = "StellarKnights"
input = "0SK4,1>6"
output = "(0SK4,1>6) > ダイスが 0 個です(アタック判定が発生しません)"
rands = []

[[ test ]]
game_system = "StellarKnights"
input = "TT"
Expand Down

0 comments on commit 7ca23e2

Please sign in to comment.