forked from bcdice/bcdice-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpatch.diff
418 lines (359 loc) · 14.1 KB
/
patch.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
diff --git a/src/bcdiceCore.rb b/src/bcdiceCore.rb
index 3aca1cd..dbbf41e 100755
--- a/src/bcdiceCore.rb
+++ b/src/bcdiceCore.rb
@@ -863,7 +863,7 @@ class BCDice
string, _secret, _count, swapMarker = getD66Infos(dice)
unless string.nil?
value = getD66ValueByMarker(swapMarker)
- diceText = (value / 10).to_s + "," + (value % 10).to_s
+ diceText = value.div(10).to_s + "," + (value % 10).to_s
return value, diceText
end
diff --git a/src/diceBot/Cthulhu7th.rb b/src/diceBot/Cthulhu7th.rb
index 9eb77e8..0e12427 100644
--- a/src/diceBot/Cthulhu7th.rb
+++ b/src/diceBot/Cthulhu7th.rb
@@ -422,7 +422,7 @@ INFO_MESSAGE_TEXT
end
def getSetOfBullet(diff)
- bullet_set_count = diff / 10
+ bullet_set_count = diff.div(10)
if (diff >= 1) && (diff < 10)
bullet_set_count = 1 # 技能値が9以下での最低値保障処理
@@ -432,7 +432,7 @@ INFO_MESSAGE_TEXT
end
def getHitBulletCountBase(diff, bullet_set_count)
- hit_bullet_count_base = (bullet_set_count / 2)
+ hit_bullet_count_base = bullet_set_count.div(2)
if (diff >= 1) && (diff < 10)
hit_bullet_count_base = 1 # 技能値9以下での最低値保障
diff --git a/src/diceBot/Cthulhu7th_ChineseTraditional.rb b/src/diceBot/Cthulhu7th_ChineseTraditional.rb
index 33f6865..7d12d7a 100644
--- a/src/diceBot/Cthulhu7th_ChineseTraditional.rb
+++ b/src/diceBot/Cthulhu7th_ChineseTraditional.rb
@@ -344,7 +344,7 @@ INFO_MESSAGE_TEXT
end
def getSetOfBullet(diff)
- bullet_set_count = diff / 10
+ bullet_set_count = diff.div(10)
if (diff >= 1) && (diff < 10)
bullet_set_count = 1 # 技能值9以下的最低限度保障處理
@@ -354,7 +354,7 @@ INFO_MESSAGE_TEXT
end
def getHitBulletCountBase(diff, bullet_set_count)
- hit_bullet_count_base = (bullet_set_count / 2)
+ hit_bullet_count_base = bullet_set_count.div(2)
if (diff >= 1) && (diff < 10)
hit_bullet_count_base = 1 # 技能值9以下的最低限度保障處理
diff --git a/src/diceBot/Cthulhu7th_Korean.rb b/src/diceBot/Cthulhu7th_Korean.rb
index 5cfb984..c01cff3 100644
--- a/src/diceBot/Cthulhu7th_Korean.rb
+++ b/src/diceBot/Cthulhu7th_Korean.rb
@@ -340,7 +340,7 @@ INFO_MESSAGE_TEXT
end
def getSetOfBullet(diff)
- bullet_set_count = diff / 10
+ bullet_set_count = diff.div(10)
if (diff >= 1) && (diff < 10)
bullet_set_count = 1 # 기능 수치가 9 이하일 때의 최저수치 보장 처리
@@ -350,7 +350,7 @@ INFO_MESSAGE_TEXT
end
def getHitBulletCountBase(diff, bullet_set_count)
- hit_bullet_count_base = (bullet_set_count / 2)
+ hit_bullet_count_base = bullet_set_count.div(2)
if (diff >= 1) && (diff < 10)
hit_bullet_count_base = 1 # 기능 수치가 9 이하일 때의 최저수치 보장
diff --git a/src/diceBot/CthulhuTech.rb b/src/diceBot/CthulhuTech.rb
index ba83a8c..92b2bd4 100644
--- a/src/diceBot/CthulhuTech.rb
+++ b/src/diceBot/CthulhuTech.rb
@@ -36,7 +36,7 @@ INFO_MESSAGE_TEXT
end
def check_nD10_nomalTest(total_n, _dice_n, _signOfInequality, diff, dice_cnt, _dice_max, n1, _n_max)
- if n1 >= (dice_cnt / 2 + 0.9).to_i
+ if n1 >= (dice_cnt.div(2) + 0.9).to_i
return " > ファンブル"
end
diff --git a/src/diceBot/DiceBot.rb b/src/diceBot/DiceBot.rb
index a4b773d..4f7e7a5 100644
--- a/src/diceBot/DiceBot.rb
+++ b/src/diceBot/DiceBot.rb
@@ -472,13 +472,13 @@ class DiceBot
item, value = get_table_by_d66(table)
value = value.to_i
output = item[1]
- diceText = (value / 10).to_s + "," + (value % 10).to_s
+ diceText = value.div(10).to_s + "," + (value % 10).to_s
[output, value, diceText]
when 'D66S'
table = getTableInfoFromExtraTableText(table, 21)
output, value = get_table_by_d66_swap(table)
value = value.to_i
- diceText = (value / 10).to_s + "," + (value % 10).to_s
+ diceText = value.div(10).to_s + "," + (value % 10).to_s
[output, value, diceText]
else
raise "invalid dice Type #{command}"
diff --git a/src/diceBot/Dracurouge.rb b/src/diceBot/Dracurouge.rb
index baee0b3..53243f1 100644
--- a/src/diceBot/Dracurouge.rb
+++ b/src/diceBot/Dracurouge.rb
@@ -85,7 +85,7 @@ MESSAGETEXT
oneCount = countTargetDice(diceList, 1)
sixCount = countTargetDice(diceList, 6)
- gloryDiceCount = (oneCount / 2) + (sixCount / 2)
+ gloryDiceCount = oneCount.div(2) + sixCount.div(2)
return gloryDiceCount
end
diff --git a/src/diceBot/Dracurouge_Korean.rb b/src/diceBot/Dracurouge_Korean.rb
index 865164b..d982d8e 100644
--- a/src/diceBot/Dracurouge_Korean.rb
+++ b/src/diceBot/Dracurouge_Korean.rb
@@ -87,7 +87,7 @@ MESSAGETEXT
oneCount = countTargetDice(diceList, 1)
sixCount = countTargetDice(diceList, 6)
- gloryDiceCount = (oneCount / 2) + (sixCount / 2)
+ gloryDiceCount = oneCount.div(2) + sixCount.div(2)
return gloryDiceCount
end
@@ -142,7 +142,7 @@ MESSAGETEXT
type2 = %w{영주 근위 방랑 현자 사냥꾼 야수}
type2_indexTexts = %w{F G R W J N}
- tensValue = number.to_i / 10
+ tensValue = number.to_i.div(10)
isBefore = (tensValue < 4)
type = (isBefore ? type1 : type2)
indexTexts = (isBefore ? type1_indexTexts : type2_indexTexts)
diff --git a/src/diceBot/EarthDawn3.rb b/src/diceBot/EarthDawn3.rb
index ee6f3e3..8e5f32c 100644
--- a/src/diceBot/EarthDawn3.rb
+++ b/src/diceBot/EarthDawn3.rb
@@ -145,7 +145,7 @@ INFO_MESSAGE_TEXT
result = [ 0, 0, 0, 0, 0, 0, 0]
- loopCount = (overStep / stepRythm.size)
+ loopCount = overStep.div(stepRythm.size)
loopCount.times do
addStepToResult(result, baseStepInfo)
diff --git a/src/diceBot/EarthDawn4.rb b/src/diceBot/EarthDawn4.rb
index a1dcdb9..0433cb4 100644
--- a/src/diceBot/EarthDawn4.rb
+++ b/src/diceBot/EarthDawn4.rb
@@ -191,7 +191,7 @@ INFO_MESSAGE_TEXT
result = [ 0, 0, 0, 0, 0, 0, 0]
- loopCount = (overStep / stepRythm.size)
+ loopCount = overStep.div(stepRythm.size)
loopCount.times do
addStepToResult(result, overBounusStep)
@@ -223,7 +223,7 @@ INFO_MESSAGE_TEXT
return "失敗"
end
- level = (diff / 5) + 1
+ level = diff.div(5) + 1
return "成功 レベル:#{level}"
end
diff --git a/src/diceBot/EclipsePhase.rb b/src/diceBot/EclipsePhase.rb
index d0f9b31..b09d16a 100644
--- a/src/diceBot/EclipsePhase.rb
+++ b/src/diceBot/EclipsePhase.rb
@@ -23,7 +23,7 @@ INFO_MESSAGE_TEXT
return '' unless signOfInequality == '<='
diceValue = total_n % 100 # 出目00は100ではなく00とする
- dice_ten_place = diceValue / 10
+ dice_ten_place = diceValue.div(10)
dice_one_place = diceValue % 10
debug("total_n", total_n)
diff --git a/src/diceBot/FilledWith.rb b/src/diceBot/FilledWith.rb
index 0c1b641..f96a41d 100644
--- a/src/diceBot/FilledWith.rb
+++ b/src/diceBot/FilledWith.rb
@@ -1512,7 +1512,7 @@ MESSAGETEXT
'『白銀の猛将』ジェネラル(CL55/ネームド)1匹([命中]+4、あらゆる致傷力+20、[HP]+500)'
]],
]
- case event / 100
+ case event.div(100)
when 1
areaText = "洞窟"
when 2
diff --git a/src/diceBot/GardenOrder.rb b/src/diceBot/GardenOrder.rb
index 53e896a..edc8725 100644
--- a/src/diceBot/GardenOrder.rb
+++ b/src/diceBot/GardenOrder.rb
@@ -50,12 +50,12 @@ INFO_MESSAGE_TEXT
def get_critical_border(critical_border_text, success_rate)
return critical_border_text.to_i unless critical_border_text.nil?
- critical_border = [success_rate / 5, 1].max
+ critical_border = [success_rate.div(5), 1].max
return critical_border
end
def check_roll_repeat_attack(success_rate, repeat_count, critical_border)
- success_rate_per_one = success_rate / repeat_count
+ success_rate_per_one = success_rate.div(repeat_count)
check_roll(success_rate_per_one, critical_border)
end
diff --git a/src/diceBot/GurpsFW.rb b/src/diceBot/GurpsFW.rb
index 2a1300c..23dca56 100644
--- a/src/diceBot/GurpsFW.rb
+++ b/src/diceBot/GurpsFW.rb
@@ -341,7 +341,7 @@ INFO_MESSAGE_TEXT
tableName = "財宝テーブル"
diff = Regexp.last_match(1)
depth = Regexp.last_match(2).to_i
- num = depth / 10
+ num = depth.div(10)
if num >= 6
num = 5
end
diff --git a/src/diceBot/IthaWenUa.rb b/src/diceBot/IthaWenUa.rb
index 1dd4f10..22ead4a 100644
--- a/src/diceBot/IthaWenUa.rb
+++ b/src/diceBot/IthaWenUa.rb
@@ -23,7 +23,7 @@ MESSAGETEXT
return '' unless signOfInequality == '<='
diceValue = total_n % 100
- dice0 = diceValue / 10 # 10の位を代入
+ dice0 = diceValue.div(10) # 10の位を代入
dice1 = diceValue % 10 # 1の位を代入
debug("total_n", total_n)
diff --git a/src/diceBot/KemonoNoMori.rb b/src/diceBot/KemonoNoMori.rb
index ab4b100..163a0bd 100644
--- a/src/diceBot/KemonoNoMori.rb
+++ b/src/diceBot/KemonoNoMori.rb
@@ -67,7 +67,7 @@ MESSAGETEXT
# 行為判定の成功度は [目標値の10の位の数+1]
# 継続判定の成功度は固定で+1
- success_degree = is_action_judge ? target_total / 10 + 1 : 1
+ success_degree = is_action_judge ? target_total.div(10) + 1 : 1
dice_total, = roll(1, 12)
debug('dice_total, target_total, success_degree = ', dice_total, target_total, success_degree)
diff --git a/src/diceBot/LogHorizon.rb b/src/diceBot/LogHorizon.rb
index 70d1316..527ece4 100644
--- a/src/diceBot/LogHorizon.rb
+++ b/src/diceBot/LogHorizon.rb
@@ -476,7 +476,7 @@ MESSAGETEXT
end
def getTableByRank(rank, tables)
- index = (rank - 1) / 5
+ index = (rank - 1).div(5)
index = [0, index].max
index = [index, (tables.size - 1)].min
diff --git a/src/diceBot/LogHorizon_Korean.rb b/src/diceBot/LogHorizon_Korean.rb
index 4ca1194..2a29e41 100644
--- a/src/diceBot/LogHorizon_Korean.rb
+++ b/src/diceBot/LogHorizon_Korean.rb
@@ -315,7 +315,7 @@ MESSAGETEXT
end
def getTableByRank(rank, tables)
- index = (rank - 1) / 5
+ index = (rank - 1).div(5)
index = [0, index].max
index = [index, (tables.size - 1)].min
diff --git a/src/diceBot/NinjaSlayer.rb b/src/diceBot/NinjaSlayer.rb
index 6dddff8..4f55fdf 100644
--- a/src/diceBot/NinjaSlayer.rb
+++ b/src/diceBot/NinjaSlayer.rb
@@ -57,16 +57,16 @@ MESSAGETEXT
# 難易度の値の正規表現
DIFFICULTY_VALUE_RE = /UH|[2-6KENH]/i.freeze
# 難易度の正規表現
- DIFFICULTY_RE = /\[(#{DIFFICULTY_VALUE_RE})\]|@(#{DIFFICULTY_VALUE_RE})/io.freeze
+ DIFFICULTY_RE = /(?:\[(#{DIFFICULTY_VALUE_RE.source})\]|@(#{DIFFICULTY_VALUE_RE.source}))/io.freeze
# 通常判定の正規表現
- NJ_RE = /\A(S)?NJ(\d+)#{DIFFICULTY_RE}?\z/io.freeze
+ NJ_RE = /\A(S)?NJ(\d+)#{DIFFICULTY_RE.source}?\z/io.freeze
# 回避判定の正規表現
- EV_RE = %r{\AEV(\d+)#{DIFFICULTY_RE}?(?:/(\d+))?\z}io.freeze
+ EV_RE = %r{\AEV(\d+)#{DIFFICULTY_RE.source}?(?:/(\d+))?\z}io.freeze
# 近接攻撃の正規表現
- AT_RE = /\AAT(\d+)#{DIFFICULTY_RE}?\z/io.freeze
+ AT_RE = /\AAT(\d+)#{DIFFICULTY_RE.source}?\z/io.freeze
# 電子戦の正規表現
- EL_RE = /\AEL(\d+)#{DIFFICULTY_RE}?\z/io.freeze
+ EL_RE = /\AEL(\d+)#{DIFFICULTY_RE.source}?\z/io.freeze
# バラバラロール結果の "(" の前までの先頭部分
B_ROLL_RESULT_HEAD_RE = /\A[^(]+/.freeze
diff --git a/src/diceBot/Ryutama.rb b/src/diceBot/Ryutama.rb
index 590545e..6a9478c 100644
--- a/src/diceBot/Ryutama.rb
+++ b/src/diceBot/Ryutama.rb
@@ -84,14 +84,14 @@ INFO_MESSAGE_TEXT
diceBase = dice1
- dice1 = diceBase / 10
+ dice1 = diceBase.div(10)
dice2 = diceBase % 10
if isValidDice(dice1, dice2)
return dice1, dice2
end
- dice1 = diceBase / 100
+ dice1 = diceBase.div(100)
dice2 = diceBase % 100
if isValidDice(dice1, dice2)
diff --git a/src/diceBot/SRS.rb b/src/diceBot/SRS.rb
index 744fe6c..7d8cbcb 100644
--- a/src/diceBot/SRS.rb
+++ b/src/diceBot/SRS.rb
@@ -72,15 +72,15 @@ HELP_MESSAGE
join('|')
@aliases_re_for_srs_roll_with_target_value = Regexp.new(
- '\A' \
+ '^' \
"(?:#{aliases_part})" \
- '((?:[-+][-+\d]+)?>=\d+(?:\[\d*(?:,\d+)?\])?)\z'
+ '((?:[-+][-+\d]+)?>=\d+(?:\[\d*(?:,\d+)?\])?)$'
)
@aliases_re_for_srs_roll_without_target_value = Regexp.new(
- '\A' \
+ '^' \
"(?:#{aliases_part})" \
- '([-+][-+\d]+)?(\[\d*(?:,\d+)?\])?\z'
+ '([-+][-+\d]+)?(\[\d*(?:,\d+)?\])?$'
)
prepare_help_msg_for_aliases_for_srs_roll(aliases_upcase)
diff --git a/src/diceBot/ShinMegamiTenseiKakuseihen.rb b/src/diceBot/ShinMegamiTenseiKakuseihen.rb
index 479ed39..bce1448 100644
--- a/src/diceBot/ShinMegamiTenseiKakuseihen.rb
+++ b/src/diceBot/ShinMegamiTenseiKakuseihen.rb
@@ -51,7 +51,7 @@ INFO_MESSAGE_TEXT
value %= 100
- dice1 = value / 10
+ dice1 = value.div(10)
dice2 = value % 10
return [dice1, dice2]
diff --git a/src/diceBot/Skynauts.rb b/src/diceBot/Skynauts.rb
index d488f10..f32ee9c 100644
--- a/src/diceBot/Skynauts.rb
+++ b/src/diceBot/Skynauts.rb
@@ -97,7 +97,7 @@ MESSAGETEXT
debug("移動修正", bonus)
total, = roll(1, 6)
- movePointBase = (total / 2) <= 0 ? 1 : (total / 2)
+ movePointBase = total.div(2) <= 0 ? 1 : total.div(2)
movePoint = movePointBase + bonus
debug("移動エリア数", movePoint)
diff --git a/src/diceBot/Warhammer.rb b/src/diceBot/Warhammer.rb
index c60aabc..6d93666 100644
--- a/src/diceBot/Warhammer.rb
+++ b/src/diceBot/Warhammer.rb
@@ -53,10 +53,10 @@ INFO_MESSAGE_TEXT
return '' unless signOfInequality == "<="
if total_n <= diff
- return " > 成功(成功度#{((diff - total_n) / 10)})"
+ return " > 成功(成功度#{(diff - total_n).div(10)})"
end
- return " > 失敗(失敗度#{((total_n - diff) / 10)})"
+ return " > 失敗(失敗度#{(total_n - diff).div(10)})"
end
#################### WHFRP関連 ########################
diff --git a/src/utils/ArithmeticEvaluator.rb b/src/utils/ArithmeticEvaluator.rb
index ad4cfa6..4876a07 100644
--- a/src/utils/ArithmeticEvaluator.rb
+++ b/src/utils/ArithmeticEvaluator.rb
@@ -71,7 +71,7 @@ class ArithmeticEvaluator
when :roundOff
return (left.to_f / right).round
else
- return left / right
+ return left.div(right)
end
end