bcdice 3.3.0 → 3.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +158 -74
  3. data/README.md +2 -1
  4. data/i18n/BeginningIdol/ja_jp.yml +2806 -0
  5. data/i18n/BeginningIdol/ko_kr.yml +1400 -0
  6. data/i18n/Cthulhu/zh_hans.yml +11 -0
  7. data/i18n/FutariSousa/ja_jp.yml +705 -9
  8. data/i18n/KillDeathBusiness/ja_jp.yml +2 -2
  9. data/i18n/MagicaLogia/ja_jp.yml +1 -1
  10. data/i18n/MonotoneMuseum/ko_kr.yml +526 -53
  11. data/i18n/SwordWorld/ja_jp.yml +6 -0
  12. data/i18n/SwordWorld2_0/ja_jp.yml +37 -0
  13. data/i18n/SwordWorld2_5/ja_jp.yml +57 -0
  14. data/lib/bcdice/common_command/add_dice/node.rb +28 -4
  15. data/lib/bcdice/common_command/add_dice/parser.rb +149 -85
  16. data/lib/bcdice/common_command/choice.rb +82 -7
  17. data/lib/bcdice/common_command/tally_dice/node.rb +135 -0
  18. data/lib/bcdice/common_command/tally_dice/parser.rb +302 -0
  19. data/lib/bcdice/common_command/tally_dice.rb +19 -0
  20. data/lib/bcdice/common_command.rb +2 -0
  21. data/lib/bcdice/dice_table/d66_left_range_table.rb +29 -0
  22. data/lib/bcdice/dice_table/d66_parity_table.rb +8 -0
  23. data/lib/bcdice/dice_table/d66_table.rb +5 -1
  24. data/lib/bcdice/dice_table.rb +1 -0
  25. data/lib/bcdice/game_system/AngelGear.rb +9 -4
  26. data/lib/bcdice/game_system/Aoharubaan.rb +91 -0
  27. data/lib/bcdice/game_system/AssaultEngine.rb +91 -0
  28. data/lib/bcdice/game_system/Avandner.rb +1 -2
  29. data/lib/bcdice/game_system/Ayabito.rb +229 -0
  30. data/lib/bcdice/game_system/BadLife.rb +264 -289
  31. data/lib/bcdice/game_system/Bakenokawa.rb +244 -0
  32. data/lib/bcdice/game_system/BattleTech.rb +1 -1
  33. data/lib/bcdice/game_system/BeginningIdol.rb +116 -2390
  34. data/lib/bcdice/game_system/BeginningIdol_Korean.rb +10 -2312
  35. data/lib/bcdice/game_system/CastleInGray.rb +133 -0
  36. data/lib/bcdice/game_system/Cthulhu.rb +2 -2
  37. data/lib/bcdice/game_system/Cthulhu7th.rb +10 -10
  38. data/lib/bcdice/game_system/Cthulhu_SimplifiedChinese.rb +60 -0
  39. data/lib/bcdice/game_system/CyberpunkRed.rb +135 -0
  40. data/lib/bcdice/game_system/DarkDaysDrive.rb +76 -41
  41. data/lib/bcdice/game_system/DoubleCross.rb +5 -0
  42. data/lib/bcdice/game_system/Dracurouge.rb +2 -1
  43. data/lib/bcdice/game_system/Elysion.rb +36 -20
  44. data/lib/bcdice/game_system/Emoklore.rb +1 -1
  45. data/lib/bcdice/game_system/FateCoreSystem.rb +117 -0
  46. data/lib/bcdice/game_system/FutariSousa.rb +48 -4
  47. data/lib/bcdice/game_system/GranCrest.rb +171 -406
  48. data/lib/bcdice/game_system/Irisbane.rb +154 -0
  49. data/lib/bcdice/game_system/Karukami.rb +84 -0
  50. data/lib/bcdice/game_system/KemonoNoMori.rb +17 -17
  51. data/lib/bcdice/game_system/KurayamiCrying.rb +1 -1
  52. data/lib/bcdice/game_system/MonotoneMuseum_Korean.rb +4 -4
  53. data/lib/bcdice/game_system/NeverCloud.rb +19 -8
  54. data/lib/bcdice/game_system/PersonaO.rb +86 -0
  55. data/lib/bcdice/game_system/Revulture.rb +2 -2
  56. data/lib/bcdice/game_system/Shiranui.rb +145 -0
  57. data/lib/bcdice/game_system/ShuumatsuKikou.rb +298 -0
  58. data/lib/bcdice/game_system/StarryDolls.rb +318 -0
  59. data/lib/bcdice/game_system/SteamPunkers.rb +14 -1
  60. data/lib/bcdice/game_system/StellarKnights.rb +1 -1
  61. data/lib/bcdice/game_system/{SterileLife.rb → StellarLife.rb} +162 -226
  62. data/lib/bcdice/game_system/StrangerOfSwordCity.rb +18 -5
  63. data/lib/bcdice/game_system/SwordWorld.rb +11 -7
  64. data/lib/bcdice/game_system/SwordWorld2_0.rb +30 -38
  65. data/lib/bcdice/game_system/SwordWorld2_5.rb +9 -63
  66. data/lib/bcdice/game_system/TalesFromTheLoop.rb +83 -0
  67. data/lib/bcdice/game_system/TorgEternity.rb +2 -2
  68. data/lib/bcdice/game_system/ToshiakiHolyGrailWar.rb +92 -0
  69. data/lib/bcdice/game_system/VampireTheMasquerade5th.rb +29 -28
  70. data/lib/bcdice/game_system/YearZeroEngine.rb +40 -19
  71. data/lib/bcdice/game_system/beginning_idol/accessories_table.rb +31 -0
  72. data/lib/bcdice/game_system/beginning_idol/bad_status_table.rb +43 -0
  73. data/lib/bcdice/game_system/beginning_idol/chain_d66_table.rb +29 -0
  74. data/lib/bcdice/game_system/beginning_idol/chain_table.rb +37 -0
  75. data/lib/bcdice/game_system/beginning_idol/costume_table.rb +37 -0
  76. data/lib/bcdice/game_system/beginning_idol/d6_twice_table.rb +36 -0
  77. data/lib/bcdice/game_system/beginning_idol/item_table.rb +51 -0
  78. data/lib/bcdice/game_system/beginning_idol/my_skill_name_table.rb +44 -0
  79. data/lib/bcdice/game_system/beginning_idol/random_event_table.rb +31 -0
  80. data/lib/bcdice/game_system/beginning_idol/skill_table.rb +63 -0
  81. data/lib/bcdice/game_system/beginning_idol/table.rb +193 -0
  82. data/lib/bcdice/game_system/beginning_idol/with_abnormality.rb +74 -0
  83. data/lib/bcdice/game_system/beginning_idol/work_table.rb +57 -0
  84. data/lib/bcdice/game_system/cyberpunk_red/tables.rb +530 -0
  85. data/lib/bcdice/game_system/meikyu_kingdom/tables.rb +1 -1
  86. data/lib/bcdice/game_system/meikyu_kingdom_basic/table.rb +1 -1
  87. data/lib/bcdice/game_system/one_way_heroics/random_event_table.rb +4 -4
  88. data/lib/bcdice/game_system/satasupe/tables.rb +1 -1
  89. data/lib/bcdice/game_system/sword_world/rating_options.rb +47 -0
  90. data/lib/bcdice/game_system/sword_world/rating_parsed.rb +40 -45
  91. data/lib/bcdice/game_system/sword_world/rating_parser.rb +172 -141
  92. data/lib/bcdice/game_system/sword_world/transcendent_test.rb +14 -10
  93. data/lib/bcdice/game_system.rb +16 -1
  94. data/lib/bcdice/randomizer.rb +1 -1
  95. data/lib/bcdice/version.rb +1 -1
  96. metadata +45 -5
@@ -11,6 +11,7 @@ require "bcdice/arithmetic/node"
11
11
  require "bcdice/enum"
12
12
  require "bcdice/game_system/sword_world/rating_lexer"
13
13
  require "bcdice/game_system/sword_world/rating_parsed"
14
+ require "bcdice/game_system/sword_world/rating_options"
14
15
 
15
16
  module BCDice
16
17
  module GameSystem
@@ -44,16 +45,16 @@ end
44
45
  private
45
46
 
46
47
  def parsed(rate, modifier, option)
47
- RatingParsed.new.tap do |p|
48
- p.rate = rate
49
- p.critical = option[:critical]&.eval(@round_type)
50
- p.kept_modify = option[:kept_modify]&.eval(@round_type)
51
- p.first_to = option[:first_to]
52
- p.first_modify = option[:first_modify]
53
- p.rateup = option[:rateup]&.eval(@round_type)
54
- p.greatest_fortune = option.fetch(:greatest_fortune, false)
55
- p.modifier = modifier.eval(@round_type)
56
- p.modifier_after_half = option[:modifier_after_half]&.eval(@round_type)
48
+ RatingParsed.new(rate, modifier).tap do |p|
49
+ p.kept_modify = option.kept_modify&.eval(@round_type) || 0
50
+ p.first_to = option.first_to || 0
51
+ p.first_modify = option.first_modify || 0
52
+ p.rateup = option.rateup&.eval(@round_type) || 0
53
+ p.greatest_fortune = option.greatest_fortune if !option.greatest_fortune.nil?
54
+ p.semi_fixed_val = option.semi_fixed_val&.clamp(1, 6) || 0
55
+ p.tmp_fixed_val = option.tmp_fixed_val&.clamp(1, 6) || 0
56
+ p.modifier_after_half = option.modifier_after_half&.eval(@round_type)
57
+ p.critical = option.critical&.eval(@round_type)&.clamp(0, 13) || (p.half ? 13 : 10)
57
58
  end
58
59
  end
59
60
 
@@ -64,105 +65,111 @@ end
64
65
  ##### State transition tables begin ###
65
66
 
66
67
  racc_action_table = [
67
- 15, 14, 16, 5, 18, 19, 51, 52, 21, 22,
68
- 11, 53, 12, 17, 13, 15, 14, 16, 4, 18,
69
- 19, 4, 8, 3, 28, 11, 28, 12, 17, 13,
70
- 24, 25, 24, 25, 27, 28, 27, 28, 49, 50,
71
- 9, 24, 25, 24, 25, 27, 28, 27, 28, 49,
72
- 50, 35, 24, 25, 24, 25, 27, 28, 27, 28,
73
- 49, 50, 42, 24, 25, 24, 25, 27, 28, 27,
74
- 28, 49, 50, 47, 24, 25, 24, 25, 27, 28,
75
- 27, 28, 49, 50, 48, 24, 25, 24, 25, 27,
76
- 28, 27, 28, 49, 50, nil, 24, 25, 24, 25,
77
- 27, 28, 27, 28, 49, 50, nil, 24, 25, 24,
78
- 25, 27, 30, 27, nil, nil, nil, nil, 31, 32 ]
68
+ 15, 14, 16, 5, 17, 18, 20, 21, 57, 58,
69
+ 23, 24, 11, 59, 12, 19, 13, 15, 14, 16,
70
+ 4, 17, 18, 20, 21, 4, 30, 3, 30, 11,
71
+ 8, 12, 19, 13, 26, 27, 26, 27, 29, 30,
72
+ 29, 30, 55, 56, 55, 56, 30, 26, 27, 26,
73
+ 27, 29, 30, 29, 26, 27, 9, 30, 29, 30,
74
+ 26, 27, 55, 56, 29, 26, 27, 26, 27, 29,
75
+ 30, 29, 30, 55, 56, 55, 56, 30, 26, 27,
76
+ 26, 27, 29, 30, 29, 26, 27, 37, 30, 29,
77
+ 30, 26, 27, 55, 56, 29, 26, 27, 26, 27,
78
+ 29, 30, 29, 30, 55, 56, 38, 39, 32, 26,
79
+ 27, 26, 27, 29, 46, 29, 33, 34, 51, 52,
80
+ 53, 54 ]
79
81
 
80
82
  racc_action_check = [
81
- 6, 6, 6, 1, 6, 6, 45, 45, 10, 10,
82
- 6, 45, 6, 6, 6, 20, 20, 20, 3, 20,
83
- 20, 0, 4, 0, 11, 20, 12, 20, 20, 20,
84
- 11, 11, 12, 12, 11, 14, 12, 15, 37, 37,
85
- 5, 14, 14, 15, 15, 14, 17, 15, 18, 39,
86
- 39, 16, 17, 17, 18, 18, 17, 19, 18, 21,
87
- 40, 40, 23, 19, 19, 21, 21, 19, 22, 21,
88
- 24, 41, 41, 31, 22, 22, 24, 24, 22, 25,
89
- 24, 27, 46, 46, 32, 25, 25, 27, 27, 25,
90
- 49, 27, 50, 56, 56, nil, 49, 49, 50, 50,
91
- 49, 51, 50, 52, 57, 57, nil, 51, 51, 52,
92
- 52, 51, 13, 52, nil, nil, nil, nil, 13, 13 ]
83
+ 6, 6, 6, 1, 6, 6, 6, 6, 49, 49,
84
+ 10, 10, 6, 49, 6, 6, 6, 22, 22, 22,
85
+ 3, 22, 22, 22, 22, 0, 11, 0, 12, 22,
86
+ 4, 22, 22, 22, 11, 11, 12, 12, 11, 14,
87
+ 12, 15, 41, 41, 43, 43, 19, 14, 14, 15,
88
+ 15, 14, 20, 15, 19, 19, 5, 21, 19, 23,
89
+ 20, 20, 44, 44, 20, 21, 21, 23, 23, 21,
90
+ 24, 23, 26, 45, 45, 50, 50, 27, 24, 24,
91
+ 26, 26, 24, 29, 26, 27, 27, 16, 55, 27,
92
+ 56, 29, 29, 62, 62, 29, 55, 55, 56, 56,
93
+ 55, 57, 56, 58, 63, 63, 17, 18, 13, 57,
94
+ 57, 58, 58, 57, 25, 58, 13, 13, 33, 34,
95
+ 38, 39 ]
93
96
 
94
97
  racc_action_pointer = [
95
- 18, 3, nil, 15, 20, 40, -4, nil, nil, nil,
96
- 0, 22, 24, 110, 33, 35, 44, 44, 46, 55,
97
- 11, 57, 66, 47, 68, 77, nil, 79, nil, nil,
98
- nil, 71, 82, nil, nil, nil, nil, 28, nil, 39,
99
- 50, 61, nil, nil, nil, -2, 72, nil, nil, 88,
100
- 90, 99, 101, nil, nil, nil, 83, 94 ]
98
+ 22, 3, nil, 17, 28, 56, -4, nil, nil, nil,
99
+ 0, 24, 26, 106, 37, 39, 80, 99, 100, 44,
100
+ 50, 55, 13, 57, 68, 97, 70, 75, nil, 81,
101
+ nil, nil, nil, 116, 117, nil, nil, nil, 118, 119,
102
+ nil, 30, nil, 32, 50, 61, nil, nil, nil, -2,
103
+ 63, nil, nil, nil, nil, 86, 88, 99, 101, nil,
104
+ nil, nil, 81, 92 ]
101
105
 
102
106
  racc_action_default = [
103
- -31, -31, -4, -31, -31, -31, -1, -4, -3, 58,
104
- -5, -31, -31, -31, -11, -31, -31, -31, -31, -31,
105
- -2, -31, -31, -31, -31, -31, -28, -31, -30, -7,
106
- -8, -31, -31, -12, -13, -14, -15, -16, -25, -17,
107
- -18, -19, -6, -26, -27, -31, -22, -9, -10, -31,
108
- -31, -31, -31, -29, -23, -24, -20, -21 ]
107
+ -33, -33, -4, -33, -33, -33, -1, -4, -3, 64,
108
+ -5, -33, -33, -33, -11, -33, -33, -33, -33, -33,
109
+ -33, -33, -2, -33, -33, -33, -33, -33, -30, -33,
110
+ -32, -7, -8, -33, -33, -12, -13, -14, -33, -33,
111
+ -17, -18, -27, -19, -20, -21, -6, -28, -29, -33,
112
+ -24, -9, -10, -15, -16, -33, -33, -33, -33, -31,
113
+ -25, -26, -22, -23 ]
109
114
 
110
115
  racc_goto_table = [
111
- 23, 29, 2, 33, 34, 7, 36, 37, 39, 1,
112
- 40, 41, 6, 43, 44, 45, 46, 20, nil, nil,
116
+ 25, 31, 6, 35, 36, 1, 49, 22, 40, 41,
117
+ 43, 2, 44, 45, 7, 47, 48, nil, 50, nil,
113
118
  nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
114
- nil, nil, nil, nil, nil, nil, nil, nil, 54, 55,
115
- 56, 57 ]
119
+ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
120
+ nil, nil, nil, nil, 60, 61, 62, 63 ]
116
121
 
117
122
  racc_goto_check = [
118
- 5, 5, 2, 5, 5, 2, 5, 6, 6, 1,
119
- 6, 6, 3, 5, 5, 7, 6, 3, nil, nil,
123
+ 5, 5, 3, 5, 5, 1, 7, 3, 5, 6,
124
+ 6, 2, 6, 6, 2, 5, 5, nil, 6, nil,
125
+ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
120
126
  nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
121
- nil, nil, nil, nil, nil, nil, nil, nil, 5, 5,
122
- 6, 6 ]
127
+ nil, nil, nil, nil, 5, 5, 6, 6 ]
123
128
 
124
129
  racc_goto_pointer = [
125
- nil, 9, 2, 10, nil, -11, -11, -12, nil ]
130
+ nil, 5, 11, 0, nil, -11, -11, -23, nil ]
126
131
 
127
132
  racc_goto_default = [
128
- nil, nil, nil, nil, 10, 38, nil, nil, 26 ]
133
+ nil, nil, nil, nil, 10, 42, nil, nil, 28 ]
129
134
 
130
135
  racc_reduce_table = [
131
136
  0, 0, :racc_error,
132
- 2, 20, :_reduce_1,
133
- 3, 20, :_reduce_2,
134
- 2, 21, :_reduce_3,
135
- 0, 22, :_reduce_4,
136
- 2, 22, :_reduce_5,
137
- 4, 22, :_reduce_6,
138
- 3, 22, :_reduce_7,
139
- 3, 22, :_reduce_8,
140
- 4, 22, :_reduce_9,
141
- 4, 22, :_reduce_10,
142
- 2, 22, :_reduce_11,
143
- 3, 22, :_reduce_12,
144
- 3, 22, :_reduce_13,
145
- 3, 22, :_reduce_14,
146
- 3, 22, :_reduce_15,
147
- 2, 23, :_reduce_16,
148
- 2, 23, :_reduce_17,
149
- 3, 23, :_reduce_18,
150
- 3, 23, :_reduce_19,
151
- 3, 26, :_reduce_20,
152
- 3, 26, :_reduce_21,
137
+ 2, 22, :_reduce_1,
138
+ 3, 22, :_reduce_2,
139
+ 2, 23, :_reduce_3,
140
+ 0, 24, :_reduce_4,
141
+ 2, 24, :_reduce_5,
142
+ 4, 24, :_reduce_6,
143
+ 3, 24, :_reduce_7,
144
+ 3, 24, :_reduce_8,
145
+ 4, 24, :_reduce_9,
146
+ 4, 24, :_reduce_10,
147
+ 2, 24, :_reduce_11,
148
+ 3, 24, :_reduce_12,
149
+ 3, 24, :_reduce_13,
150
+ 3, 24, :_reduce_14,
151
+ 4, 24, :_reduce_15,
152
+ 4, 24, :_reduce_16,
153
+ 3, 24, :_reduce_17,
154
+ 2, 25, :_reduce_18,
155
+ 2, 25, :_reduce_19,
156
+ 3, 25, :_reduce_20,
157
+ 3, 25, :_reduce_21,
158
+ 3, 28, :_reduce_22,
159
+ 3, 28, :_reduce_23,
160
+ 1, 28, :_reduce_none,
161
+ 3, 27, :_reduce_25,
162
+ 3, 27, :_reduce_26,
163
+ 1, 27, :_reduce_none,
164
+ 2, 26, :_reduce_28,
165
+ 2, 26, :_reduce_29,
153
166
  1, 26, :_reduce_none,
154
- 3, 25, :_reduce_23,
155
- 3, 25, :_reduce_24,
156
- 1, 25, :_reduce_none,
157
- 2, 24, :_reduce_26,
158
- 2, 24, :_reduce_27,
159
- 1, 24, :_reduce_none,
160
- 3, 27, :_reduce_29,
161
- 1, 27, :_reduce_30 ]
167
+ 3, 29, :_reduce_31,
168
+ 1, 29, :_reduce_32 ]
162
169
 
163
- racc_reduce_n = 31
170
+ racc_reduce_n = 33
164
171
 
165
- racc_shift_n = 58
172
+ racc_shift_n = 64
166
173
 
167
174
  racc_token_table = {
168
175
  false => 0,
@@ -173,19 +180,21 @@ racc_token_table = {
173
180
  :H => 5,
174
181
  :G => 6,
175
182
  :F => 7,
176
- :PLUS => 8,
177
- :MINUS => 9,
178
- :ASTERISK => 10,
179
- :SLASH => 11,
180
- :PARENL => 12,
181
- :PARENR => 13,
182
- :BRACKETL => 14,
183
- :BRACKETR => 15,
184
- :AT => 16,
185
- :SHARP => 17,
186
- :DOLLAR => 18 }
187
-
188
- racc_nt_base = 19
183
+ :S => 8,
184
+ :T => 9,
185
+ :PLUS => 10,
186
+ :MINUS => 11,
187
+ :ASTERISK => 12,
188
+ :SLASH => 13,
189
+ :PARENL => 14,
190
+ :PARENR => 15,
191
+ :BRACKETL => 16,
192
+ :BRACKETR => 17,
193
+ :AT => 18,
194
+ :SHARP => 19,
195
+ :DOLLAR => 20 }
196
+
197
+ racc_nt_base = 21
189
198
 
190
199
  racc_use_result_var = true
191
200
 
@@ -214,6 +223,8 @@ Racc_token_to_s_table = [
214
223
  "H",
215
224
  "G",
216
225
  "F",
226
+ "S",
227
+ "T",
217
228
  "PLUS",
218
229
  "MINUS",
219
230
  "ASTERISK",
@@ -243,17 +254,17 @@ Racc_debug_parser = false
243
254
 
244
255
  def _reduce_1(val, _values, result)
245
256
  rate, option = val
246
- modifier = option[:modifier] || Arithmetic::Node::Number.new(0)
247
- result = parsed(rate, modifier, option)
257
+ modifier = option.modifier || Arithmetic::Node::Number.new(0)
258
+ result = parsed(rate, modifier.eval(@round_type), option)
248
259
 
249
260
  result
250
261
  end
251
262
 
252
263
  def _reduce_2(val, _values, result)
253
264
  _, rate, option = val
254
- option[:modifier_after_half] ||= Arithmetic::Node::Number.new(0)
255
- modifier = option[:modifier] || Arithmetic::Node::Number.new(0)
256
- result = parsed(rate, modifier, option)
265
+ option.modifier_after_half ||= Arithmetic::Node::Number.new(0)
266
+ modifier = option.modifier || Arithmetic::Node::Number.new(0)
267
+ result = parsed(rate, modifier.eval(@round_type), option)
257
268
 
258
269
  result
259
270
  end
@@ -264,16 +275,16 @@ def _reduce_3(val, _values, result)
264
275
  end
265
276
 
266
277
  def _reduce_4(val, _values, result)
267
- result = {}
278
+ result = RatingOptions.new
268
279
 
269
280
  result
270
281
  end
271
282
 
272
283
  def _reduce_5(val, _values, result)
273
284
  option, term = val
274
- raise ParseError unless option[:modifier].nil?
285
+ raise ParseError unless option.modifier.nil?
275
286
 
276
- option[:modifier] = term
287
+ option.modifier = term
277
288
  result = option
278
289
 
279
290
  result
@@ -281,9 +292,9 @@ end
281
292
 
282
293
  def _reduce_6(val, _values, result)
283
294
  option, _, term, _ = val
284
- raise ParseError unless option[:critical].nil?
295
+ raise ParseError unless option.critical.nil?
285
296
 
286
- option[:critical] = term
297
+ option.critical = term
287
298
  result = option
288
299
 
289
300
  result
@@ -291,9 +302,9 @@ end
291
302
 
292
303
  def _reduce_7(val, _values, result)
293
304
  option, _, term = val
294
- raise ParseError unless option[:critical].nil?
305
+ raise ParseError unless option.critical.nil?
295
306
 
296
- option[:critical] = term
307
+ option.critical = term
297
308
  result = option
298
309
 
299
310
  result
@@ -301,9 +312,9 @@ end
301
312
 
302
313
  def _reduce_8(val, _values, result)
303
314
  option, _, term = val
304
- raise ParseError unless option[:first_to].nil? && option[:first_modify].nil?
315
+ raise ParseError unless option.settable_first_roll_adjust_option?
305
316
 
306
- option[:first_to] = term.to_i
317
+ option.first_to = term.to_i
307
318
  result = option
308
319
 
309
320
  result
@@ -311,9 +322,9 @@ end
311
322
 
312
323
  def _reduce_9(val, _values, result)
313
324
  option, _, _, term = val
314
- raise ParseError unless option[:first_to].nil? && option[:first_modify].nil?
325
+ raise ParseError unless option.settable_first_roll_adjust_option?
315
326
 
316
- option[:first_modify] = term.to_i
327
+ option.first_modify = term.to_i
317
328
  result = option
318
329
 
319
330
  result
@@ -321,9 +332,9 @@ end
321
332
 
322
333
  def _reduce_10(val, _values, result)
323
334
  option, _, _, term = val
324
- raise ParseError unless option[:first_to].nil? && option[:first_modify].nil?
335
+ raise ParseError unless option.settable_first_roll_adjust_option?
325
336
 
326
- option[:first_modify] = -(term.to_i)
337
+ option.first_modify = -(term.to_i)
327
338
  result = option
328
339
 
329
340
  result
@@ -331,9 +342,9 @@ end
331
342
 
332
343
  def _reduce_11(val, _values, result)
333
344
  option, _ = val
334
- raise ParseError unless option[:modifier_after_half].nil?
345
+ raise ParseError unless option.modifier_after_half.nil?
335
346
 
336
- option[:modifier_after_half] = Arithmetic::Node::Number.new(0)
347
+ option.modifier_after_half = Arithmetic::Node::Number.new(0)
337
348
  result = option
338
349
 
339
350
  result
@@ -341,9 +352,9 @@ end
341
352
 
342
353
  def _reduce_12(val, _values, result)
343
354
  option, _, term = val
344
- raise ParseError unless option[:modifier_after_half].nil?
355
+ raise ParseError unless option.modifier_after_half.nil?
345
356
 
346
- option[:modifier_after_half] = term
357
+ option.modifier_after_half = term
347
358
  result = option
348
359
 
349
360
  result
@@ -351,9 +362,9 @@ end
351
362
 
352
363
  def _reduce_13(val, _values, result)
353
364
  option, _, term = val
354
- raise ParseError unless [:v2_5, :v2_0].include?(@version) && option[:rateup].nil?
365
+ raise ParseError unless [:v2_5, :v2_0].include?(@version) && option.rateup.nil?
355
366
 
356
- option[:rateup] = term
367
+ option.rateup = term
357
368
  result = option
358
369
 
359
370
  result
@@ -361,41 +372,51 @@ end
361
372
 
362
373
  def _reduce_14(val, _values, result)
363
374
  option, _, _ = val
364
- raise ParseError unless [:v2_5, :v2_0].include?(@version) && option[:greatest_fortune].nil?
375
+ raise ParseError unless [:v2_5, :v2_0].include?(@version) && option.settable_non_2d_roll_option?
365
376
 
366
- option[:greatest_fortune] = true
377
+ option.greatest_fortune = true
367
378
  result = option
368
379
 
369
380
  result
370
381
  end
371
382
 
372
383
  def _reduce_15(val, _values, result)
373
- option, _, term = val
374
- raise ParseError unless @version == :v2_5 && option[:kept_modify].nil?
384
+ option, _, _, term = val
385
+ raise ParseError unless [:v2_5, :v2_0].include?(@version) && option.settable_non_2d_roll_option?
375
386
 
376
- option[:kept_modify] = term
387
+ option.semi_fixed_val = term.to_i
377
388
  result = option
378
389
 
379
390
  result
380
391
  end
381
392
 
382
393
  def _reduce_16(val, _values, result)
383
- result = val[1]
394
+ option, _, _, term = val
395
+ raise ParseError unless [:v2_5, :v2_0].include?(@version) && option.settable_non_2d_roll_option?
396
+
397
+ option.tmp_fixed_val = term.to_i
398
+ result = option
399
+
384
400
  result
385
401
  end
386
402
 
387
403
  def _reduce_17(val, _values, result)
388
- result = Arithmetic::Node::Negative.new(val[1])
404
+ option, _, term = val
405
+ raise ParseError unless @version == :v2_5 && option.kept_modify.nil?
406
+
407
+ option.kept_modify = term
408
+ result = option
409
+
389
410
  result
390
411
  end
391
412
 
392
413
  def _reduce_18(val, _values, result)
393
- result = Arithmetic::Node::BinaryOp.new(val[0], :+, val[2])
414
+ result = val[1]
394
415
  result
395
416
  end
396
417
 
397
418
  def _reduce_19(val, _values, result)
398
- result = Arithmetic::Node::BinaryOp.new(val[0], :-, val[2])
419
+ result = Arithmetic::Node::Negative.new(val[1])
399
420
  result
400
421
  end
401
422
 
@@ -409,39 +430,49 @@ def _reduce_21(val, _values, result)
409
430
  result
410
431
  end
411
432
 
412
- # reduce 22 omitted
433
+ def _reduce_22(val, _values, result)
434
+ result = Arithmetic::Node::BinaryOp.new(val[0], :+, val[2])
435
+ result
436
+ end
413
437
 
414
438
  def _reduce_23(val, _values, result)
439
+ result = Arithmetic::Node::BinaryOp.new(val[0], :-, val[2])
440
+ result
441
+ end
442
+
443
+ # reduce 24 omitted
444
+
445
+ def _reduce_25(val, _values, result)
415
446
  result = Arithmetic::Node::BinaryOp.new(val[0], :*, val[2])
416
447
  result
417
448
  end
418
449
 
419
- def _reduce_24(val, _values, result)
450
+ def _reduce_26(val, _values, result)
420
451
  result = Arithmetic::Node::DivideWithGameSystemDefault.new(val[0], val[2])
421
452
 
422
453
  result
423
454
  end
424
455
 
425
- # reduce 25 omitted
456
+ # reduce 27 omitted
426
457
 
427
- def _reduce_26(val, _values, result)
458
+ def _reduce_28(val, _values, result)
428
459
  result = val[1]
429
460
  result
430
461
  end
431
462
 
432
- def _reduce_27(val, _values, result)
463
+ def _reduce_29(val, _values, result)
433
464
  result = Arithmetic::Node::Negative.new(val[1])
434
465
  result
435
466
  end
436
467
 
437
- # reduce 28 omitted
468
+ # reduce 30 omitted
438
469
 
439
- def _reduce_29(val, _values, result)
470
+ def _reduce_31(val, _values, result)
440
471
  result = val[1]
441
472
  result
442
473
  end
443
474
 
444
- def _reduce_30(val, _values, result)
475
+ def _reduce_32(val, _values, result)
445
476
  result = Arithmetic::Node::Number.new(val[0])
446
477
  result
447
478
  end
@@ -1,27 +1,23 @@
1
1
  require "bcdice/result"
2
+ require "bcdice/translate"
2
3
 
3
4
  module BCDice
4
5
  module GameSystem
5
6
  class SwordWorld2_0 < SwordWorld
6
7
  # 超越判定のノード
7
8
  class TranscendentTest
8
- RESULT_STR = {
9
- success: "成功",
10
- failure: "失敗",
11
- super_success: "超成功",
12
- critical: "自動的成功",
13
- fumble: "自動的失敗",
14
- }.freeze
9
+ include Translate
15
10
 
16
11
  # @param [Integer] critical_value クリティカル値
17
12
  # @param [Integer] modifier 修正値
18
13
  # @param [String, nil] cmp_op 比較演算子(> または >=)
19
14
  # @param [Integer, nil] target 目標値
20
- def initialize(critical_value, modifier, cmp_op, target)
15
+ def initialize(critical_value, modifier, cmp_op, target, locale)
21
16
  @critical_value = critical_value
22
17
  @modifier = modifier
23
18
  @cmp_op = cmp_op
24
19
  @target = target
20
+ @locale = locale
25
21
 
26
22
  @modifier_str = Format.modifier(@modifier)
27
23
  @expression = node_expression()
@@ -32,7 +28,7 @@ module BCDice
32
28
  # @return [String]
33
29
  def execute(randomizer)
34
30
  if @critical_value < 3
35
- return "(#{@expression}) > クリティカル値が小さすぎます。3以上を指定してください。"
31
+ return translate("SwordWorld2_0.transcendent_critical_too_small", expression: @expression)
36
32
  end
37
33
 
38
34
  first_value_group = randomizer.roll_barabara(2, 6)
@@ -51,11 +47,19 @@ module BCDice
51
47
  total_sum = sum + @modifier
52
48
 
53
49
  result = result_status(total_sum, value_groups.length, fumble, critical)
50
+ result_str = {
51
+ success: translate("success"),
52
+ failure: translate("failure"),
53
+ super_success: translate("SwordWorld2_0.super_success"),
54
+ critical: translate("SwordWorld.critical"),
55
+ fumble: translate("SwordWorld.fumble"),
56
+ }.freeze[result]
57
+
54
58
  parts = [
55
59
  "(#{@expression})",
56
60
  "#{dice_str(value_groups, sum)}#{@modifier_str}",
57
61
  total_sum,
58
- RESULT_STR[result],
62
+ result_str,
59
63
  ].compact
60
64
 
61
65
  return Result.new.tap do |r|