bcdice 3.8.0 → 3.10.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.
@@ -0,0 +1,837 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BCDice
4
+ module GameSystem
5
+ class HeroScale < Base
6
+ # ゲームシステムの識別子
7
+ ID = 'HeroScale'
8
+
9
+ # ゲームシステム名
10
+ NAME = '英雄の尺度'
11
+
12
+ # ゲームシステム名の読みがな
13
+ SORT_KEY = 'えいゆうのしやくと'
14
+
15
+ HELP_MESSAGE = <<~TEXT
16
+ 同人TRPGシステム『英雄の尺度』用ダイスボット。
17
+ 基本ルールブック+サプリメント対応。仮称は非対応。
18
+ コマンド一覧は以下の通り。*添え字で内容は[]。†がついていたら添え字必須。
19
+ 5hs4 超越
20
+ 5hs4,b 肉体の超越
21
+ 5hs4,s,* 科学の超越[†達成値への加算値]
22
+ 5hs4,p 激情の超越
23
+ 4hs6 加護
24
+ 4hs6,s 選択の加護
25
+ 4hs6,p 安寧の加護
26
+ 4hs6,r 逆転の加護
27
+ 3hs8,*,* 契約[奉納の出目1,奉納の出目2]
28
+ 3hs8,a,*,* 享受の契約[†受諾出目1][†受諾出目2]
29
+ 3hs8,e,* 収奪の契約[†取得出目]
30
+ 3hs8,b 燃焼の契約
31
+ 3hs8,o,*,* 奉納の契約[奉納の出目1,奉納の出目2]
32
+ 2hs20 呪い
33
+ 2hs20,r 歪曲の呪い
34
+ 2hs20,c 崩壊の呪い
35
+ 2hs20,d 破滅の呪い
36
+ 3hs10 異物
37
+ 3hs10,i 模造の異物
38
+ 3hs10,m,* 混血の異物[追加振り基準出目(初期値10)]
39
+ 3hs10,b,* 彼方の異物[追加振り停止基準値(初期値666)]
40
+ 1hs60 報い
41
+ 1hs60,d 堕落の報い
42
+ 1hs60,o 忘却の報い
43
+ 1hs60,s,* 封印の報い[出目への係数]
44
+ 12hs2 同化
45
+ 12hs2,m,*,*,*,*,*,*,*,* 怪物の同化[*d2,*d4,*d6,*d8,*d10,*d12,*d20,*d60]
46
+ 12hs2,t,* [†2の枚数宣言]
47
+ 12hs2,c,* 法則の同化[†1の枚数宣言]
48
+ 1hs12 下位存在
49
+ 2hs12 中位存在
50
+ 2hs12,t 変遷の中位存在
51
+ 2hs12,c 偶然の中位存在
52
+ 2hs12,g,* 萌芽の上位存在[加算値]
53
+ 3hs12 上位存在
54
+ 3hs12,g 大神の上位存在
55
+ 3hs12,h 神性の上位存在
56
+ 3hs12,w 魔性の上位存在
57
+ 3hs12,m 悪意の上位存在
58
+ 3hs12,s,* 大罪の上位存在[†確定する目標値]
59
+ 3hs12,d 破壊の上位存在
60
+ 3hs12,a 懊悩の上位存在
61
+ 3hs12,o 試練の上位存在
62
+ 3hs12,c 創造の上位存在
63
+ 3hs12,e 元素の上位存在
64
+ *hs* 乗算ロール
65
+ TEXT
66
+
67
+ register_prefix('\d+HS\d+')
68
+
69
+ def eval_game_system_specific_command(command)
70
+ return select_origin(command)
71
+ end
72
+
73
+ private
74
+
75
+ def select_origin(command)
76
+ order = command.split(",")
77
+
78
+ case order[0]
79
+ when "5HS4"
80
+ return origin_great(order)
81
+ when "4HS6"
82
+ return origin_protection(order)
83
+ when "3HS8"
84
+ return origin_vow(order)
85
+ when "2HS20"
86
+ return origin_curse(order)
87
+ when "3HS10"
88
+ return origin_stranger(order)
89
+ when "1HS60"
90
+ return origin_karma(order)
91
+ when "12HS2"
92
+ return origin_absorption(order)
93
+ when "1HS12"
94
+ return origin_normal()
95
+ when "2HS12"
96
+ return origin_unique(order)
97
+ when "3HS12"
98
+ return origin_omnipotent(order)
99
+ else
100
+ message = order[0]
101
+ dice = order[0].rpartition("HS")
102
+ if dice.length > 2 && dice[0] =~ /^\d+$/ && dice[2] =~ /^\d+$/
103
+ natural_result = @randomizer.roll_barabara(dice[0].to_i, dice[2].to_i)
104
+ total = results_multiplication(natural_result)
105
+ message += " > #{total}[#{natural_result.join(',')}]"
106
+ return message
107
+ else
108
+ return nil
109
+ end
110
+ end
111
+ end
112
+
113
+ # 超越
114
+ def origin_great(order)
115
+ natural_result = @randomizer.roll_barabara(5, 4)
116
+ case order[1]
117
+ when "P"
118
+ message = fate_passion(natural_result)
119
+ when "S"
120
+ message = fate_science(natural_result, order)
121
+ when "B"
122
+ message = fate_body(natural_result)
123
+ else
124
+ total = results_multiplication(natural_result)
125
+ message = "超越 > #{total}[#{natural_result.join(',')}]"
126
+ end
127
+ return message
128
+ end
129
+
130
+ def fate_passion(natural_result)
131
+ modified_result = []
132
+ number_of_1 = natural_result.count(1)
133
+ natural_result.each do |result|
134
+ modified_result << result + number_of_1
135
+ end
136
+ subtotal = results_multiplication(natural_result)
137
+ total = results_multiplication(modified_result)
138
+ message = "激情の超越 > #{subtotal}[#{natural_result.join(',')}] > #{total}[#{modified_result.join(',')}]"
139
+ return message
140
+ end
141
+
142
+ def fate_science(natural_result, order)
143
+ subtotal = results_multiplication(natural_result)
144
+ if order.length > 2 && order[2] =~ /^\d+$/
145
+ if order[2].to_i < 1024
146
+ total = subtotal + order[2].to_i
147
+ message = "科学の超越 > #{subtotal}[#{natural_result.join(',')}] > #{total}"
148
+ if total > 1023
149
+ message += "(科学臨界)"
150
+ end
151
+ else
152
+ message = "エラー:科学力が1024を超えています。"
153
+ end
154
+ else
155
+ message = "エラー:科学力を設定してください。"
156
+ end
157
+ return message
158
+ end
159
+
160
+ def fate_body(natural_result)
161
+ modified_result = natural_result.dup
162
+ modified_result.each do |result|
163
+ if result == 4
164
+ modified_result << @randomizer.roll_once(4)
165
+ end
166
+ end
167
+ subtotal = results_multiplication(natural_result)
168
+ total = results_multiplication(modified_result)
169
+ message = "肉体の超越 > #{subtotal}[#{natural_result.join(',')}] > #{total}[#{modified_result.join(',')}]"
170
+ return message
171
+ end
172
+
173
+ # 加護
174
+ def origin_protection(order)
175
+ natural_result = @randomizer.roll_barabara(4, 6)
176
+ case order[1]
177
+ when "R"
178
+ message = fate_reversal(natural_result)
179
+ when "P"
180
+ message = fate_peace(natural_result)
181
+ when "S"
182
+ message = fate_choice(natural_result)
183
+ else
184
+ total = results_multiplication(natural_result)
185
+ message = "加護 > #{total}[#{natural_result.join(',')}]"
186
+ end
187
+ return message
188
+ end
189
+
190
+ def fate_reversal(natural_result)
191
+ modified_result = []
192
+ natural_result.each do |result|
193
+ if result < 4
194
+ result = 7 - result
195
+ end
196
+ modified_result << result
197
+ end
198
+ subtotal = results_multiplication(natural_result)
199
+ total = results_multiplication(modified_result)
200
+ message = "逆転の加護 > #{subtotal}[#{natural_result.join(',')}] > #{total}[#{modified_result.join(',')}]"
201
+ return message
202
+ end
203
+
204
+ def fate_peace(natural_result)
205
+ subtotal = results_multiplication(natural_result)
206
+ total = subtotal + 250
207
+ message = "安寧の加護 > #{subtotal}[#{natural_result.join(',')}] > #{total}"
208
+ return message
209
+ end
210
+
211
+ def fate_choice(natural_result)
212
+ modified_result = natural_result.dup
213
+ modified_result.concat(@randomizer.roll_barabara(3, 6))
214
+ even_total = 1
215
+ odd_total = 1
216
+ modified_result.each do |result|
217
+ if result.even?
218
+ even_total *= result
219
+ else
220
+ odd_total *= result
221
+ end
222
+ end
223
+ if even_total > odd_total
224
+ total = even_total
225
+ else
226
+ total = odd_total
227
+ end
228
+ subtotal = results_multiplication(natural_result)
229
+ message = "選択の加護 > #{subtotal}[#{natural_result.join(',')}] > #{total}[#{modified_result.join(',')}]"
230
+ return message
231
+ end
232
+
233
+ # 契約
234
+ def origin_vow(order)
235
+ natural_result = @randomizer.roll_barabara(3, 8)
236
+ case order[1]
237
+ when "O"
238
+ message = fate_offering(natural_result, order)
239
+ when "B"
240
+ message = fate_burning(natural_result)
241
+ when "E"
242
+ message = fate_exploitation(natural_result, order)
243
+ when "A"
244
+ message = fate_acceptance(natural_result, order)
245
+ else
246
+ subtotal = results_multiplication(natural_result)
247
+ if order.length > 2 && order[1] =~ /^\d+$/ && order[2] =~ /^\d+$/
248
+ modified_result = natural_result.dup
249
+ modified_result << order[1].to_i
250
+ modified_result << order[2].to_i
251
+ total = results_multiplication(modified_result)
252
+ message = "契約 > #{subtotal}[#{natural_result.join(',')}] > #{total}[#{modified_result.join(',')}]"
253
+ else
254
+ message = "契約 > #{subtotal}[#{natural_result.join(',')}]"
255
+ end
256
+ end
257
+ return message
258
+ end
259
+
260
+ def fate_offering(natural_result, order)
261
+ subtotal = results_multiplication(natural_result)
262
+ if order.length > 3 && order[2] =~ /^\d+$/ && order[3] =~ /^\d+$/
263
+ modified_result = natural_result.dup
264
+ modified_result << order[2].to_i
265
+ modified_result << order[3].to_i
266
+ total = results_multiplication(modified_result)
267
+ message = "奉納の契約 > #{subtotal}[#{natural_result.join(',')}] > #{total}[#{modified_result.join(',')}]"
268
+ else
269
+ message = "奉納の契約 > #{subtotal}[#{natural_result.join(',')}]"
270
+ end
271
+ offering_result = natural_result.dup
272
+ offering_result.sort!.reverse!.shift(1)
273
+ message += "(奉納:#{offering_result.join(',')})"
274
+ return message
275
+ end
276
+
277
+ def fate_burning(natural_result)
278
+ subtotal = results_multiplication(natural_result)
279
+ total = subtotal * 6
280
+ message = "燃焼の契約 > #{subtotal}[#{natural_result.join(',')}] > #{total}"
281
+ return message
282
+ end
283
+
284
+ def fate_exploitation(natural_result, order)
285
+ subtotal = results_multiplication(natural_result)
286
+ if order.length > 2 && order[2] =~ /^\d+$/
287
+ modified_result = natural_result.dup
288
+ modified_result[modified_result.index(modified_result.min)] = order[2].to_i
289
+ total = results_multiplication(modified_result)
290
+ message = "収奪の契約 > #{subtotal}[#{natural_result.join(',')}] > #{total}[#{modified_result.join(',')}]"
291
+ else
292
+ message = "エラー:収奪数を指定してください。"
293
+ end
294
+ return message
295
+ end
296
+
297
+ def fate_acceptance(natural_result, order)
298
+ subtotal = results_multiplication(natural_result)
299
+ if order.length > 3 && order[2] =~ /^\d+$/ && order[3] =~ /^\d+$/
300
+ change_result = natural_result.min(2)
301
+ modified_result = natural_result.dup
302
+ modified_result[modified_result.index(change_result[0])] = order[2].to_i
303
+ modified_result[modified_result.index(change_result[1])] = order[3].to_i
304
+ total = results_multiplication(modified_result)
305
+ message = "享受の契約 > #{subtotal}[#{natural_result.join(',')}] > #{total}[#{modified_result.join(',')}]"
306
+ else
307
+ message = "エラー:享受数を指定してください。"
308
+ end
309
+ return message
310
+ end
311
+
312
+ # 呪い
313
+ def origin_curse(order)
314
+ natural_result = @randomizer.roll_barabara(2, 20)
315
+ case order[1]
316
+ when "R"
317
+ message = fate_ruin(natural_result)
318
+ when "C"
319
+ message = fate_collapse(natural_result)
320
+ when "D"
321
+ message = fate_distortion(natural_result)
322
+ else
323
+ total = results_multiplication(natural_result)
324
+ message = "呪い > #{total}[#{natural_result.join(',')}]"
325
+ end
326
+ return message
327
+ end
328
+
329
+ def fate_ruin(natural_result)
330
+ modified_result = natural_result.dup
331
+ modified_result.concat(@randomizer.roll_barabara(2, 20))
332
+ total = 1
333
+ modified_result.each do |result|
334
+ if result > 10
335
+ total *= result
336
+ end
337
+ end
338
+ subtotal = results_multiplication(natural_result)
339
+ message = "破滅の呪い > #{subtotal}[#{natural_result.join(',')}] > #{total}[#{modified_result.join(',')}]"
340
+ return message
341
+ end
342
+
343
+ def fate_collapse(natural_result)
344
+ modified_result = natural_result.dup
345
+ collapse_result = result_raoundup(natural_result[natural_result.index(natural_result.max)])
346
+ if modified_result[0] == modified_result[1]
347
+ modified_result[0] = collapse_result
348
+ modified_result[1] = collapse_result
349
+ modified_result << collapse_result
350
+ modified_result << collapse_result
351
+ else
352
+ modified_result[natural_result.index(natural_result.max)] = collapse_result
353
+ modified_result.insert(natural_result.index(natural_result.max), collapse_result)
354
+ end
355
+ subtotal = results_multiplication(natural_result)
356
+ total = results_multiplication(modified_result)
357
+ message = "崩壊の呪い > #{subtotal}[#{natural_result.join(',')}] > #{total}[#{modified_result.join(',')}]"
358
+ return message
359
+ end
360
+
361
+ def fate_distortion(natural_result)
362
+ modified_result = natural_result.dup
363
+
364
+ if modified_result[0] == modified_result[1]
365
+ modified_result[0] += 13
366
+ modified_result[1] += 13
367
+ else
368
+ modified_result[natural_result.index(natural_result.min)] += 13
369
+ end
370
+ subtotal = results_multiplication(natural_result)
371
+ total = results_multiplication(modified_result)
372
+ message = "歪曲の呪い > #{subtotal}[#{natural_result.join(',')}] > #{total}[#{modified_result.join(',')}]"
373
+ return message
374
+ end
375
+
376
+ # 異物
377
+ def origin_stranger(order)
378
+ natural_result = @randomizer.roll_barabara(3, 10)
379
+ natural_result = stranger_effection(natural_result)
380
+ case order[1]
381
+ when "I"
382
+ message = fate_imitation(natural_result)
383
+ when "M"
384
+ message = fate_mixed(natural_result, order)
385
+ when "B"
386
+ message = fate_beyond(natural_result, order)
387
+ else
388
+ total = results_multiplication(natural_result)
389
+ message = "異物 > #{total}[#{natural_result.join(',')}]"
390
+ end
391
+ return message
392
+ end
393
+
394
+ def fate_imitation(natural_result)
395
+ modified_result = natural_result.dup
396
+ modified_result.sort!
397
+ modified_result[0] = (modified_result[0] + modified_result[1] * 10) == 0 ? 100 : (modified_result[0] + modified_result[1] * 10)
398
+ modified_result[1] = modified_result[2]
399
+ modified_result.delete_at(2)
400
+ subtotal = results_multiplication(natural_result)
401
+ total = results_multiplication(modified_result)
402
+ message = "模造の異物 > #{subtotal}[#{natural_result.join(',')}] > #{total}[#{modified_result.join(',')}]"
403
+ return message
404
+ end
405
+
406
+ def fate_mixed(natural_result, order)
407
+ subtotal = results_multiplication(natural_result)
408
+ if order.length > 2 && order[2] =~ /^\d+$/
409
+ mixed_score = order[2].to_i
410
+ else
411
+ mixed_score = 1
412
+ end
413
+ modified_result = natural_result.dup
414
+ if mixed_score <= natural_result.min
415
+ modified_result << @randomizer.roll_once(12)
416
+ total = results_multiplication(modified_result)
417
+ message = "混血の異物 > #{subtotal}[#{natural_result.join(',')}] > #{total}[#{modified_result.join(',')}](追加振り)"
418
+ else
419
+ modified_result[natural_result.index(natural_result.min)] = 10
420
+ total = results_multiplication(modified_result)
421
+ message = "混血の異物 > #{subtotal}[#{natural_result.join(',')}] > #{total}[#{modified_result.join(',')}](10置換)"
422
+ end
423
+ return message
424
+ end
425
+
426
+ def fate_beyond(natural_result, order)
427
+ modified_result = natural_result.dup
428
+ subtotal = results_multiplication(natural_result)
429
+ total = subtotal
430
+ beyond_limit = 666
431
+ if order.length > 2 && order[2] =~ /^\d+$/ && (order[2].to_i < 666)
432
+ beyond_limit = order[2].to_i
433
+ end
434
+ while total != 0 && total <= beyond_limit
435
+ modified_result << @randomizer.roll_d9
436
+ total = results_multiplication(modified_result)
437
+ end
438
+ message = "彼方の異物 > #{subtotal}[#{natural_result.join(',')}] > #{total}[#{modified_result.join(',')}]"
439
+ return message
440
+ end
441
+
442
+ # 報い
443
+ def origin_karma(order)
444
+ natural_result = @randomizer.roll_barabara(1, 60)
445
+ case order[1]
446
+ when "D"
447
+ message = fate_depravity(natural_result)
448
+ when "O"
449
+ message = fate_oblivion(natural_result)
450
+ when "S"
451
+ message = fate_sealed(natural_result, order)
452
+ else
453
+ total = results_multiplication(natural_result)
454
+ message = "報い > #{total}[#{natural_result.join(',')}]"
455
+ end
456
+ return message
457
+ end
458
+
459
+ def fate_depravity(natural_result)
460
+ subtotal = results_multiplication(natural_result)
461
+ modified_result = natural_result.dup
462
+ depravity_num1 = natural_result[0] % 10
463
+ depravity_num10 = natural_result[0] / 10
464
+ if depravity_num10 > 1
465
+ modified_result << depravity_num10
466
+ end
467
+ if depravity_num1 > 1
468
+ modified_result << depravity_num1
469
+ end
470
+ total = results_multiplication(modified_result)
471
+ message = "堕落の報い > #{subtotal}[#{natural_result.join(',')}] > #{total}[#{modified_result.join(',')}]"
472
+ return message
473
+ end
474
+
475
+ def fate_oblivion(natural_result)
476
+ modified_result = natural_result.dup
477
+ modified_result << @randomizer.roll_once(60)
478
+ subtotal = results_multiplication(natural_result)
479
+ total = results_multiplication(modified_result) / 2
480
+ message = "忘却の報い > #{subtotal}[#{natural_result.join(',')}] > #{total}[#{modified_result.join(',')}]"
481
+ return message
482
+ end
483
+
484
+ def fate_sealed(natural_result, order)
485
+ modified_result = natural_result.dup
486
+ subtotal = results_multiplication(natural_result)
487
+ sealed_break = 1
488
+ if order.length > 2 && order[2] =~ /^\d+$/
489
+ sealed_break = order[2].to_i
490
+ end
491
+ modified_result[0] *= sealed_break
492
+ total = subtotal * sealed_break
493
+ message = "封印の報い > #{subtotal}[#{natural_result.join(',')}] > #{total}[#{modified_result.join(',')}]"
494
+ if total <= 30
495
+ sealed_break *= 4
496
+ message += "(封印解除成功:#{sealed_break})"
497
+ elsif total <= 60
498
+ sealed_break *= 2
499
+ message += "(封印解除成功:#{sealed_break})"
500
+ else
501
+ message += "(封印解除失敗:#{sealed_break})"
502
+ end
503
+ return message
504
+ end
505
+
506
+ # 同化
507
+ def origin_absorption(order)
508
+ natural_result = @randomizer.roll_barabara(12, 2)
509
+ case order[1]
510
+ when "M"
511
+ message = fate_monster(natural_result, order)
512
+ when "T"
513
+ message = fate_treasure(natural_result, order)
514
+ when "C"
515
+ message = fate_concept(natural_result, order)
516
+ else
517
+ total = results_multiplication(natural_result)
518
+ message = "同化 > #{total}[#{natural_result.join(',')}]"
519
+ end
520
+ return message
521
+ end
522
+
523
+ def fate_monster(_natural_result, order)
524
+ modified_result = []
525
+ if order.length > 9 && order[2] =~ /^\d+$/ && order[3] =~ /^\d+$/ && order[4] =~ /^\d+$/ && order[5] =~ /^\d+$/ && order[6] =~ /^\d+$/ && order[7] =~ /^\d+$/ && order[8] =~ /^\d+$/ && order[9] =~ /^\d+$/
526
+ if order[2].to_i > 0
527
+ modified_result.concat(@randomizer.roll_barabara(order[2].to_i, 2))
528
+ end
529
+ if order[3].to_i > 0
530
+ modified_result.concat(@randomizer.roll_barabara(order[3].to_i, 4))
531
+ end
532
+ if order[4].to_i > 0
533
+ modified_result.concat(@randomizer.roll_barabara(order[4].to_i, 6))
534
+ end
535
+ if order[5].to_i > 0
536
+ modified_result.concat(@randomizer.roll_barabara(order[5].to_i, 8))
537
+ end
538
+ count_of_10 = order[6].to_i
539
+ while count_of_10 > 0
540
+ modified_result << @randomizer.roll_d9
541
+ count_of_10 -= 1
542
+ end
543
+ if order[7].to_i > 0
544
+ modified_result.concat(@randomizer.roll_barabara(order[7].to_i, 12))
545
+ end
546
+ if order[8].to_i > 0
547
+ modified_result.concat(@randomizer.roll_barabara(order[8].to_i, 20))
548
+ end
549
+ if order[9].to_i > 0
550
+ modified_result.concat(@randomizer.roll_barabara(order[9].to_i, 60))
551
+ end
552
+ total = results_multiplication(modified_result)
553
+ subtotal = modified_result.sum
554
+ message = "怪物の同化 > #{total}[#{modified_result.join(',')}] 浸蝕値:#{subtotal}"
555
+ if [2, 4, 6, 8, 10, 12, 20, 60].include?(subtotal)
556
+ message += "(変異進行)"
557
+ end
558
+ if modified_result.include?(1)
559
+ message += "(人間性喪失)"
560
+ end
561
+ else
562
+ message = "エラー:変異状態を指定してください。"
563
+ end
564
+ return message
565
+ end
566
+
567
+ def fate_treasure(natural_result, order)
568
+ modified_result = natural_result.dup
569
+ subtotal = results_multiplication(natural_result)
570
+ total = subtotal
571
+ if order.length > 2 && order[2] =~ /^\d+$/
572
+ treasure_point = order[2].to_i
573
+ if modified_result.count(2) >= treasure_point
574
+ total *= treasure_point
575
+ message = "秘宝の同化 > #{subtotal}[#{natural_result.join(',')}] > #{total}(同調成功)"
576
+ else
577
+ message = "秘宝の同化 > #{subtotal}[#{natural_result.join(',')}] > #{total}(同調失敗)"
578
+ end
579
+ else
580
+ message = "エラー:解放率を指定してください。"
581
+ end
582
+ return message
583
+ end
584
+
585
+ def fate_concept(natural_result, order)
586
+ modified_result = natural_result.dup
587
+ subtotal = results_multiplication(natural_result)
588
+ if order.length > 2 && order[2] =~ /^\d+$/
589
+ existence_scale = order[2].to_i
590
+ if existence_scale > 12
591
+ existence_scale = 12
592
+ end
593
+ modified_result.fill(2, 0, existence_scale)
594
+ total = results_multiplication(modified_result)
595
+ message = "概念の同化 > #{subtotal}[#{natural_result.join(',')}] > #{total}[#{modified_result.join(',')}]"
596
+ else
597
+ message = "エラー:事象強度を指定してください。"
598
+ end
599
+ return message
600
+ end
601
+
602
+ # 下位存在
603
+ def origin_normal()
604
+ natural_result = @randomizer.roll_barabara(1, 12)
605
+ total = results_multiplication(natural_result)
606
+ message = "下位存在 > #{total}[#{natural_result.join(',')}]"
607
+ return message
608
+ end
609
+
610
+ # 中位存在
611
+ def origin_unique(order)
612
+ natural_result = @randomizer.roll_barabara(2, 12)
613
+ case order[1]
614
+ when "G"
615
+ message = fate_growth(natural_result, order)
616
+ when "T"
617
+ message = fate_transition(natural_result)
618
+ when "C"
619
+ message = fate_chance(natural_result)
620
+ else
621
+ total = results_multiplication(natural_result)
622
+ message = "中位存在 > #{total}[#{natural_result.join(',')}]"
623
+ end
624
+ return message
625
+ end
626
+
627
+ def fate_growth(natural_result, order)
628
+ subtotal = results_multiplication(natural_result)
629
+ total = subtotal
630
+ if order.length > 2 && order[2] =~ /^\d+$/
631
+ total += order[2].to_i
632
+ message = "萌芽の中位存在 > #{subtotal}[#{natural_result.join(',')}] > #{total}"
633
+ else
634
+ message = "萌芽の中位存在 > #{subtotal}[#{natural_result.join(',')}]"
635
+ end
636
+ growth_level = order[2].to_i + 50
637
+ message += "(成長段階:#{growth_level})"
638
+ return message
639
+ end
640
+
641
+ def fate_transition(natural_result)
642
+ modified_result = natural_result.dup
643
+ modified_result << @randomizer.roll_d9
644
+ subtotal = results_multiplication(natural_result)
645
+ total = results_multiplication(modified_result)
646
+ message = "変遷の中位存在 > #{subtotal}[#{natural_result.join(',')}] > #{total}[#{modified_result.join(',')}]"
647
+ return message
648
+ end
649
+
650
+ def fate_chance(natural_result)
651
+ modified_result = natural_result.dup
652
+ subtotal = results_multiplication(natural_result)
653
+ total = results_multiplication(modified_result)
654
+ if modified_result[0] == modified_result[1]
655
+ total *= 24
656
+ message = "偶然の中位存在 > #{subtotal}[#{natural_result.join(',')}] > #{total}"
657
+ else
658
+ message = "偶然の中位存在 > #{subtotal}[#{natural_result.join(',')}]"
659
+ end
660
+ return message
661
+ end
662
+
663
+ # 上位存在
664
+ def origin_omnipotent(order)
665
+ natural_result = @randomizer.roll_barabara(3, 12)
666
+
667
+ case order[1]
668
+ when "G"
669
+ message = fate_god(natural_result)
670
+ when "H"
671
+ message = fate_holy(natural_result)
672
+ when "W"
673
+ message = fate_wicked(natural_result)
674
+ when "M"
675
+ message = fate_malice(natural_result)
676
+ when "S"
677
+ message = fate_sin(natural_result, order)
678
+ when "D"
679
+ message = fate_destruction(natural_result)
680
+ when "A"
681
+ message = fate_anguish(natural_result)
682
+ when "O"
683
+ message = fate_ordeal(natural_result)
684
+ when "C"
685
+ message = fate_creation(natural_result)
686
+ when "E"
687
+ message = fate_element()
688
+ else
689
+ total = results_multiplication(natural_result)
690
+ message = "上位存在 > #{total}[#{natural_result.join(',')}]"
691
+ end
692
+
693
+ return message
694
+ end
695
+
696
+ def fate_god(natural_result)
697
+ modified_result = []
698
+ natural_result.each do |result|
699
+ modified_result << result + 3
700
+ end
701
+ subtotal = results_multiplication(natural_result)
702
+ total = results_multiplication(modified_result)
703
+ message = "大神の上位存在 > #{subtotal}[#{natural_result.join(',')}] > #{total}[#{modified_result.join(',')}]"
704
+ return message
705
+ end
706
+
707
+ def fate_holy(natural_result)
708
+ modified_result = []
709
+ natural_result.each do |result|
710
+ modified_result << result + 1
711
+ end
712
+ subtotal = results_multiplication(natural_result)
713
+ total = results_multiplication(modified_result)
714
+ message = "神性の上位存在 > #{subtotal}[#{natural_result.join(',')}] > #{total}[#{modified_result.join(',')}]"
715
+ return message
716
+ end
717
+
718
+ def fate_wicked(natural_result)
719
+ subtotal = results_multiplication(natural_result)
720
+ total = subtotal + 120
721
+ message = "魔性の上位存在 > #{subtotal}[#{natural_result.join(',')}] > #{total}"
722
+ return message
723
+ end
724
+
725
+ def fate_malice(natural_result)
726
+ subtotal = results_multiplication(natural_result)
727
+ total = subtotal * 2
728
+ message = "悪意の上位存在 > #{subtotal}[#{natural_result.join(',')}] > #{total}"
729
+ return message
730
+ end
731
+
732
+ def fate_sin(natural_result, order)
733
+ subtotal = results_multiplication(natural_result)
734
+ total = subtotal
735
+ if order.length > 2 && order[2] =~ /^\d+$/
736
+ message = "大罪の上位存在 > #{subtotal}[#{natural_result.join(',')}]"
737
+ sin_weight = order[2].to_i
738
+ sin_count = 0
739
+ while sin_count < 3 && total < sin_weight
740
+ modified_result = @randomizer.roll_barabara(3, 12)
741
+ total = results_multiplication(modified_result)
742
+ message += " > #{total}[#{modified_result.join(',')}]"
743
+ sin_count += 1
744
+ end
745
+ else
746
+ message = "エラー:罪の重さを指定してください。"
747
+ end
748
+ return message
749
+ end
750
+
751
+ def fate_destruction(natural_result)
752
+ modified_result = natural_result.dup
753
+ modified_result << @randomizer.roll_once(12)
754
+ subtotal = results_multiplication(natural_result)
755
+ total = results_multiplication(modified_result) - 300
756
+ message = "破壊の上位存在 > #{subtotal}[#{natural_result.join(',')}] > #{total}[#{modified_result.join(',')}]"
757
+ return message
758
+ end
759
+
760
+ def fate_anguish(natural_result)
761
+ modified_result = []
762
+ natural_result.each do |result|
763
+ if result < 7
764
+ result = 7
765
+ end
766
+ modified_result << result
767
+ end
768
+ subtotal = results_multiplication(natural_result)
769
+ total = results_multiplication(modified_result)
770
+ message = "懊悩の上位存在 > #{subtotal}[#{natural_result.join(',')}] > #{total}[#{modified_result.join(',')}]"
771
+ return message
772
+ end
773
+
774
+ def fate_ordeal(natural_result)
775
+ modified_result = []
776
+ natural_result.each do |result|
777
+ if result < 9
778
+ result = 9
779
+ end
780
+ modified_result << result
781
+ end
782
+ subtotal = results_multiplication(natural_result)
783
+ total = results_multiplication(modified_result)
784
+ message = "試練の上位存在 > #{subtotal}[#{natural_result.join(',')}] > #{total}[#{modified_result.join(',')}]"
785
+ return message
786
+ end
787
+
788
+ def fate_creation(natural_result)
789
+ modified_result = natural_result.dup
790
+ temporary_result = natural_result.dup
791
+ temporary_result.sort!
792
+ modified_result << temporary_result[1]
793
+ subtotal = results_multiplication(natural_result)
794
+ total = results_multiplication(modified_result)
795
+ message = "創造の上位存在 > #{subtotal}[#{natural_result.join(',')}] > #{total}[#{modified_result.join(',')}]"
796
+ return message
797
+ end
798
+
799
+ def fate_element()
800
+ modified_result = []
801
+ modified_result << @randomizer.roll_once(4)
802
+ modified_result << @randomizer.roll_once(6)
803
+ modified_result << @randomizer.roll_once(8)
804
+ modified_result << @randomizer.roll_once(12)
805
+ modified_result << @randomizer.roll_once(20)
806
+ total = results_multiplication(modified_result)
807
+ message = "元素の上位存在 > #{total}[#{modified_result.join(',')}]"
808
+ return message
809
+ end
810
+
811
+ # 汎用
812
+ def results_multiplication(result_list)
813
+ total = 1
814
+ result_list.each do |result|
815
+ total *= result
816
+ end
817
+ return total
818
+ end
819
+
820
+ def stranger_effection(result_list)
821
+ stranger_list = []
822
+ result_list.each do |result|
823
+ stranger_list << result - 1
824
+ end
825
+ return stranger_list
826
+ end
827
+
828
+ def result_raoundup(result)
829
+ if result.even?
830
+ return result / 2
831
+ else
832
+ return result / 2 + 1
833
+ end
834
+ end
835
+ end
836
+ end
837
+ end