From b5bbe8eaf23f0c097193d0ed0cfe0a2191454696 Mon Sep 17 00:00:00 2001 From: Sarla Date: Sat, 20 Nov 2021 21:06:29 +0900 Subject: [PATCH 01/10] =?UTF-8?q?[SwordWorld2.0][SwordWorld2.5]1d+?= =?UTF-8?q?=E5=9B=BA=E5=AE=9A=E5=80=A4=E3=81=A7=E3=81=AE=E5=A8=81=E5=8A=9B?= =?UTF-8?q?=E8=A1=A8=E5=8F=82=E7=85=A7=E3=82=B3=E3=83=9E=E3=83=B3=E3=83=89?= =?UTF-8?q?=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bcdice/game_system/SwordWorld.rb | 3 ++ lib/bcdice/game_system/SwordWorld2_0.rb | 31 ++++++++++++++++--- lib/bcdice/game_system/SwordWorld2_5.rb | 6 ++++ .../game_system/sword_world/rating_parsed.rb | 20 ++++++++++++ .../game_system/sword_world/rating_parser.y | 31 +++++++++++++++++-- 5 files changed, 85 insertions(+), 6 deletions(-) diff --git a/lib/bcdice/game_system/SwordWorld.rb b/lib/bcdice/game_system/SwordWorld.rb index 8d723aee1..978a38e7c 100644 --- a/lib/bcdice/game_system/SwordWorld.rb +++ b/lib/bcdice/game_system/SwordWorld.rb @@ -84,6 +84,9 @@ def rating(string) # レーティング表 loop do dice_raw, diceText = rollDice(command) + if command.tmp_fixed_val > 0 + command.tmp_fixed_val = 0 + end dice = dice_raw if first_to != 0 diff --git a/lib/bcdice/game_system/SwordWorld2_0.rb b/lib/bcdice/game_system/SwordWorld2_0.rb index e08fdf2dc..2ab41b0b1 100644 --- a/lib/bcdice/game_system/SwordWorld2_0.rb +++ b/lib/bcdice/game_system/SwordWorld2_0.rb @@ -51,6 +51,12 @@ class SwordWorld2_0 < SwordWorld ・首切り刀用レーティング上昇 r10  例)K20r10 K30+24@8R10 K40+24@8$12r10 + ・威力表を1d+sfで参照 回転後も継続 sf4 +  例)k10sf4 + + ・威力表を1d+tfで参照 回転後は2dで判定 tf3 +  例)k10tf3 + ・グレイテストフォーチュンは末尾に gf  例)K20gf K30+24@8GF K40+24@8$12r10gf @@ -109,13 +115,30 @@ def rating_parser end def rollDice(command) + if command.semi_fixed_val > 0 + if command.semi_fixed_val > 6 + command.semi_fixed_val = 6 + end + dice = @randomizer.roll_once(6) + if command.critical < command.semi_fixed_val + 2 + command.critical = command.semi_fixed_val + 2 + end + return dice + command.semi_fixed_val, "#{dice},#{command.semi_fixed_val}" + end + if command.tmp_fixed_val > 0 + if command.tmp_fixed_val > 6 + command.tmp_fixed_val = 6 + end + dice = @randomizer.roll_once(6) + return dice + command.tmp_fixed_val, "#{dice},#{command.tmp_fixed_val}" + end unless command.greatest_fortune return super(command) end - - dice = @randomizer.roll_once(6) - - return dice * 2, "#{dice},#{dice}" + if command.greatest_fortune + dice = @randomizer.roll_once(6) + return dice * 2, "#{dice},#{dice}" + end end def growth(count = 1) diff --git a/lib/bcdice/game_system/SwordWorld2_5.rb b/lib/bcdice/game_system/SwordWorld2_5.rb index 106acb749..d2e8e8a86 100644 --- a/lib/bcdice/game_system/SwordWorld2_5.rb +++ b/lib/bcdice/game_system/SwordWorld2_5.rb @@ -56,6 +56,12 @@ class SwordWorld2_5 < SwordWorld2_0 ・グレイテストフォーチュンは末尾に gf  例)K20gf K30+24@8GF K40+24@8$12r5gf + ・威力表を1d+sfで参照 回転後も継続 sf4 +  例)k10sf4 + + ・威力表を1d+tfで参照 回転後は2dで判定 tf3 +  例)k10tf3 + ・超越判定用に2d6ロールに 2D6@10 書式でクリティカル値付与が可能に。  例)2D6@10 2D6@10+11>=30 diff --git a/lib/bcdice/game_system/sword_world/rating_parsed.rb b/lib/bcdice/game_system/sword_world/rating_parsed.rb index 55c0a5899..add3728b4 100644 --- a/lib/bcdice/game_system/sword_world/rating_parsed.rb +++ b/lib/bcdice/game_system/sword_world/rating_parsed.rb @@ -25,6 +25,12 @@ class RatingParsed # @return [Boolean] attr_accessor :greatest_fortune + # @return [Integer, nil] + attr_writer :semi_fixed_val + + # @return [Integer, nil] + attr_writer :tmp_fixed_val + # @return [Integer] attr_accessor :modifier @@ -38,6 +44,8 @@ def initialize @first_modify = nil @greatest_fortune = false @rateup = nil + @semi_fixed_val = nil + @tmp_fixed_val = nil end # @return [Boolean] @@ -66,6 +74,16 @@ def first_to def rateup return @rateup || 0 end + + # @return [Integer] + def semi_fixed_val + return @semi_fixed_val || 0 + end + + # @return [Integer] + def tmp_fixed_val + return @tmp_fixed_val || 0 + end # @return [Integer] def kept_modify @@ -86,6 +104,8 @@ def to_s() output += "m[#{first_to}]" if first_to != 0 output += "r[#{rateup}]" if rateup != 0 output += "gf" if @greatest_fortune + output += "x[#{semi_fixed_val}]" if semi_fixed_val != 0 + output += "y[#{tmp_fixed_val}]" if tmp_fixed_val != 0 output += "a[#{Format.modifier(kept_modify)}]" if kept_modify != 0 if @modifier != 0 diff --git a/lib/bcdice/game_system/sword_world/rating_parser.y b/lib/bcdice/game_system/sword_world/rating_parser.y index 3962cd655..f8c8db81c 100644 --- a/lib/bcdice/game_system/sword_world/rating_parser.y +++ b/lib/bcdice/game_system/sword_world/rating_parser.y @@ -1,5 +1,5 @@ class RatingParser - token NUMBER K R H G F PLUS MINUS ASTERISK SLASH PARENL PARENR BRACKETL BRACKETR AT SHARP DOLLAR + token NUMBER K R H G F S T PLUS MINUS ASTERISK SLASH PARENL PARENR BRACKETL BRACKETR AT SHARP DOLLAR expect 4 @@ -101,11 +101,36 @@ class RatingParser | option G F { option, _, _ = val - raise ParseError unless [:v2_5, :v2_0].include?(@version) && option[:greatest_fortune].nil? + raise ParseError unless [:v2_5, :v2_0].include?(@version) + raise ParseError unless option[:greatest_fortune].nil? + raise ParseError unless option[:semi_fixed_val].nil? + raise ParseError unless option[:tmp_fixed_val].nil? option[:greatest_fortune] = true result = option } + | option S F unary + { + option, _, _, term = val + raise ParseError unless [:v2_5, :v2_0].include?(@version) + raise ParseError unless option[:greatest_fortune].nil? + raise ParseError unless option[:semi_fixed_val].nil? + raise ParseError unless option[:tmp_fixed_val].nil? + + option[:semi_fixed_val] = term + result = option + } + | option T F unary + { + option, _, _, term = val + raise ParseError unless [:v2_5, :v2_0].include?(@version) + raise ParseError unless option[:greatest_fortune].nil? + raise ParseError unless option[:semi_fixed_val].nil? + raise ParseError unless option[:tmp_fixed_val].nil? + + option[:tmp_fixed_val] = term + result = option + } | option SHARP unary { option, _, term = val @@ -196,6 +221,8 @@ def parsed(rate, modifier, option) p.first_modify = option[:first_modify] p.rateup = option[:rateup]&.eval(@round_type) p.greatest_fortune = option.fetch(:greatest_fortune, false) + p.semi_fixed_val = option[:semi_fixed_val]&.eval(@round_type) + p.tmp_fixed_val = option[:tmp_fixed_val]&.eval(@round_type) p.modifier = modifier.eval(@round_type) p.modifier_after_half = option[:modifier_after_half]&.eval(@round_type) end From b2d89812c22964521c215246cd557a419b619943 Mon Sep 17 00:00:00 2001 From: Sarla Date: Sat, 20 Nov 2021 22:27:17 +0900 Subject: [PATCH 02/10] =?UTF-8?q?=E3=83=AA=E3=83=95=E3=82=A1=E3=82=AF?= =?UTF-8?q?=E3=82=BF=E3=83=AA=E3=83=B3=E3=82=B01?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bcdice/game_system/SwordWorld.rb | 11 +++++++---- lib/bcdice/game_system/SwordWorld2_0.rb | 14 ++++---------- .../game_system/sword_world/rating_parsed.rb | 12 ++++++++---- lib/bcdice/game_system/sword_world/rating_parser.y | 12 ++++++------ 4 files changed, 25 insertions(+), 24 deletions(-) diff --git a/lib/bcdice/game_system/SwordWorld.rb b/lib/bcdice/game_system/SwordWorld.rb index 978a38e7c..2311aec13 100644 --- a/lib/bcdice/game_system/SwordWorld.rb +++ b/lib/bcdice/game_system/SwordWorld.rb @@ -81,12 +81,13 @@ def rating(string) # レーティング表 round = 0 first_to = command.first_to first_modify = command.first_modify + tmp_fixed_val = command.tmp_fixed_val loop do - dice_raw, diceText = rollDice(command) - if command.tmp_fixed_val > 0 - command.tmp_fixed_val = 0 + if tmp_fixed_val > 0 && round > 0 + tmp_fixed_val = 0 end + dice_raw, diceText = rollDice(command, tmp_fixed_val) dice = dice_raw if first_to != 0 @@ -129,6 +130,8 @@ def rating(string) # レーティング表 break unless dice >= command.critical end + command.tmp_fixed_val = tmp_fixed_val + result_text, critical, fumble = getResultText( totalValue, command, diceResults, diceResultTotals, rateResults, diceOnlyTotal, round @@ -298,7 +301,7 @@ def getNewRates(rate_sw2_0) return newRates end - def rollDice(_command) + def rollDice(_command, _tmp_fixed_val) dice_list = @randomizer.roll_barabara(2, 6) total = dice_list.sum() dice_str = dice_list.join(",") diff --git a/lib/bcdice/game_system/SwordWorld2_0.rb b/lib/bcdice/game_system/SwordWorld2_0.rb index 2ab41b0b1..e2ab660f1 100644 --- a/lib/bcdice/game_system/SwordWorld2_0.rb +++ b/lib/bcdice/game_system/SwordWorld2_0.rb @@ -114,26 +114,20 @@ def rating_parser return RatingParser.new(version: :v2_0) end - def rollDice(command) + def rollDice(command, tmp_fixed_val) if command.semi_fixed_val > 0 - if command.semi_fixed_val > 6 - command.semi_fixed_val = 6 - end dice = @randomizer.roll_once(6) if command.critical < command.semi_fixed_val + 2 command.critical = command.semi_fixed_val + 2 end return dice + command.semi_fixed_val, "#{dice},#{command.semi_fixed_val}" end - if command.tmp_fixed_val > 0 - if command.tmp_fixed_val > 6 - command.tmp_fixed_val = 6 - end + if tmp_fixed_val > 0 dice = @randomizer.roll_once(6) - return dice + command.tmp_fixed_val, "#{dice},#{command.tmp_fixed_val}" + return dice + tmp_fixed_val, "#{dice},#{tmp_fixed_val}" end unless command.greatest_fortune - return super(command) + return super(command, tmp_fixed_val) end if command.greatest_fortune dice = @randomizer.roll_once(6) diff --git a/lib/bcdice/game_system/sword_world/rating_parsed.rb b/lib/bcdice/game_system/sword_world/rating_parsed.rb index add3728b4..ef70eb5fd 100644 --- a/lib/bcdice/game_system/sword_world/rating_parsed.rb +++ b/lib/bcdice/game_system/sword_world/rating_parsed.rb @@ -77,12 +77,16 @@ def rateup # @return [Integer] def semi_fixed_val - return @semi_fixed_val || 0 + sf = @semi_fixed_val || 0 + sf = 6 if sf > 6 + return sf end # @return [Integer] def tmp_fixed_val - return @tmp_fixed_val || 0 + tf = @tmp_fixed_val || 0 + tf = 6 if tf > 6 + return tf end # @return [Integer] @@ -104,8 +108,8 @@ def to_s() output += "m[#{first_to}]" if first_to != 0 output += "r[#{rateup}]" if rateup != 0 output += "gf" if @greatest_fortune - output += "x[#{semi_fixed_val}]" if semi_fixed_val != 0 - output += "y[#{tmp_fixed_val}]" if tmp_fixed_val != 0 + output += "sf[#{semi_fixed_val}]" if semi_fixed_val != 0 + output += "tf[#{tmp_fixed_val}]" if tmp_fixed_val != 0 output += "a[#{Format.modifier(kept_modify)}]" if kept_modify != 0 if @modifier != 0 diff --git a/lib/bcdice/game_system/sword_world/rating_parser.y b/lib/bcdice/game_system/sword_world/rating_parser.y index f8c8db81c..f4ff10705 100644 --- a/lib/bcdice/game_system/sword_world/rating_parser.y +++ b/lib/bcdice/game_system/sword_world/rating_parser.y @@ -109,7 +109,7 @@ class RatingParser option[:greatest_fortune] = true result = option } - | option S F unary + | option S F NUMBER { option, _, _, term = val raise ParseError unless [:v2_5, :v2_0].include?(@version) @@ -117,10 +117,10 @@ class RatingParser raise ParseError unless option[:semi_fixed_val].nil? raise ParseError unless option[:tmp_fixed_val].nil? - option[:semi_fixed_val] = term + option[:semi_fixed_val] = term.to_i result = option } - | option T F unary + | option T F NUMBER { option, _, _, term = val raise ParseError unless [:v2_5, :v2_0].include?(@version) @@ -128,7 +128,7 @@ class RatingParser raise ParseError unless option[:semi_fixed_val].nil? raise ParseError unless option[:tmp_fixed_val].nil? - option[:tmp_fixed_val] = term + option[:tmp_fixed_val] = term.to_i result = option } | option SHARP unary @@ -221,8 +221,8 @@ def parsed(rate, modifier, option) p.first_modify = option[:first_modify] p.rateup = option[:rateup]&.eval(@round_type) p.greatest_fortune = option.fetch(:greatest_fortune, false) - p.semi_fixed_val = option[:semi_fixed_val]&.eval(@round_type) - p.tmp_fixed_val = option[:tmp_fixed_val]&.eval(@round_type) + p.semi_fixed_val = option[:semi_fixed_val] + p.tmp_fixed_val = option[:tmp_fixed_val] p.modifier = modifier.eval(@round_type) p.modifier_after_half = option[:modifier_after_half]&.eval(@round_type) end From 7a55a3c9cb51e649e8685b0ac81cacfa4e36bee5 Mon Sep 17 00:00:00 2001 From: Sarla Date: Sat, 20 Nov 2021 22:40:35 +0900 Subject: [PATCH 03/10] =?UTF-8?q?=E3=83=AA=E3=83=95=E3=82=A1=E3=82=AF?= =?UTF-8?q?=E3=82=BF=E3=83=AA=E3=83=B3=E3=82=B02?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bcdice/game_system/SwordWorld.rb | 10 ++-------- lib/bcdice/game_system/SwordWorld2_0.rb | 8 ++++---- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/lib/bcdice/game_system/SwordWorld.rb b/lib/bcdice/game_system/SwordWorld.rb index 2311aec13..86d7d87ee 100644 --- a/lib/bcdice/game_system/SwordWorld.rb +++ b/lib/bcdice/game_system/SwordWorld.rb @@ -81,13 +81,9 @@ def rating(string) # レーティング表 round = 0 first_to = command.first_to first_modify = command.first_modify - tmp_fixed_val = command.tmp_fixed_val loop do - if tmp_fixed_val > 0 && round > 0 - tmp_fixed_val = 0 - end - dice_raw, diceText = rollDice(command, tmp_fixed_val) + dice_raw, diceText = rollDice(command, round) dice = dice_raw if first_to != 0 @@ -130,8 +126,6 @@ def rating(string) # レーティング表 break unless dice >= command.critical end - command.tmp_fixed_val = tmp_fixed_val - result_text, critical, fumble = getResultText( totalValue, command, diceResults, diceResultTotals, rateResults, diceOnlyTotal, round @@ -301,7 +295,7 @@ def getNewRates(rate_sw2_0) return newRates end - def rollDice(_command, _tmp_fixed_val) + def rollDice(_command, _round) dice_list = @randomizer.roll_barabara(2, 6) total = dice_list.sum() dice_str = dice_list.join(",") diff --git a/lib/bcdice/game_system/SwordWorld2_0.rb b/lib/bcdice/game_system/SwordWorld2_0.rb index e2ab660f1..1cd366508 100644 --- a/lib/bcdice/game_system/SwordWorld2_0.rb +++ b/lib/bcdice/game_system/SwordWorld2_0.rb @@ -114,7 +114,7 @@ def rating_parser return RatingParser.new(version: :v2_0) end - def rollDice(command, tmp_fixed_val) + def rollDice(command, round) if command.semi_fixed_val > 0 dice = @randomizer.roll_once(6) if command.critical < command.semi_fixed_val + 2 @@ -122,12 +122,12 @@ def rollDice(command, tmp_fixed_val) end return dice + command.semi_fixed_val, "#{dice},#{command.semi_fixed_val}" end - if tmp_fixed_val > 0 + if round == 0 && command.tmp_fixed_val > 0 dice = @randomizer.roll_once(6) - return dice + tmp_fixed_val, "#{dice},#{tmp_fixed_val}" + return dice + command.tmp_fixed_val, "#{dice},#{command.tmp_fixed_val}" end unless command.greatest_fortune - return super(command, tmp_fixed_val) + return super(command, round) end if command.greatest_fortune dice = @randomizer.roll_once(6) From c431cf33148b97f5647b71efdb7d2526582d0760 Mon Sep 17 00:00:00 2001 From: Sarla Date: Sat, 20 Nov 2021 22:56:54 +0900 Subject: [PATCH 04/10] =?UTF-8?q?=E3=83=AA=E3=83=95=E3=82=A1=E3=82=AF?= =?UTF-8?q?=E3=82=BF=E3=83=AA=E3=83=B3=E3=82=B03?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bcdice/game_system/SwordWorld2_0.rb | 3 --- lib/bcdice/game_system/sword_world/rating_parsed.rb | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/bcdice/game_system/SwordWorld2_0.rb b/lib/bcdice/game_system/SwordWorld2_0.rb index 1cd366508..3bc855daf 100644 --- a/lib/bcdice/game_system/SwordWorld2_0.rb +++ b/lib/bcdice/game_system/SwordWorld2_0.rb @@ -117,9 +117,6 @@ def rating_parser def rollDice(command, round) if command.semi_fixed_val > 0 dice = @randomizer.roll_once(6) - if command.critical < command.semi_fixed_val + 2 - command.critical = command.semi_fixed_val + 2 - end return dice + command.semi_fixed_val, "#{dice},#{command.semi_fixed_val}" end if round == 0 && command.tmp_fixed_val > 0 diff --git a/lib/bcdice/game_system/sword_world/rating_parsed.rb b/lib/bcdice/game_system/sword_world/rating_parsed.rb index ef70eb5fd..4d73773aa 100644 --- a/lib/bcdice/game_system/sword_world/rating_parsed.rb +++ b/lib/bcdice/game_system/sword_world/rating_parsed.rb @@ -57,6 +57,9 @@ def half def critical crit = @critical || (half ? 13 : 10) crit = 3 if crit < 3 + if !@semi_fixed_val.nil? + crit = @semi_fixed_val + 2 if crit < @semi_fixed_val + 2 + end return crit end From b0e294d5ed03cca2d1397241d0fd38c1231d76ed Mon Sep 17 00:00:00 2001 From: Sarla Date: Sun, 21 Nov 2021 02:43:34 +0900 Subject: [PATCH 05/10] =?UTF-8?q?=E3=83=86=E3=82=B9=E3=83=88=E3=82=B1?= =?UTF-8?q?=E3=83=BC=E3=82=B9=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/data/SwordWorld2_0.toml | 121 ++++++++++++++ test/data/SwordWorld2_5.toml | 153 ++++++++++++++++++ .../test_sword_world_rating_command_parser.rb | 114 ++++++++++++- 3 files changed, 386 insertions(+), 2 deletions(-) diff --git a/test/data/SwordWorld2_0.toml b/test/data/SwordWorld2_0.toml index 8c033c349..29e68b632 100644 --- a/test/data/SwordWorld2_0.toml +++ b/test/data/SwordWorld2_0.toml @@ -185,6 +185,36 @@ rands = [ { sides = 6, value = 3 }, ] +[[ test ]] +game_system = "SwordWorld2.0" +input = "K40+24sf4@8$12r10" +output = "KeyNo.40c[8]m[12]r[10]sf[4]+24 > 2D:[1,4 5,4 4,4 5,4 2,4]=12,9,8,9,6 > 13,12,13,17,13+24 > 4回転 > 92" +critical = true +rands = [ + { sides = 6, value = 1 }, + { sides = 6, value = 5 }, + { sides = 6, value = 4 }, + { sides = 6, value = 5 }, + { sides = 6, value = 2 }, +] + +[[ test ]] +game_system = "SwordWorld2.0" +input = "K40+24tf4@8$12r10" +output = "KeyNo.40c[8]m[12]r[10]tf[4]+24 > 2D:[1,4 4,5 5,4 3,5 5,2]=12,9,9,8,7 > 13,12,14,16,16+24 > 4回転 > 95" +critical = true +rands = [ + { sides = 6, value = 1 }, + { sides = 6, value = 4 }, + { sides = 6, value = 5 }, + { sides = 6, value = 5 }, + { sides = 6, value = 4 }, + { sides = 6, value = 3 }, + { sides = 6, value = 5 }, + { sides = 6, value = 5 }, + { sides = 6, value = 2 }, +] + [[ test ]] game_system = "SwordWorld2.0" input = "K20+5" @@ -300,6 +330,97 @@ rands = [ { sides = 6, value = 1 }, ] +[[ test ]] +game_system = "SwordWorld2.0" +input = "k20sf4 sf通常時" +output = "KeyNo.20c[10]sf[4] > 2D:[3,4]=7 > 5" +rands = [ + { sides = 6, value = 3 }, +] + +[[ test ]] +game_system = "SwordWorld2.0" +input = "k20tf4 tf通常時" +output = "KeyNo.20c[10]tf[4] > 2D:[3,4]=7 > 5" +rands = [ + { sides = 6, value = 3 }, +] + +[[ test ]] +game_system = "SwordWorld2.0" +input = "k20sf7 sfクリティカル時" +output = "KeyNo.20c[10]sf[6] > 2D:[5,6 4,6 3,6]=11,10,9 > 9,8,7 > 2回転 > 24" +critical = true +rands = [ + { sides = 6, value = 5 }, + { sides = 6, value = 4 }, + { sides = 6, value = 3 }, +] + +[[ test ]] +game_system = "SwordWorld2.0" +input = "k20tf7 tfクリティカル時" +output = "KeyNo.20c[10]tf[6] > 2D:[5,6 6,5 3,4]=11,11,7 > 9,9,5 > 2回転 > 23" +critical = true +rands = [ + { sides = 6, value = 5 }, + { sides = 6, value = 6 }, + { sides = 6, value = 5 }, + { sides = 6, value = 3 }, + { sides = 6, value = 4 }, +] + +[[ test ]] +game_system = "SwordWorld2.0" +input = "k20sf1@3 sf自動失敗時" +output = "KeyNo.20c[3]sf[1] > 2D:[1,1]=2 > ** > 自動的失敗" +fumble = true +rands = [ + { sides = 6, value = 1 }, +] + +[[ test ]] +game_system = "SwordWorld2.0" +input = "k20tf1@3 tf自動失敗時" +output = "KeyNo.20c[3]tf[1] > 2D:[1,1]=2 > ** > 自動的失敗" +fumble = true +rands = [ + { sides = 6, value = 1 }, +] + + +[[ test ]] +game_system = "SwordWorld2.0" +input = "k20sf4@3 sfクリティカル下限変更 通常時" +output = "KeyNo.20c[6]sf[4] > 2D:[1,4]=5 > 3" +rands = [ + { sides = 6, value = 1 }, +] + +[[ test ]] +game_system = "SwordWorld2.0" +input = "k20sf3@3 sfクリティカル下限変更 クリティカル時" +output = "KeyNo.20c[5]sf[3] > 2D:[2,3 5,3 1,3]=5,8,4 > 3,6,2 > 2回転 > 11" +critical = true +rands = [ + { sides = 6, value = 2 }, + { sides = 6, value = 5 }, + { sides = 6, value = 1 }, +] + +[[ test ]] +game_system = "SwordWorld2.0" +input = "k20tf3@3 tfクリティカル自動失敗時" +output = "KeyNo.20c[3]tf[3] > 2D:[2,3 6,5 1,1]=5,11,2 > 3,9,** > 2回転 > 12" +critical = true +rands = [ + { sides = 6, value = 2 }, + { sides = 6, value = 6 }, + { sides = 6, value = 5 }, + { sides = 6, value = 1 }, + { sides = 6, value = 1 }, +] + [[ test ]] game_system = "SwordWorld2.0" input = "2D6@10+15>=30" diff --git a/test/data/SwordWorld2_5.toml b/test/data/SwordWorld2_5.toml index 1e871bccc..5c25d726d 100644 --- a/test/data/SwordWorld2_5.toml +++ b/test/data/SwordWorld2_5.toml @@ -169,6 +169,68 @@ rands = [ { sides = 6, value = 3 }, ] +[[ test ]] +game_system = "SwordWorld2.5" +input = "K40+24sf4@8$12r10" +output = "KeyNo.40c[8]m[12]r[10]sf[4]+24 > 2D:[1,4 5,4 4,4 5,4 2,4]=12,9,8,9,6 > 13,12,13,17,13+24 > 4回転 > 92" +critical = true +rands = [ + { sides = 6, value = 1 }, + { sides = 6, value = 5 }, + { sides = 6, value = 4 }, + { sides = 6, value = 5 }, + { sides = 6, value = 2 }, +] + +[[ test ]] +game_system = "SwordWorld2.5" +input = "K40+24tf4@8$12r10" +output = "KeyNo.40c[8]m[12]r[10]tf[4]+24 > 2D:[1,4 4,5 5,4 3,5 5,2]=12,9,9,8,7 > 13,12,14,16,16+24 > 4回転 > 95" +critical = true +rands = [ + { sides = 6, value = 1 }, + { sides = 6, value = 4 }, + { sides = 6, value = 5 }, + { sides = 6, value = 5 }, + { sides = 6, value = 4 }, + { sides = 6, value = 3 }, + { sides = 6, value = 5 }, + { sides = 6, value = 5 }, + { sides = 6, value = 2 }, +] + +[[ test ]] +game_system = "SwordWorld2.5" +input = "K40+24sf4@8$12r10#1" +output = "KeyNo.40c[8]m[12]r[10]sf[4]a[+1]+24 > 2D:[4,4 4,4 6,4 5,4 1,4]=12,9,11,10,6 > 13,12,16,18,13+24 > 4回転 > 96" +critical = true +rands = [ + { sides = 6, value = 4 }, + { sides = 6, value = 4 }, + { sides = 6, value = 6 }, + { sides = 6, value = 5 }, + { sides = 6, value = 1 }, +] + +[[ test ]] +game_system = "SwordWorld2.5" +input = "K40+24tf4@8$12r10#1" +output = "KeyNo.40c[8]m[12]r[10]tf[4]a[+1]+24 > 2D:[6,4 4,5 1,6 4,4 3,5 3,3]=12,10,8,9,9,7 > 13,13,13,17,20,18+24 > 5回転 > 118" +critical = true +rands = [ + { sides = 6, value = 6 }, + { sides = 6, value = 4 }, + { sides = 6, value = 5 }, + { sides = 6, value = 1 }, + { sides = 6, value = 6 }, + { sides = 6, value = 4 }, + { sides = 6, value = 4 }, + { sides = 6, value = 3 }, + { sides = 6, value = 5 }, + { sides = 6, value = 3 }, + { sides = 6, value = 3 }, +] + [[ test ]] game_system = "SwordWorld2.5" input = "K20+5" @@ -354,6 +416,97 @@ rands = [ { sides = 6, value = 1 }, ] +[[ test ]] +game_system = "SwordWorld2.5" +input = "k20sf4 sf通常時" +output = "KeyNo.20c[10]sf[4] > 2D:[3,4]=7 > 5" +rands = [ + { sides = 6, value = 3 }, +] + +[[ test ]] +game_system = "SwordWorld2.5" +input = "k20tf4 tf通常時" +output = "KeyNo.20c[10]tf[4] > 2D:[3,4]=7 > 5" +rands = [ + { sides = 6, value = 3 }, +] + +[[ test ]] +game_system = "SwordWorld2.5" +input = "k20sf7 sfクリティカル時" +output = "KeyNo.20c[10]sf[6] > 2D:[5,6 4,6 3,6]=11,10,9 > 9,8,7 > 2回転 > 24" +critical = true +rands = [ + { sides = 6, value = 5 }, + { sides = 6, value = 4 }, + { sides = 6, value = 3 }, +] + +[[ test ]] +game_system = "SwordWorld2.5" +input = "k20tf7 tfクリティカル時" +output = "KeyNo.20c[10]tf[6] > 2D:[5,6 6,5 3,4]=11,11,7 > 9,9,5 > 2回転 > 23" +critical = true +rands = [ + { sides = 6, value = 5 }, + { sides = 6, value = 6 }, + { sides = 6, value = 5 }, + { sides = 6, value = 3 }, + { sides = 6, value = 4 }, +] + +[[ test ]] +game_system = "SwordWorld2.5" +input = "k20sf1@3 sf自動失敗時" +output = "KeyNo.20c[3]sf[1] > 2D:[1,1]=2 > ** > 自動的失敗" +fumble = true +rands = [ + { sides = 6, value = 1 }, +] + +[[ test ]] +game_system = "SwordWorld2.5" +input = "k20tf1@3 tf自動失敗時" +output = "KeyNo.20c[3]tf[1] > 2D:[1,1]=2 > ** > 自動的失敗" +fumble = true +rands = [ + { sides = 6, value = 1 }, +] + + +[[ test ]] +game_system = "SwordWorld2.5" +input = "k20sf4@3 sfクリティカル下限変更 通常時" +output = "KeyNo.20c[6]sf[4] > 2D:[1,4]=5 > 3" +rands = [ + { sides = 6, value = 1 }, +] + +[[ test ]] +game_system = "SwordWorld2.5" +input = "k20sf3@3 sfクリティカル下限変更 クリティカル時" +output = "KeyNo.20c[5]sf[3] > 2D:[2,3 5,3 1,3]=5,8,4 > 3,6,2 > 2回転 > 11" +critical = true +rands = [ + { sides = 6, value = 2 }, + { sides = 6, value = 5 }, + { sides = 6, value = 1 }, +] + +[[ test ]] +game_system = "SwordWorld2.5" +input = "k20tf3@3 tfクリティカル自動失敗時" +output = "KeyNo.20c[3]tf[3] > 2D:[2,3 6,5 1,1]=5,11,2 > 3,9,** > 2回転 > 12" +critical = true +rands = [ + { sides = 6, value = 2 }, + { sides = 6, value = 6 }, + { sides = 6, value = 5 }, + { sides = 6, value = 1 }, + { sides = 6, value = 1 }, +] + [[ test ]] game_system = "SwordWorld2.5" input = "2D6@10+15>=30" diff --git a/test/test_sword_world_rating_command_parser.rb b/test/test_sword_world_rating_command_parser.rb index c31d2cf9d..d4dab2703 100644 --- a/test/test_sword_world_rating_command_parser.rb +++ b/test/test_sword_world_rating_command_parser.rb @@ -142,7 +142,7 @@ def test_parse_v1_arithmetic assert_equal(0, parsed.modifier_after_half) end - def test_parse_v20_full + def test_parse_v20_full_gf parser = BCDice::GameSystem::SwordWorld::RatingParser.new(version: :v2_0).set_debug() parsed = parser.parse("K20+5+3@9$+1gfr5H+2") @@ -159,6 +159,40 @@ def test_parse_v20_full assert_equal(2, parsed.modifier_after_half) end + def test_parse_v20_full_sf + parser = BCDice::GameSystem::SwordWorld::RatingParser.new(version: :v2_0).set_debug() + parsed = parser.parse("K20+5+3@9$+1sf4r5H+2") + + assert_not_nil(parsed) + assert_equal(20, parsed.rate) + assert_equal(8, parsed.modifier) + assert_equal(9, parsed.critical) + assert_equal(0, parsed.kept_modify) + assert_equal(0, parsed.first_to) + assert_equal(1, parsed.first_modify) + assert_equal(4, parsed.semi_fixed_val) + assert_equal(5, parsed.rateup) + assert_true(parsed.half) + assert_equal(2, parsed.modifier_after_half) + end + + def test_parse_v20_full_tf + parser = BCDice::GameSystem::SwordWorld::RatingParser.new(version: :v2_0).set_debug() + parsed = parser.parse("K20+5+3@9$+1tf4r5H+2") + + assert_not_nil(parsed) + assert_equal(20, parsed.rate) + assert_equal(8, parsed.modifier) + assert_equal(9, parsed.critical) + assert_equal(0, parsed.kept_modify) + assert_equal(0, parsed.first_to) + assert_equal(1, parsed.first_modify) + assert_equal(4, parsed.tmp_fixed_val) + assert_equal(5, parsed.rateup) + assert_true(parsed.half) + assert_equal(2, parsed.modifier_after_half) + end + def test_parse_v20_kept_modify_unsupported parser = BCDice::GameSystem::SwordWorld::RatingParser.new(version: :v2_0).set_debug() parsed = parser.parse("K20+5+3#1") @@ -166,7 +200,28 @@ def test_parse_v20_kept_modify_unsupported assert_nil(parsed) end - def test_parse_v25_full + def test_parse_v20_gf_sf_unsupported + parser = BCDice::GameSystem::SwordWorld::RatingParser.new(version: :v2_5).set_debug() + parsed = parser.parse("K20+5+3gfsf4") + + assert_nil(parsed) + end + + def test_parse_v20_gf_tf_unsupported + parser = BCDice::GameSystem::SwordWorld::RatingParser.new(version: :v2_5).set_debug() + parsed = parser.parse("K20+5+3gftf4") + + assert_nil(parsed) + end + + def test_parse_v20_sf_tf_unsupported + parser = BCDice::GameSystem::SwordWorld::RatingParser.new(version: :v2_5).set_debug() + parsed = parser.parse("K20+5+3sf4tf4") + + assert_nil(parsed) + end + + def test_parse_v25_full_gf parser = BCDice::GameSystem::SwordWorld::RatingParser.new(version: :v2_5).set_debug() parsed = parser.parse("K20+5+3@9#+2$+1gfr5H+2") @@ -182,4 +237,59 @@ def test_parse_v25_full assert_true(parsed.half) assert_equal(2, parsed.modifier_after_half) end + + def test_parse_v25_full_sf + parser = BCDice::GameSystem::SwordWorld::RatingParser.new(version: :v2_5).set_debug() + parsed = parser.parse("K20+5+3@9#+2$+1sf4r5H+2") + + assert_not_nil(parsed) + assert_equal(20, parsed.rate) + assert_equal(8, parsed.modifier) + assert_equal(9, parsed.critical) + assert_equal(2, parsed.kept_modify) + assert_equal(0, parsed.first_to) + assert_equal(1, parsed.first_modify) + assert_equal(4, parsed.semi_fixed_val) + assert_equal(5, parsed.rateup) + assert_true(parsed.half) + assert_equal(2, parsed.modifier_after_half) + end + + def test_parse_v25_full_tf + parser = BCDice::GameSystem::SwordWorld::RatingParser.new(version: :v2_5).set_debug() + parsed = parser.parse("K20+5+3@9#+2$+1tf4r5H+2") + + assert_not_nil(parsed) + assert_equal(20, parsed.rate) + assert_equal(8, parsed.modifier) + assert_equal(9, parsed.critical) + assert_equal(2, parsed.kept_modify) + assert_equal(0, parsed.first_to) + assert_equal(1, parsed.first_modify) + assert_equal(4, parsed.tmp_fixed_val) + assert_equal(5, parsed.rateup) + assert_true(parsed.half) + assert_equal(2, parsed.modifier_after_half) + end + + def test_parse_v25_gf_sf_unsupported + parser = BCDice::GameSystem::SwordWorld::RatingParser.new(version: :v2_5).set_debug() + parsed = parser.parse("K20+5+3gfsf4") + + assert_nil(parsed) + end + + def test_parse_v25_gf_tf_unsupported + parser = BCDice::GameSystem::SwordWorld::RatingParser.new(version: :v2_5).set_debug() + parsed = parser.parse("K20+5+3gftf4") + + assert_nil(parsed) + end + + def test_parse_v25_sf_tf_unsupported + parser = BCDice::GameSystem::SwordWorld::RatingParser.new(version: :v2_5).set_debug() + parsed = parser.parse("K20+5+3sf4tf4") + + assert_nil(parsed) + end end From b0a094834349dce7f0a5e7972002fdaa5297b06b Mon Sep 17 00:00:00 2001 From: Sarla Date: Sun, 21 Nov 2021 02:57:50 +0900 Subject: [PATCH 06/10] =?UTF-8?q?=E3=83=AA=E3=83=95=E3=82=A1=E3=82=AF?= =?UTF-8?q?=E3=82=BF=E3=83=AA=E3=83=B3=E3=82=B04?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bcdice/game_system/SwordWorld2_0.rb | 1 + lib/bcdice/game_system/sword_world/rating_parsed.rb | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/bcdice/game_system/SwordWorld2_0.rb b/lib/bcdice/game_system/SwordWorld2_0.rb index 3bc855daf..d98bb8de4 100644 --- a/lib/bcdice/game_system/SwordWorld2_0.rb +++ b/lib/bcdice/game_system/SwordWorld2_0.rb @@ -126,6 +126,7 @@ def rollDice(command, round) unless command.greatest_fortune return super(command, round) end + if command.greatest_fortune dice = @randomizer.roll_once(6) return dice * 2, "#{dice},#{dice}" diff --git a/lib/bcdice/game_system/sword_world/rating_parsed.rb b/lib/bcdice/game_system/sword_world/rating_parsed.rb index 4d73773aa..4df14ba91 100644 --- a/lib/bcdice/game_system/sword_world/rating_parsed.rb +++ b/lib/bcdice/game_system/sword_world/rating_parsed.rb @@ -27,7 +27,7 @@ class RatingParsed # @return [Integer, nil] attr_writer :semi_fixed_val - + # @return [Integer, nil] attr_writer :tmp_fixed_val @@ -57,8 +57,8 @@ def half def critical crit = @critical || (half ? 13 : 10) crit = 3 if crit < 3 - if !@semi_fixed_val.nil? - crit = @semi_fixed_val + 2 if crit < @semi_fixed_val + 2 + unless @semi_fixed_val.nil? || crit >= @semi_fixed_val + 2 + crit = @semi_fixed_val + 2 end return crit end @@ -77,14 +77,14 @@ def first_to def rateup return @rateup || 0 end - + # @return [Integer] def semi_fixed_val sf = @semi_fixed_val || 0 sf = 6 if sf > 6 return sf end - + # @return [Integer] def tmp_fixed_val tf = @tmp_fixed_val || 0 From 30e0d3fde6eb525574d26a0c77ca382a47c518ae Mon Sep 17 00:00:00 2001 From: Sarla Date: Sun, 21 Nov 2021 12:09:39 +0900 Subject: [PATCH 07/10] =?UTF-8?q?=E3=82=B3=E3=83=A1=E3=83=B3=E3=83=88?= =?UTF-8?q?=E7=B7=A8=E9=9B=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bcdice/game_system/SwordWorld2_0.rb | 12 ++++++------ lib/bcdice/game_system/SwordWorld2_5.rb | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/bcdice/game_system/SwordWorld2_0.rb b/lib/bcdice/game_system/SwordWorld2_0.rb index d98bb8de4..2a42d1430 100644 --- a/lib/bcdice/game_system/SwordWorld2_0.rb +++ b/lib/bcdice/game_system/SwordWorld2_0.rb @@ -51,15 +51,15 @@ class SwordWorld2_0 < SwordWorld ・首切り刀用レーティング上昇 r10  例)K20r10 K30+24@8R10 K40+24@8$12r10 - ・威力表を1d+sfで参照 回転後も継続 sf4 -  例)k10sf4 - - ・威力表を1d+tfで参照 回転後は2dで判定 tf3 -  例)k10tf3 - ・グレイテストフォーチュンは末尾に gf  例)K20gf K30+24@8GF K40+24@8$12r10gf + ・威力表を1d+sfで参照 クリティカル後も継続 sf4 +  例)k10sf4 k0+5SF4@13 k70+26sf3@9 + + ・威力表を1d+tfで参照 クリティカル後は2dで参照 tf3 +  例)k10tf3 k0+5TF4@13 k70+26tf3@9 + ・超越判定用に2d6ロールに 2D6@10 書式でクリティカル値付与が可能に。  例)2D6@10 2D6@10+11>=30 diff --git a/lib/bcdice/game_system/SwordWorld2_5.rb b/lib/bcdice/game_system/SwordWorld2_5.rb index d2e8e8a86..6d2f340f7 100644 --- a/lib/bcdice/game_system/SwordWorld2_5.rb +++ b/lib/bcdice/game_system/SwordWorld2_5.rb @@ -56,11 +56,11 @@ class SwordWorld2_5 < SwordWorld2_0 ・グレイテストフォーチュンは末尾に gf  例)K20gf K30+24@8GF K40+24@8$12r5gf - ・威力表を1d+sfで参照 回転後も継続 sf4 -  例)k10sf4 + ・威力表を1d+sfで参照 クリティカル後も継続 sf4 +  例)k10sf4 k0+5sf4@13 k70+26sf3@9 - ・威力表を1d+tfで参照 回転後は2dで判定 tf3 -  例)k10tf3 + ・威力表を1d+tfで参照 クリティカル後は2dで参照 tf3 +  例)k10tf3 k0+5tf4@13 k70+26tf3@9 ・超越判定用に2d6ロールに 2D6@10 書式でクリティカル値付与が可能に。  例)2D6@10 2D6@10+11>=30 From 147f7b6531daea2597fde0e9b4b3ad7b78680e8e Mon Sep 17 00:00:00 2001 From: Sarla Date: Wed, 24 Nov 2021 17:25:45 +0900 Subject: [PATCH 08/10] =?UTF-8?q?[SwordWorld2.0][SwordWorld2.5]=E3=82=AF?= =?UTF-8?q?=E3=83=AA=E3=83=86=E3=82=A3=E3=82=AB=E3=83=AB=E4=B8=8B=E9=99=90?= =?UTF-8?q?=E3=82=A8=E3=83=A9=E3=83=BC=E3=81=AE=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bcdice/game_system/SwordWorld.rb | 4 ++ .../game_system/sword_world/rating_parsed.rb | 29 ++++++++-- test/data/SwordWorld2_0.toml | 32 ++++------- test/data/SwordWorld2_5.toml | 56 ++++++++++++------- 4 files changed, 76 insertions(+), 45 deletions(-) diff --git a/lib/bcdice/game_system/SwordWorld.rb b/lib/bcdice/game_system/SwordWorld.rb index 86d7d87ee..f05dd71c8 100644 --- a/lib/bcdice/game_system/SwordWorld.rb +++ b/lib/bcdice/game_system/SwordWorld.rb @@ -68,6 +68,10 @@ def rating(string) # レーティング表 return "キーナンバーは#{keyMax}までです" end + if command.infinite_roll? + return Result.new("C値を#{command.min_critical}以上にしてください") + end + newRates = getNewRates(rate_sw2_0) output = "#{command} > " diff --git a/lib/bcdice/game_system/sword_world/rating_parsed.rb b/lib/bcdice/game_system/sword_world/rating_parsed.rb index 4df14ba91..d8b8bc8fa 100644 --- a/lib/bcdice/game_system/sword_world/rating_parsed.rb +++ b/lib/bcdice/game_system/sword_world/rating_parsed.rb @@ -10,6 +10,9 @@ class RatingParsed # @return [Integer, nil] attr_writer :critical + # @return [Integer, nil] + attr_writer :min_critical + # @return [Integer, nil] attr_writer :kept_modify @@ -39,6 +42,7 @@ class RatingParsed def initialize @critical = nil + @min_critical = nil @kept_modify = nil @first_to = nil @first_modify = nil @@ -55,12 +59,22 @@ def half # @return [Integer] def critical - crit = @critical || (half ? 13 : 10) - crit = 3 if crit < 3 - unless @semi_fixed_val.nil? || crit >= @semi_fixed_val + 2 - crit = @semi_fixed_val + 2 + return @critical || (half ? 13 : 10) + end + + # @return [Integer] + def min_critical + min_critical = 3 + if !@semi_fixed_val.nil? + if !@kept_modify.nil? + min_critical = @semi_fixed_val + @kept_modify + 2 if min_critical < @semi_fixed_val + @kept_modify + 2 + else + min_critical = @semi_fixed_val + 2 if min_critical < @semi_fixed_val + 2 + end + min_critical = 3 if @semi_fixed_val == 1 end - return crit + min_critical = 13 if min_critical > 13 + return min_critical end # @return [Integer] @@ -120,6 +134,11 @@ def to_s() end return output end + + # @return [Boolean] + def infinite_roll? + return critical < min_critical + end end end end diff --git a/test/data/SwordWorld2_0.toml b/test/data/SwordWorld2_0.toml index 29e68b632..0aec13518 100644 --- a/test/data/SwordWorld2_0.toml +++ b/test/data/SwordWorld2_0.toml @@ -388,26 +388,6 @@ rands = [ { sides = 6, value = 1 }, ] - -[[ test ]] -game_system = "SwordWorld2.0" -input = "k20sf4@3 sfクリティカル下限変更 通常時" -output = "KeyNo.20c[6]sf[4] > 2D:[1,4]=5 > 3" -rands = [ - { sides = 6, value = 1 }, -] - -[[ test ]] -game_system = "SwordWorld2.0" -input = "k20sf3@3 sfクリティカル下限変更 クリティカル時" -output = "KeyNo.20c[5]sf[3] > 2D:[2,3 5,3 1,3]=5,8,4 > 3,6,2 > 2回転 > 11" -critical = true -rands = [ - { sides = 6, value = 2 }, - { sides = 6, value = 5 }, - { sides = 6, value = 1 }, -] - [[ test ]] game_system = "SwordWorld2.0" input = "k20tf3@3 tfクリティカル自動失敗時" @@ -421,6 +401,18 @@ rands = [ { sides = 6, value = 1 }, ] +[[ test ]] +game_system = "SwordWorld2.0" +input = "k20@2 クリティカル下限エラー 通常の下限は3" +output = "C値を3以上にしてください" +rands = [] + +[[ test ]] +game_system = "SwordWorld2.0" +input = "k20sf2@2 クリティカル下限エラー sfが2以上の時はsf+2" +output = "C値を4以上にしてください" +rands = [] + [[ test ]] game_system = "SwordWorld2.0" input = "2D6@10+15>=30" diff --git a/test/data/SwordWorld2_5.toml b/test/data/SwordWorld2_5.toml index 5c25d726d..d7521ee33 100644 --- a/test/data/SwordWorld2_5.toml +++ b/test/data/SwordWorld2_5.toml @@ -474,26 +474,6 @@ rands = [ { sides = 6, value = 1 }, ] - -[[ test ]] -game_system = "SwordWorld2.5" -input = "k20sf4@3 sfクリティカル下限変更 通常時" -output = "KeyNo.20c[6]sf[4] > 2D:[1,4]=5 > 3" -rands = [ - { sides = 6, value = 1 }, -] - -[[ test ]] -game_system = "SwordWorld2.5" -input = "k20sf3@3 sfクリティカル下限変更 クリティカル時" -output = "KeyNo.20c[5]sf[3] > 2D:[2,3 5,3 1,3]=5,8,4 > 3,6,2 > 2回転 > 11" -critical = true -rands = [ - { sides = 6, value = 2 }, - { sides = 6, value = 5 }, - { sides = 6, value = 1 }, -] - [[ test ]] game_system = "SwordWorld2.5" input = "k20tf3@3 tfクリティカル自動失敗時" @@ -507,6 +487,42 @@ rands = [ { sides = 6, value = 1 }, ] +[[ test ]] +game_system = "SwordWorld2.5" +input = "k20@2 クリティカル下限エラー 通常の下限は3" +output = "C値を3以上にしてください" +rands = [] + +[[ test ]] +game_system = "SwordWorld2.5" +input = "k20sf2@2 クリティカル下限エラー sfが2以上の時はsf+2" +output = "C値を4以上にしてください" +rands = [] + +[[ test ]] +game_system = "SwordWorld2.5" +input = "k20sf2#1@2 クリティカル下限エラー sfと#の同時指定時はsf+#+2" +output = "C値を5以上にしてください" +rands = [] + +[[ test ]] +game_system = "SwordWorld2.5" +input = "k20sf2#20@2 クリティカル下限エラー 下限の上限は13" +output = "C値を13以上にしてください" +rands = [] + +[[ test ]] +game_system = "SwordWorld2.5" +input = "k20sf1@2 クリティカル下限エラー sfが1の時の下限は3" +output = "C値を3以上にしてください" +rands = [] + +[[ test ]] +game_system = "SwordWorld2.5" +input = "k20sf1#8@2 クリティカル下限エラー sfが1の時の下限は3" +output = "C値を3以上にしてください" +rands = [] + [[ test ]] game_system = "SwordWorld2.5" input = "2D6@10+15>=30" From 73ac1f3c0a3f40a269acd41d34d9fb570f3e316d Mon Sep 17 00:00:00 2001 From: Sarla Date: Wed, 24 Nov 2021 17:31:00 +0900 Subject: [PATCH 09/10] =?UTF-8?q?=E3=83=AA=E3=83=95=E3=82=A1=E3=82=AF?= =?UTF-8?q?=E3=82=BF=E3=83=AA=E3=83=B3=E3=82=B05?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bcdice/game_system/sword_world/rating_parsed.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/bcdice/game_system/sword_world/rating_parsed.rb b/lib/bcdice/game_system/sword_world/rating_parsed.rb index d8b8bc8fa..63a538bd3 100644 --- a/lib/bcdice/game_system/sword_world/rating_parsed.rb +++ b/lib/bcdice/game_system/sword_world/rating_parsed.rb @@ -65,11 +65,11 @@ def critical # @return [Integer] def min_critical min_critical = 3 - if !@semi_fixed_val.nil? - if !@kept_modify.nil? - min_critical = @semi_fixed_val + @kept_modify + 2 if min_critical < @semi_fixed_val + @kept_modify + 2 - else + unless @semi_fixed_val.nil? + if @kept_modify.nil? min_critical = @semi_fixed_val + 2 if min_critical < @semi_fixed_val + 2 + else + min_critical = @semi_fixed_val + @kept_modify + 2 if min_critical < @semi_fixed_val + @kept_modify + 2 end min_critical = 3 if @semi_fixed_val == 1 end From ca56617908046f8432479f194e2f995b64ba7988 Mon Sep 17 00:00:00 2001 From: Sarla Date: Wed, 24 Nov 2021 17:38:36 +0900 Subject: [PATCH 10/10] =?UTF-8?q?=E4=BB=A3=E5=85=A5=E3=81=99=E3=82=8B?= =?UTF-8?q?=E3=81=93=E3=81=A8=E3=81=8C=E3=81=AA=E3=81=84=E3=81=9F=E3=82=81?= =?UTF-8?q?=E6=9C=80=E5=B0=8F=E3=82=AF=E3=83=AA=E3=83=86=E3=82=A3=E3=82=AB?= =?UTF-8?q?=E3=83=AB=E5=80=A4=E3=81=AEattr=5Fwriter=E3=82=92=E5=89=8A?= =?UTF-8?q?=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bcdice/game_system/sword_world/rating_parsed.rb | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/bcdice/game_system/sword_world/rating_parsed.rb b/lib/bcdice/game_system/sword_world/rating_parsed.rb index 63a538bd3..47df9ffdd 100644 --- a/lib/bcdice/game_system/sword_world/rating_parsed.rb +++ b/lib/bcdice/game_system/sword_world/rating_parsed.rb @@ -10,9 +10,6 @@ class RatingParsed # @return [Integer, nil] attr_writer :critical - # @return [Integer, nil] - attr_writer :min_critical - # @return [Integer, nil] attr_writer :kept_modify