Skip to content

Commit

Permalink
Chenges for new BCDice#check_suc
Browse files Browse the repository at this point in the history
GranCrestの明確な仕様ミスを修正
RuneQuestのクリティカルなどの境界をテストするように
  • Loading branch information
ysakasin committed Mar 29, 2020
1 parent 8fea4f1 commit 199b119
Show file tree
Hide file tree
Showing 67 changed files with 787 additions and 957 deletions.
39 changes: 17 additions & 22 deletions src/diceBot/Arianrhod.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,28 +24,23 @@ def initialize
@d66Type = 1
end

def check_2D6(total_n, dice_n, signOfInequality, diff, dice_cnt, dice_max, n1, n_max) # ゲーム別成功度判定(2D6)
check_nD6(total_n, dice_n, signOfInequality, diff, dice_cnt, dice_max, n1, n_max)
end

def check_nD6(total_n, _dice_n, signOfInequality, diff, dice_cnt, _dice_max, n1, n_max) # ゲーム別成功度判定(nD6)
debug("check_nD6 begin")

# 全部1の目ならファンブル
return " > ファンブル" if n1 >= dice_cnt

# 2個以上6の目があったらクリティカル
return " > クリティカル(+#{n_max}D6)" if n_max >= 2

result = ''

return result unless signOfInequality == ">="
return result if diff == "?"

if total_n >= diff
return " > 成功"
def check_nD6(total, _dice_total, dice_list, cmp_op, target)
n_max = dice_list.count(6)

if dice_list.count(1) == dice_list.size
# 全部1の目ならファンブル
" > ファンブル"
elsif n_max >= 2
# 2個以上6の目があったらクリティカル
" > クリティカル(+#{n_max}D6)" if n_max >= 2
elsif cmp_op != :>= || target == '?'
''
elsif total >= target
" > 成功"
else
" > 失敗"
end

return " > 失敗"
end

alias check_2D6 check_nD6
end
16 changes: 4 additions & 12 deletions src/diceBot/BeastBindTrinity.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class BeastBindTrinity < DiceBot
HELP_MESSAGE = <<INFO_MESSAGE_TEXT
・判定 (nBB+m%w@x#y$z&v)
 n個のD6を振り、出目の大きい2個から達成値を算出。修正mも可能。
 
 %w、@x、#y、$z、&vはすべて省略可能。
>%w:現在の人間性が w であるとして、クリティカル値(C値)を計算。
・省略した場合、C値=12として達成値を算出する。
Expand Down Expand Up @@ -79,16 +79,6 @@ def dice_command_xRn(string, nick_e)
return bbt_check(string)
end

def check_2D6(total_n, _dice_n, signOfInequality, diff, _dice_cnt, _dice_max, _n1, _n_max) # ゲーム別成功度判定(2D6)
return '' unless signOfInequality == ">="

if total_n >= diff
return " > 成功"
else
return " > 失敗"
end
end

#################### ビーストバインド トリニティ ########################

def bbt_check(string)
Expand Down Expand Up @@ -282,7 +272,9 @@ def bbt_check(string)
end

if signOfInequality != "" # 成功度判定処理
output += check_suc(total_n, dice_now, signOfInequality, diff, 2, 6, 0, 0)
cmp_op = Normalizer.cmp_op(signOfInequality)
dice_list = dice_num
output += check_suc(total_n, dice_now, dice_list, 6, cmp_op, diff)
end

return output
Expand Down
25 changes: 12 additions & 13 deletions src/diceBot/BeginningIdol.rb
Original file line number Diff line number Diff line change
Expand Up @@ -150,23 +150,22 @@ def initialize
@d66Type = 2
end

def check_2D6(total_n, dice_n, signOfInequality, diff, dice_cnt, dice_max, n1, n_max)
check_nD6(total_n, dice_n, signOfInequality, diff, dice_cnt, dice_max, n1, n_max)
end

def check_nD6(total_n, dice_n, signOfInequality, diff, _dice_cnt, _dice_max, _n1, _n_max)
return '' unless signOfInequality == ">="
if dice_n <= 2
return " > ファンブル(変調がランダムに1つ発生し、PCは【思い出】を1つ獲得する)"
elsif dice_n >= 12
return " > スペシャル!(PCは【思い出】を1つ獲得する)"
elsif total_n >= diff
return " > 成功"
def check_nD6(total, dice_total, _dice_list, cmp_op, target)
return '' unless cmp_op == :>=

if dice_total <= 2
" > ファンブル(変調がランダムに1つ発生し、PCは【思い出】を1つ獲得する)"
elsif dice_total >= 12
" > スペシャル!(PCは【思い出】を1つ獲得する)"
elsif total >= target
" > 成功"
else
return " > 失敗"
" > 失敗"
end
end

alias check_2D6 check_nD6

def rollDiceCommand(command)
case command.upcase
when /^([1-7]*)PD(\d+)([\+\-]\d+)?$/
Expand Down
25 changes: 12 additions & 13 deletions src/diceBot/BeginningIdol_Korean.rb
Original file line number Diff line number Diff line change
Expand Up @@ -145,23 +145,22 @@ def initialize
@d66Type = 2
end

def check_2D6(total_n, dice_n, signOfInequality, diff, dice_cnt, dice_max, n1, n_max)
check_nD6(total_n, dice_n, signOfInequality, diff, dice_cnt, dice_max, n1, n_max)
end

def check_nD6(total_n, dice_n, signOfInequality, diff, _dice_cnt, _dice_max, _n1, _n_max)
return '' unless signOfInequality == ">="
if dice_n <= 2
return " > ファンブル(変調がランダムに1つ発生し、PCは【思い出】を1つ獲得する)"
elsif dice_n >= 12
return " > 스페셜!(PC는 【추억】 1개 획득)"
elsif total_n >= diff
return " > 성공"
def check_nD6(total, dice_total, _dice_list, cmp_op, target)
return '' unless cmp_op == :>=

if dice_total <= 2
" > ファンブル(変調がランダムに1つ発生し、PCは【思い出】を1つ獲得する)"
elsif dice_total >= 12
" > 스페셜!(PC는 【추억】 1개 획득)"
elsif total >= target
" > 성공"
else
return " > 실패"
" > 실패"
end
end

alias check_2D6 check_nD6

def rollDiceCommand(command)
case command.upcase
when /^([1-7]*)PD(\d+)([\+\-]\d+)?$/
Expand Down
20 changes: 10 additions & 10 deletions src/diceBot/BloodCrusade.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,17 @@ def initialize
@fractionType = "roundUp" # 端数切り上げに設定
end

def check_2D6(total_n, dice_n, signOfInequality, diff, _dice_cnt, _dice_max, _n1, _n_max) # ゲーム別成功度判定(2D6)
return '' unless signOfInequality == ">="

if dice_n <= 2
return " > ファンブル(【モラル】-3。追跡フェイズなら吸血シーンを追加。戦闘フェイズなら吸血鬼は追加行動を一回得る)"
elsif dice_n >= 12
return " > スペシャル(【モラル】+3。追跡フェイズならあなたに関係を持つPCの【モラル】+2。攻撃判定ならダメージ+1D6)"
elsif total_n >= diff
return " > 成功"
def check_2D6(total, dice_total, _dice_list, cmp_op, target)
return '' unless cmp_op == :>=

if dice_total <= 2
" > ファンブル(【モラル】-3。追跡フェイズなら吸血シーンを追加。戦闘フェイズなら吸血鬼は追加行動を一回得る)"
elsif dice_total >= 12
" > スペシャル(【モラル】+3。追跡フェイズならあなたに関係を持つPCの【モラル】+2。攻撃判定ならダメージ+1D6)"
elsif total >= target
" > 成功"
else
return " > 失敗"
" > 失敗"
end
end

Expand Down
10 changes: 5 additions & 5 deletions src/diceBot/BloodMoon.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ def initialize
end

# ゲーム別成功度判定(2D6)
def check_2D6(total_n, dice_n, signOfInequality, diff, _dice_cnt, _dice_max, _n1, _n_max)
return '' unless signOfInequality == ">="
def check_2D6(total, dice_total, _dice_list, cmp_op, target)
return '' unless cmp_op == :>=

if dice_n <= 2
if dice_total <= 2
return " > ファンブル(【余裕】が 0 に)"
elsif dice_n >= 12
elsif dice_total >= 12
return " > スペシャル(【余裕】+3)"
elsif total_n >= diff
elsif total >= target
return " > 成功"
else
return " > 失敗"
Expand Down
10 changes: 5 additions & 5 deletions src/diceBot/CardRanker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ def initialize
end

# ゲーム別成功度判定(2D6)
def check_2D6(total_n, dice_n, signOfInequality, diff, _dice_cnt, _dice_max, _n1, _n_max)
return '' unless signOfInequality == ">="
def check_2D6(total, dice_total, _dice_list, cmp_op, target)
return '' unless cmp_op == :>=

if dice_n <= 2
if dice_total <= 2
return " > ファンブル"
elsif dice_n >= 12
elsif dice_total >= 12
return " > スペシャル > " + getRandumMonster()
elsif total_n >= diff
elsif total >= target
return " > 成功"
else
return " > 失敗"
Expand Down
21 changes: 11 additions & 10 deletions src/diceBot/ChaosFlare.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,25 @@ def postSet
end

# ゲーム別成功度判定(2D6)
def check_2D6(total_n, dice_n, signOfInequality, diff, _dice_cnt, _dice_max, _n1, _n_max)
def check_2D6(total, dice_total, _dice_list, cmp_op, target)
output = ''

if dice_n <= 2
total_n -= 20
output += " > ファンブル(-20)"
if dice_total <= 2
total -= 20
output = " > ファンブル(-20)"
end

return output unless signOfInequality == ">="
unless cmp_op == :>=
return output
end

if total_n >= diff
if total >= target
output += " > 成功"
if total_n > diff
output += " > 差分値#{total_n - diff}"
if total > target
output += " > 差分値#{total - target}"
end
else
output += " > 失敗"
output += " > 差分値#{total_n - diff}"
output += " > 失敗 > 差分値#{total - target}"
end

return output
Expand Down
27 changes: 16 additions & 11 deletions src/diceBot/Chill.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,22 @@ class Chill < DiceBot

setPrefixes(['SR\d+.*'])

def check_1D100(total_n, _dice_n, signOfInequality, diff, _dice_cnt, _dice_max, _n1, _n_max) # ゲーム別成功度判定(1D10)
return '' if signOfInequality != "<="

return " > ファンブル" if total_n >= 100
return " > 失敗" if total_n > diff

return " > L成功" if total_n >= (diff * 0.9)
return " > M成功" if total_n >= (diff / 2)
return " > H成功" if total_n >= (diff / 10)

return " > C成功"
def check_1D100(total, _dice_total, cmp_op, target)
return '' if cmp_op != :<=

if total >= 100
" > ファンブル"
elsif total > target
" > 失敗"
elsif total >= (target * 0.9)
" > L成功"
elsif total >= (target / 2)
" > M成功"
elsif total >= (target / 10)
" > H成功"
else
" > C成功"
end
end

def rollDiceCommand(command)
Expand Down
39 changes: 17 additions & 22 deletions src/diceBot/Chill3.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,36 +18,31 @@ class Chill3 < DiceBot
   Chill3 : (1D100<=50) > 55 > Botch
INFO_MESSAGE_TEXT

def check_1D100(total_n, dice_n, signOfInequality, diff, _dice_cnt, _dice_max, _n1, _n_max) # ゲーム別成功度判定(1D100)
return '' unless signOfInequality == "<="
def check_1D100(total, dice_total, cmp_op, target)
return '' unless cmp_op == :<=

# ゾロ目ならC-ResultかBotch
s10 = dice_n.div(10) # 10'sダイスの出目
s1 = dice_n % 10 # 1'sダイスの出目
tens = (dice_total / 10) % 10
ones = dice_total % 10

if s10 == 10
s10 = 0 # 10'sと1'sの表記をそろえる
end

if s10 == s1
if (total_n > diff) || (dice_n == 100) # 00は必ず失敗
if diff > 100 # 目標値が100を超えている場合は、00を振ってもBotchにならない
if tens == ones
if (total > target) || (dice_total == 100) # 00は必ず失敗
if target > 100 # 目標値が100を超えている場合は、00を振ってもBotchにならない
return " > 失敗"
else
return " > Botch"
end

return " > Botch"
else
return " > C成功"
end
return " > C成功"
end

if (total_n <= diff) || (dice_n == 1) # 01は必ず成功
if total_n <= (diff / 2)
elsif (total <= target) || (dice_total == 1) # 01は必ず成功
if total <= (target / 2)
return " > H成功"
else
return " > L成功"
end

return " > L成功"
else
return " > 失敗"
end

return " > 失敗"
end
end
Loading

0 comments on commit 199b119

Please sign in to comment.