From c5be5c9de172a3ca039896a46d2a28e42e6a419d Mon Sep 17 00:00:00 2001 From: SAKATA Sinji Date: Fri, 26 Feb 2021 23:27:47 +0900 Subject: [PATCH] =?UTF-8?q?[Cthulhu]=20=E5=AE=8C=E5=85=A8=E4=B8=80?= =?UTF-8?q?=E8=87=B4=E3=81=AB=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bcdice/game_system/Cthulhu.rb | 10 +++++++--- test/data/Cthulhu.toml | 10 ++++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/lib/bcdice/game_system/Cthulhu.rb b/lib/bcdice/game_system/Cthulhu.rb index 6faa73d75..a8267b931 100644 --- a/lib/bcdice/game_system/Cthulhu.rb +++ b/lib/bcdice/game_system/Cthulhu.rb @@ -97,7 +97,11 @@ def eval_game_system_specific_command(command) private def getCheckResult(command) - m = %r{CCB?(\d+)?(?:<=([+-/*\d]+))?}i.match(command) + m = %r{^CCB?(\d+)?(?:<=([+-/*\d]+))?$}i.match(command) + unless m + return nil + end + broken_num = m[1].to_i diff = ArithmeticEvaluator.eval(m[2]) @@ -189,7 +193,7 @@ def compare(total, target, broken_number = 0) end def getRegistResult(command) - m = /RES(B)?([-\d]+)/i.match(command) + m = /^RES(B)?([-\d]+)$/i.match(command) unless m return nil end @@ -215,7 +219,7 @@ def getRegistResult(command) end def getCombineRoll(command) - m = /CBR(B)?\((\d+),(\d+)\)/i.match(command) + m = /^CBR(B)?\((\d+),(\d+)\)$/i.match(command) unless m return nil end diff --git a/test/data/Cthulhu.toml b/test/data/Cthulhu.toml index c3d21f582..6c3511e1b 100644 --- a/test/data/Cthulhu.toml +++ b/test/data/Cthulhu.toml @@ -461,6 +461,11 @@ rands = [ { sides = 100, value = 77 }, ] +[[ test ]] +game_system = "Cthulhu" +input = "CCさくら 完全一致" +output = "" +rands = [] ##### 戦闘用技能判定 CCB ##### @@ -670,6 +675,11 @@ rands = [ { sides = 100, value = 30 }, ] +[[ test ]] +game_system = "Cthulhu" +input = "CCBさくら 完全一致" +output = "" +rands = [] ##### 戦闘用対抗判定 RESB #####