bcdice 3.2.0 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +27 -3
- data/README.md +1 -1
- data/i18n/MagicaLogia/zh_hans.yml +564 -0
- data/i18n/StellarKnights/ja_jp.yml +2 -0
- data/i18n/StellarKnights/ko_kr.yml +498 -0
- data/i18n/zh_hans.yml +7 -0
- data/lib/bcdice/command/parsed.rb +11 -3
- data/lib/bcdice/command/parser.rb +179 -100
- data/lib/bcdice/common_command/barabara_dice/node.rb +2 -2
- data/lib/bcdice/common_command/barabara_dice/result.rb +6 -0
- data/lib/bcdice/game_system.rb +3 -0
- data/lib/bcdice/game_system/Amadeus.rb +110 -93
- data/lib/bcdice/game_system/AnimaAnimus.rb +15 -8
- data/lib/bcdice/game_system/BattleTech.rb +109 -28
- data/lib/bcdice/game_system/BeastBindTrinity.rb +28 -12
- data/lib/bcdice/game_system/BlindMythos.rb +38 -37
- data/lib/bcdice/game_system/CodeLayerd.rb +39 -39
- data/lib/bcdice/game_system/ColossalHunter.rb +34 -47
- data/lib/bcdice/game_system/DeadlineHeroes.rb +9 -8
- data/lib/bcdice/game_system/DoubleCross.rb +2 -0
- data/lib/bcdice/game_system/Emoklore.rb +22 -17
- data/lib/bcdice/game_system/FutariSousa.rb +12 -10
- data/lib/bcdice/game_system/GardenOrder.rb +11 -6
- data/lib/bcdice/game_system/KemonoNoMori.rb +25 -38
- data/lib/bcdice/game_system/KurayamiCrying.rb +86 -0
- data/lib/bcdice/game_system/LiveraDoll.rb +254 -304
- data/lib/bcdice/game_system/LogHorizon.rb +10 -7
- data/lib/bcdice/game_system/MagicaLogia_SimplifiedChinese.rb +66 -0
- data/lib/bcdice/game_system/MeikyuKingdomBasic.rb +2 -1
- data/lib/bcdice/game_system/Nechronica.rb +57 -91
- data/lib/bcdice/game_system/NinjaSlayer.rb +2 -3
- data/lib/bcdice/game_system/SRS.rb +17 -16
- data/lib/bcdice/game_system/SamsaraBallad.rb +38 -11
- data/lib/bcdice/game_system/Satasupe.rb +31 -31
- data/lib/bcdice/game_system/ScreamHighSchool.rb +3 -3
- data/lib/bcdice/game_system/Skynauts.rb +101 -140
- data/lib/bcdice/game_system/StarryDolls.rb +318 -0
- data/lib/bcdice/game_system/SteamPunkers.rb +11 -6
- data/lib/bcdice/game_system/StellarKnights.rb +28 -12
- data/lib/bcdice/game_system/StellarKnights_Korean.rb +79 -0
- data/lib/bcdice/game_system/TokumeiTenkousei.rb +4 -3
- data/lib/bcdice/game_system/TrinitySeven.rb +275 -276
- data/lib/bcdice/game_system/Utakaze.rb +52 -47
- data/lib/bcdice/game_system/Yggdrasill.rb +1 -1
- data/lib/bcdice/game_system/ZettaiReido.rb +20 -25
- data/lib/bcdice/version.rb +1 -1
- metadata +8 -2
@@ -82,16 +82,34 @@ module BCDice
|
|
82
82
|
|
83
83
|
dice_list_org_str = "[#{dice_list_org.join(',')}]" if dice_list_filtered != dice_list_org
|
84
84
|
|
85
|
+
result = result_compare(total)
|
86
|
+
result.critical = critical?
|
87
|
+
result.fumble = fumble?
|
88
|
+
|
89
|
+
dice_status =
|
90
|
+
if result.fumble?
|
91
|
+
"ファンブル"
|
92
|
+
elsif result.critical?
|
93
|
+
"クリティカル"
|
94
|
+
end
|
95
|
+
result_str =
|
96
|
+
if result.success?
|
97
|
+
"成功"
|
98
|
+
elsif result.failure?
|
99
|
+
"失敗"
|
100
|
+
end
|
101
|
+
|
85
102
|
sequence = [
|
86
103
|
command_expr(),
|
87
104
|
dice_list_org_str,
|
88
105
|
interim_expr(dice_list_filtered),
|
89
|
-
dice_status
|
106
|
+
dice_status,
|
90
107
|
total.to_s,
|
91
|
-
|
108
|
+
result_str
|
92
109
|
].compact
|
110
|
+
result.text = sequence.join(" > ")
|
93
111
|
|
94
|
-
return
|
112
|
+
return result
|
95
113
|
end
|
96
114
|
|
97
115
|
private
|
@@ -187,14 +205,6 @@ module BCDice
|
|
187
205
|
return expr
|
188
206
|
end
|
189
207
|
|
190
|
-
def dice_status
|
191
|
-
if fumble?
|
192
|
-
"ファンブル"
|
193
|
-
elsif critical?
|
194
|
-
"クリティカル"
|
195
|
-
end
|
196
|
-
end
|
197
|
-
|
198
208
|
def fumble?
|
199
209
|
@dice_total <= @fumble
|
200
210
|
end
|
@@ -220,7 +230,13 @@ module BCDice
|
|
220
230
|
|
221
231
|
def result_compare(total)
|
222
232
|
if @cmp_op
|
223
|
-
total.send(@cmp_op, @target_number)
|
233
|
+
if total.send(@cmp_op, @target_number)
|
234
|
+
Result.success(nil)
|
235
|
+
else
|
236
|
+
Result.failure(nil)
|
237
|
+
end
|
238
|
+
else
|
239
|
+
Result.new
|
224
240
|
end
|
225
241
|
end
|
226
242
|
end
|
@@ -22,7 +22,7 @@ module BCDice
|
|
22
22
|
BMSは振り足しを自動では行いません。
|
23
23
|
例)BM>=1 BM@3>=1 BMS2>=1
|
24
24
|
|
25
|
-
・判定振り足し:ReRollx,x,x...@y>=
|
25
|
+
・判定振り足し:ReRollx,x,x...@y>=z
|
26
26
|
x:振るダイスの個数
|
27
27
|
y:目標難易度(省略可。デフォルト4)
|
28
28
|
z:必要成功度
|
@@ -40,15 +40,15 @@ module BCDice
|
|
40
40
|
def eval_game_system_specific_command(command)
|
41
41
|
debug("eval_game_system_specific_command Begin")
|
42
42
|
|
43
|
-
|
44
|
-
return
|
43
|
+
result = judgeRoll(command)
|
44
|
+
return result unless result.nil?
|
45
45
|
|
46
46
|
isStop = true
|
47
47
|
text, = reRoll(command, isStop)
|
48
48
|
return text unless text.nil?
|
49
49
|
|
50
|
-
|
51
|
-
return
|
50
|
+
result = getRulingPlanetDiceCommandResult(command)
|
51
|
+
return result unless result.nil?
|
52
52
|
|
53
53
|
text = getDurtyTableCommandReuslt(command)
|
54
54
|
return text unless text.nil?
|
@@ -72,9 +72,10 @@ module BCDice
|
|
72
72
|
getRollResult([diceCount], judgeNumberText, judgeNumber, targetNumber, isReRoll, isStop)
|
73
73
|
|
74
74
|
message += text
|
75
|
-
|
75
|
+
result = getTotalResult(bitList, successList, countOneList, targetNumber, isStop, canReRoll)
|
76
|
+
result.text = message + result.text
|
76
77
|
|
77
|
-
return
|
78
|
+
return result
|
78
79
|
end
|
79
80
|
|
80
81
|
def reRoll(command, isStop)
|
@@ -181,7 +182,7 @@ module BCDice
|
|
181
182
|
return message, bitList, successList, countOneList, canReRoll
|
182
183
|
end
|
183
184
|
|
184
|
-
def
|
185
|
+
def getTotalResult(bitList, successList, countOneList, targetNumber, isStop, canReRoll)
|
185
186
|
success = successList.inject { |sum, i| sum + i }
|
186
187
|
countOne = countOneList.inject { |sum, i| sum + i }
|
187
188
|
|
@@ -196,27 +197,35 @@ module BCDice
|
|
196
197
|
|
197
198
|
if success >= targetNumber
|
198
199
|
result += " > 現状で成功。コマンド実行で追加リロールも可能"
|
200
|
+
return Result.success(result)
|
199
201
|
else
|
200
202
|
result += " > 現状のままでは失敗"
|
201
|
-
|
203
|
+
if countOne >= 1
|
204
|
+
result += "。汚染ポイント+#{countOne}"
|
205
|
+
return Result.fumble(result)
|
206
|
+
else
|
207
|
+
return Result.failure(result)
|
208
|
+
end
|
202
209
|
end
|
203
|
-
|
204
|
-
return result
|
205
210
|
end
|
206
211
|
|
207
212
|
if success >= targetNumber
|
208
213
|
result += " > 成功"
|
209
|
-
|
210
214
|
if bitList.size >= 1
|
211
215
|
result += "、禁書ビット発生[#{bitList.join(',')}]"
|
216
|
+
return Result.critical(result)
|
217
|
+
else
|
218
|
+
return Result.success(result)
|
212
219
|
end
|
213
|
-
|
214
220
|
else
|
215
221
|
result += " > 失敗"
|
216
|
-
|
222
|
+
if countOne >= 1
|
223
|
+
result += "。汚染ポイント+#{countOne}"
|
224
|
+
return Result.fumble(result)
|
225
|
+
else
|
226
|
+
return Result.failure(result)
|
227
|
+
end
|
217
228
|
end
|
218
|
-
|
219
|
-
return result
|
220
229
|
end
|
221
230
|
|
222
231
|
def getSameDieList(diceList)
|
@@ -252,44 +261,36 @@ module BCDice
|
|
252
261
|
end
|
253
262
|
|
254
263
|
def getRulingPlanetDiceCommandResult(command)
|
255
|
-
|
264
|
+
m = /^RP(\d+)$/i.match(command)
|
265
|
+
return nil unless m
|
256
266
|
|
257
|
-
targetNumbers =
|
267
|
+
targetNumbers = m[1].each_char.map(&:to_i)
|
258
268
|
diceList = getRulingPlanetDice
|
259
269
|
|
260
|
-
|
261
|
-
targetNumbers.each do |i|
|
262
|
-
if diceList.include?(i)
|
263
|
-
matchResult = "発動"
|
264
|
-
break
|
265
|
-
end
|
266
|
-
end
|
270
|
+
condition = diceList.any? { |dice| targetNumbers.include?(dice) }
|
267
271
|
|
268
|
-
|
272
|
+
result = condition ? "発動" : "失敗"
|
273
|
+
text = "守護星表チェック(#{targetNumbers.join(',')}) > #{diceList.count}D10[#{diceList.join(',')}] > #{result}"
|
269
274
|
|
270
|
-
|
275
|
+
Result.new.tap do |r|
|
276
|
+
r.text = text
|
277
|
+
r.condition = condition
|
278
|
+
end
|
271
279
|
end
|
272
280
|
|
273
281
|
def getRulingPlanetDice
|
274
|
-
dice1 = @randomizer.
|
275
|
-
dice2 = dice1
|
282
|
+
dice1, dice2 = @randomizer.roll_barabara(2, 10)
|
276
283
|
|
277
284
|
while dice1 == dice2
|
278
285
|
dice2 = @randomizer.roll_once(10)
|
279
286
|
end
|
280
287
|
|
281
|
-
dice1 =
|
282
|
-
dice2 =
|
288
|
+
dice1 = 0 if dice1 == 10
|
289
|
+
dice2 = 0 if dice2 == 10
|
283
290
|
|
284
291
|
return dice1, dice2
|
285
292
|
end
|
286
293
|
|
287
|
-
def changeRulingPlanetDice(dice)
|
288
|
-
return 0 if dice == 10
|
289
|
-
|
290
|
-
return dice
|
291
|
-
end
|
292
|
-
|
293
294
|
def getDurtyTableCommandReuslt(command)
|
294
295
|
return nil unless /^DT$/i =~ command
|
295
296
|
|
@@ -30,7 +30,7 @@ module BCDice
|
|
30
30
|
デフォルトダイス:10面
|
31
31
|
MESSAGETEXT
|
32
32
|
|
33
|
-
register_prefix('[+-]?\d*CL
|
33
|
+
register_prefix('[+-]?\d*CL')
|
34
34
|
|
35
35
|
def initialize(command)
|
36
36
|
super(command)
|
@@ -41,61 +41,61 @@ module BCDice
|
|
41
41
|
def eval_game_system_specific_command(command)
|
42
42
|
debug('eval_game_system_specific_command command', command)
|
43
43
|
|
44
|
-
|
45
|
-
|
46
|
-
case command
|
47
|
-
when /([+-]?\d+)?CL([+-]\d+)?(@(\d))?(\[(\d+)\])?([+-]\d+)?(>=(\d+))?/i
|
48
|
-
m = Regexp.last_match
|
49
|
-
base = (m[1] || 1).to_i
|
50
|
-
modifier1 = m[2].to_i
|
51
|
-
target = (m[4] || 6).to_i
|
52
|
-
critical_target = (m[6] || 1).to_i
|
53
|
-
modifier2 = m[7].to_i
|
54
|
-
diff = m[9].to_i
|
55
|
-
result = check_roll(base, target, critical_target, diff, modifier1 + modifier2)
|
56
|
-
end
|
57
|
-
|
58
|
-
return nil if result.empty?
|
44
|
+
m = /([+-]?\d+)?CL([+-]\d+)?(@(\d))?(\[(\d+)\])?([+-]\d+)?(>=(\d+))?/i.match(command)
|
45
|
+
return nil unless m
|
59
46
|
|
60
|
-
|
47
|
+
base = (m[1] || 1).to_i
|
48
|
+
modifier1 = m[2].to_i
|
49
|
+
target = (m[4] || 6).to_i
|
50
|
+
critical_target = (m[6] || 1).to_i
|
51
|
+
modifier2 = m[7].to_i
|
52
|
+
diff = m[9].to_i if m[9]
|
53
|
+
check_roll(command, base, target, critical_target, diff, modifier1 + modifier2)
|
61
54
|
end
|
62
55
|
|
63
|
-
def check_roll(base, target, critical_target, diff, modifier)
|
56
|
+
def check_roll(command, base, target, critical_target, diff, modifier)
|
64
57
|
if base <= 0 # クリティカルしない1D
|
65
58
|
critical_target = 0
|
66
59
|
base = 1
|
67
60
|
end
|
61
|
+
result = Result.new
|
68
62
|
|
69
63
|
target = 10 if target > 10
|
70
64
|
dice_list = @randomizer.roll_barabara(base, 10).sort
|
71
65
|
success_count = dice_list.count { |x| x <= target }
|
72
66
|
critical_count = dice_list.count { |x| x <= critical_target }
|
67
|
+
result.critical = critical_count > 0
|
73
68
|
success_total = success_count + critical_count + modifier
|
74
69
|
|
75
70
|
mod_text = Format.modifier(modifier)
|
76
71
|
|
77
72
|
# (10d10+5)
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
73
|
+
text = "#{command} > (#{base}d10#{mod_text}) > [#{dice_list.join(',')}]#{mod_text} > "
|
74
|
+
text += "判定値[#{target}] " unless target == 6
|
75
|
+
text += "クリティカル値[#{critical_target}] " unless critical_target == 1
|
76
|
+
text += "達成値[#{success_count}]"
|
77
|
+
|
78
|
+
if success_count <= 0
|
79
|
+
result.fumble = true
|
80
|
+
result.failure = true
|
81
|
+
result.text = "#{text} > ファンブル!"
|
82
|
+
return result
|
83
|
+
end
|
84
|
+
|
85
|
+
text += "+クリティカル[#{critical_count}]" if result.critical?
|
86
|
+
text += mod_text
|
87
|
+
text += "=[#{success_total}]" if result.critical? || modifier != 0
|
88
|
+
|
89
|
+
if diff.nil?
|
90
|
+
result.text = "#{text} > #{success_total}"
|
91
|
+
elsif success_total >= diff
|
92
|
+
result.text = "#{text} > 成功"
|
93
|
+
result.success = true
|
94
|
+
else
|
95
|
+
result.text = "#{text} > 失敗"
|
96
|
+
result.failure = true
|
97
|
+
end
|
98
|
+
return result
|
99
99
|
end
|
100
100
|
end
|
101
101
|
end
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "bcdice/format"
|
4
|
+
|
3
5
|
module BCDice
|
4
6
|
module GameSystem
|
5
7
|
class ColossalHunter < Base
|
@@ -14,10 +16,12 @@ module BCDice
|
|
14
16
|
|
15
17
|
# ダイスボットの使い方
|
16
18
|
HELP_MESSAGE = <<~MESSAGETEXT
|
17
|
-
・判定(
|
18
|
-
|
19
|
-
|
20
|
-
|
19
|
+
・判定(nCH±x>=y)
|
20
|
+
nD6の判定。クリティカル、ファンブルの自動判定を行います。
|
21
|
+
n:ダイス数。省略可能。省略した場合3。
|
22
|
+
x:修正値。省略可能。
|
23
|
+
y:目標値。省略可能。
|
24
|
+
例) CH CH+1 CH+2>=10 4CH+1
|
21
25
|
・BIG-6表(B6T)
|
22
26
|
・覚醒表(AWT)
|
23
27
|
・現状表(CST)
|
@@ -45,65 +49,48 @@ module BCDice
|
|
45
49
|
def getCheckRollDiceCommandResult(command)
|
46
50
|
debug("getCheckRollDiceCommandResult command", command)
|
47
51
|
|
48
|
-
|
52
|
+
parser = Command::Parser.new(/\d*CH/, round_type: round_type)
|
53
|
+
.restrict_cmp_op_to(nil, :>=)
|
49
54
|
|
50
|
-
|
51
|
-
|
52
|
-
|
55
|
+
parsed = parser.parse(command)
|
56
|
+
unless parsed
|
57
|
+
return nil
|
58
|
+
end
|
53
59
|
|
54
|
-
|
55
|
-
modify = getValue(modifyText, 0)
|
60
|
+
parsed.command = "3CH" unless parsed.command.start_with?(/\d/)
|
56
61
|
|
57
|
-
|
58
|
-
|
62
|
+
dice_count = parsed.command.to_i
|
63
|
+
modify = parsed.modify_number
|
59
64
|
|
60
65
|
# ダイスロール
|
61
|
-
dice_list = @randomizer.roll_barabara(
|
66
|
+
dice_list = @randomizer.roll_barabara(dice_count, 6)
|
62
67
|
dice = dice_list.sum()
|
63
68
|
dice_str = dice_list.join(",")
|
64
69
|
|
65
70
|
total = dice + modify
|
66
71
|
|
67
|
-
# 出力用ダイスコマンドを生成
|
68
|
-
command = "#{diceCount}CH#{modifyText}"
|
69
|
-
command += ">=#{difficulty}" unless difficulty.nil?
|
70
|
-
|
71
72
|
# 出力文の生成
|
72
|
-
|
73
|
+
text = "(#{parsed}) > #{dice}[#{dice_str}]#{Format.modifier(modify)} > #{total}"
|
73
74
|
|
74
|
-
|
75
|
-
if isFamble(dice)
|
76
|
-
result += " > ファンブル"
|
77
|
-
elsif isCritical(total)
|
78
|
-
result += " > クリティカル"
|
79
|
-
else
|
80
|
-
result += getJudgeResultString(difficulty, total)
|
81
|
-
end
|
75
|
+
result = get_judge_result(dice, total, parsed)
|
82
76
|
|
77
|
+
result.text = text + result.text
|
83
78
|
return result
|
84
79
|
end
|
85
80
|
|
86
81
|
# 成否判定
|
87
|
-
def
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
end
|
100
|
-
|
101
|
-
def isCritical(total)
|
102
|
-
(total >= 16)
|
103
|
-
end
|
104
|
-
|
105
|
-
def isFamble(total)
|
106
|
-
(total <= 5)
|
82
|
+
def get_judge_result(dice, total, parsed)
|
83
|
+
if dice <= 5
|
84
|
+
Result.fumble(" > ファンブル")
|
85
|
+
elsif total >= 16
|
86
|
+
Result.critical(" > クリティカル")
|
87
|
+
elsif parsed.cmp_op.nil?
|
88
|
+
Result.new("")
|
89
|
+
elsif total >= parsed.target_number
|
90
|
+
Result.success(" > 成功")
|
91
|
+
else
|
92
|
+
Result.failure(" > 失敗")
|
93
|
+
end
|
107
94
|
end
|
108
95
|
|
109
96
|
def getSourceSceneDiceCommandResult(command)
|
@@ -562,7 +549,7 @@ module BCDice
|
|
562
549
|
|
563
550
|
}.freeze
|
564
551
|
|
565
|
-
register_prefix(
|
552
|
+
register_prefix('\d*CH', "B6T", "CNP", TABLES.keys)
|
566
553
|
end
|
567
554
|
end
|
568
555
|
end
|