Skip to content

Commit

Permalink
Merge c5be5c9 into a2cd6f6
Browse files Browse the repository at this point in the history
  • Loading branch information
ysakasin authored Feb 26, 2021
2 parents a2cd6f6 + c5be5c9 commit 11475f9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/bcdice/game_system/Cthulhu.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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])

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
10 changes: 10 additions & 0 deletions test/data/Cthulhu.toml
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,11 @@ rands = [
{ sides = 100, value = 77 },
]

[[ test ]]
game_system = "Cthulhu"
input = "CCさくら 完全一致"
output = ""
rands = []

##### 戦闘用技能判定 CCB #####

Expand Down Expand Up @@ -670,6 +675,11 @@ rands = [
{ sides = 100, value = 30 },
]

[[ test ]]
game_system = "Cthulhu"
input = "CCBさくら 完全一致"
output = ""
rands = []

##### 戦闘用対抗判定 RESB #####

Expand Down

0 comments on commit 11475f9

Please sign in to comment.