bcdice 3.14.0 → 3.15.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.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +59 -0
  3. data/i18n/Cthulhu/zh_hant.yml +1 -1
  4. data/i18n/CyberpunkRed/ko_kr.yml +389 -0
  5. data/i18n/DoubleCross/ja_jp.yml +53 -0
  6. data/i18n/DoubleCross/ko_kr.yml +52 -0
  7. data/i18n/FutariSousa/ja_jp.yml +138 -138
  8. data/i18n/KillDeathBusiness/ja_jp.yml +198 -0
  9. data/i18n/MagicaLogia/ko_kr.yml +2 -2
  10. data/i18n/MonotoneMuseum/ko_kr.yml +227 -0
  11. data/i18n/SkynautsBouken/ko_kr.yml +114 -0
  12. data/i18n/StratoShout/ko_kr.yml +102 -102
  13. data/i18n/zh_hant.yml +5 -0
  14. data/lib/bcdice/game_system/Aionia.rb +131 -0
  15. data/lib/bcdice/game_system/Arianrhod_Korean.rb +2 -0
  16. data/lib/bcdice/game_system/ArknightsFan.rb +245 -87
  17. data/lib/bcdice/game_system/BlackJacket_Korean.rb +244 -0
  18. data/lib/bcdice/game_system/CharonSanctions.rb +112 -0
  19. data/lib/bcdice/game_system/Cthulhu7th.rb +1 -1
  20. data/lib/bcdice/game_system/Cthulhu7th_ChineseTraditional/full_auto.rb +293 -0
  21. data/lib/bcdice/game_system/Cthulhu7th_ChineseTraditional/rollable.rb +43 -0
  22. data/lib/bcdice/game_system/Cthulhu7th_ChineseTraditional.rb +470 -306
  23. data/lib/bcdice/game_system/CyberpunkRed.rb +1 -2
  24. data/lib/bcdice/game_system/CyberpunkRed_Korean.rb +66 -0
  25. data/lib/bcdice/game_system/DoubleCross.rb +18 -1
  26. data/lib/bcdice/game_system/DoubleCross_Korean.rb +5 -1
  27. data/lib/bcdice/game_system/FullFace.rb +25 -3
  28. data/lib/bcdice/game_system/FutariSousa.rb +17 -5
  29. data/lib/bcdice/game_system/Garactier.rb +479 -0
  30. data/lib/bcdice/game_system/GardenOrder.rb +390 -9
  31. data/lib/bcdice/game_system/GundogRevised.rb +8 -8
  32. data/lib/bcdice/game_system/KillDeathBusiness.rb +155 -3
  33. data/lib/bcdice/game_system/KimitoYell.rb +568 -0
  34. data/lib/bcdice/game_system/Magius.rb +125 -0
  35. data/lib/bcdice/game_system/Magius_3rdNewTokyoCity.rb +62 -0
  36. data/lib/bcdice/game_system/MonotoneMuseum_Korean.rb +4 -4
  37. data/lib/bcdice/game_system/NSSQ.rb +17 -9
  38. data/lib/bcdice/game_system/NervWhitePaper.rb +129 -0
  39. data/lib/bcdice/game_system/RogueLikeHalf.rb +198 -0
  40. data/lib/bcdice/game_system/RuneQuestRoleplayingInGlorantha.rb +16 -13
  41. data/lib/bcdice/game_system/ShinobiGami.rb +73 -43
  42. data/lib/bcdice/game_system/SkynautsBouken.rb +4 -4
  43. data/lib/bcdice/game_system/SkynautsBouken_Korean.rb +57 -0
  44. data/lib/bcdice/game_system/StratoShout_Korean.rb +1 -1
  45. data/lib/bcdice/game_system/SwordWorld.rb +4 -0
  46. data/lib/bcdice/game_system/SwordWorld2_5.rb +3 -2
  47. data/lib/bcdice/game_system/TensaiGunshiNiNaro.rb +51 -17
  48. data/lib/bcdice/game_system/TheIndieHack.rb +82 -0
  49. data/lib/bcdice/game_system/TorgEternity.rb +35 -6
  50. data/lib/bcdice/game_system/WoW.rb +161 -0
  51. data/lib/bcdice/game_system/YankeeMustDie.rb +192 -0
  52. data/lib/bcdice/game_system/YearZeroEngine.rb +225 -28
  53. data/lib/bcdice/game_system/YuMyoKishi.rb +141 -0
  54. data/lib/bcdice/game_system/sword_world/rating_lexer.rb +1 -0
  55. data/lib/bcdice/game_system/sword_world/rating_options.rb +4 -1
  56. data/lib/bcdice/game_system/sword_world/rating_parsed.rb +5 -0
  57. data/lib/bcdice/game_system/sword_world/rating_parser.rb +129 -115
  58. data/lib/bcdice/game_system.rb +15 -0
  59. data/lib/bcdice/version.rb +1 -1
  60. metadata +22 -6
@@ -0,0 +1,125 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BCDice
4
+ module GameSystem
5
+ class Magius < Base
6
+ # ゲームシステムの識別子
7
+ ID = 'Magius'
8
+
9
+ # ゲームシステム名
10
+ NAME = 'MAGIUS'
11
+
12
+ # ゲームシステム名の読みがな
13
+ SORT_KEY = 'まきうす'
14
+
15
+ # ダイスボットの使い方
16
+ HELP_MESSAGE = <<~INFO_MESSAGETEXT
17
+ ■能力値判定 MA+x>=t x:修正値 t:目標値
18
+ 例)MA>=7: ダイスを2個振って、その結果を表示
19
+
20
+ ■技能値判定 MS+x>=t x:修正値 t:目標値
21
+ 例)MS>=7: ダイスを3個振って、そのうち上位2つを採用し、結果を表示
22
+
23
+ INFO_MESSAGETEXT
24
+
25
+ register_prefix('M[AS]')
26
+
27
+ def initialize(command)
28
+ super(command)
29
+
30
+ @sort_barabara_dice = true # バラバラロール(Bコマンド)でソート有
31
+ end
32
+
33
+ def eval_game_system_specific_command(command)
34
+ resolute_ability_action(command) ||
35
+ resolute_skill_action(command)
36
+ end
37
+
38
+ private
39
+
40
+ def with_symbol(number)
41
+ if number == 0
42
+ return ""
43
+ elsif number > 0
44
+ return "+#{number}"
45
+ else
46
+ return number.to_s
47
+ end
48
+ end
49
+
50
+ # 能力値判定
51
+ # @param [String] command
52
+ # @return [Result]
53
+ def get_result_of_ability_action(total, _dice_add, target)
54
+ if total >= target
55
+ return Result.success("成功")
56
+ else
57
+ return Result.failure("失敗")
58
+ end
59
+ end
60
+
61
+ def resolute_ability_action(command)
62
+ m = /MA([+-]\d+)*>=(\d+)/.match(command)
63
+ return nil unless m
64
+
65
+ modify = m[1] ? Arithmetic.eval(m[1], @round_type) : 0
66
+ target = m[2].to_i
67
+
68
+ dices = @randomizer.roll_barabara(2, 6).sort
69
+ dice_text = dices.join(",")
70
+ dice_add = dices.sum
71
+ total = dice_add + modify
72
+
73
+ result = get_result_of_ability_action(total, dice_add, target)
74
+
75
+ sequence = [
76
+ "(#{command})",
77
+ "[#{dice_text}]#{with_symbol(modify)}",
78
+ total,
79
+ result.text,
80
+ ].compact
81
+
82
+ result.text = sequence.join(" > ")
83
+
84
+ return result
85
+ end
86
+
87
+ # 技能値値判定
88
+ # @param [String] command
89
+ # @return [Result]
90
+ def get_result_of_skill_action(total, _dice_add, target)
91
+ if total >= target
92
+ return Result.success("成功")
93
+ else
94
+ return Result.failure("失敗")
95
+ end
96
+ end
97
+
98
+ def resolute_skill_action(command)
99
+ m = /MS([+-]\d+)*>=(\d+)/.match(command)
100
+ return nil unless m
101
+
102
+ modify = m[1] ? Arithmetic.eval(m[1], @round_type) : 0
103
+ target = m[2].to_i
104
+
105
+ dices = @randomizer.roll_barabara(3, 6).sort
106
+ dice_text = dices.join(",")
107
+ dice_add = dices[1].to_i + dices[2].to_i
108
+ total = dice_add + modify
109
+
110
+ result = get_result_of_skill_action(total, dice_add, target)
111
+
112
+ sequence = [
113
+ "(#{command})",
114
+ "[#{dice_text}]#{with_symbol(modify)}",
115
+ total,
116
+ result.text,
117
+ ].compact
118
+
119
+ result.text = sequence.join(" > ")
120
+
121
+ return result
122
+ end
123
+ end
124
+ end
125
+ end
@@ -0,0 +1,62 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bcdice/game_system/Magius'
4
+
5
+ module BCDice
6
+ module GameSystem
7
+ class Magius_3rdNewTokyoCity < Magius
8
+ # ゲームシステムの識別子
9
+ ID = 'Magius_3rdNewTokyoCity'
10
+
11
+ # ゲームシステム名
12
+ NAME = 'MAGIUS:新世紀エヴァンゲリオンRPG 決戦!第3新東京市'
13
+
14
+ # ゲームシステム名の読みがな
15
+ SORT_KEY = 'まきうすしんせいきえうあんけりおんRPGけつせんたい3しんとうきようし'
16
+
17
+ # ダイスボットの使い方
18
+ HELP_MESSAGE = <<~INFO_MESSAGETEXT
19
+ ■能力値判定 MA+x>=t x:修正値 t:目標値
20
+ 例)MA>=7: ダイスを2個振って、その結果(成功,失敗,絶対成功,絶対失敗)を表示
21
+
22
+ ■技能値判定 MS+x>=t x:修正値 t:目標値
23
+ 例)MS>=7: ダイスを3個振って、そのうち上位2つを採用し、結果(成功,失敗,絶対成功,絶対失敗)を表示
24
+
25
+ INFO_MESSAGETEXT
26
+
27
+ register_prefix('M[AS]')
28
+
29
+ private
30
+
31
+ # 能力値判定の結果取得
32
+ # @param [Integer] total, dice_add, target
33
+ # @return [Result]
34
+ def get_result_of_ability_action(total, dice_add, target)
35
+ if dice_add == 12
36
+ return Result.critical("絶対成功")
37
+ elsif dice_add == 2
38
+ return Result.fumble("絶対失敗")
39
+ elsif total >= target
40
+ return Result.success("成功")
41
+ else
42
+ return Result.failure("失敗")
43
+ end
44
+ end
45
+
46
+ # 技能値判定の結果取得
47
+ # @param [Integer] total, dice_add, target
48
+ # @return [Result]
49
+ def get_result_of_skill_action(total, dice_add, target)
50
+ if dice_add == 12
51
+ return Result.critical("絶対成功")
52
+ elsif dice_add == 2
53
+ return Result.fumble("絶対失敗")
54
+ elsif total >= target
55
+ return Result.success("成功")
56
+ else
57
+ return Result.failure("失敗")
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
@@ -22,11 +22,11 @@ module BCDice
22
22
    크리티컬, 펌블치는 생략가능합니다. ([]자체를 생략가능)
23
23
    자동성공, 자동실패, 성공, 실패를 자동표기합니다.
24
24
  ・각종표
25
-  ・감정표 ET/감정표 2.0 ET2
26
-  ・징조표 OT/징조표ver2.0 OT2/징조표ver3.0 OT3
25
+  ・감정표 ET/감정표 2.0 ET2/개정판 감정표 MET
26
+  ・징조표 OT/징조표ver2.0 OT2/징조표ver3.0 OT3 / 개정판 전투 징조표 MBOT / 개정판 비전투 징조표 MNOT
27
27
   ・일그러짐표 DT/일그러짐표ver2.0 DT2/일그러짐표(야외) DTO/일그러짐표(바다) DTS/일그러짐표(저택・성) DTM
28
-  ・세계왜곡표  WDT/세계왜곡표2.0 WDT2
29
-  ・영구소실표 EDT
28
+  ・세계왜곡표  WDT/세계왜곡표2.0 WDT2/개정판 왜곡표 MDT/개정판 세계왜곡표 MWDT
29
+  ・영구소실표 EDT/개정판 영구소실표 MEDT
30
30
  ・D66다이스 있음
31
31
  INFO_MESSAGE_TEXT
32
32
 
@@ -54,7 +54,7 @@ module BCDice
54
54
  total = largest_two.sum + modifier
55
55
  num_1 = dice_list.count(1)
56
56
 
57
- additional_result =
57
+ result =
58
58
  if largest_two == [6, 6]
59
59
  Result.critical(" > 絶対成功!")
60
60
  elsif largest_two == [1, 1]
@@ -73,10 +73,11 @@ module BCDice
73
73
  sequence = [
74
74
  "(#{command})",
75
75
  "[#{dice_list.join(',')}]#{Format.modifier(modifier)}",
76
- "#{total}[#{largest_two.join(',')}]#{additional_result.text}#{fp_result}",
76
+ "#{total}[#{largest_two.join(',')}]#{result.text}#{fp_result}",
77
77
  ]
78
78
 
79
- return sequence.join(" > ")
79
+ result.text = sequence.join(" > ")
80
+ return result
80
81
  end
81
82
 
82
83
  # ダメージロール
@@ -90,24 +91,29 @@ module BCDice
90
91
  resist = m[4].to_i
91
92
 
92
93
  dice_list = @randomizer.roll_barabara(dice_count, 6)
94
+ normal_damage = damage(dice_list, resist)
93
95
 
94
- result = "(#{command}) > [#{dice_list.join(',')}]#{resist} > #{damage(dice_list, resist)}ダメージ"
96
+ result = "(#{command}) > [#{dice_list.join(',')}]#{resist}"
95
97
 
96
98
  critical_target = critical_up ? 1 : 2
97
99
 
98
100
  if dice_list.count(6) - dice_list.count(1) >= critical_target
99
- result += " クリティカルヒット!\n"
100
- result += additional_damage_roll(increase_critical_dice, resist)
101
+ result += critical_damage_roll(increase_critical_dice, resist, normal_damage)
102
+ result = Result.critical(result)
103
+ else
104
+ result += " > #{normal_damage}ダメージ"
105
+ result = normal_damage > 0 ? Result.success(result) : Result.failure(result)
101
106
  end
102
107
 
103
108
  return result
104
109
  end
105
110
 
106
- def additional_damage_roll(increase_critical_dice, resist)
111
+ def critical_damage_roll(increase_critical_dice, resist, normal_damage)
107
112
  dice_count = increase_critical_dice ? 8 : 4
108
113
 
109
114
  dice_list = @randomizer.roll_barabara(dice_count, 6)
110
- "(#{dice_count}DR#{resist}) [#{dice_list.join(',')}]#{resist} > #{damage(dice_list, resist)}ダメージ"
115
+ critical_damage = damage(dice_list, resist)
116
+ return " > クリティカルヒット! > (#{dice_count}DR#{resist}) > [#{dice_list.join(',')}]#{resist} > #{normal_damage + critical_damage}ダメージ"
111
117
  end
112
118
 
113
119
  # 回復ロール
@@ -119,8 +125,10 @@ module BCDice
119
125
  resist = m[2]&.to_i || 3
120
126
 
121
127
  dice_list = @randomizer.roll_barabara(dice_count, 6)
128
+ heal_amount = damage(dice_list, resist)
129
+ result_text = "(#{command}) > [#{dice_list.join(',')}]#{resist} > #{heal_amount}回復"
122
130
 
123
- return "(#{command}) [#{dice_list.join(',')}]#{resist} #{damage(dice_list, resist)}回復"
131
+ return heal_amount > 0 ? Result.success(result_text) : Result.failure(result_text)
124
132
  end
125
133
 
126
134
  def damage(dice_list, resist)
@@ -0,0 +1,129 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BCDice
4
+ module GameSystem
5
+ class NervWhitePaper < Base
6
+ # ゲームシステムの識別子
7
+ ID = 'NervWhitePaper'
8
+
9
+ # ゲームシステム名
10
+ NAME = '新世紀エヴァンゲリオンRPG NERV白書/使徒降臨'
11
+
12
+ # ゲームシステム名の読みがな
13
+ SORT_KEY = 'しんせいきえうあんけりおんああるひいしいねるふはくしよしとこおりん'
14
+
15
+ # ダイスボットの使い方
16
+ HELP_MESSAGE = <<~INFO_MESSAGETEXT
17
+ ■通常ロール(NR):成功、失敗、絶対成功、絶対失敗を表示します。
18
+ 例) NR
19
+
20
+ ■長所ロール(NA):成功、失敗、絶対成功、絶対失敗を表示します。
21
+ 例) NA
22
+
23
+ ■短所ロール(ND):成功、失敗、絶対成功、絶対失敗を表示します。
24
+ 例) ND
25
+
26
+ INFO_MESSAGETEXT
27
+
28
+ register_prefix('N[RAD]')
29
+
30
+ def eval_game_system_specific_command(command)
31
+ resolute_regular_action(command) ||
32
+ resolute_advantage_action(command) ||
33
+ resolute_disadvantage_action(command)
34
+ end
35
+
36
+ private
37
+
38
+ # 通常ロールによる判定
39
+ # @param [String] command
40
+ # @return [Result]
41
+ def resolute_regular_action(command)
42
+ m = /NR/.match(command)
43
+ return nil unless m
44
+
45
+ dices = @randomizer.roll_barabara(2, 6)
46
+ dice_text = dices.join(",")
47
+ dice_add = dices.sum
48
+
49
+ output = "(NR) > #{dice_text}"
50
+
51
+ if dice_add == 7
52
+ output += " > 絶対成功"
53
+ return Result.critical(output)
54
+ elsif dice_add == 2
55
+ output += " > 絶対失敗"
56
+ return Result.fumble(output)
57
+ elsif dice_add == 12
58
+ output += " > 絶対失敗"
59
+ return Result.fumble(output)
60
+ elsif dice_add.modulo(2) == 0
61
+ output += " > 失敗"
62
+ return Result.failure(output)
63
+ else
64
+ output += " > 成功"
65
+ return Result.success(output)
66
+ end
67
+ end
68
+
69
+ # 長所ロールによる判定
70
+ # @param [String] command
71
+ # @return [Result]
72
+ def resolute_advantage_action(command)
73
+ m = /NA/.match(command)
74
+ return nil unless m
75
+
76
+ dices = @randomizer.roll_barabara(2, 6)
77
+ dice_text = dices.join(",")
78
+ dice_add = dices.sum
79
+
80
+ output = "(NA) > #{dice_text}"
81
+
82
+ if dice_add == 7
83
+ output += " > 絶対成功"
84
+ return Result.critical(output)
85
+ elsif dice_add == 2
86
+ output += " > 絶対失敗"
87
+ return Result.fumble(output)
88
+ elsif dice_add == 12
89
+ output += " > 絶対失敗"
90
+ return Result.fumble(output)
91
+ elsif dices[0] == dices[1]
92
+ output += " > 失敗"
93
+ return Result.failure(output)
94
+ else
95
+ output += " > 成功"
96
+ return Result.success(output)
97
+ end
98
+ end
99
+
100
+ # 短所ロールによる判定
101
+ # @param [String] command
102
+ # @return [Result]
103
+ def resolute_disadvantage_action(command)
104
+ m = /ND/.match(command)
105
+ return nil unless m
106
+
107
+ dices = @randomizer.roll_barabara(2, 6)
108
+ dice_text = dices.join(",")
109
+ dice_add = dices.sum
110
+
111
+ output = "(ND) > #{dice_text}"
112
+
113
+ if dice_add == 7
114
+ output += " > 絶対成功"
115
+ return Result.critical(output)
116
+ elsif dice_add == 2
117
+ output += " > 絶対失敗"
118
+ return Result.fumble(output)
119
+ elsif dice_add == 12
120
+ output += " > 絶対失敗"
121
+ return Result.fumble(output)
122
+ elsif dice_add != 7
123
+ output += " > 失敗"
124
+ return Result.failure(output)
125
+ end
126
+ end
127
+ end
128
+ end
129
+ end
@@ -0,0 +1,198 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BCDice
4
+ module GameSystem
5
+ class RogueLikeHalf < Base
6
+ # ゲームシステムの識別子
7
+ ID = 'RogueLikeHalf'
8
+
9
+ # ゲームシステム名
10
+ NAME = 'ローグライクハーフ'
11
+
12
+ # ゲームシステム名の読みがな
13
+ SORT_KEY = 'ろおくらいくはあふ'
14
+
15
+ # ダイスボットの使い方
16
+ HELP_MESSAGE = <<~INFO_MESSAGETEXT
17
+ ■判定 RH+x>=t x:技量点 t:達成値(威力)
18
+
19
+ 例)RH+1>=5: ダイスを1個振って、技量点1,達成値5の結果を表示(クリティカル・ファンブルも表示)
20
+
21
+ ■D33 D33+x x:修正値
22
+
23
+ 例)D33: 3面ダイスを2個振って、その結果を表示。
24
+
25
+ ■宝物表 NTT+x x:修正値
26
+ INFO_MESSAGETEXT
27
+
28
+ def initialize(command)
29
+ super(command)
30
+
31
+ @sort_barabara_dice = true # バラバラロール(Bコマンド)でソート有
32
+ end
33
+
34
+ def eval_game_system_specific_command(command)
35
+ resolute_action(command) ||
36
+ resolute_d33(command) ||
37
+ roll_table_command(command)
38
+ end
39
+
40
+ private
41
+
42
+ def with_symbol(number)
43
+ if number == 0
44
+ return "+0"
45
+ elsif number > 0
46
+ return "+#{number}"
47
+ else
48
+ return number.to_s
49
+ end
50
+ end
51
+
52
+ # 判定ロール
53
+ # @param [String] command
54
+ # @return [Result]
55
+ def get_result_of_action(total, die, target)
56
+ if die == 6
57
+ return Result.critical("クリティカル")
58
+ elsif die == 1
59
+ return Result.fumble("ファンブル")
60
+ elsif total >= target
61
+ return Result.success("成功")
62
+ else
63
+ return Result.failure("失敗")
64
+ end
65
+ end
66
+
67
+ def resolute_action(command)
68
+ m = /RH([+-]\d)*(>=(\d+))?/.match(command)
69
+ return nil unless m
70
+
71
+ modify = m[1] ? Arithmetic.eval(m[1], @round_type) : 0
72
+ target = m[3].to_i
73
+ target = 4 if target == 0
74
+
75
+ die = @randomizer.roll_once(6)
76
+ die_text = die.to_s
77
+ total = die + modify
78
+
79
+ result = get_result_of_action(total, die, target)
80
+
81
+ command_text = "(RH#{with_symbol(modify)}>=#{target})"
82
+ sequence = [
83
+ command_text,
84
+ "[#{die_text}]#{with_symbol(modify)}",
85
+ total,
86
+ result.text,
87
+ ].compact
88
+
89
+ result.text = sequence.join(" > ")
90
+
91
+ return result
92
+ end
93
+
94
+ # D33ロール
95
+ # @param [String] command
96
+ # @return [Result]
97
+ def resolute_d33(command)
98
+ m = /D33([+-]\d+)*/.match(command)
99
+ return nil unless m
100
+
101
+ modify = m[1] ? Arithmetic.eval(m[1], @round_type) : 0
102
+
103
+ dice = @randomizer.roll_barabara(2, 3)
104
+ dice_text = dice.join("")
105
+ dice_total = dice[0] * 3 + dice[1] + modify
106
+ dice_total = 12 if dice_total > 12
107
+ dice_total = 4 if dice_total < 4
108
+ p = dice_total.divmod(3)
109
+ if p[1] == 0
110
+ p[0] = p[0] - 1
111
+ p[1] = 3
112
+ end
113
+ total = p[0] * 10 + p[1]
114
+
115
+ sequence = [
116
+ "(#{command})",
117
+ dice_text,
118
+ ].compact
119
+
120
+ if modify != 0
121
+ sequence = [
122
+ "(#{command})",
123
+ "#{dice_text}#{with_symbol(modify)}",
124
+ total,
125
+ ].compact
126
+ end
127
+
128
+ return Result.new(sequence.join(" > "))
129
+ end
130
+
131
+ def roll_table_command(command)
132
+ command = command.upcase
133
+ result = []
134
+
135
+ m = /([A-Z]+)(([+]|-)(\d+))?/.match(command)
136
+ return result unless m
137
+
138
+ command = m[1]
139
+ operator = m[3]
140
+ value = m[4].to_i
141
+
142
+ return get_another_table_result(command, operator, value)
143
+ end
144
+
145
+ def get_another_table_result(command, operator, value)
146
+ result = ""
147
+
148
+ table_name = command
149
+ table = TABLES[table_name]
150
+ return result if table.nil?
151
+
152
+ index = get_table_index(operator, value, 1, 6)
153
+
154
+ info = table.choice(index)
155
+ result = "#{info.table_name}:#{info.value}:#{info.body}"
156
+
157
+ return result
158
+ end
159
+
160
+ def get_table_index(operator, value, dice_count, dice_type)
161
+ modify = 0
162
+
163
+ case operator
164
+ when "+"
165
+ modify = value
166
+ when "-"
167
+ modify = value * -1
168
+ end
169
+
170
+ index = @randomizer.roll_sum(dice_count, dice_type)
171
+ index += modify
172
+
173
+ index = [index, dice_count * 1].max
174
+ index = [index, dice_count * dice_type + 1].min
175
+
176
+ return index
177
+ end
178
+
179
+ TABLES = {
180
+ "NTT" => DiceTable::Table.new(
181
+ "宝物表",
182
+ "1D6",
183
+ [
184
+ "金貨1枚",
185
+ "1d6枚の金貨",
186
+ "2d6枚の金貨(下限は金貨5枚)",
187
+ "1個のアクセサリー(1d6×1d6枚の金貨と同等の価値)",
188
+ "1個の宝石・小(1d6×5枚の金貨と同等の価値。下限は金貨15枚の価値)",
189
+ "1個の宝石・大(2d6×5枚の金貨と同等の価値。下限は金貨30枚の価値)",
190
+ "【魔法の宝物表】でダイスロールを行うこと。",
191
+ ]
192
+ )
193
+ }.freeze
194
+
195
+ register_prefix('RH', 'D33', TABLES.keys)
196
+ end
197
+ end
198
+ end
@@ -14,13 +14,16 @@ module BCDice
14
14
 
15
15
  # ダイスボットの使い方
16
16
  HELP_MESSAGE = <<~MESSAGETEXT
17
- ・判定コマンド クリティカル、スペシャル、ファンブルを含めた判定を行う。
18
- RQG<=成功率
17
+ ・判定コマンド 決定的成功、効果的成功、ファンブルを含めた判定を行う。
18
+ RQG<=成功率 (基本書式)
19
+ RQG成功率 (省略記法)
19
20
 
20
- 例1:RQG<=80 (技能値80で判定)
21
+ 例1:RQG<=80 (技能値80で判定)
21
22
  例2:RQG<=80+20 (技能値100で判定)
23
+ 例3:RQG80 (省略書式で技能値80の判定)
24
+ 例4:RQG80+20 (省略書式で技能値100の判定)
22
25
 
23
- ・抵抗判定コマンド(能動-受動) クリティカル、スペシャル、ファンブルを含めた判定を行う。
26
+ ・抵抗判定コマンド(能動-受動) 決定的成功、効果的成功、ファンブルを含めた判定を行う。
24
27
  RES(能動能力-受動能力)m増強値
25
28
  増強値は省略可能。
26
29
 
@@ -28,7 +31,7 @@ module BCDice
28
31
  例2:RES(9-11)m20 (能動能力9 vs 受動能力11、+20%の増強が能動側に入る判定)
29
32
  例3:RES(9)m50 (能動能力と受動能力の差が9で、+50%の増強が能動側に入る判定)
30
33
 
31
- ・抵抗判定コマンド(能動側のみ) クリティカル、スペシャル、ファンブルは含めず判定を行う。
34
+ ・抵抗判定コマンド(能動側のみ) 決定的成功、効果的成功、ファンブルは含めず判定を行う。
32
35
  RSA(能動能力)m増強値
33
36
  増強値は省略可能。
34
37
 
@@ -55,18 +58,18 @@ module BCDice
55
58
 
56
59
  # 技能などの一般判定
57
60
  def do_ability_roll(command)
58
- m = %r{\A(RQG)(<=([+-/*\d]+))?$}.match(command)
61
+ m = %r{\A(RQG)((<=)?([+-/*\d]+))?$}.match(command)
59
62
  unless m
60
63
  return nil
61
64
  end
62
65
 
63
66
  roll_value = @randomizer.roll_once(100)
64
- unless m[3]
67
+ unless m[4]
65
68
  # RQGのみ指定された場合は1d100を振ったのと同じ挙動
66
69
  return "(1D100) > #{roll_value}"
67
70
  end
68
71
 
69
- ability_value = Arithmetic.eval(m[3], RoundType::ROUND)
72
+ ability_value = Arithmetic.eval(m[4], RoundType::ROUND)
70
73
  result_prefix_str = "(1D100<=#{ability_value}) >"
71
74
 
72
75
  if ability_value == 0
@@ -125,7 +128,7 @@ module BCDice
125
128
  active_value = active_ability_value * 5 + modifiy_value
126
129
  result_prefix_str = "(1D100<=#{active_value}) > #{roll_value} >"
127
130
 
128
- note_str = "クリティカル/スペシャル、ファンブルは未処理。必要なら確認すること。"
131
+ note_str = "決定的成功、効果的成功、ファンブルは未処理。必要なら確認すること。"
129
132
 
130
133
  if roll_value >= 96
131
134
  # 96以上は無条件で失敗
@@ -146,8 +149,8 @@ module BCDice
146
149
  funmble_value = ((100 - success_value.to_f) / 20).round
147
150
 
148
151
  if (roll_value == 1) || (roll_value <= critical_value)
149
- # クリティカル(01は必ずクリティカル)
150
- Result.critical("#{result_str} クリティカル/スペシャル")
152
+ # 決定的成功(01は必ず決定的成功)
153
+ Result.critical("#{result_str} 決定的成功")
151
154
  elsif (roll_value == 100) || (roll_value >= (100 - funmble_value + 1))
152
155
  # ファンブル(00は必ずファンブル)
153
156
  Result.fumble("#{result_str} ファンブル")
@@ -155,8 +158,8 @@ module BCDice
155
158
  # 失敗(96以上は必ず失敗、出目が01-05ではなく技能値より上なら失敗)
156
159
  Result.failure("#{result_str} 失敗")
157
160
  elsif roll_value <= special_value
158
- # スペシャル
159
- Result.success("#{result_str} スペシャル")
161
+ # 効果的成功
162
+ Result.success("#{result_str} 効果的成功")
160
163
  elsif (roll_value <= 5) || (roll_value <= success_value)
161
164
  # 成功(05以下は必ず成功)
162
165
  Result.success("#{result_str} 成功")