From d1cba9b6abcbf5b4ecf4ad90c0114fe79ce96e2d Mon Sep 17 00:00:00 2001 From: FredGreenfield Date: Wed, 29 Sep 2021 16:27:28 +0900 Subject: [PATCH 1/6] =?UTF-8?q?=E3=83=BBSuccess=E3=81=AB=E5=AF=BE=E5=BF=9C?= =?UTF-8?q?=20=E3=83=BB=E5=86=85=E9=83=A8=E3=81=AEMODIFY=5FINDEX=E3=82=92G?= =?UTF-8?q?EAR=5FINDEX=E3=81=AB=E5=A4=89=E6=9B=B4=1B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bcdice/game_system/YearZeroEngine.rb | 37 +++++++++++++++--------- test/data/YearZeroEngine.toml | 34 ++++++++++++++++++++++ 2 files changed, 58 insertions(+), 13 deletions(-) diff --git a/lib/bcdice/game_system/YearZeroEngine.rb b/lib/bcdice/game_system/YearZeroEngine.rb index ff85aec7c..2087db329 100644 --- a/lib/bcdice/game_system/YearZeroEngine.rb +++ b/lib/bcdice/game_system/YearZeroEngine.rb @@ -19,15 +19,16 @@ class YearZeroEngine < Base ・判定コマンド(nMYZx+x+x) (難易度)MYZ(能力ダイス数)+(技能ダイス数)+(アイテムダイス数) # (1と6を数え、プッシュ可能数を表示) + (難易度)MYZ(能力ダイス数)-(技能ダイス数)+(アイテムダイス数) # (1と6を数え、プッシュ可能数を表示、技能のマイナス指定) ※ 難易度と技能、アイテムダイス数は省略可能 INFO_MESSAGE_TEXT - DIFFICULTY_INDEX = 1 # 難易度のインデックス - COMMAND_TYPE_INDEX = 2 # コマンドタイプのインデックス - ABILITY_INDEX = 3 # 能力値ダイスのインデックス - SKILL_INDEX = 5 # 技能値ダイスのインデックス - MODIFIED_INDEX = 7 # 修正ダイスのインデックス + DIFFICULTY_INDEX = 1 # 難易度のインデックス + COMMAND_TYPE_INDEX = 2 # コマンドタイプのインデックス + ABILITY_INDEX = 3 # 能力値ダイスのインデックス + SKILL_INDEX = 5 # 技能値ダイスのインデックス + GEAR_INDEX = 7 # アイテムダイスのインデックス register_prefix('(\d+)?(YZE|MYZ)') @@ -79,9 +80,9 @@ def eval_game_system_specific_command(command) dice_text += "+#{skill_dice_text}" end - if m[MODIFIED_INDEX] - dice_pool = m[MODIFIED_INDEX].to_i - modified_dice_text, success_dice, botch_dice = make_dice_roll(dice_pool) + if m[GEAR_INDEX] + dice_pool = m[GEAR_INDEX].to_i + gear_dice_text, success_dice, botch_dice = make_dice_roll(dice_pool) @total_success_dice += success_dice @total_botch_dice += botch_dice @@ -89,8 +90,9 @@ def eval_game_system_specific_command(command) @push_dice += (dice_pool - (success_dice + botch_dice)) dice_count_text += "+(#{dice_pool}D6)" - dice_text += "+#{modified_dice_text}" + dice_text += "+#{gear_dice_text}" end + return make_result_text(command_type, dice_count_text, dice_text) end @@ -108,18 +110,27 @@ def make_result_with_yze(dice_count_text, dice_text) result_text = "#{dice_count_text} > #{dice_text} 成功数:#{@total_success_dice}" if @difficulty > 0 if @total_success_dice >= @difficulty - result_text = "#{result_text} 難易度=#{@difficulty}:判定成功!" + return Result.success("#{result_text} 難易度=#{@difficulty}:判定成功!") else - result_text = "#{result_text} 難易度=#{@difficulty}:判定失敗!" + return Result.failure("#{result_text} 難易度=#{@difficulty}:判定失敗!") end end return result_text end def make_result_with_myz(dice_count_text, dice_text) - result_text = make_result_with_yze(dice_count_text, dice_text) + result_text = "#{dice_count_text} > #{dice_text} 成功数:#{@total_success_dice}" + atter_text = "\n出目1:[能力:#{@base_botch_dice},技能:#{@skill_botch_dice},アイテム:#{@gear_botch_dice}) プッシュ可能=#{@push_dice}ダイス" + + if @difficulty > 0 + if @total_success_dice >= @difficulty + return Result.success("#{result_text} 難易度=#{@difficulty}:判定成功!#{atter_text}") + else + return Result.failure("#{result_text} 難易度=#{@difficulty}:判定失敗!#{atter_text}") + end + end - return "#{result_text}\n出目1:[能力:#{@base_botch_dice},技能:#{@skill_botch_dice},アイテム:#{@gear_botch_dice}) プッシュ可能=#{@push_dice}ダイス" + return "#{result_text}#{atter_text}" end def make_dice_roll(dice_pool) diff --git a/test/data/YearZeroEngine.toml b/test/data/YearZeroEngine.toml index d41cdd523..504fb4be5 100644 --- a/test/data/YearZeroEngine.toml +++ b/test/data/YearZeroEngine.toml @@ -210,6 +210,7 @@ rands = [ game_system = "YearZeroEngine" input = "2YZE3" output = "(3D6) > [2,5,3] 成功数:0 難易度=2:判定失敗!" +failure = true rands = [ { sides = 6, value = 2 }, { sides = 6, value = 5 }, @@ -220,6 +221,7 @@ rands = [ game_system = "YearZeroEngine" input = "2YZE3" output = "(3D6) > [2,6,1] 成功数:1 難易度=2:判定失敗!" +failure = true rands = [ { sides = 6, value = 2 }, { sides = 6, value = 6 }, @@ -230,6 +232,7 @@ rands = [ game_system = "YearZeroEngine" input = "2YZE3" output = "(3D6) > [6,6,6] 成功数:3 難易度=2:判定成功!" +success = true rands = [ { sides = 6, value = 6 }, { sides = 6, value = 6 }, @@ -240,6 +243,7 @@ rands = [ game_system = "YearZeroEngine" input = "2YZE3+3" output = "(3D6)+(3D6) > [2,5,3]+[1,4,1] 成功数:0 難易度=2:判定失敗!" +failure = true rands = [ { sides = 6, value = 2 }, { sides = 6, value = 5 }, @@ -253,6 +257,7 @@ rands = [ game_system = "YearZeroEngine" input = "2YZE3+3" output = "(3D6)+(3D6) > [2,6,3]+[1,6,1] 成功数:2 難易度=2:判定成功!" +success = true rands = [ { sides = 6, value = 2 }, { sides = 6, value = 6 }, @@ -266,6 +271,7 @@ rands = [ game_system = "YearZeroEngine" input = "2YZE3+3" output = "(3D6)+(3D6) > [6,6,6]+[6,6,6] 成功数:6 難易度=2:判定成功!" +success = true rands = [ { sides = 6, value = 6 }, { sides = 6, value = 6 }, @@ -279,6 +285,7 @@ rands = [ game_system = "YearZeroEngine" input = "2YZE3+3+3" output = "(3D6)+(3D6)+(3D6) > [2,5,3]+[1,4,1]+[3,1,4] 成功数:0 難易度=2:判定失敗!" +failure = true rands = [ { sides = 6, value = 2 }, { sides = 6, value = 5 }, @@ -295,6 +302,7 @@ rands = [ game_system = "YearZeroEngine" input = "2YZE3+3+3" output = "(3D6)+(3D6)+(3D6) > [2,5,6]+[1,4,6]+[3,1,6] 成功数:3 難易度=2:判定成功!" +success = true rands = [ { sides = 6, value = 2 }, { sides = 6, value = 5 }, @@ -311,6 +319,7 @@ rands = [ game_system = "YearZeroEngine" input = "2YZE3+3+3" output = "(3D6)+(3D6)+(3D6) > [6,6,6]+[6,6,6]+[6,6,6] 成功数:9 難易度=2:判定成功!" +success = true rands = [ { sides = 6, value = 6 }, { sides = 6, value = 6 }, @@ -327,6 +336,7 @@ rands = [ game_system = "YearZeroEngine" input = "2YZE3+2+1" output = "(3D6)+(2D6)+(1D6) > [2,5,3]+[1,4]+[3] 成功数:0 難易度=2:判定失敗!" +failure = true rands = [ { sides = 6, value = 2 }, { sides = 6, value = 5 }, @@ -340,6 +350,7 @@ rands = [ game_system = "YearZeroEngine" input = "2YZE3+2+1" output = "(3D6)+(2D6)+(1D6) > [2,5,6]+[4,6]+[6] 成功数:3 難易度=2:判定成功!" +success = true rands = [ { sides = 6, value = 2 }, { sides = 6, value = 5 }, @@ -353,6 +364,7 @@ rands = [ game_system = "YearZeroEngine" input = "2YZE3+2+1" output = "(3D6)+(2D6)+(1D6) > [6,6,6]+[6,6]+[6] 成功数:6 難易度=2:判定成功!" +success = true rands = [ { sides = 6, value = 6 }, { sides = 6, value = 6 }, @@ -366,6 +378,7 @@ rands = [ game_system = "YearZeroEngine" input = "2YZE1+2+3" output = "(1D6)+(2D6)+(3D6) > [2]+[4,6]+[6,1,5] 成功数:2 難易度=2:判定成功!" +success = true rands = [ { sides = 6, value = 2 }, { sides = 6, value = 4 }, @@ -379,6 +392,7 @@ rands = [ game_system = "YearZeroEngine" input = "S2YZE3" output = "(3D6) > [2,5,3] 成功数:0 難易度=2:判定失敗!" +failure = true secret = true rands = [ { sides = 6, value = 2 }, @@ -390,6 +404,7 @@ rands = [ game_system = "YearZeroEngine" input = "S2YZE3+3" output = "(3D6)+(3D6) > [2,5,3]+[1,4,1] 成功数:0 難易度=2:判定失敗!" +failure = true secret = true rands = [ { sides = 6, value = 2 }, @@ -404,6 +419,7 @@ rands = [ game_system = "YearZeroEngine" input = "S2YZE1+2+3" output = "(1D6)+(2D6)+(3D6) > [2]+[4,6]+[6,1,5] 成功数:2 難易度=2:判定成功!" +success = true secret = true rands = [ { sides = 6, value = 2 }, @@ -626,6 +642,7 @@ rands = [ game_system = "YearZeroEngine" input = "2MYZ3" output = "(3D6) > [2,5,3] 成功数:0 難易度=2:判定失敗!\n出目1:[能力:0,技能:0,アイテム:0) プッシュ可能=3ダイス" +failure = true rands = [ { sides = 6, value = 2 }, { sides = 6, value = 5 }, @@ -636,6 +653,7 @@ rands = [ game_system = "YearZeroEngine" input = "2MYZ3" output = "(3D6) > [2,6,1] 成功数:1 難易度=2:判定失敗!\n出目1:[能力:1,技能:0,アイテム:0) プッシュ可能=1ダイス" +failure = true rands = [ { sides = 6, value = 2 }, { sides = 6, value = 6 }, @@ -646,6 +664,7 @@ rands = [ game_system = "YearZeroEngine" input = "2MYZ3" output = "(3D6) > [6,6,6] 成功数:3 難易度=2:判定成功!\n出目1:[能力:0,技能:0,アイテム:0) プッシュ可能=0ダイス" +success = true rands = [ { sides = 6, value = 6 }, { sides = 6, value = 6 }, @@ -656,6 +675,7 @@ rands = [ game_system = "YearZeroEngine" input = "2MYZ3+3" output = "(3D6)+(3D6) > [2,5,3]+[1,4,1] 成功数:0 難易度=2:判定失敗!\n出目1:[能力:0,技能:2,アイテム:0) プッシュ可能=6ダイス" +failure = true rands = [ { sides = 6, value = 2 }, { sides = 6, value = 5 }, @@ -669,6 +689,7 @@ rands = [ game_system = "YearZeroEngine" input = "2MYZ3+3" output = "(3D6)+(3D6) > [2,6,3]+[1,6,1] 成功数:2 難易度=2:判定成功!\n出目1:[能力:0,技能:2,アイテム:0) プッシュ可能=4ダイス" +success = true rands = [ { sides = 6, value = 2 }, { sides = 6, value = 6 }, @@ -682,6 +703,7 @@ rands = [ game_system = "YearZeroEngine" input = "2MYZ3+3" output = "(3D6)+(3D6) > [6,6,6]+[6,6,6] 成功数:6 難易度=2:判定成功!\n出目1:[能力:0,技能:0,アイテム:0) プッシュ可能=0ダイス" +success = true rands = [ { sides = 6, value = 6 }, { sides = 6, value = 6 }, @@ -695,6 +717,7 @@ rands = [ game_system = "YearZeroEngine" input = "2MYZ3+3+3" output = "(3D6)+(3D6)+(3D6) > [2,5,3]+[1,4,1]+[3,1,4] 成功数:0 難易度=2:判定失敗!\n出目1:[能力:0,技能:2,アイテム:1) プッシュ可能=8ダイス" +failure = true rands = [ { sides = 6, value = 2 }, { sides = 6, value = 5 }, @@ -711,6 +734,7 @@ rands = [ game_system = "YearZeroEngine" input = "2MYZ3+3+3" output = "(3D6)+(3D6)+(3D6) > [2,5,6]+[1,4,6]+[3,1,6] 成功数:3 難易度=2:判定成功!\n出目1:[能力:0,技能:1,アイテム:1) プッシュ可能=5ダイス" +success = true rands = [ { sides = 6, value = 2 }, { sides = 6, value = 5 }, @@ -727,6 +751,7 @@ rands = [ game_system = "YearZeroEngine" input = "2MYZ3+3+3" output = "(3D6)+(3D6)+(3D6) > [6,6,6]+[6,6,6]+[6,6,6] 成功数:9 難易度=2:判定成功!\n出目1:[能力:0,技能:0,アイテム:0) プッシュ可能=0ダイス" +success = true rands = [ { sides = 6, value = 6 }, { sides = 6, value = 6 }, @@ -743,6 +768,7 @@ rands = [ game_system = "YearZeroEngine" input = "2MYZ3+2+1" output = "(3D6)+(2D6)+(1D6) > [2,5,3]+[1,4]+[3] 成功数:0 難易度=2:判定失敗!\n出目1:[能力:0,技能:1,アイテム:0) プッシュ可能=6ダイス" +failure = true rands = [ { sides = 6, value = 2 }, { sides = 6, value = 5 }, @@ -756,6 +782,7 @@ rands = [ game_system = "YearZeroEngine" input = "2MYZ3+2+1" output = "(3D6)+(2D6)+(1D6) > [2,5,6]+[4,6]+[6] 成功数:3 難易度=2:判定成功!\n出目1:[能力:0,技能:0,アイテム:0) プッシュ可能=3ダイス" +success = true rands = [ { sides = 6, value = 2 }, { sides = 6, value = 5 }, @@ -769,6 +796,7 @@ rands = [ game_system = "YearZeroEngine" input = "2MYZ3+2+1" output = "(3D6)+(2D6)+(1D6) > [6,6,6]+[6,6]+[6] 成功数:6 難易度=2:判定成功!\n出目1:[能力:0,技能:0,アイテム:0) プッシュ可能=0ダイス" +success = true rands = [ { sides = 6, value = 6 }, { sides = 6, value = 6 }, @@ -782,6 +810,7 @@ rands = [ game_system = "YearZeroEngine" input = "2MYZ1+2+3" output = "(1D6)+(2D6)+(3D6) > [2]+[4,6]+[6,1,5] 成功数:2 難易度=2:判定成功!\n出目1:[能力:0,技能:0,アイテム:1) プッシュ可能=3ダイス" +success = true rands = [ { sides = 6, value = 2 }, { sides = 6, value = 4 }, @@ -795,6 +824,7 @@ rands = [ game_system = "YearZeroEngine" input = "S2MYZ3" output = "(3D6) > [2,5,3] 成功数:0 難易度=2:判定失敗!\n出目1:[能力:0,技能:0,アイテム:0) プッシュ可能=3ダイス" +failure = true secret = true rands = [ { sides = 6, value = 2 }, @@ -806,6 +836,7 @@ rands = [ game_system = "YearZeroEngine" input = "S2MYZ3+3" output = "(3D6)+(3D6) > [2,5,3]+[1,4,1] 成功数:0 難易度=2:判定失敗!\n出目1:[能力:0,技能:2,アイテム:0) プッシュ可能=6ダイス" +failure = true secret = true rands = [ { sides = 6, value = 2 }, @@ -820,6 +851,8 @@ rands = [ game_system = "YearZeroEngine" input = "S2MYZ1+2+3" output = "(1D6)+(2D6)+(3D6) > [2]+[4,6]+[6,1,5] 成功数:2 難易度=2:判定成功!\n出目1:[能力:0,技能:0,アイテム:1) プッシュ可能=3ダイス" +success = true +success = true secret = true rands = [ { sides = 6, value = 2 }, @@ -834,6 +867,7 @@ rands = [ game_system = "YearZeroEngine" input = "2MYZ3+3+3" output = "(3D6)+(3D6)+(3D6) > [1,6,3]+[1,4,1]+[3,1,4] 成功数:1 難易度=2:判定失敗!\n出目1:[能力:1,技能:2,アイテム:1) プッシュ可能=6ダイス" +failure = true rands = [ { sides = 6, value = 1 }, { sides = 6, value = 6 }, From 2edb4c39bb3fac1f0fe00f2507b37d853cfd0be6 Mon Sep 17 00:00:00 2001 From: FredGreenfield Date: Wed, 29 Sep 2021 16:48:14 +0900 Subject: [PATCH 2/6] =?UTF-8?q?=E3=83=BB=E4=BD=99=E8=A8=88=E3=81=AA?= =?UTF-8?q?=E3=82=B3=E3=83=A1=E3=83=B3=E3=83=88=E3=81=8C=E3=81=82=E3=81=A3?= =?UTF-8?q?=E3=81=9F=E3=81=AE=E3=81=A7=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bcdice/game_system/YearZeroEngine.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/bcdice/game_system/YearZeroEngine.rb b/lib/bcdice/game_system/YearZeroEngine.rb index 2087db329..cb7bdf689 100644 --- a/lib/bcdice/game_system/YearZeroEngine.rb +++ b/lib/bcdice/game_system/YearZeroEngine.rb @@ -19,7 +19,6 @@ class YearZeroEngine < Base ・判定コマンド(nMYZx+x+x) (難易度)MYZ(能力ダイス数)+(技能ダイス数)+(アイテムダイス数) # (1と6を数え、プッシュ可能数を表示) - (難易度)MYZ(能力ダイス数)-(技能ダイス数)+(アイテムダイス数) # (1と6を数え、プッシュ可能数を表示、技能のマイナス指定) ※ 難易度と技能、アイテムダイス数は省略可能 INFO_MESSAGE_TEXT From 6aa1629492687ff5896a4cd58c337903bce63b8c Mon Sep 17 00:00:00 2001 From: FredGreenfield Date: Wed, 29 Sep 2021 19:38:02 +0900 Subject: [PATCH 3/6] =?UTF-8?q?=E3=83=BB=E3=83=9E=E3=82=A4=E3=83=8A?= =?UTF-8?q?=E3=82=B9=E6=8A=80=E8=83=BD=E5=87=A6=E7=90=86=E5=AE=9F=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bcdice/game_system/YearZeroEngine.rb | 23 ++-- test/data/YearZeroEngine.toml | 137 ++++++++++++++++++++++- 2 files changed, 151 insertions(+), 9 deletions(-) diff --git a/lib/bcdice/game_system/YearZeroEngine.rb b/lib/bcdice/game_system/YearZeroEngine.rb index cb7bdf689..c73e533bd 100644 --- a/lib/bcdice/game_system/YearZeroEngine.rb +++ b/lib/bcdice/game_system/YearZeroEngine.rb @@ -19,6 +19,7 @@ class YearZeroEngine < Base ・判定コマンド(nMYZx+x+x) (難易度)MYZ(能力ダイス数)+(技能ダイス数)+(アイテムダイス数) # (1と6を数え、プッシュ可能数を表示) + (難易度)MYZ(能力ダイス数)-(技能ダイス数)+(アイテムダイス数) # (1と6を数え、プッシュ可能数を表示、技能のマイナス指定) ※ 難易度と技能、アイテムダイス数は省略可能 INFO_MESSAGE_TEXT @@ -26,8 +27,9 @@ class YearZeroEngine < Base DIFFICULTY_INDEX = 1 # 難易度のインデックス COMMAND_TYPE_INDEX = 2 # コマンドタイプのインデックス ABILITY_INDEX = 3 # 能力値ダイスのインデックス - SKILL_INDEX = 5 # 技能値ダイスのインデックス - GEAR_INDEX = 7 # アイテムダイスのインデックス + SKILL_SIGNED_INDEX = 5 # 技能値ダイス符号のインデックス + SKILL_INDEX = 6 # 技能値ダイスのインデックス + GEAR_INDEX = 8 # アイテムダイスのインデックス register_prefix('(\d+)?(YZE|MYZ)') @@ -42,7 +44,7 @@ def dice_info_init() end def eval_game_system_specific_command(command) - m = /\A(\d+)?(YZE|MYZ)(\d+)(\+(\d+))?(\+(\d+))?/.match(command) + m = /\A(\d+)?(YZE|MYZ)(\d+)((\+|-)(\d+))?(\+(\d+))?/.match(command) unless m return '' end @@ -70,13 +72,18 @@ def eval_game_system_specific_command(command) dice_pool = m[SKILL_INDEX].to_i skill_dice_text, success_dice, botch_dice = make_dice_roll(dice_pool) - @total_success_dice += success_dice + skill_unsigned = m[SKILL_SIGNED_INDEX] + if command_type == 'MYZ' and skill_unsigned == '-' + @total_success_dice -= success_dice # マイナス技能の成功は通常の成功と相殺される + else + @total_success_dice += success_dice + end @total_botch_dice += botch_dice - @skill_botch_dice += botch_dice # 技能ダイスの1はpushで振り直し可能 - @push_dice += (dice_pool - success_dice) # 技能ダイスのみ1を含む + @skill_botch_dice += botch_dice # 技能ダイスの1はpushで振り直し可能(例えマイナス技能でも) + @push_dice += (dice_pool - success_dice) # 技能ダイスのみ1を含むので、ここでは1を計算に入れない - dice_count_text += "+(#{dice_pool}D6)" - dice_text += "+#{skill_dice_text}" + dice_count_text += "#{skill_unsigned}(#{dice_pool}D6)" + dice_text += "#{skill_unsigned}#{skill_dice_text}" end if m[GEAR_INDEX] diff --git a/test/data/YearZeroEngine.toml b/test/data/YearZeroEngine.toml index 504fb4be5..827d406ec 100644 --- a/test/data/YearZeroEngine.toml +++ b/test/data/YearZeroEngine.toml @@ -852,7 +852,6 @@ game_system = "YearZeroEngine" input = "S2MYZ1+2+3" output = "(1D6)+(2D6)+(3D6) > [2]+[4,6]+[6,1,5] 成功数:2 難易度=2:判定成功!\n出目1:[能力:0,技能:0,アイテム:1) プッシュ可能=3ダイス" success = true -success = true secret = true rands = [ { sides = 6, value = 2 }, @@ -879,3 +878,139 @@ rands = [ { sides = 6, value = 1 }, { sides = 6, value = 4 }, ] + +[[ test ]] +game_system = "YearZeroEngine" +input = "2MYZ3-3+3" +output = "(3D6)-(3D6)+(3D6) > [1,6,3]-[1,6,1]+[3,1,4] 成功数:0 難易度=2:判定失敗!\n出目1:[能力:1,技能:2,アイテム:1) プッシュ可能=5ダイス" +failure = true +rands = [ + { sides = 6, value = 1 }, + { sides = 6, value = 6 }, + { sides = 6, value = 3 }, + { sides = 6, value = 1 }, + { sides = 6, value = 6 }, + { sides = 6, value = 1 }, + { sides = 6, value = 3 }, + { sides = 6, value = 1 }, + { sides = 6, value = 4 }, +] + +[[ test ]] +game_system = "YearZeroEngine" +input = "2MYZ3-3+3" +output = "(3D6)-(3D6)+(3D6) > [1,6,3]-[1,6,6]+[3,1,4] 成功数:-1 難易度=2:判定失敗!\n出目1:[能力:1,技能:1,アイテム:1) プッシュ可能=4ダイス" +failure = true +rands = [ + { sides = 6, value = 1 }, + { sides = 6, value = 6 }, + { sides = 6, value = 3 }, + { sides = 6, value = 1 }, + { sides = 6, value = 6 }, + { sides = 6, value = 6 }, + { sides = 6, value = 3 }, + { sides = 6, value = 1 }, + { sides = 6, value = 4 }, +] + +[[ test ]] +game_system = "YearZeroEngine" +input = "2MYZ3-3+3" +output = "(3D6)-(3D6)+(3D6) > [1,6,6]-[1,6,2]+[6,1,4] 成功数:2 難易度=2:判定成功!\n出目1:[能力:1,技能:1,アイテム:1) プッシュ可能=3ダイス" +success = true +rands = [ + { sides = 6, value = 1 }, + { sides = 6, value = 6 }, + { sides = 6, value = 6 }, + { sides = 6, value = 1 }, + { sides = 6, value = 6 }, + { sides = 6, value = 2 }, + { sides = 6, value = 6 }, + { sides = 6, value = 1 }, + { sides = 6, value = 4 }, +] + +[[ test ]] +game_system = "YearZeroEngine" +input = "2MYZ3-3" +output = "(3D6)-(3D6) > [1,6,6]-[1,6,2] 成功数:1 難易度=2:判定失敗!\n出目1:[能力:1,技能:1,アイテム:0) プッシュ可能=2ダイス" +failure = true +rands = [ + { sides = 6, value = 1 }, + { sides = 6, value = 6 }, + { sides = 6, value = 6 }, + { sides = 6, value = 1 }, + { sides = 6, value = 6 }, + { sides = 6, value = 2 }, +] + +[[ test ]] +game_system = "YearZeroEngine" +input = "2MYZ3-3" +output = "(3D6)-(3D6) > [6,6,6]-[1,6,2] 成功数:2 難易度=2:判定成功!\n出目1:[能力:0,技能:1,アイテム:0) プッシュ可能=2ダイス" +success = true +rands = [ + { sides = 6, value = 6 }, + { sides = 6, value = 6 }, + { sides = 6, value = 6 }, + { sides = 6, value = 1 }, + { sides = 6, value = 6 }, + { sides = 6, value = 2 }, +] +[[ test ]] +game_system = "YearZeroEngine" +input = "MYZ3-3+3" +output = "(3D6)-(3D6)+(3D6) > [1,6,3]-[1,6,6]+[3,1,4] 成功数:-1\n出目1:[能力:1,技能:1,アイテム:1) プッシュ可能=4ダイス" +rands = [ + { sides = 6, value = 1 }, + { sides = 6, value = 6 }, + { sides = 6, value = 3 }, + { sides = 6, value = 1 }, + { sides = 6, value = 6 }, + { sides = 6, value = 6 }, + { sides = 6, value = 3 }, + { sides = 6, value = 1 }, + { sides = 6, value = 4 }, +] + +[[ test ]] +game_system = "YearZeroEngine" +input = "MYZ3-3+3" +output = "(3D6)-(3D6)+(3D6) > [1,6,6]-[1,6,2]+[6,1,4] 成功数:2\n出目1:[能力:1,技能:1,アイテム:1) プッシュ可能=3ダイス" +rands = [ + { sides = 6, value = 1 }, + { sides = 6, value = 6 }, + { sides = 6, value = 6 }, + { sides = 6, value = 1 }, + { sides = 6, value = 6 }, + { sides = 6, value = 2 }, + { sides = 6, value = 6 }, + { sides = 6, value = 1 }, + { sides = 6, value = 4 }, +] + +[[ test ]] +game_system = "YearZeroEngine" +input = "MYZ3-3" +output = "(3D6)-(3D6) > [1,6,6]-[1,6,2] 成功数:1\n出目1:[能力:1,技能:1,アイテム:0) プッシュ可能=2ダイス" +rands = [ + { sides = 6, value = 1 }, + { sides = 6, value = 6 }, + { sides = 6, value = 6 }, + { sides = 6, value = 1 }, + { sides = 6, value = 6 }, + { sides = 6, value = 2 }, +] + +[[ test ]] +game_system = "YearZeroEngine" +input = "MYZ3-3" +output = "(3D6)-(3D6) > [6,6,6]-[1,6,2] 成功数:2\n出目1:[能力:0,技能:1,アイテム:0) プッシュ可能=2ダイス" +rands = [ + { sides = 6, value = 6 }, + { sides = 6, value = 6 }, + { sides = 6, value = 6 }, + { sides = 6, value = 1 }, + { sides = 6, value = 6 }, + { sides = 6, value = 2 }, +] From 7df3879966ea401977e42fcd1783184690d71764 Mon Sep 17 00:00:00 2001 From: FredGreenfield Date: Thu, 30 Sep 2021 21:20:20 +0900 Subject: [PATCH 4/6] =?UTF-8?q?=E3=83=BBYZE=E3=81=A7=E3=81=AE=E3=83=9E?= =?UTF-8?q?=E3=82=A4=E3=83=8A=E3=82=B9=E6=8A=80=E8=83=BD=E3=82=92=E3=82=A8?= =?UTF-8?q?=E3=83=A9=E3=83=BC=E3=81=AB=E3=81=99=E3=82=8B=E5=87=A6=E7=90=86?= =?UTF-8?q?=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/YearZeroEngine.rb | 3 +++ test/data/YearZeroEngine.toml | 13 +++++++++++++ 2 files changed, 16 insertions(+) diff --git a/lib/bcdice/game_system/YearZeroEngine.rb b/lib/bcdice/game_system/YearZeroEngine.rb index c73e533bd..f58058d56 100644 --- a/lib/bcdice/game_system/YearZeroEngine.rb +++ b/lib/bcdice/game_system/YearZeroEngine.rb @@ -73,6 +73,9 @@ def eval_game_system_specific_command(command) skill_dice_text, success_dice, botch_dice = make_dice_roll(dice_pool) skill_unsigned = m[SKILL_SIGNED_INDEX] + if command_type == 'YZE' and skill_unsigned == '-' + # YZEはシンプルに動作するコマンドなのでマイナス技能の処理は対応しない。 + return "YZEコマンドでは技能ダイスをマイナス指定できません。" if command_type == 'MYZ' and skill_unsigned == '-' @total_success_dice -= success_dice # マイナス技能の成功は通常の成功と相殺される else diff --git a/test/data/YearZeroEngine.toml b/test/data/YearZeroEngine.toml index 827d406ec..eff3f01d8 100644 --- a/test/data/YearZeroEngine.toml +++ b/test/data/YearZeroEngine.toml @@ -1014,3 +1014,16 @@ rands = [ { sides = 6, value = 6 }, { sides = 6, value = 2 }, ] + +[[ test ]] +game_system = "YearZeroEngine" +input = "YZE3-3" +output = "YZEでは技能ダイスをマイナス指定できません。" +rands = [ + { sides = 6, value = 6 }, + { sides = 6, value = 6 }, + { sides = 6, value = 6 }, + { sides = 6, value = 1 }, + { sides = 6, value = 6 }, + { sides = 6, value = 2 }, +] From 237c6a4d55155fc7a8544e9151eb2003a547ba51 Mon Sep 17 00:00:00 2001 From: FredGreenfield Date: Thu, 30 Sep 2021 21:22:48 +0900 Subject: [PATCH 5/6] =?UTF-8?q?=E3=83=BB=E3=83=A1=E3=83=83=E3=82=BB?= =?UTF-8?q?=E3=83=BC=E3=82=B8=E3=81=A8=E3=83=90=E3=82=B0=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bcdice/game_system/YearZeroEngine.rb | 2 +- test/data/YearZeroEngine.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/bcdice/game_system/YearZeroEngine.rb b/lib/bcdice/game_system/YearZeroEngine.rb index f58058d56..c0cb14909 100644 --- a/lib/bcdice/game_system/YearZeroEngine.rb +++ b/lib/bcdice/game_system/YearZeroEngine.rb @@ -76,7 +76,7 @@ def eval_game_system_specific_command(command) if command_type == 'YZE' and skill_unsigned == '-' # YZEはシンプルに動作するコマンドなのでマイナス技能の処理は対応しない。 return "YZEコマンドでは技能ダイスをマイナス指定できません。" - if command_type == 'MYZ' and skill_unsigned == '-' + elsif command_type == 'MYZ' and skill_unsigned == '-' @total_success_dice -= success_dice # マイナス技能の成功は通常の成功と相殺される else @total_success_dice += success_dice diff --git a/test/data/YearZeroEngine.toml b/test/data/YearZeroEngine.toml index eff3f01d8..48f6018bf 100644 --- a/test/data/YearZeroEngine.toml +++ b/test/data/YearZeroEngine.toml @@ -1018,7 +1018,7 @@ rands = [ [[ test ]] game_system = "YearZeroEngine" input = "YZE3-3" -output = "YZEでは技能ダイスをマイナス指定できません。" +output = "YZEコマンドでは技能ダイスをマイナス指定できません。" rands = [ { sides = 6, value = 6 }, { sides = 6, value = 6 }, From 8b7f2a444f47a0ae13dc11df607ed1009ae70508 Mon Sep 17 00:00:00 2001 From: FredGreenfield Date: Thu, 30 Sep 2021 21:37:39 +0900 Subject: [PATCH 6/6] =?UTF-8?q?=E3=83=BB=E3=83=AC=E3=82=A4=E3=82=A2?= =?UTF-8?q?=E3=82=A6=E3=83=88=E4=BF=AE=E6=AD=A3=E3=81=A8if=E6=96=87?= =?UTF-8?q?=E3=81=AE=E4=B8=AD=E8=BA=AB=E3=82=92&&=E3=81=AB=E7=BD=AE?= =?UTF-8?q?=E3=81=8D=E6=8F=9B=E3=81=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bcdice/game_system/YearZeroEngine.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/bcdice/game_system/YearZeroEngine.rb b/lib/bcdice/game_system/YearZeroEngine.rb index c0cb14909..074af1377 100644 --- a/lib/bcdice/game_system/YearZeroEngine.rb +++ b/lib/bcdice/game_system/YearZeroEngine.rb @@ -73,14 +73,15 @@ def eval_game_system_specific_command(command) skill_dice_text, success_dice, botch_dice = make_dice_roll(dice_pool) skill_unsigned = m[SKILL_SIGNED_INDEX] - if command_type == 'YZE' and skill_unsigned == '-' - # YZEはシンプルに動作するコマンドなのでマイナス技能の処理は対応しない。 - return "YZEコマンドでは技能ダイスをマイナス指定できません。" - elsif command_type == 'MYZ' and skill_unsigned == '-' + if command_type == 'YZE' && skill_unsigned == '-' + # YZEはシンプルに動作するコマンドなのでマイナス技能の処理は対応しない。 + return "YZEコマンドでは技能ダイスをマイナス指定できません。" + elsif command_type == 'MYZ' && skill_unsigned == '-' @total_success_dice -= success_dice # マイナス技能の成功は通常の成功と相殺される else @total_success_dice += success_dice end + @total_botch_dice += botch_dice @skill_botch_dice += botch_dice # 技能ダイスの1はpushで振り直し可能(例えマイナス技能でも) @push_dice += (dice_pool - success_dice) # 技能ダイスのみ1を含むので、ここでは1を計算に入れない @@ -130,7 +131,7 @@ def make_result_with_yze(dice_count_text, dice_text) def make_result_with_myz(dice_count_text, dice_text) result_text = "#{dice_count_text} > #{dice_text} 成功数:#{@total_success_dice}" atter_text = "\n出目1:[能力:#{@base_botch_dice},技能:#{@skill_botch_dice},アイテム:#{@gear_botch_dice}) プッシュ可能=#{@push_dice}ダイス" - + if @difficulty > 0 if @total_success_dice >= @difficulty return Result.success("#{result_text} 難易度=#{@difficulty}:判定成功!#{atter_text}")