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
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BCDice
4
+ module GameSystem
5
+ class BeginningIdol < Base
6
+ class << self
7
+ private
8
+
9
+ # @params locale [Symbol]
10
+ # @return [ChainTable]
11
+ def translate_accessories_table(locale)
12
+ items = I18n.t("BeginningIdol.ACT.items", locale: locale)
13
+ subtables = [
14
+ DiceTable::D66Table.from_i18n("BeginningIdol.ACT.subtables.head", locale),
15
+ DiceTable::D66Table.from_i18n("BeginningIdol.ACT.subtables.hat", locale),
16
+ DiceTable::D66Table.from_i18n("BeginningIdol.ACT.subtables.body", locale),
17
+ DiceTable::D66Table.from_i18n("BeginningIdol.ACT.subtables.arm", locale),
18
+ DiceTable::D66Table.from_i18n("BeginningIdol.ACT.subtables.foot", locale),
19
+ DiceTable::D66Table.from_i18n("BeginningIdol.ACT.subtables.other", locale),
20
+ ]
21
+
22
+ ChainTable.new(
23
+ I18n.t("BeginningIdol.ACT.name", locale: locale),
24
+ "1D6",
25
+ items.zip(subtables)
26
+ )
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BCDice
4
+ module GameSystem
5
+ class BeginningIdol < Base
6
+ class BadStatusTable
7
+ def initialize(locale)
8
+ @locale = locale
9
+ end
10
+
11
+ def roll_command(randomizer, command)
12
+ m = /^BT(\d+)?$/.match(command)
13
+ unless m
14
+ return nil
15
+ end
16
+
17
+ roll_counts = m[1]&.to_i || 1
18
+ return roll(randomizer, roll_counts)
19
+ end
20
+
21
+ # @param randomizer [BCDice::Randomizer]
22
+ # @param counts [Integer]
23
+ def roll(randomizer, roll_counts = 1)
24
+ if roll_counts <= 0
25
+ return nil
26
+ end
27
+
28
+ name = I18n.t("BeginningIdol.BT.name", locale: @locale)
29
+ items = I18n.t("BeginningIdol.BT.items", locale: @locale)
30
+ prefix_format = I18n.t("BeginningIdol.BT.prefix_format", locale: @locale)
31
+
32
+ dice_list = randomizer.roll_barabara(roll_counts, 6).sort
33
+ index_list = dice_list.uniq
34
+
35
+ result_prefix = format(prefix_format, count_bad_status: index_list.size) + "\n" if index_list.size > 1
36
+ result_text = index_list.map { |i| items[i - 1] }.join("\n")
37
+
38
+ return "#{name} > [#{dice_list.join(',')}] > #{result_prefix}#{result_text}"
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BCDice
4
+ module GameSystem
5
+ class BeginningIdol < Base
6
+ class ChainD66Table
7
+ # @param [String] name 表の名前
8
+ # @param [Array<Array<String, #roll>>] items 表の項目の配列
9
+ def initialize(name, items)
10
+ @name = name
11
+ @items = items.freeze
12
+ end
13
+
14
+ # 表を振る
15
+ # @param randomizer [#roll_sum] ランダマイザ
16
+ # @return [String] 結果
17
+ def roll(randomizer)
18
+ dice = randomizer.roll_barabara(2, 6).sort
19
+
20
+ value = dice[0] * 10 + dice[1]
21
+ chosen = @items[value]
22
+ body = chosen.map { |item| item.respond_to?(:roll) ? item.roll(randomizer) : item }.join("\n")
23
+
24
+ return "#{@name}(#{value}) > #{body}"
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BCDice
4
+ module GameSystem
5
+ class BeginningIdol < Base
6
+ class ChainTable
7
+ # @param [String] name 表の名前
8
+ # @param [String] type 項目を選ぶときのダイスロールの方法 '1D6'など
9
+ # @param [Array<Array<String, #roll>>] items 表の項目の配列
10
+ def initialize(name, type, items)
11
+ @name = name
12
+ @items = items.freeze
13
+
14
+ m = /^(\d+)D(\d+)$/i.match(type)
15
+ unless m
16
+ raise ArgumentError, "Unexpected table type: #{type}"
17
+ end
18
+
19
+ @times = m[1].to_i
20
+ @sides = m[2].to_i
21
+ end
22
+
23
+ # 表を振る
24
+ # @param randomizer [#roll_sum] ランダマイザ
25
+ # @return [String] 結果
26
+ def roll(randomizer)
27
+ value = randomizer.roll_sum(@times, @sides)
28
+ index = value - @times
29
+ chosen = @items[index]
30
+ body = chosen.map { |item| item.respond_to?(:roll) ? item.roll(randomizer) : item }.join("\n")
31
+
32
+ return "#{@name}(#{value}) > #{body}"
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BCDice
4
+ module GameSystem
5
+ class BeginningIdol < Base
6
+ class CostumeTable
7
+ def self.from_i18n(key, locale)
8
+ table = I18n.t(key, locale: locale)
9
+ new(table[:name], table[:items])
10
+ end
11
+
12
+ # @param name [String]
13
+ # @param items [Hash{Integer => String}]
14
+ def initialize(name, items)
15
+ @name = name
16
+ @items = items
17
+ end
18
+
19
+ # @param randomizer [Randomizer]
20
+ # @return [String]
21
+ def roll(randomizer)
22
+ value = randomizer.roll_d66(D66SortType::ASC)
23
+ "#{@name}(#{value}) > #{@items[value]}"
24
+ end
25
+
26
+ # @return [DiceTable::D66Table]
27
+ def brand_only()
28
+ DiceTable::D66Table.new(
29
+ @name,
30
+ D66SortType::ASC,
31
+ @items.transform_values { |e| e.split("\n").first }
32
+ )
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BCDice
4
+ module GameSystem
5
+ class BeginningIdol < Base
6
+ class D6TwiceTable
7
+ # @param key [String]
8
+ # @param locale [Symbol]
9
+ # @return [D6TwiceTable]
10
+ def self.from_i18n(key, locale)
11
+ table = I18n.t(key, locale: locale)
12
+ new(table[:name], table[:items1], table[:items2])
13
+ end
14
+
15
+ # @param name [String]
16
+ # @param items1 [Array<String>]
17
+ # @param items2 [Array<String>]
18
+ def initialize(name, items1, items2)
19
+ @name = name
20
+ @items1 = items1
21
+ @items2 = items2
22
+ end
23
+
24
+ # @param [Randomizer]
25
+ # @return [String]
26
+ def roll(randomizer)
27
+ value1, value2 = randomizer.roll_barabara(2, 6)
28
+ chosen1 = @items1[value1 - 1]
29
+ chosen2 = @items2[value2 - 1]
30
+
31
+ "#{@name}[#{value1},#{value2}] > #{chosen1}#{chosen2}"
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BCDice
4
+ module GameSystem
5
+ class BeginningIdol < Base
6
+ class ItemTable
7
+ def initialize(locale)
8
+ @locale = locale
9
+ end
10
+
11
+ def roll_command(randomizer, command)
12
+ m = /^IT(\d+)?$/.match(command)
13
+ unless m
14
+ return nil
15
+ end
16
+
17
+ roll_counts = m[1]&.to_i || 1
18
+ return roll(randomizer, roll_counts)
19
+ end
20
+
21
+ # @param randomizer [BCDice::Randomizer]
22
+ # @param counts [Integer]
23
+ def roll(randomizer, roll_counts = 1)
24
+ if roll_counts == 0
25
+ return nil
26
+ end
27
+
28
+ table = I18n.t("BeginningIdol.item_table", locale: @locale)
29
+
30
+ dice_list = randomizer.roll_barabara(roll_counts, 6).sort
31
+ grouped = dice_list.group_by(&:itself)
32
+
33
+ item_list = grouped.map do |dice, list|
34
+ item = table[:items][dice - 1]
35
+ if grouped.size != 1
36
+ item = format(table[:emph], item: item)
37
+ end
38
+
39
+ if dice_list.size == grouped.size
40
+ item
41
+ else
42
+ format(table[:counting], item: item, count: list.size)
43
+ end
44
+ end
45
+
46
+ return "#{table[:name]} > [#{dice_list.join(',')}] > #{item_list.join(table[:sep])}"
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BCDice
4
+ module GameSystem
5
+ class BeginningIdol < Base
6
+ class MySkillNameTable
7
+ # @param locale [Symbol]
8
+ # @return [MySkillNameTable]
9
+ def initialize(locale)
10
+ @locale = locale
11
+
12
+ article = DiceTable::Table.from_i18n("BeginningIdol.MS.subtables.article", locale)
13
+ describe = DiceTable::D66Table.from_i18n("BeginningIdol.MS.subtables.describe", locale)
14
+ scene = DiceTable::D66Table.from_i18n("BeginningIdol.MS.subtables.scene", locale)
15
+ material = DiceTable::D66Table.from_i18n("BeginningIdol.MS.subtables.material", locale)
16
+ action = DiceTable::D66Table.from_i18n("BeginningIdol.MS.subtables.action", locale)
17
+ @chains = [
18
+ [describe, scene, material],
19
+ [describe, scene, action],
20
+ [describe, material, action],
21
+ [scene, material, action],
22
+ [describe, scene, article],
23
+ [material, action, article],
24
+ ].freeze
25
+ end
26
+
27
+ # @param randomizer [BCDice::Randomizer]
28
+ # @return [String]
29
+ def roll(randomizer)
30
+ index = randomizer.roll_once(6)
31
+ chosens = @chains[index - 1].map { |t| t.roll(randomizer) }
32
+
33
+ dice = chosens.map { |chosen| chosen.table_name + chosen.value.to_s }
34
+
35
+ name = I18n.t("BeginningIdol.MS.name", locale: @locale)
36
+ skill_name_format = I18n.t("BeginningIdol.MS.formats", locale: @locale)[index - 1]
37
+ skill_name = format(skill_name_format, *chosens.map(&:body))
38
+
39
+ "#{name} > [#{index},#{dice.join(',')}] > #{skill_name}"
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BCDice
4
+ module GameSystem
5
+ class BeginningIdol < Base
6
+ class RandomEventTable
7
+ # @param locale [Symbol]
8
+ # @return [MySkillNameTable]
9
+ def initialize(locale)
10
+ @locale = locale
11
+ end
12
+
13
+ # @param randomizer [BCDice::Randomizer]
14
+ # @return [String]
15
+ def roll(randomizer)
16
+ first_index = randomizer.roll_once(6)
17
+ d66_index = randomizer.roll_d66(D66SortType::NO_SORT)
18
+
19
+ i18n_key = first_index.even? ? "BeginningIdol.RE.on_event" : "BeginningIdol.RE.off_event"
20
+ table = I18n.t(i18n_key, locale: @locale)
21
+ name = I18n.t("BeginningIdol.RE.name", locale: @locale)
22
+ result_format = I18n.t("BeginningIdol.RE.format", locale: @locale)
23
+
24
+ chosen = table[:items][d66_index]
25
+
26
+ return "#{name} > (1D6) > #{first_index}\n#{table[:name]} > [#{d66_index}] > #{format(result_format, event: chosen[0], page: chosen[1])}"
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BCDice
4
+ module GameSystem
5
+ class BeginningIdol < Base
6
+ class SkillTable < DiceTable::SaiFicSkillTable
7
+ def roll(randomizer)
8
+ roll_command(randomizer, "RTT")
9
+ end
10
+ end
11
+
12
+ class SkillGetTable < DiceTable::Table
13
+ def self.from_i18n(key, skill_table, locale)
14
+ table = I18n.t(key, locale: locale)
15
+ new(table[:name], table[:type], table[:items], skill_table, locale)
16
+ end
17
+
18
+ def initialize(name, type, items, skill_table, locale)
19
+ super(name, type, items)
20
+ @skill_table = skill_table
21
+
22
+ skill_get_table = I18n.t("BeginningIdol.skill_get_table", locale: locale)
23
+ @reroll_reg = Regexp.new(skill_get_table[:reroll_reg])
24
+ @reroll = skill_get_table[:reroll]
25
+ @secondary_name = skill_get_table[:secondary_name]
26
+ end
27
+
28
+ def roll(randomizer)
29
+ chosen = super(randomizer)
30
+
31
+ m = @reroll_reg.match(chosen.body)
32
+ unless m
33
+ return chosen
34
+ end
35
+
36
+ reroll_category = m.captures
37
+ body = chosen.body + "\n"
38
+ loop do
39
+ skill = @skill_table.roll_skill(randomizer)
40
+ body += "#{@secondary_name} > [#{skill.category_dice},#{skill.row_dice}] > #{skill}"
41
+ unless reroll_category.include?(skill.category_name)
42
+ break
43
+ end
44
+
45
+ body += " > #{@reroll}\n"
46
+ end
47
+
48
+ DiceTable::RollResult.new(chosen.table_name, chosen.value, body)
49
+ end
50
+ end
51
+
52
+ class SkillHometown
53
+ def initialize(skill_table)
54
+ @skill_name = skill_table
55
+ end
56
+
57
+ def roll(randomizer)
58
+ @skill_name.roll_command(randomizer, "AT6")
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,193 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bcdice/game_system/beginning_idol/chain_table"
4
+ require "bcdice/game_system/beginning_idol/chain_d66_table"
5
+ require "bcdice/game_system/beginning_idol/bad_status_table"
6
+ require "bcdice/game_system/beginning_idol/random_event_table"
7
+ require "bcdice/game_system/beginning_idol/my_skill_name_table"
8
+ require "bcdice/game_system/beginning_idol/d6_twice_table"
9
+ require "bcdice/game_system/beginning_idol/item_table"
10
+ require "bcdice/game_system/beginning_idol/costume_table"
11
+ require "bcdice/game_system/beginning_idol/accessories_table"
12
+ require "bcdice/game_system/beginning_idol/with_abnormality"
13
+ require "bcdice/game_system/beginning_idol/work_table"
14
+ require "bcdice/game_system/beginning_idol/skill_table"
15
+
16
+ module BCDice
17
+ module GameSystem
18
+ class BeginningIdol < Base
19
+ class << self
20
+ private
21
+
22
+ def translate_skill_table(locale)
23
+ SkillTable.from_i18n(
24
+ "BeginningIdol.skill_table",
25
+ locale,
26
+ rtt: "AT",
27
+ rttn: ["AT1", "AT2", "AT3", "AT4", "AT5", "AT6"]
28
+ )
29
+ end
30
+
31
+ def translate_tables(locale)
32
+ costume_challenge_girls = CostumeTable.from_i18n("BeginningIdol.tables.DT", locale)
33
+ costume_road_to_prince = CostumeTable.from_i18n("BeginningIdol.tables.RC", locale)
34
+ costume_fortune_stars = CostumeTable.from_i18n("BeginningIdol.tables.FC", locale)
35
+
36
+ bland = ChainTable.new(
37
+ I18n.t("BeginningIdol.ACB.name", locale: locale),
38
+ "1D6",
39
+ [
40
+ [I18n.t("BeginningIdol.ACB.items.challenge_girls", locale: locale), costume_challenge_girls.brand_only()],
41
+ [I18n.t("BeginningIdol.ACB.items.challenge_girls", locale: locale), costume_challenge_girls.brand_only()],
42
+ [I18n.t("BeginningIdol.ACB.items.road_to_prince", locale: locale), costume_road_to_prince.brand_only()],
43
+ [I18n.t("BeginningIdol.ACB.items.road_to_prince", locale: locale), costume_road_to_prince.brand_only()],
44
+ [I18n.t("BeginningIdol.ACB.items.fortune_stars", locale: locale), costume_fortune_stars.brand_only()],
45
+ [I18n.t("BeginningIdol.ACB.items.fortune_stars", locale: locale), costume_fortune_stars.brand_only()],
46
+ ]
47
+ )
48
+
49
+ bad_status_table = BadStatusTable.new(locale)
50
+
51
+ skill_table = translate_skill_table(locale)
52
+
53
+ rare_skill_table = DiceTable::Table.from_i18n("BeginningIdol.rare_skill_table", locale)
54
+
55
+ item_table = ItemTable.new(locale)
56
+
57
+ tn = ChainTable.new(
58
+ I18n.t("BeginningIdol.TN.name", locale: locale),
59
+ "1D6",
60
+ I18n.t("BeginningIdol.TN.items", locale: locale).dup.tap { |items| items[3].push(skill_table) }
61
+ )
62
+
63
+ cg = ChainTable.new(
64
+ I18n.t("BeginningIdol.CG.name", locale: locale),
65
+ "1D6",
66
+ I18n.t("BeginningIdol.CG.items", locale: locale).map.with_index do |item, index|
67
+ if [3, 4].include?(index)
68
+ [item, item_table]
69
+ else
70
+ [item]
71
+ end
72
+ end
73
+ )
74
+
75
+ gg = ChainD66Table.new(
76
+ I18n.t("BeginningIdol.GG.name", locale: locale),
77
+ I18n.t("BeginningIdol.GG.items", locale: locale).to_h do |index, value|
78
+ chain =
79
+ if [23, 24, 25].include?(index)
80
+ [value, rare_skill_table]
81
+ elsif index == 56
82
+ [value, item_table]
83
+ else
84
+ [value]
85
+ end
86
+
87
+ [index, chain]
88
+ end
89
+ )
90
+
91
+ ha = ChainD66Table.new(
92
+ I18n.t("BeginningIdol.HA.name", locale: locale),
93
+ I18n.t("BeginningIdol.HA.items", locale: locale).dup.tap { |items| items[22].push(SkillHometown.new(skill_table)) }
94
+ )
95
+
96
+ {
97
+ "DT" => costume_challenge_girls,
98
+ "RC" => costume_road_to_prince,
99
+ "FC" => costume_fortune_stars,
100
+ "ACB" => bland,
101
+ "TN" => tn,
102
+ "CG" => cg,
103
+ "GG" => gg,
104
+ "HA" => ha,
105
+ "CBT" => DiceTable::D66Table.from_i18n("BeginningIdol.tables.CBT", locale),
106
+ "RCB" => DiceTable::D66Table.from_i18n("BeginningIdol.tables.RCB", locale),
107
+ "HBT" => DiceTable::D66Table.from_i18n("BeginningIdol.tables.HBT", locale),
108
+ "RHB" => DiceTable::D66Table.from_i18n("BeginningIdol.tables.RHB", locale),
109
+ "RU" => DiceTable::Table.from_i18n("BeginningIdol.tables.RU", locale),
110
+ "SIP" => DiceTable::Table.from_i18n("BeginningIdol.tables.SIP", locale),
111
+ "BU" => DiceTable::Table.from_i18n("BeginningIdol.tables.BU", locale),
112
+ "HW" => DiceTable::Table.from_i18n("BeginningIdol.tables.HW", locale),
113
+ "FL" => DiceTable::Table.from_i18n("BeginningIdol.tables.FL", locale),
114
+ "MSE" => DiceTable::Table.from_i18n("BeginningIdol.tables.MSE", locale),
115
+ "ST" => DiceTable::Table.from_i18n("BeginningIdol.tables.ST", locale),
116
+ "FST" => DiceTable::Table.from_i18n("BeginningIdol.tables.FST", locale),
117
+ "BWT" => DiceTable::D66Table.from_i18n("BeginningIdol.tables.BWT", locale),
118
+ "LWT" => DiceTable::D66Table.from_i18n("BeginningIdol.tables.LWT", locale),
119
+ "TWT" => DiceTable::D66Table.from_i18n("BeginningIdol.tables.TWT", locale),
120
+ "CWT" => DiceTable::D66Table.from_i18n("BeginningIdol.tables.CWT", locale),
121
+ "SU" => DiceTable::D66Table.from_i18n("BeginningIdol.tables.SU", locale),
122
+ "WI" => DiceTable::D66Table.from_i18n("BeginningIdol.tables.WI", locale),
123
+ "NA" => DiceTable::D66Table.from_i18n("BeginningIdol.tables.NA", locale),
124
+ "GA" => DiceTable::D66Table.from_i18n("BeginningIdol.tables.GA", locale),
125
+ "BA" => DiceTable::D66Table.from_i18n("BeginningIdol.tables.BA", locale),
126
+ "WT" => DiceTable::D66Table.from_i18n("BeginningIdol.tables.WT", locale),
127
+ "VA" => DiceTable::D66Table.from_i18n("BeginningIdol.tables.VA", locale),
128
+ "MU" => DiceTable::D66Table.from_i18n("BeginningIdol.tables.MU", locale),
129
+ "DR" => DiceTable::D66Table.from_i18n("BeginningIdol.tables.DR", locale),
130
+ "VI" => DiceTable::D66Table.from_i18n("BeginningIdol.tables.VI", locale),
131
+ "SP" => DiceTable::D66Table.from_i18n("BeginningIdol.tables.SP", locale),
132
+ "CHR" => DiceTable::D66Table.from_i18n("BeginningIdol.tables.CHR", locale),
133
+ "PAR" => DiceTable::D66Table.from_i18n("BeginningIdol.tables.PAR", locale),
134
+ "SW" => DiceTable::D66Table.from_i18n("BeginningIdol.tables.SW", locale),
135
+ "AN" => DiceTable::D66Table.from_i18n("BeginningIdol.tables.AN", locale),
136
+ "MOV" => DiceTable::D66Table.from_i18n("BeginningIdol.tables.MOV", locale),
137
+ "FA" => DiceTable::D66Table.from_i18n("BeginningIdol.tables.FA", locale),
138
+ "BVT" => DiceTable::Table.from_i18n("BeginningIdol.tables.BVT", locale),
139
+ "LVT" => DiceTable::Table.from_i18n("BeginningIdol.tables.LVT", locale),
140
+ "TVT" => DiceTable::Table.from_i18n("BeginningIdol.tables.TVT", locale),
141
+ "CVT" => DiceTable::Table.from_i18n("BeginningIdol.tables.CVT", locale),
142
+ "BST" => DiceTable::Table.from_i18n("BeginningIdol.tables.BST", locale),
143
+ "LST" => DiceTable::Table.from_i18n("BeginningIdol.tables.LST", locale),
144
+ "TST" => DiceTable::Table.from_i18n("BeginningIdol.tables.TST", locale),
145
+ "CST" => DiceTable::Table.from_i18n("BeginningIdol.tables.CST", locale),
146
+ "BPT" => DiceTable::Table.from_i18n("BeginningIdol.tables.BPT", locale),
147
+ "LPT" => DiceTable::Table.from_i18n("BeginningIdol.tables.LPT", locale),
148
+ "TPT" => DiceTable::Table.from_i18n("BeginningIdol.tables.TPT", locale),
149
+ "CPT" => DiceTable::Table.from_i18n("BeginningIdol.tables.CPT", locale),
150
+ "BIT" => DiceTable::Table.from_i18n("BeginningIdol.tables.BIT", locale),
151
+ "LIT" => DiceTable::Table.from_i18n("BeginningIdol.tables.LIT", locale),
152
+ "TIT" => DiceTable::Table.from_i18n("BeginningIdol.tables.TIT", locale),
153
+ "CIT" => DiceTable::Table.from_i18n("BeginningIdol.tables.CIT", locale),
154
+ "CHO" => DiceTable::D66Table.from_i18n("BeginningIdol.tables.CHO", locale),
155
+ "SCH" => DiceTable::Table.from_i18n("BeginningIdol.tables.SCH", locale),
156
+ "WCH" => DiceTable::Table.from_i18n("BeginningIdol.tables.WCH", locale),
157
+ "NCH" => DiceTable::Table.from_i18n("BeginningIdol.tables.NCH", locale),
158
+ "GCH" => DiceTable::D66Table.from_i18n("BeginningIdol.tables.GCH", locale),
159
+ "PCH" => DiceTable::D66Table.from_i18n("BeginningIdol.tables.PCH", locale),
160
+ "LUR" => D6TwiceTable.from_i18n("BeginningIdol.tables.LUR", locale),
161
+ "SUR" => D6TwiceTable.from_i18n("BeginningIdol.tables.SUR", locale),
162
+ "WUR" => D6TwiceTable.from_i18n("BeginningIdol.tables.WUR", locale),
163
+ "NUR" => D6TwiceTable.from_i18n("BeginningIdol.tables.NUR", locale),
164
+ "GUR" => D6TwiceTable.from_i18n("BeginningIdol.tables.GUR", locale),
165
+ "BUR" => D6TwiceTable.from_i18n("BeginningIdol.tables.BUR", locale),
166
+ "ACE" => DiceTable::D66Table.from_i18n("BeginningIdol.tables.ACE", locale),
167
+ "ACT" => translate_accessories_table(locale),
168
+ "MS" => MySkillNameTable.new(locale),
169
+ "RE" => RandomEventTable.new(locale),
170
+ "SH" => D66WithAbnormality.from_i18n("BeginningIdol.tables.SH", bad_status_table, locale),
171
+ "MO" => D66WithAbnormality.from_i18n("BeginningIdol.tables.MO", bad_status_table, locale),
172
+ "SEA" => D66WithAbnormality.from_i18n("BeginningIdol.tables.SEA", bad_status_table, locale),
173
+ "SPA" => D66WithAbnormality.from_i18n("BeginningIdol.tables.SPA", bad_status_table, locale),
174
+ "LN" => TableWithAbnormality.from_i18n("BeginningIdol.tables.LN", bad_status_table, locale),
175
+ "SGT" => SkillGetTable.from_i18n("BeginningIdol.tables.SGT", skill_table, locale),
176
+ "RS" => SkillGetTable.from_i18n("BeginningIdol.tables.RS", skill_table, locale),
177
+ }
178
+ end
179
+ end
180
+
181
+ TABLES = translate_tables(:ja_jp)
182
+
183
+ BAD_STATUS_TABLE = BadStatusTable.new(:ja_jp)
184
+
185
+ LOCAL_WORK_TABLE = translate_local_work_table(:ja_jp)
186
+ ITEM_TABLE = ItemTable.new(:ja_jp)
187
+
188
+ SKILL_TABLE = translate_skill_table(:ja_jp)
189
+
190
+ register_prefix(TABLES.keys)
191
+ end
192
+ end
193
+ end
@@ -0,0 +1,74 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BCDice
4
+ module GameSystem
5
+ class BeginningIdol < Base
6
+ module WithAbnormality
7
+ def replace_abnormality(chosen, randomizer)
8
+ reg = Regexp.new(I18n.t("BeginningIdol.abnormality.regexp", locale: @locale))
9
+ m = reg.match(chosen.body)
10
+ unless m
11
+ return chosen
12
+ end
13
+
14
+ abno_count = kanji_to_i(m[1])
15
+ unless abno_count
16
+ return chosen
17
+ end
18
+
19
+ text = @bad_status_table.roll(randomizer, abno_count)
20
+ new_body = chosen.body.sub(reg, text)
21
+
22
+ return DiceTable::RollResult.new(chosen.table_name, chosen.value, new_body)
23
+ end
24
+
25
+ def kanji_to_i(kanji)
26
+ list = I18n.t("BeginningIdol.abnormality.num_map", locale: @locale)
27
+ list.find_index(kanji)&.succ
28
+ end
29
+ end
30
+
31
+ class D66WithAbnormality < DiceTable::D66Table
32
+ include WithAbnormality
33
+
34
+ def self.from_i18n(key, bad_status_table, locale)
35
+ table = I18n.t(key, locale: locale)
36
+ sort_type = D66SortType.const_get(table[:d66_sort_type])
37
+
38
+ new(table[:name], sort_type, table[:items], bad_status_table, locale)
39
+ end
40
+
41
+ def initialize(name, sort_type, items, bad_status_table, locale)
42
+ super(name, sort_type, items)
43
+ @bad_status_table = bad_status_table
44
+ @locale = locale
45
+ end
46
+
47
+ def roll(randomizer)
48
+ chosen = super(randomizer)
49
+ replace_abnormality(chosen, randomizer)
50
+ end
51
+ end
52
+
53
+ class TableWithAbnormality < DiceTable::Table
54
+ include WithAbnormality
55
+
56
+ def self.from_i18n(key, bad_status_table, locale)
57
+ table = I18n.t(key, locale: locale)
58
+ new(table[:name], table[:type], table[:items], bad_status_table, locale)
59
+ end
60
+
61
+ def initialize(name, type, items, bad_status_table, locale)
62
+ super(name, type, items)
63
+ @bad_status_table = bad_status_table
64
+ @locale = locale
65
+ end
66
+
67
+ def roll(randomizer)
68
+ chosen = super(randomizer)
69
+ replace_abnormality(chosen, randomizer)
70
+ end
71
+ end
72
+ end
73
+ end
74
+ end