bcdice 3.12.0 → 3.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +27 -0
  3. data/lib/bcdice/arithmetic/parser.rb +4 -2
  4. data/lib/bcdice/base.rb +1 -1
  5. data/lib/bcdice/command/parser.rb +4 -2
  6. data/lib/bcdice/common_command/add_dice/parser.rb +4 -2
  7. data/lib/bcdice/common_command/barabara_dice/parser.rb +4 -2
  8. data/lib/bcdice/common_command/calc/parser.rb +4 -2
  9. data/lib/bcdice/common_command/reroll_dice/parser.rb +4 -2
  10. data/lib/bcdice/common_command/tally_dice/parser.rb +4 -2
  11. data/lib/bcdice/common_command/upper_dice/parser.rb +4 -2
  12. data/lib/bcdice/game_system/Airgetlamh.rb +1 -1
  13. data/lib/bcdice/game_system/Alsetto.rb +2 -2
  14. data/lib/bcdice/game_system/AniMalus.rb +221 -0
  15. data/lib/bcdice/game_system/ArknightsFan.rb +182 -0
  16. data/lib/bcdice/game_system/Avandner.rb +1 -1
  17. data/lib/bcdice/game_system/BBN.rb +1 -1
  18. data/lib/bcdice/game_system/BadLife.rb +3 -3
  19. data/lib/bcdice/game_system/BarnaKronika.rb +1 -1
  20. data/lib/bcdice/game_system/Chill3.rb +6 -6
  21. data/lib/bcdice/game_system/DarkSouls.rb +1 -1
  22. data/lib/bcdice/game_system/Elric.rb +1 -1
  23. data/lib/bcdice/game_system/FullFace.rb +92 -0
  24. data/lib/bcdice/game_system/InfiniteFantasia.rb +4 -1
  25. data/lib/bcdice/game_system/Irisbane.rb +1 -1
  26. data/lib/bcdice/game_system/KillDeathBusiness.rb +1 -1
  27. data/lib/bcdice/game_system/KyokoShinshoku.rb +158 -0
  28. data/lib/bcdice/game_system/Liminal.rb +136 -0
  29. data/lib/bcdice/game_system/MetalHead.rb +1 -1
  30. data/lib/bcdice/game_system/MetalHeadExtream.rb +1 -1
  31. data/lib/bcdice/game_system/NRR.rb +122 -0
  32. data/lib/bcdice/game_system/NSSQ.rb +1 -1
  33. data/lib/bcdice/game_system/NightWizard.rb +1 -1
  34. data/lib/bcdice/game_system/NightWizard3rd.rb +15 -2
  35. data/lib/bcdice/game_system/OneWayHeroics.rb +1 -1
  36. data/lib/bcdice/game_system/PastFutureParadox.rb +1238 -0
  37. data/lib/bcdice/game_system/Postman.rb +3 -3
  38. data/lib/bcdice/game_system/RecordOfSteam.rb +1 -1
  39. data/lib/bcdice/game_system/RuneQuestRoleplayingInGlorantha.rb +1 -1
  40. data/lib/bcdice/game_system/Ryutama.rb +4 -4
  41. data/lib/bcdice/game_system/Siren.rb +97 -0
  42. data/lib/bcdice/game_system/Skynauts.rb +1 -1
  43. data/lib/bcdice/game_system/Strave.rb +1 -1
  44. data/lib/bcdice/game_system/TherapieSein.rb +1 -1
  45. data/lib/bcdice/game_system/TrinitySeven.rb +1 -1
  46. data/lib/bcdice/game_system/VampireTheMasquerade5th.rb +12 -6
  47. data/lib/bcdice/game_system/WerewolfTheApocalypse5th.rb +12 -6
  48. data/lib/bcdice/game_system/cthulhu7th/full_auto.rb +1 -1
  49. data/lib/bcdice/game_system/sword_world/rating_parser.rb +4 -2
  50. data/lib/bcdice/game_system.rb +8 -0
  51. data/lib/bcdice/loader.rb +1 -1
  52. data/lib/bcdice/version.rb +1 -1
  53. metadata +27 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bd5d6c3f713665875f8208a8ca6ccca9c3e1be2cada89128f9932b65e9939b36
4
- data.tar.gz: 0df640b438c6eb769a2cf042ebe776f64491d1da5253ab5184cac051f76d2a2a
3
+ metadata.gz: c364b7cf3805345490d3e93d448a79b6575817d21bb9706ef3a792f8be0fb748
4
+ data.tar.gz: 6cc52cf4ba2c97c4a053f3b0e4e412e7982751ae0744f4554d6b9d4480948257
5
5
  SHA512:
6
- metadata.gz: 525dd898713a1d5f1f7578aa8a2693e3c51f70d8a9d2fb9aad25cc397aee9b192e0dbb67a4dbaa2eec54eb8fd49087828730210410d61f20c038c3106e16d8a4
7
- data.tar.gz: 448ec837facf89009c8e9411fadaf9e967df20b2f0839beecfaff7a4d2c571950f0c336e2f304a658b2dd5609bb9c4df61c0deee672b1fc1ffb9cb609b13a328
6
+ metadata.gz: e8acaab5a72d4e8aac101337796249a8acd615a37c0ade50a01679ed9aaf281cb7450c40912f1bef8e292a18d0ee5951ac4fee618061111b4644418c28643b6e
7
+ data.tar.gz: a6d7c34f493d0b546c380f000adfeb5d40e4d17df95632bf178fb98e4c6c42ed944f501a17e4055f088d27cf564ea9273f76fd65a7e5c0c1ed61de95d730764e
data/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # Change Log
2
2
 
3
+ ## 3.13.0 2024/02/08
4
+
5
+ ### 対応ゲームシステムの追加
6
+ - 終末アイドル育成TRPGセイレーン (Siren): 蜂紫さんありがとうっ! ([#663](https://github.com/bcdice/BCDice/pull/663))
7
+ - リミナル (Liminal): Facelessさんありがとうっ! ([#664](https://github.com/bcdice/BCDice/pull/664))
8
+ - アークナイツTRPG by Dapto (ArknightsFan): Ayase00さんありがとうっ! ([#666](https://github.com/bcdice/BCDice/pull/666))
9
+ - フルフェイス (FullFace): Facelessさんありがとうっ! ([#668](https://github.com/bcdice/BCDice/pull/668))
10
+ - アニマラス (AniMalus): Facelessさんありがとうっ! ([#669](https://github.com/bcdice/BCDice/pull/669))
11
+ - パストフューチャーパラドックス (PastFutureParadox): hikoyamamayoさんありがとうっ! ([#673](https://github.com/bcdice/BCDice/pull/673))
12
+ - 虚構侵蝕TRPG (KyokoShinshoku) ([#674](https://github.com/bcdice/BCDice/pull/674))
13
+ - nRR (NRR) ([#675](https://github.com/bcdice/BCDice/pull/675))
14
+
15
+ ### 変更
16
+
17
+ - RuneQuest:Roleplaying in Glorantha: システム名を英語から日本語に変更。フレッド緑野さんありがとうっ! ([#662](https://github.com/bcdice/BCDice/pull/662))
18
+ - Vampire: The Masquerade 5th Edition: ダイスプールよりHungerダイスよりが大きい時に全てのダイスがHungerダイスになるよう変更。フレッド緑野さんありがとうっ! ([#670](https://github.com/bcdice/BCDice/pull/670))
19
+ - Werewolf: The Apocalypse 5th Edition: ダイスプールよりRageダイスよりが大きい時に全てのダイスがRageダイスになるよう変更。フレッド緑野さんありがとうっ! ([#671](https://github.com/bcdice/BCDice/pull/671))
20
+ - Chill 3rd Edition: 成否の表記をルールに合わせて変更。Facelessさんありがとうっ! ([#672](https://github.com/bcdice/BCDice/pull/672))
21
+
22
+ ### 誤植修正
23
+ - ナイトウィザード The 3rd Edition: ヘルプメッセージの誤りを修正。opparcoさんありがとうっ! ([#667](https://github.com/bcdice/BCDice/pull/667))
24
+ - 無限のファンタジア: 成功レベルの判定方法を記載。 ([#676](https://github.com/bcdice/BCDice/pull/676))
25
+
26
+ ### 開発
27
+ - Ruby 3.3をサポートバージョンに追加 ([#665](https://github.com/bcdice/BCDice/pull/665))
28
+ - Ruby 2.6をサポートバージョンから除外 ([#665](https://github.com/bcdice/BCDice/pull/665))
29
+
3
30
  ## 3.12.0 2023/12/04
4
31
 
5
32
  ### 対応ゲームシステムの追加
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # DO NOT MODIFY!!!!
3
- # This file is automatically generated by Racc 1.6.2
4
- # from Racc grammar file "".
3
+ # This file is automatically generated by Racc 1.7.3
4
+ # from Racc grammar file "parser.y".
5
5
  #
6
6
 
7
7
  require 'racc/parser.rb'
@@ -130,6 +130,7 @@ Racc_arg = [
130
130
  racc_shift_n,
131
131
  racc_reduce_n,
132
132
  racc_use_result_var ]
133
+ Ractor.make_shareable(Racc_arg) if defined?(Ractor)
133
134
 
134
135
  Racc_token_to_s_table = [
135
136
  "$end",
@@ -151,6 +152,7 @@ Racc_token_to_s_table = [
151
152
  "unary",
152
153
  "round_type",
153
154
  "term" ]
155
+ Ractor.make_shareable(Racc_token_to_s_table) if defined?(Ractor)
154
156
 
155
157
  Racc_debug_parser = false
156
158
 
data/lib/bcdice/base.rb CHANGED
@@ -58,7 +58,7 @@ module BCDice
58
58
  @prefixes.freeze
59
59
  pattarns = CommonCommand::COMMANDS.map { |c| c::PREFIX_PATTERN.source } + @prefixes
60
60
 
61
- @command_pattern = /^S?(#{pattarns.join("|")})/i.freeze
61
+ @command_pattern = /^S?(#{pattarns.join('|')})/i.freeze
62
62
  end
63
63
 
64
64
  # @param command [String]
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # DO NOT MODIFY!!!!
3
- # This file is automatically generated by Racc 1.6.2
4
- # from Racc grammar file "".
3
+ # This file is automatically generated by Racc 1.7.3
4
+ # from Racc grammar file "parser.y".
5
5
  #
6
6
 
7
7
  require 'racc/parser.rb'
@@ -312,6 +312,7 @@ Racc_arg = [
312
312
  racc_shift_n,
313
313
  racc_reduce_n,
314
314
  racc_use_result_var ]
315
+ Ractor.make_shareable(Racc_arg) if defined?(Ractor)
315
316
 
316
317
  Racc_token_to_s_table = [
317
318
  "$end",
@@ -344,6 +345,7 @@ Racc_token_to_s_table = [
344
345
  "mul",
345
346
  "add",
346
347
  "round_type" ]
348
+ Ractor.make_shareable(Racc_token_to_s_table) if defined?(Ractor)
347
349
 
348
350
  Racc_debug_parser = false
349
351
 
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # DO NOT MODIFY!!!!
3
- # This file is automatically generated by Racc 1.6.2
4
- # from Racc grammar file "".
3
+ # This file is automatically generated by Racc 1.7.3
4
+ # from Racc grammar file "parser.y".
5
5
  #
6
6
 
7
7
  require 'racc/parser.rb'
@@ -200,6 +200,7 @@ Racc_arg = [
200
200
  racc_shift_n,
201
201
  racc_reduce_n,
202
202
  racc_use_result_var ]
203
+ Ractor.make_shareable(Racc_arg) if defined?(Ractor)
203
204
 
204
205
  Racc_token_to_s_table = [
205
206
  "$end",
@@ -242,6 +243,7 @@ Racc_token_to_s_table = [
242
243
  "filter_type",
243
244
  "filter_type_with_shorthand",
244
245
  "filter_shorthand" ]
246
+ Ractor.make_shareable(Racc_token_to_s_table) if defined?(Ractor)
245
247
 
246
248
  Racc_debug_parser = false
247
249
 
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # DO NOT MODIFY!!!!
3
- # This file is automatically generated by Racc 1.6.2
4
- # from Racc grammar file "".
3
+ # This file is automatically generated by Racc 1.7.3
4
+ # from Racc grammar file "parser.y".
5
5
  #
6
6
 
7
7
  require 'racc/parser.rb'
@@ -154,6 +154,7 @@ Racc_arg = [
154
154
  racc_shift_n,
155
155
  racc_reduce_n,
156
156
  racc_use_result_var ]
157
+ Ractor.make_shareable(Racc_arg) if defined?(Ractor)
157
158
 
158
159
  Racc_token_to_s_table = [
159
160
  "$end",
@@ -190,6 +191,7 @@ Racc_token_to_s_table = [
190
191
  "mul",
191
192
  "unary",
192
193
  "round_type" ]
194
+ Ractor.make_shareable(Racc_token_to_s_table) if defined?(Ractor)
193
195
 
194
196
  Racc_debug_parser = false
195
197
 
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # DO NOT MODIFY!!!!
3
- # This file is automatically generated by Racc 1.6.2
4
- # from Racc grammar file "".
3
+ # This file is automatically generated by Racc 1.7.3
4
+ # from Racc grammar file "parser.y".
5
5
  #
6
6
 
7
7
  require 'racc/parser.rb'
@@ -138,6 +138,7 @@ Racc_arg = [
138
138
  racc_shift_n,
139
139
  racc_reduce_n,
140
140
  racc_use_result_var ]
141
+ Ractor.make_shareable(Racc_arg) if defined?(Ractor)
141
142
 
142
143
  Racc_token_to_s_table = [
143
144
  "$end",
@@ -162,6 +163,7 @@ Racc_token_to_s_table = [
162
163
  "unary",
163
164
  "round_type",
164
165
  "term" ]
166
+ Ractor.make_shareable(Racc_token_to_s_table) if defined?(Ractor)
165
167
 
166
168
  Racc_debug_parser = false
167
169
 
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # DO NOT MODIFY!!!!
3
- # This file is automatically generated by Racc 1.6.2
4
- # from Racc grammar file "".
3
+ # This file is automatically generated by Racc 1.7.3
4
+ # from Racc grammar file "parser.y".
5
5
  #
6
6
 
7
7
  require 'racc/parser.rb'
@@ -175,6 +175,7 @@ Racc_arg = [
175
175
  racc_shift_n,
176
176
  racc_reduce_n,
177
177
  racc_use_result_var ]
178
+ Ractor.make_shareable(Racc_arg) if defined?(Ractor)
178
179
 
179
180
  Racc_token_to_s_table = [
180
181
  "$end",
@@ -212,6 +213,7 @@ Racc_token_to_s_table = [
212
213
  "mul",
213
214
  "unary",
214
215
  "round_type" ]
216
+ Ractor.make_shareable(Racc_token_to_s_table) if defined?(Ractor)
215
217
 
216
218
  Racc_debug_parser = false
217
219
 
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # DO NOT MODIFY!!!!
3
- # This file is automatically generated by Racc 1.6.2
4
- # from Racc grammar file "".
3
+ # This file is automatically generated by Racc 1.7.3
4
+ # from Racc grammar file "parser.y".
5
5
  #
6
6
 
7
7
  require 'racc/parser.rb'
@@ -144,6 +144,7 @@ Racc_arg = [
144
144
  racc_shift_n,
145
145
  racc_reduce_n,
146
146
  racc_use_result_var ]
147
+ Ractor.make_shareable(Racc_arg) if defined?(Ractor)
147
148
 
148
149
  Racc_token_to_s_table = [
149
150
  "$end",
@@ -173,6 +174,7 @@ Racc_token_to_s_table = [
173
174
  "mul",
174
175
  "unary",
175
176
  "round_type" ]
177
+ Ractor.make_shareable(Racc_token_to_s_table) if defined?(Ractor)
176
178
 
177
179
  Racc_debug_parser = false
178
180
 
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # DO NOT MODIFY!!!!
3
- # This file is automatically generated by Racc 1.6.2
4
- # from Racc grammar file "".
3
+ # This file is automatically generated by Racc 1.7.3
4
+ # from Racc grammar file "parser.y".
5
5
  #
6
6
 
7
7
  require 'racc/parser.rb'
@@ -181,6 +181,7 @@ Racc_arg = [
181
181
  racc_shift_n,
182
182
  racc_reduce_n,
183
183
  racc_use_result_var ]
184
+ Ractor.make_shareable(Racc_arg) if defined?(Ractor)
184
185
 
185
186
  Racc_token_to_s_table = [
186
187
  "$end",
@@ -220,6 +221,7 @@ Racc_token_to_s_table = [
220
221
  "term",
221
222
  "unary",
222
223
  "round_type" ]
224
+ Ractor.make_shareable(Racc_token_to_s_table) if defined?(Ractor)
223
225
 
224
226
  Racc_debug_parser = false
225
227
 
@@ -102,7 +102,7 @@ module BCDice
102
102
  totalDamage = totalSuccessCount * damage + totalCriticalCount * criticalTrigger
103
103
 
104
104
  result += "(#{diceCount}D10\<\=#{target}) > #{text} > Hits:#{totalSuccessCount}*#{damage}"
105
- result += " + Trigger:#{totalCriticalCount}*#{criticalTrigger}" if criticalTrigger > 0
105
+ result += " + Trigger:#{totalCriticalCount}*#{criticalTrigger}" if criticalTrigger > 0
106
106
  result += " > #{totalDamage}ダメージ"
107
107
  else
108
108
  result += "(#{diceCount}D10\<\=#{target}) > #{text} > 成功数:#{totalSuccessCount}"
@@ -50,7 +50,7 @@ module BCDice
50
50
  if command =~ /(\d+)AL(C|G)?(\d+)?((x|\*)(\d+))?$/i
51
51
  rapid = Regexp.last_match(1).to_i
52
52
  isCritical = Regexp.last_match(2).nil?
53
- if isCritical
53
+ if isCritical
54
54
  criticalNumber = 1
55
55
  else
56
56
  if Regexp.last_match(2) == "G"
@@ -98,7 +98,7 @@ module BCDice
98
98
  text += "+" unless text.empty?
99
99
  text += "#{successCount}[#{diceText}]"
100
100
 
101
- break unless isCritical
101
+ break unless isCritical
102
102
 
103
103
  rollCount = criticalCount
104
104
  end
@@ -0,0 +1,221 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BCDice
4
+ module GameSystem
5
+ class AniMalus < Base
6
+ # ゲームシステムの識別子
7
+ ID = 'AniMalus'
8
+
9
+ # ゲームシステム名
10
+ NAME = 'アニマラス'
11
+
12
+ # ゲームシステム名の読みがな
13
+ SORT_KEY = 'あにまらす'
14
+
15
+ # ダイスボットの使い方
16
+ HELP_MESSAGE = <<~INFO_MESSAGETEXT
17
+ ■ステータスのダイス判定 nAM<=t,x n:能力値 t:成功値 x:必要成功数
18
+ 例)3AM<=2,1: ダイスを3個振って、成功値2,必要成功数1で判定。その結果(成功数,成功・失敗)を表示
19
+
20
+ ■探索技能のダイス判定 AI<=t,x t:探索技能レベル x:必要成功数
21
+ 例)AI<=3,1: ダイスを3個振って、探索技能レベル3,必要成功数1で判定。その結果(成功数,成功・失敗)を表示
22
+
23
+ ■攻撃判定 AA<=t t:戦闘技能レベル
24
+ 例)AA<=3: ダイスを3個振って、戦闘技能レベル3で判定。その結果(成功・失敗,ダメージ,クリティカル,ファンブル)を表示
25
+
26
+ ■防御判定 AG=t t:攻撃技能レベル
27
+ 例)AG=2: ダイスを3個振って、攻撃技能レベル2で判定。その結果(成功・失敗,ダメージ,クリティカル,ファンブル)を表示
28
+
29
+ ■回避判定 AD=t t:攻撃技能レベル
30
+ 例)AD=3: ダイスを1個振って、攻撃技能レベル3で判定。その結果(成功・失敗)を表示
31
+ INFO_MESSAGETEXT
32
+
33
+ register_prefix('\d*A[MIAGD]')
34
+
35
+ def initialize(command)
36
+ super(command)
37
+
38
+ @sort_barabara_dice = true # バラバラロール(Bコマンド)でソート有
39
+ end
40
+
41
+ def eval_game_system_specific_command(command)
42
+ resolute_action(command) ||
43
+ resolute_investigation(command) ||
44
+ resolute_attacking(command) ||
45
+ resolute_guarding(command) ||
46
+ resolute_dodging(command)
47
+ end
48
+
49
+ private
50
+
51
+ # ステータスの判定
52
+ # @param [String] command
53
+ # @return [Result]
54
+ def resolute_action(command)
55
+ m = /^(\d+)AM<=(\d+),(\d)$/.match(command)
56
+ return nil unless m
57
+
58
+ num_dice = m[1].to_i
59
+ num_target = m[2].to_i
60
+ num_success = m[3].to_i
61
+
62
+ dice = @randomizer.roll_barabara(num_dice, 6).sort
63
+ dice_text = dice.join(",")
64
+ success_num = dice.count { |val| val <= num_target }
65
+ output = "(#{num_dice}AM<=#{num_target},#{num_success}) > #{dice_text} > 成功数#{success_num}"
66
+ if success_num >= num_success
67
+ output += " > 成功"
68
+ return Result.success(output)
69
+ else
70
+ output += " > 失敗"
71
+ return Result.failure(output)
72
+ end
73
+ end
74
+
75
+ # 探索技能の判定
76
+ # @param [String] command
77
+ # @return [Result]
78
+ def resolute_investigation(command)
79
+ m = /^AI<=(\d+),(\d)$/.match(command)
80
+ return nil unless m
81
+
82
+ num_target = m[1].to_i
83
+ num_success = m[2].to_i
84
+
85
+ dice = @randomizer.roll_barabara(3, 6).sort
86
+ dice_text = dice.join(",")
87
+ success_num = dice.count { |val| val <= num_target }
88
+ output = "(AI<=#{num_target},#{num_success}) > #{dice_text} > 成功数#{success_num}"
89
+ if success_num >= num_success
90
+ output += " > 成功"
91
+ return Result.success(output)
92
+ else
93
+ output += " > 失敗"
94
+ return Result.failure(output)
95
+ end
96
+ end
97
+
98
+ # 攻撃技能の判定
99
+ # @param [String] command
100
+ # @return [Result]
101
+ def resolute_attacking(command)
102
+ m = /^AA<=(\d+)$/.match(command)
103
+ return nil unless m
104
+
105
+ num_target = m[1].to_i
106
+
107
+ dice = @randomizer.roll_barabara(3, 6).sort
108
+ dice_text = dice.join(",")
109
+ success_num = dice.count { |val| val <= num_target }
110
+ is_critical = dice[0] == 1 && dice[1] == 2 && dice[2] == 3
111
+ is_fumble = dice[0] == 4 && dice[1] == 5 && dice[2] == 6
112
+ damage1 = dice.max
113
+ damage2 = dice.max
114
+ if dice[0] == dice[1] && dice[1] == dice[2] && dice[2] <= num_target
115
+ damage2 += 6
116
+ damage1 = damage2
117
+ elsif dice[0] == dice[1] && dice[1] <= num_target
118
+ damage2 += 3
119
+ elsif dice[1] == dice[2] && dice[2] <= num_target
120
+ damage2 += 3
121
+ end
122
+
123
+ return Result.new.tap do |result|
124
+ result.critical = is_critical
125
+ result.fumble = is_fumble
126
+ result.condition = (success_num > 0)
127
+
128
+ sequence = [
129
+ "(AA<=#{num_target})",
130
+ dice_text,
131
+ "成功数#{success_num}",
132
+ if result.success?
133
+ "成功"
134
+ else
135
+ "失敗"
136
+ end
137
+ ].compact
138
+ if result.success?
139
+ if damage1 == damage2
140
+ sequence.push("ダメージ(#{damage1})")
141
+ else
142
+ sequence.push("ダメージ(#{damage1}か#{damage2})")
143
+ end
144
+ end
145
+ sequence.push("クリティカル") if result.critical?
146
+ sequence.push("ファンブル") if result.fumble?
147
+
148
+ result.text = sequence.join(" > ")
149
+ end
150
+ end
151
+
152
+ # 防御技能の判定
153
+ # @param [String] command
154
+ # @return [Result]
155
+ def resolute_guarding(command)
156
+ m = /^AG=(\d+)$/.match(command)
157
+ return nil unless m
158
+
159
+ num_target = m[1].to_i
160
+
161
+ dice = @randomizer.roll_barabara(3, 6).sort
162
+ dice_text = dice.join(",")
163
+ success_num = dice.count(num_target)
164
+ is_critical = dice[0] == 1 && dice[1] == 2 && dice[2] == 3
165
+ is_fumble = dice[0] == 4 && dice[1] == 5 && dice[2] == 6
166
+
167
+ return Result.new.tap do |result|
168
+ result.critical = is_critical
169
+ result.fumble = is_fumble
170
+ result.condition = (success_num > 0)
171
+
172
+ sequence = [
173
+ "(AG=#{num_target})",
174
+ dice_text,
175
+ "成功数#{success_num}",
176
+ if result.success?
177
+ "成功 > ダメージ軽減(#{success_num * 2})"
178
+ else
179
+ "失敗"
180
+ end
181
+ ].compact
182
+ sequence.push("クリティカル") if result.critical?
183
+ sequence.push("ファンブル") if result.fumble?
184
+
185
+ result.text = sequence.join(" > ")
186
+ end
187
+ end
188
+
189
+ # 回避技能の判定
190
+ # @param [String] command
191
+ # @return [Result]
192
+ def resolute_dodging(command)
193
+ m = /^AD=(\d+)$/.match(command)
194
+ return nil unless m
195
+
196
+ num_target = m[1].to_i
197
+
198
+ dice = @randomizer.roll_barabara(1, 6)
199
+ dice_text = dice.join(",")
200
+ success_num = dice.count(num_target)
201
+
202
+ return Result.new.tap do |result|
203
+ result.condition = (success_num > 0)
204
+
205
+ sequence = [
206
+ "(AD=#{num_target})",
207
+ dice_text,
208
+ "成功数#{success_num}",
209
+ if result.success?
210
+ "成功(ダメージ無効)"
211
+ else
212
+ "失敗"
213
+ end
214
+ ].compact
215
+
216
+ result.text = sequence.join(" > ")
217
+ end
218
+ end
219
+ end
220
+ end
221
+ end