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

[GardenOrder] Result対応およびファンブル境界,連続攻撃の修正 #463

Merged
merged 4 commits into from
May 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions lib/bcdice/game_system/GardenOrder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ def get_critical_border(critical_border_text, success_rate)

def check_roll_repeat_attack(success_rate, repeat_count, critical_border)
success_rate_per_one = success_rate / repeat_count
# 連続攻撃は最終的な成功率が50%以上であることが必要 cf. p217
if repeat_count > 1 && success_rate_per_one < 50
return "D100<=#{success_rate_per_one}@#{critical_border} > 連続攻撃は成功率が50%以上必要です"
end

check_roll(success_rate_per_one, critical_border)
end
Expand All @@ -69,16 +73,17 @@ def check_roll(success_rate, critical_border)
dice_value = @randomizer.roll_once(100)
result = get_check_result(dice_value, success_rate, critical_border, fumble_border)

text = "D100<=#{success_rate}@#{critical_border} > #{dice_value} > #{result}"
return text
result.text = "D100<=#{success_rate}@#{critical_border} > #{dice_value} > #{result.text}"
return result
end

def get_check_result(dice_value, success_rate, critical_border, fumble_border)
return "クリティカル" if dice_value <= critical_border
return "ファンブル" if dice_value >= fumble_border
return "成功" if dice_value <= success_rate
# クリティカルとファンブルが重なった場合は、ファンブルとなる。 cf. p175
return Result.fumble("ファンブル") if dice_value >= fumble_border
return Result.critical("クリティカル") if dice_value <= critical_border
return Result.success("成功") if dice_value <= success_rate

return "失敗"
return Result.failure("失敗")
end

def look_up_damage_chart(type, damage_value)
Expand Down
6 changes: 3 additions & 3 deletions lib/bcdice/game_system/ScreamHighSchool.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ def check_roll_sh(success_rate, critical_border, command_type)

dice_value = @randomizer.roll_once(100)
result = get_check_result(dice_value, success_rate, critical_border, fumble_border)
title, supplementary = get_supplementary(command_type, result)
title, supplementary = get_supplementary(command_type, result.text)
unless supplementary.empty?
supplementary = "(#{supplementary})"
end

text = "#{title}判定 D100<=#{success_rate}@#{critical_border} > #{dice_value} > #{result}#{supplementary}"
return text
result.text = "#{title}判定 D100<=#{success_rate}@#{critical_border} > #{dice_value} > #{result.text}#{supplementary}"
return result
end

def get_supplementary(command_type, result)
Expand Down
104 changes: 103 additions & 1 deletion test/data/AceKillerGene.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
game_system = "AceKillerGene"
input = "AK50"
output = "D100<=50@10 > 50 > 成功"
success = true
rands = [
{ sides = 100, value = 50 },
]
Expand All @@ -10,6 +11,7 @@ rands = [
game_system = "AceKillerGene"
input = "AK50"
output = "D100<=50@10 > 51 > 失敗"
failure = true
rands = [
{ sides = 100, value = 51 },
]
Expand All @@ -18,6 +20,7 @@ rands = [
game_system = "AceKillerGene"
input = "AK50"
output = "D100<=50@10 > 95 > 失敗"
failure = true
rands = [
{ sides = 100, value = 95 },
]
Expand All @@ -26,6 +29,8 @@ rands = [
game_system = "AceKillerGene"
input = "AK50"
output = "D100<=50@10 > 96 > ファンブル"
failure = true
fumble = true
rands = [
{ sides = 100, value = 96 },
]
Expand All @@ -34,6 +39,8 @@ rands = [
game_system = "AceKillerGene"
input = "AK96"
output = "D100<=96@19 > 96 > ファンブル"
failure = true
fumble = true
rands = [
{ sides = 100, value = 96 },
]
Expand All @@ -42,6 +49,8 @@ rands = [
game_system = "AceKillerGene"
input = "AK99"
output = "D100<=99@19 > 96 > ファンブル"
failure = true
fumble = true
rands = [
{ sides = 100, value = 96 },
]
Expand All @@ -50,6 +59,7 @@ rands = [
game_system = "AceKillerGene"
input = "AK100"
output = "D100<=100@20 > 96 > 成功"
success = true
rands = [
{ sides = 100, value = 96 },
]
Expand All @@ -58,6 +68,7 @@ rands = [
game_system = "AceKillerGene"
input = "AK100"
output = "D100<=100@20 > 98 > 成功"
success = true
rands = [
{ sides = 100, value = 98 },
]
Expand All @@ -66,6 +77,8 @@ rands = [
game_system = "AceKillerGene"
input = "AK100"
output = "D100<=100@20 > 99 > ファンブル"
failure = true
fumble = true
rands = [
{ sides = 100, value = 99 },
]
Expand All @@ -74,6 +87,7 @@ rands = [
game_system = "AceKillerGene"
input = "AK50"
output = "D100<=50@10 > 11 > 成功"
success = true
rands = [
{ sides = 100, value = 11 },
]
Expand All @@ -82,14 +96,18 @@ rands = [
game_system = "AceKillerGene"
input = "AK50"
output = "D100<=50@10 > 10 > クリティカル"
success = true
critical = true
rands = [
{ sides = 100, value = 10 },
]

[[ test ]]
game_system = "AceKillerGene"
input = "AK500"
output = "D100<=500@100 > 100 > クリティカル"
output = "D100<=500@100 > 100 > ファンブル"
failure = true
fumble = true
rands = [
{ sides = 100, value = 100 },
]
Expand All @@ -98,6 +116,7 @@ rands = [
game_system = "AceKillerGene"
input = "AK0"
output = "D100<=0@1 > 2 > 失敗"
failure = true
rands = [
{ sides = 100, value = 2 },
]
Expand All @@ -106,6 +125,8 @@ rands = [
game_system = "AceKillerGene"
input = "AK0"
output = "D100<=0@1 > 1 > クリティカル"
success = true
critical = true
rands = [
{ sides = 100, value = 1 },
]
Expand All @@ -114,6 +135,7 @@ rands = [
game_system = "AceKillerGene"
input = "AK50"
output = "D100<=50@10 > 11 > 成功"
success = true
rands = [
{ sides = 100, value = 11 },
]
Expand All @@ -122,6 +144,8 @@ rands = [
game_system = "AceKillerGene"
input = "AK50@11"
output = "D100<=50@11 > 11 > クリティカル"
success = true
critical = true
rands = [
{ sides = 100, value = 11 },
]
Expand All @@ -130,14 +154,35 @@ rands = [
game_system = "AceKillerGene"
input = "AK50@11"
output = "D100<=50@11 > 12 > 成功"
success = true
rands = [
{ sides = 100, value = 12 },
]

[[ test ]]
game_system = "AceKillerGene"
input = "AK50@5"
output = "D100<=50@5 > 10 > 成功"
success = true
rands = [
{ sides = 100, value = 10 },
]

[[ test ]]
game_system = "AceKillerGene"
input = "AK50@5"
output = "D100<=50@5 > 5 > クリティカル"
success = true
critical = true
rands = [
{ sides = 100, value = 5 },
]

[[ test ]]
game_system = "AceKillerGene"
input = "AK100/2"
output = "D100<=50@20 > 50 > 成功"
success = true
rands = [
{ sides = 100, value = 50 },
]
Expand All @@ -146,6 +191,7 @@ rands = [
game_system = "AceKillerGene"
input = "AK100/2"
output = "D100<=50@20 > 51 > 失敗"
failure = true
rands = [
{ sides = 100, value = 51 },
]
Expand All @@ -154,6 +200,8 @@ rands = [
game_system = "AceKillerGene"
input = "AK100/2"
output = "D100<=50@20 > 96 > ファンブル"
failure = true
fumble = true
rands = [
{ sides = 100, value = 96 },
]
Expand All @@ -162,6 +210,7 @@ rands = [
game_system = "AceKillerGene"
input = "AK100/2"
output = "D100<=50@20 > 21 > 成功"
success = true
rands = [
{ sides = 100, value = 21 },
]
Expand All @@ -170,6 +219,8 @@ rands = [
game_system = "AceKillerGene"
input = "AK100/2"
output = "D100<=50@20 > 20 > クリティカル"
success = true
critical = true
rands = [
{ sides = 100, value = 20 },
]
Expand All @@ -178,6 +229,7 @@ rands = [
game_system = "AceKillerGene"
input = "AK150/2"
output = "D100<=75@30 > 51 > 成功"
success = true
rands = [
{ sides = 100, value = 51 },
]
Expand All @@ -186,6 +238,8 @@ rands = [
game_system = "AceKillerGene"
input = "AK150/2"
output = "D100<=75@30 > 30 > クリティカル"
success = true
critical = true
rands = [
{ sides = 100, value = 30 },
]
Expand All @@ -194,10 +248,54 @@ rands = [
game_system = "AceKillerGene"
input = "AK150/3"
output = "D100<=50@30 > 51 > 失敗"
failure = true
rands = [
{ sides = 100, value = 51 },
]

[[ test ]]
game_system = "AceKillerGene"
input = "AK179/3"
output = "D100<=59@35 > 60 > 失敗"
failure = true
rands = [
{ sides = 100, value = 60 },
]

[[ test ]]
game_system = "AceKillerGene"
input = "AK179/3"
output = "D100<=59@35 > 59 > 成功"
success = true
rands = [
{ sides = 100, value = 59 },
]

[[ test ]]
game_system = "AceKillerGene"
input = "AK179/3"
output = "D100<=59@35 > 35 > クリティカル"
success = true
critical = true
rands = [
{ sides = 100, value = 35 },
]

[[ test ]]
game_system = "AceKillerGene"
input = "AK99/2"
output = "D100<=49@19 > 連続攻撃は成功率が50%以上必要です"
rands = []

[[ test ]]
game_system = "AceKillerGene"
input = "AK(99/2)"
output = "D100<=49@9 > 10 > 成功"
success = true
rands = [
{ sides = 100, value = 10 },
]

[[ test ]]
game_system = "AceKillerGene"
input = "dcSL1"
Expand Down Expand Up @@ -256,6 +354,8 @@ rands = []
game_system = "AceKillerGene"
input = "AK(20-20)"
output = "D100<=0@1 > 1 > クリティカル"
success = true
critical = true
rands = [
{ sides = 100, value = 1 },
]
Expand All @@ -264,6 +364,8 @@ rands = [
game_system = "AceKillerGene"
input = "AK(20-50)"
output = "D100<=0@1 > 1 > クリティカル"
success = true
critical = true
rands = [
{ sides = 100, value = 1 },
]
Loading