bcdice 3.0.0.pre.alpha.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (258) hide show
  1. checksums.yaml +7 -0
  2. data/.editorconfig +21 -0
  3. data/.github/.codecov.yaml +10 -0
  4. data/.github/workflows/coverage.yaml +21 -0
  5. data/.github/workflows/lint.yaml +13 -0
  6. data/.github/workflows/test.yml +20 -0
  7. data/.gitignore +14 -0
  8. data/.rubocop.yml +96 -0
  9. data/.rubocop_todo.yml +113 -0
  10. data/CHANGELOG.md +868 -0
  11. data/Gemfile +11 -0
  12. data/LICENSE +29 -0
  13. data/README.md +38 -0
  14. data/ROADMAP.md +30 -0
  15. data/Rakefile +118 -0
  16. data/bcdice.gemspec +27 -0
  17. data/bin/repl.rb +21 -0
  18. data/docs/README.txt +2028 -0
  19. data/docs/dicebot_sort_key.md +72 -0
  20. data/docs/how_to_make_dicebot.md +453 -0
  21. data/lib/bcdice.rb +8 -0
  22. data/lib/bcdice/arithmetic_evaluator.rb +167 -0
  23. data/lib/bcdice/base.rb +423 -0
  24. data/lib/bcdice/command_parser.rb +242 -0
  25. data/lib/bcdice/common_command.rb +23 -0
  26. data/lib/bcdice/common_command/add_dice.rb +54 -0
  27. data/lib/bcdice/common_command/add_dice/node.rb +488 -0
  28. data/lib/bcdice/common_command/add_dice/parser.rb +282 -0
  29. data/lib/bcdice/common_command/add_dice/randomizer.rb +48 -0
  30. data/lib/bcdice/common_command/barabara_dice.rb +57 -0
  31. data/lib/bcdice/common_command/calc.rb +39 -0
  32. data/lib/bcdice/common_command/choice.rb +35 -0
  33. data/lib/bcdice/common_command/d66_dice.rb +63 -0
  34. data/lib/bcdice/common_command/reroll_dice.rb +190 -0
  35. data/lib/bcdice/common_command/upper_dice.rb +165 -0
  36. data/lib/bcdice/common_command/version.rb +26 -0
  37. data/lib/bcdice/dice_table.rb +8 -0
  38. data/lib/bcdice/dice_table/chain_table.rb +33 -0
  39. data/lib/bcdice/dice_table/d66_grid_table.rb +26 -0
  40. data/lib/bcdice/dice_table/d66_range_table.rb +26 -0
  41. data/lib/bcdice/dice_table/d66_table.rb +34 -0
  42. data/lib/bcdice/dice_table/range_table.rb +267 -0
  43. data/lib/bcdice/dice_table/roll_result.rb +43 -0
  44. data/lib/bcdice/dice_table/sai_fic_skill_table.rb +32 -0
  45. data/lib/bcdice/dice_table/table.rb +35 -0
  46. data/lib/bcdice/enum.rb +15 -0
  47. data/lib/bcdice/format.rb +36 -0
  48. data/lib/bcdice/game_system.rb +187 -0
  49. data/lib/bcdice/game_system/AFF2e.rb +141 -0
  50. data/lib/bcdice/game_system/AceKillerGene.rb +55 -0
  51. data/lib/bcdice/game_system/Airgetlamh.rb +117 -0
  52. data/lib/bcdice/game_system/Alsetto.rb +124 -0
  53. data/lib/bcdice/game_system/Alshard.rb +27 -0
  54. data/lib/bcdice/game_system/AlterRaise.rb +282 -0
  55. data/lib/bcdice/game_system/Amadeus.rb +622 -0
  56. data/lib/bcdice/game_system/Amadeus_Korean.rb +501 -0
  57. data/lib/bcdice/game_system/AnimaAnimus.rb +96 -0
  58. data/lib/bcdice/game_system/Arianrhod.rb +50 -0
  59. data/lib/bcdice/game_system/ArsMagica.rb +149 -0
  60. data/lib/bcdice/game_system/Avandner.rb +101 -0
  61. data/lib/bcdice/game_system/BBN.rb +143 -0
  62. data/lib/bcdice/game_system/BadLife.rb +435 -0
  63. data/lib/bcdice/game_system/BarnaKronika.rb +188 -0
  64. data/lib/bcdice/game_system/BattleTech.rb +530 -0
  65. data/lib/bcdice/game_system/BeastBindTrinity.rb +348 -0
  66. data/lib/bcdice/game_system/BeginningIdol.rb +2527 -0
  67. data/lib/bcdice/game_system/BeginningIdol_Korean.rb +2378 -0
  68. data/lib/bcdice/game_system/BladeOfArcana.rb +252 -0
  69. data/lib/bcdice/game_system/BlindMythos.rb +460 -0
  70. data/lib/bcdice/game_system/BloodCrusade.rb +423 -0
  71. data/lib/bcdice/game_system/BloodMoon.rb +213 -0
  72. data/lib/bcdice/game_system/CardRanker.rb +249 -0
  73. data/lib/bcdice/game_system/ChaosFlare.rb +181 -0
  74. data/lib/bcdice/game_system/Chill.rb +163 -0
  75. data/lib/bcdice/game_system/Chill3.rb +52 -0
  76. data/lib/bcdice/game_system/CodeLayerd.rb +132 -0
  77. data/lib/bcdice/game_system/ColossalHunter.rb +569 -0
  78. data/lib/bcdice/game_system/CrashWorld.rb +81 -0
  79. data/lib/bcdice/game_system/Cthulhu.rb +252 -0
  80. data/lib/bcdice/game_system/Cthulhu7th.rb +767 -0
  81. data/lib/bcdice/game_system/Cthulhu7th_ChineseTraditional.rb +386 -0
  82. data/lib/bcdice/game_system/Cthulhu7th_Korean.rb +383 -0
  83. data/lib/bcdice/game_system/CthulhuTech.rb +263 -0
  84. data/lib/bcdice/game_system/Cthulhu_ChineseTraditional.rb +243 -0
  85. data/lib/bcdice/game_system/Cthulhu_Korean.rb +240 -0
  86. data/lib/bcdice/game_system/DarkBlaze.rb +207 -0
  87. data/lib/bcdice/game_system/DarkDaysDrive.rb +425 -0
  88. data/lib/bcdice/game_system/DarkSouls.rb +91 -0
  89. data/lib/bcdice/game_system/DeadlineHeroes.rb +583 -0
  90. data/lib/bcdice/game_system/DemonParasite.rb +524 -0
  91. data/lib/bcdice/game_system/DetatokoSaga.rb +310 -0
  92. data/lib/bcdice/game_system/DetatokoSaga_Korean.rb +310 -0
  93. data/lib/bcdice/game_system/DiceBot.rb +17 -0
  94. data/lib/bcdice/game_system/DiceOfTheDead.rb +111 -0
  95. data/lib/bcdice/game_system/DoubleCross.rb +373 -0
  96. data/lib/bcdice/game_system/DoubleCross_Korean.rb +371 -0
  97. data/lib/bcdice/game_system/Dracurouge.rb +1856 -0
  98. data/lib/bcdice/game_system/Dracurouge_Korean.rb +310 -0
  99. data/lib/bcdice/game_system/DungeonsAndDragons.rb +19 -0
  100. data/lib/bcdice/game_system/EarthDawn.rb +225 -0
  101. data/lib/bcdice/game_system/EarthDawn3.rb +275 -0
  102. data/lib/bcdice/game_system/EarthDawn4.rb +272 -0
  103. data/lib/bcdice/game_system/EclipsePhase.rb +51 -0
  104. data/lib/bcdice/game_system/Elric.rb +36 -0
  105. data/lib/bcdice/game_system/Elysion.rb +1213 -0
  106. data/lib/bcdice/game_system/EmbryoMachine.rb +227 -0
  107. data/lib/bcdice/game_system/EndBreaker.rb +132 -0
  108. data/lib/bcdice/game_system/EtrianOdysseySRS.rb +27 -0
  109. data/lib/bcdice/game_system/Fiasco.rb +123 -0
  110. data/lib/bcdice/game_system/Fiasco_Korean.rb +122 -0
  111. data/lib/bcdice/game_system/FilledWith.rb +1543 -0
  112. data/lib/bcdice/game_system/FullMetalPanic.rb +27 -0
  113. data/lib/bcdice/game_system/FutariSousa.rb +994 -0
  114. data/lib/bcdice/game_system/FutariSousa_Korean.rb +994 -0
  115. data/lib/bcdice/game_system/Garako.rb +559 -0
  116. data/lib/bcdice/game_system/GardenOrder.rb +451 -0
  117. data/lib/bcdice/game_system/GehennaAn.rb +136 -0
  118. data/lib/bcdice/game_system/GeishaGirlwithKatana.rb +120 -0
  119. data/lib/bcdice/game_system/GoblinSlayer.rb +168 -0
  120. data/lib/bcdice/game_system/GoldenSkyStories.rb +77 -0
  121. data/lib/bcdice/game_system/Gorilla.rb +44 -0
  122. data/lib/bcdice/game_system/GranCrest.rb +518 -0
  123. data/lib/bcdice/game_system/Gundog.rb +52 -0
  124. data/lib/bcdice/game_system/GundogRevised.rb +294 -0
  125. data/lib/bcdice/game_system/GundogZero.rb +261 -0
  126. data/lib/bcdice/game_system/Gurps.rb +403 -0
  127. data/lib/bcdice/game_system/GurpsFW.rb +2330 -0
  128. data/lib/bcdice/game_system/HarnMaster.rb +208 -0
  129. data/lib/bcdice/game_system/HatsuneMiku.rb +706 -0
  130. data/lib/bcdice/game_system/Hieizan.rb +48 -0
  131. data/lib/bcdice/game_system/HouraiGakuen.rb +270 -0
  132. data/lib/bcdice/game_system/HuntersMoon.rb +503 -0
  133. data/lib/bcdice/game_system/Illusio.rb +89 -0
  134. data/lib/bcdice/game_system/InfiniteFantasia.rb +51 -0
  135. data/lib/bcdice/game_system/Insane.rb +822 -0
  136. data/lib/bcdice/game_system/Insane_Korean.rb +773 -0
  137. data/lib/bcdice/game_system/IthaWenUa.rb +38 -0
  138. data/lib/bcdice/game_system/JamesBond.rb +45 -0
  139. data/lib/bcdice/game_system/Kamigakari.rb +394 -0
  140. data/lib/bcdice/game_system/Kamigakari_Korean.rb +428 -0
  141. data/lib/bcdice/game_system/KanColle.rb +938 -0
  142. data/lib/bcdice/game_system/KemonoNoMori.rb +258 -0
  143. data/lib/bcdice/game_system/KillDeathBusiness.rb +1420 -0
  144. data/lib/bcdice/game_system/KillDeathBusiness_Korean.rb +1510 -0
  145. data/lib/bcdice/game_system/KurayamiCrying.rb +49 -0
  146. data/lib/bcdice/game_system/LiveraDoll.rb +375 -0
  147. data/lib/bcdice/game_system/LogHorizon.rb +3567 -0
  148. data/lib/bcdice/game_system/LogHorizon_Korean.rb +1407 -0
  149. data/lib/bcdice/game_system/LostRecord.rb +30 -0
  150. data/lib/bcdice/game_system/LostRoyal.rb +242 -0
  151. data/lib/bcdice/game_system/MagicaLogia.rb +1148 -0
  152. data/lib/bcdice/game_system/MeikyuDays.rb +415 -0
  153. data/lib/bcdice/game_system/MeikyuKingdom.rb +466 -0
  154. data/lib/bcdice/game_system/MeikyuKingdomBasic.rb +269 -0
  155. data/lib/bcdice/game_system/MetalHead.rb +249 -0
  156. data/lib/bcdice/game_system/MetalHeadExtream.rb +917 -0
  157. data/lib/bcdice/game_system/MetallicGuardian.rb +31 -0
  158. data/lib/bcdice/game_system/MonotoneMuseum.rb +354 -0
  159. data/lib/bcdice/game_system/MonotoneMuseum_Korean.rb +304 -0
  160. data/lib/bcdice/game_system/Nechronica.rb +211 -0
  161. data/lib/bcdice/game_system/Nechronica_Korean.rb +160 -0
  162. data/lib/bcdice/game_system/NeverCloud.rb +74 -0
  163. data/lib/bcdice/game_system/NightWizard.rb +231 -0
  164. data/lib/bcdice/game_system/NightWizard3rd.rb +24 -0
  165. data/lib/bcdice/game_system/NightmareHunterDeep.rb +117 -0
  166. data/lib/bcdice/game_system/NinjaSlayer.rb +274 -0
  167. data/lib/bcdice/game_system/NjslyrBattle.rb +54 -0
  168. data/lib/bcdice/game_system/Nuekagami.rb +293 -0
  169. data/lib/bcdice/game_system/OneWayHeroics.rb +134 -0
  170. data/lib/bcdice/game_system/OracleEngine.rb +265 -0
  171. data/lib/bcdice/game_system/OrgaRain.rb +77 -0
  172. data/lib/bcdice/game_system/Oukahoushin3rd.rb +162 -0
  173. data/lib/bcdice/game_system/Paradiso.rb +323 -0
  174. data/lib/bcdice/game_system/Paranoia.rb +64 -0
  175. data/lib/bcdice/game_system/ParanoiaRebooted.rb +109 -0
  176. data/lib/bcdice/game_system/ParasiteBlood.rb +231 -0
  177. data/lib/bcdice/game_system/Pathfinder.rb +21 -0
  178. data/lib/bcdice/game_system/Peekaboo.rb +324 -0
  179. data/lib/bcdice/game_system/Pendragon.rb +39 -0
  180. data/lib/bcdice/game_system/PhantasmAdventure.rb +73 -0
  181. data/lib/bcdice/game_system/Postman.rb +185 -0
  182. data/lib/bcdice/game_system/PulpCthulhu.rb +184 -0
  183. data/lib/bcdice/game_system/Raisondetre.rb +171 -0
  184. data/lib/bcdice/game_system/RecordOfLodossWar.rb +58 -0
  185. data/lib/bcdice/game_system/RecordOfSteam.rb +149 -0
  186. data/lib/bcdice/game_system/RokumonSekai2.rb +110 -0
  187. data/lib/bcdice/game_system/RoleMaster.rb +24 -0
  188. data/lib/bcdice/game_system/RuneQuest.rb +47 -0
  189. data/lib/bcdice/game_system/RyuTuber.rb +266 -0
  190. data/lib/bcdice/game_system/Ryutama.rb +199 -0
  191. data/lib/bcdice/game_system/SRS.rb +348 -0
  192. data/lib/bcdice/game_system/SamsaraBallad.rb +111 -0
  193. data/lib/bcdice/game_system/Satasupe.rb +1173 -0
  194. data/lib/bcdice/game_system/ScreamHighSchool.rb +128 -0
  195. data/lib/bcdice/game_system/SevenFortressMobius.rb +34 -0
  196. data/lib/bcdice/game_system/ShadowRun.rb +26 -0
  197. data/lib/bcdice/game_system/ShadowRun4.rb +49 -0
  198. data/lib/bcdice/game_system/ShadowRun5.rb +80 -0
  199. data/lib/bcdice/game_system/SharedFantasia.rb +69 -0
  200. data/lib/bcdice/game_system/ShinMegamiTenseiKakuseihen.rb +85 -0
  201. data/lib/bcdice/game_system/ShinkuuGakuen.rb +506 -0
  202. data/lib/bcdice/game_system/ShinobiGami.rb +680 -0
  203. data/lib/bcdice/game_system/ShoujoTenrankai.rb +677 -0
  204. data/lib/bcdice/game_system/Skynauts.rb +324 -0
  205. data/lib/bcdice/game_system/SteamPunkers.rb +485 -0
  206. data/lib/bcdice/game_system/StellarKnights.rb +856 -0
  207. data/lib/bcdice/game_system/SterileLife.rb +452 -0
  208. data/lib/bcdice/game_system/StrangerOfSwordCity.rb +103 -0
  209. data/lib/bcdice/game_system/StratoShout.rb +316 -0
  210. data/lib/bcdice/game_system/StratoShout_Korean.rb +314 -0
  211. data/lib/bcdice/game_system/Strave.rb +223 -0
  212. data/lib/bcdice/game_system/SwordWorld.rb +491 -0
  213. data/lib/bcdice/game_system/SwordWorld2_0.rb +295 -0
  214. data/lib/bcdice/game_system/SwordWorld2_5.rb +121 -0
  215. data/lib/bcdice/game_system/TherapieSein.rb +93 -0
  216. data/lib/bcdice/game_system/TokumeiTenkousei.rb +96 -0
  217. data/lib/bcdice/game_system/TokyoGhostResearch.rb +122 -0
  218. data/lib/bcdice/game_system/TokyoNova.rb +19 -0
  219. data/lib/bcdice/game_system/Torg.rb +364 -0
  220. data/lib/bcdice/game_system/Torg1_5.rb +139 -0
  221. data/lib/bcdice/game_system/TorgEternity.rb +414 -0
  222. data/lib/bcdice/game_system/TrinitySeven.rb +364 -0
  223. data/lib/bcdice/game_system/TunnelsAndTrolls.rb +287 -0
  224. data/lib/bcdice/game_system/TwilightGunsmoke.rb +527 -0
  225. data/lib/bcdice/game_system/Utakaze.rb +153 -0
  226. data/lib/bcdice/game_system/VampireTheMasquerade5th.rb +132 -0
  227. data/lib/bcdice/game_system/Villaciel.rb +555 -0
  228. data/lib/bcdice/game_system/WARPS.rb +33 -0
  229. data/lib/bcdice/game_system/WaresBlade.rb +34 -0
  230. data/lib/bcdice/game_system/Warhammer.rb +336 -0
  231. data/lib/bcdice/game_system/WitchQuest.rb +275 -0
  232. data/lib/bcdice/game_system/WorldOfDarkness.rb +135 -0
  233. data/lib/bcdice/game_system/YankeeYogSothoth.rb +440 -0
  234. data/lib/bcdice/game_system/YearZeroEngine.rb +134 -0
  235. data/lib/bcdice/game_system/ZettaiReido.rb +142 -0
  236. data/lib/bcdice/game_system/meikyu_kingdom/item_table.rb +383 -0
  237. data/lib/bcdice/game_system/meikyu_kingdom/kingdom_name_table.rb +89 -0
  238. data/lib/bcdice/game_system/meikyu_kingdom/landscape_table.rb +196 -0
  239. data/lib/bcdice/game_system/meikyu_kingdom/name_tables.rb +223 -0
  240. data/lib/bcdice/game_system/meikyu_kingdom/placename_table.rb +214 -0
  241. data/lib/bcdice/game_system/meikyu_kingdom/tables.rb +610 -0
  242. data/lib/bcdice/game_system/meikyu_kingdom/word_table.rb +117 -0
  243. data/lib/bcdice/game_system/meikyu_kingdom_basic/item_table.rb +380 -0
  244. data/lib/bcdice/game_system/meikyu_kingdom_basic/kingdom_table.rb +184 -0
  245. data/lib/bcdice/game_system/meikyu_kingdom_basic/name_table.rb +417 -0
  246. data/lib/bcdice/game_system/meikyu_kingdom_basic/table.rb +912 -0
  247. data/lib/bcdice/game_system/meikyu_kingdom_basic/word_table.rb +121 -0
  248. data/lib/bcdice/game_system/one_way_heroics/dungeon_table.rb +67 -0
  249. data/lib/bcdice/game_system/one_way_heroics/random_event_table.rb +166 -0
  250. data/lib/bcdice/game_system/one_way_heroics/tables.rb +668 -0
  251. data/lib/bcdice/loader.rb +37 -0
  252. data/lib/bcdice/normalize.rb +38 -0
  253. data/lib/bcdice/preprocessor.rb +87 -0
  254. data/lib/bcdice/randomizer.rb +137 -0
  255. data/lib/bcdice/repl.rb +155 -0
  256. data/lib/bcdice/user_defined_dice_table.rb +153 -0
  257. data/lib/bcdice/version.rb +3 -0
  258. metadata +304 -0
@@ -0,0 +1,134 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BCDice
4
+ module GameSystem
5
+ class YearZeroEngine < Base
6
+ # ゲームシステムの識別子
7
+ ID = 'YearZeroEngine'
8
+
9
+ # ゲームシステム名
10
+ NAME = 'YearZeroEngine'
11
+
12
+ # ゲームシステム名の読みがな
13
+ SORT_KEY = 'いやあせろえんしん'
14
+
15
+ # ダイスボットの使い方
16
+ HELP_MESSAGE = <<~INFO_MESSAGE_TEXT
17
+ ・判定コマンド(nYZEx+x+x)
18
+ (難易度)YZE(能力ダイス数)+(技能ダイス数)+(アイテムダイス数) # (6のみを数える)
19
+
20
+ ・判定コマンド(nMYZx+x+x)
21
+ (難易度)MYZ(能力ダイス数)+(技能ダイス数)+(アイテムダイス数) # (1と6を数え、プッシュ可能数を表示)
22
+
23
+ ※ 難易度と技能、アイテムダイス数は省略可能
24
+ INFO_MESSAGE_TEXT
25
+
26
+ DIFFICULTY_INDEX = 1 # 難易度のインデックス
27
+ COMMAND_TYPE_INDEX = 2 # コマンドタイプのインデックス
28
+ ABILITY_INDEX = 3 # 能力値ダイスのインデックス
29
+ SKILL_INDEX = 5 # 技能値ダイスのインデックス
30
+ MODIFIED_INDEX = 7 # 修正ダイスのインデックス
31
+
32
+ register_prefix(['(\d+)?(YZE|MYZ).*'])
33
+
34
+ def dice_info_init()
35
+ @total_success_dice = 0
36
+ @total_botch_dice = 0
37
+ @base_botch_dice = 0
38
+ @skill_botch_dice = 0
39
+ @gear_botch_dice = 0
40
+ @push_dice = 0
41
+ @difficulty = 0
42
+ end
43
+
44
+ def eval_game_system_specific_command(command)
45
+ m = /\A(\d+)?(YZE|MYZ)(\d+)(\+(\d+))?(\+(\d+))?/.match(command)
46
+ unless m
47
+ return ''
48
+ end
49
+
50
+ dice_info_init
51
+
52
+ @difficulty = m[DIFFICULTY_INDEX].to_i
53
+
54
+ command_type = m[COMMAND_TYPE_INDEX]
55
+
56
+ @total_success_dice = 0
57
+
58
+ dice_pool = m[ABILITY_INDEX].to_i
59
+ ability_dice_text, success_dice, botch_dice = make_dice_roll(dice_pool)
60
+
61
+ @total_success_dice += success_dice
62
+ @total_botch_dice += botch_dice
63
+ @base_botch_dice += botch_dice # 能力ダメージ
64
+ @push_dice += (dice_pool - (success_dice + botch_dice))
65
+
66
+ dice_count_text = "(#{dice_pool}D6)"
67
+ dice_text = ability_dice_text
68
+
69
+ if m[SKILL_INDEX]
70
+ dice_pool = m[SKILL_INDEX].to_i
71
+ skill_dice_text, success_dice, botch_dice = make_dice_roll(dice_pool)
72
+
73
+ @total_success_dice += success_dice
74
+ @total_botch_dice += botch_dice
75
+ @skill_botch_dice += botch_dice # 技能ダイスの1はpushで振り直し可能
76
+ @push_dice += (dice_pool - success_dice) # 技能ダイスのみ1を含む
77
+
78
+ dice_count_text += "+(#{dice_pool}D6)"
79
+ dice_text += "+#{skill_dice_text}"
80
+ end
81
+
82
+ if m[MODIFIED_INDEX]
83
+ dice_pool = m[MODIFIED_INDEX].to_i
84
+ modified_dice_text, success_dice, botch_dice = make_dice_roll(dice_pool)
85
+
86
+ @total_success_dice += success_dice
87
+ @total_botch_dice += botch_dice
88
+ @gear_botch_dice += botch_dice # ギアダメージ
89
+ @push_dice += (dice_pool - (success_dice + botch_dice))
90
+
91
+ dice_count_text += "+(#{dice_pool}D6)"
92
+ dice_text += "+#{modified_dice_text}"
93
+ end
94
+ return make_result_text(command_type, dice_count_text, dice_text)
95
+ end
96
+
97
+ def make_result_text(command_type, dice_count_text, dice_text)
98
+ if command_type == 'YZE'
99
+ return make_result_with_yze(dice_count_text, dice_text)
100
+ elsif command_type == 'MYZ'
101
+ return make_result_with_myz(dice_count_text, dice_text)
102
+ end
103
+
104
+ return 'Error' # 到達しないはず
105
+ end
106
+
107
+ def make_result_with_yze(dice_count_text, dice_text)
108
+ result_text = "#{dice_count_text} > #{dice_text} 成功数:#{@total_success_dice}"
109
+ if @difficulty > 0
110
+ if @total_success_dice >= @difficulty
111
+ result_text = "#{result_text} 難易度=#{@difficulty}:判定成功!"
112
+ else
113
+ result_text = "#{result_text} 難易度=#{@difficulty}:判定失敗!"
114
+ end
115
+ end
116
+ return result_text
117
+ end
118
+
119
+ def make_result_with_myz(dice_count_text, dice_text)
120
+ result_text = make_result_with_yze(dice_count_text, dice_text)
121
+
122
+ return "#{result_text}\n出目1:[能力:#{@base_botch_dice},技能:#{@skill_botch_dice},アイテム:#{@gear_botch_dice}) プッシュ可能=#{@push_dice}ダイス"
123
+ end
124
+
125
+ def make_dice_roll(dice_pool)
126
+ dice_list = @randomizer.roll_barabara(dice_pool, 6)
127
+ success_dice = dice_list.count(6)
128
+ botch_dice = dice_list.count(1)
129
+
130
+ return "[#{dice_list.join(',')}]", success_dice, botch_dice
131
+ end
132
+ end
133
+ end
134
+ end
@@ -0,0 +1,142 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BCDice
4
+ module GameSystem
5
+ class ZettaiReido < Base
6
+ # ゲームシステムの識別子
7
+ ID = 'ZettaiReido'
8
+
9
+ # ゲームシステム名
10
+ NAME = '絶対隷奴'
11
+
12
+ # ゲームシステム名の読みがな
13
+ SORT_KEY = 'せつたいれいと'
14
+
15
+ # ダイスボットの使い方
16
+ HELP_MESSAGE = <<~INFO_MESSAGE_TEXT
17
+ ・判定
18
+ m-2DR+n>=x
19
+ m(基本能力),n(修正値),x(目標値)
20
+ DPの取得の有無も表示されます。
21
+ INFO_MESSAGE_TEXT
22
+
23
+ register_prefix(['\d+\-2DR.*'])
24
+
25
+ def eval_game_system_specific_command(command)
26
+ return nil unless command =~ /^(\d+)-2DR([\+\-\d]*)(>=(\d+))?$/i
27
+
28
+ baseAvility = Regexp.last_match(1).to_i
29
+ modText = Regexp.last_match(2)
30
+ diffValue = Regexp.last_match(4)
31
+
32
+ return roll2DR(baseAvility, modText, diffValue)
33
+ end
34
+
35
+ def roll2DR(baseAvility, modText, diffValue)
36
+ diceTotal, diceText, darkPoint = roll2DarkDice()
37
+
38
+ mod, modText = getModInfo(modText)
39
+ diff, diffText = getDiffInfo(diffValue)
40
+
41
+ output = ""
42
+ output += "(#{baseAvility}-2DR#{modText}#{diffText})"
43
+ output += " > #{baseAvility}-#{diceTotal}[#{diceText}]#{modText}"
44
+
45
+ total = baseAvility - diceTotal + mod
46
+ output += " > #{total}"
47
+
48
+ successText = getSuccessText(diceTotal, total, diff)
49
+ output += successText
50
+
51
+ darkPointText = getDarkPointResult(total, diff, darkPoint)
52
+ output += darkPointText
53
+
54
+ return output
55
+ end
56
+
57
+ def roll2DarkDice()
58
+ dice1 = @randomizer.roll_once(6)
59
+ dice2 = @randomizer.roll_once(6)
60
+
61
+ darkDice1, darkPoint1 = changeDiceToDarkDice(dice1)
62
+ darkDice2, darkPoint2 = changeDiceToDarkDice(dice2)
63
+
64
+ darkPoint = darkPoint1 + darkPoint2
65
+ if darkPoint == 2
66
+ darkPoint = 4
67
+ end
68
+
69
+ darkTotal = darkDice1 + darkDice2
70
+ darkDiceText = "#{darkDice1},#{darkDice2}"
71
+
72
+ return darkTotal, darkDiceText, darkPoint
73
+ end
74
+
75
+ def changeDiceToDarkDice(dice)
76
+ darkPoint = 0
77
+ darkDice = dice
78
+ if dice == 6
79
+ darkDice = 0
80
+ darkPoint = 1
81
+ end
82
+
83
+ return darkDice, darkPoint
84
+ end
85
+
86
+ def getModInfo(modText)
87
+ value = ArithmeticEvaluator.eval(modText)
88
+
89
+ text = ""
90
+ if value < 0
91
+ text = value.to_s
92
+ elsif value > 0
93
+ text = "+" + value.to_s
94
+ end
95
+
96
+ return value, text
97
+ end
98
+
99
+ def getDiffInfo(diffValue)
100
+ diffText = ""
101
+
102
+ unless diffValue.nil?
103
+ diffValue = diffValue.to_i
104
+ diffText = ">=#{diffValue.to_i}"
105
+ end
106
+
107
+ return diffValue, diffText
108
+ end
109
+
110
+ def getDarkPointResult(_total, _diff, darkPoint)
111
+ text = ''
112
+
113
+ if darkPoint > 0
114
+ text = " > #{darkPoint}DP"
115
+ end
116
+
117
+ return text
118
+ end
119
+
120
+ def getSuccessText(diceTotal, total, diff)
121
+ if diceTotal == 0
122
+ return " > クリティカル"
123
+ end
124
+
125
+ if diceTotal == 10
126
+ return " > ファンブル"
127
+ end
128
+
129
+ if diff.nil?
130
+ diff = 0
131
+ end
132
+
133
+ successLevel = (total - diff)
134
+ if successLevel >= 0
135
+ return " > #{successLevel} 成功"
136
+ end
137
+
138
+ return ' > 失敗'
139
+ end
140
+ end
141
+ end
142
+ end
@@ -0,0 +1,383 @@
1
+ module BCDice
2
+ module GameSystem
3
+ class MeikyuKingdom
4
+ # デバイスファクトリー(1D6)
5
+ def mk_device_factory_table()
6
+ output = mk_item_decide_table(@randomizer.roll_once(6))
7
+
8
+ dice = @randomizer.roll_sum(2, 6)
9
+ output = output + " / " + mk_item_features_table(dice)
10
+ return output
11
+ end
12
+
13
+ # アイテムカテゴリ決定表(1D6)
14
+ def mk_item_decide_table(num)
15
+ functionTable = [
16
+ [1, lambda { mk_weapon_item_table(@randomizer.roll_d66(D66SortType::ASC)) }],
17
+ [2, lambda { mk_life_item_table(@randomizer.roll_d66(D66SortType::ASC)) }],
18
+ [3, lambda { mk_rest_item_table(@randomizer.roll_d66(D66SortType::ASC)) }],
19
+ [4, lambda { mk_search_item_table(@randomizer.roll_d66(D66SortType::ASC)) }],
20
+ [5, lambda { mk_rare_weapon_item_table(@randomizer.roll_d66(D66SortType::NO_SORT)) }],
21
+ [6, lambda { mk_rare_item_table(@randomizer.roll_d66(D66SortType::NO_SORT)) }],
22
+ ]
23
+ return get_table_by_number(num, functionTable)
24
+ end
25
+
26
+ # 武具アイテム表(D66)
27
+ def mk_weapon_item_table(num)
28
+ table = [
29
+ [11, "だんびら"],
30
+ [12, "だんびら"],
31
+ [13, "ダガー"],
32
+ [14, "戦斧"],
33
+ [15, "盾"],
34
+ [16, "鑓"],
35
+ [22, "籠手(だんびら)"],
36
+ [23, "手裏剣"],
37
+ [24, "石弓"],
38
+ [25, "甲冑"],
39
+ [26, "戦鎚"],
40
+ [33, "大弓(だんびら)"],
41
+ [34, "爆弾"],
42
+ [35, "鉄砲"],
43
+ [36, "大剣"],
44
+ [44, "拳銃(だんびら)"],
45
+ [45, "ホウキ"],
46
+ [46, "徹甲弾"],
47
+ [55, "だんびら"],
48
+ [56, "大砲"],
49
+ [66, "だんびら"],
50
+ ]
51
+
52
+ return get_table_by_number(num, table)
53
+ end
54
+
55
+ # 生活アイテム表(D66)
56
+ def mk_life_item_table(num)
57
+ table = [
58
+ [11, "バックパック"],
59
+ [12, "バックパック"],
60
+ [13, "鍋"],
61
+ [14, "クラッカー"],
62
+ [15, "がまぐち"],
63
+ [16, "マント"],
64
+ [22, "法衣(バックパック)"],
65
+ [23, "カード"],
66
+ [24, "エプロン"],
67
+ [25, "住民台帳"],
68
+ [26, "携帯電話"],
69
+ [33, "召喚鍵(バックパック)"],
70
+ [34, "肖像画"],
71
+ [35, "衣装"],
72
+ [36, "山吹色のお菓子"],
73
+ [44, "バックパック"],
74
+ [45, "眼鏡"],
75
+ [46, "クレジットカード"],
76
+ [55, "バックパック"],
77
+ [56, "魔道書"],
78
+ [66, "バックパック"],
79
+ ]
80
+
81
+ return get_table_by_number(num, table)
82
+ end
83
+
84
+ # 回復アイテム表(D66)
85
+ def mk_rest_item_table(num)
86
+ table = [
87
+ [11, "お弁当"],
88
+ [12, "お弁当"],
89
+ [13, "特効薬"],
90
+ [14, "保存食"],
91
+ [15, "担架"],
92
+ [16, "珈琲"],
93
+ [22, "軟膏(お弁当)"],
94
+ [23, "チョコレート"],
95
+ [24, "お酒"],
96
+ [25, "フルコース"],
97
+ [26, "ポーション"],
98
+ [33, "お弁当"],
99
+ [34, "救急箱"],
100
+ [35, "強壮剤"],
101
+ [36, "迷宮保険"],
102
+ [44, "お弁当"],
103
+ [45, "科学調味料"],
104
+ [46, "惚れ薬"],
105
+ [55, "お弁当"],
106
+ [56, "復活薬"],
107
+ [66, "お弁当"],
108
+ ]
109
+
110
+ return get_table_by_number(num, table)
111
+ end
112
+
113
+ # 探索アイテム表(D66)
114
+ def mk_search_item_table(num)
115
+ table = [
116
+ [11, "星の欠片"],
117
+ [12, "星の欠片"],
118
+ [13, "旗"],
119
+ [14, "お守り"],
120
+ [15, "拷問具"],
121
+ [16, "パワーリスト"],
122
+ [22, "工具(星の欠片)"],
123
+ [23, "テント"],
124
+ [24, "楽器"],
125
+ [25, "使い魔"],
126
+ [26, "乗騎"],
127
+ [33, "迷宮迷彩(星の欠片)"],
128
+ [34, "罠百科"],
129
+ [35, "迷宮防護服"],
130
+ [36, "地図"],
131
+ [44, "星の欠片"],
132
+ [45, "時計"],
133
+ [46, "もぐら棒"],
134
+ [55, "星の欠片"],
135
+ [56, "カボチャの馬車"],
136
+ [66, "星の欠片"],
137
+ ]
138
+
139
+ return get_table_by_number(num, table)
140
+ end
141
+
142
+ # レア武具アイテム表(1D6+1D6)
143
+ def mk_rare_weapon_item_table(num)
144
+ table = [
145
+ [11, "虚弾"],
146
+ [12, "怪物毒"],
147
+ [13, "小鬼の襟巻"],
148
+ [14, "喇叭銃"],
149
+ [15, "蛍矢"],
150
+ [16, "大盾"],
151
+ [21, "まわし"],
152
+ [22, "怪物毒"],
153
+ [23, "しゃべる剣"],
154
+ [24, "小麦粉"],
155
+ [25, "王笏"],
156
+ [26, "服従の鞭"],
157
+ [31, "ぬいぐるみ"],
158
+ [32, "魔杖"],
159
+ [33, "怪物毒"],
160
+ [34, "星衣"],
161
+ [35, "聖印"],
162
+ [36, "獣の毛皮"],
163
+ [41, "日傘"],
164
+ [42, "チェインソード"],
165
+ [43, "邪眼"],
166
+ [44, "怪物毒"],
167
+ [45, "徒手空拳"],
168
+ [46, "バカには見えない鎧"],
169
+ [51, "ビキニアーマー"],
170
+ [52, "輝く者"],
171
+ [53, "貪る者"],
172
+ [54, "滅ぼす者"],
173
+ [55, "機械の体"],
174
+ [56, "破城槌"],
175
+ [61, "刈り取る者"],
176
+ [62, "貫く者"],
177
+ [63, "黄金の鶴嘴"],
178
+ [64, "ムラサマ"],
179
+ [65, "蒸気甲冑"],
180
+ [66, "王剣"],
181
+ ]
182
+
183
+ return get_table_by_number(num, table)
184
+ end
185
+
186
+ # レア一般アイテム表(1D6+1D6)
187
+ def mk_rare_item_table(num)
188
+ table = [
189
+ [11, "ブルーリボン"],
190
+ [12, "聖痕"],
191
+ [13, "剥製"],
192
+ [14, "愚者の冠"],
193
+ [15, "名刺"],
194
+ [16, "種籾"],
195
+ [21, "香水"],
196
+ [22, "守りの指輪(名刺)"],
197
+ [23, "煙玉"],
198
+ [24, "悪名"],
199
+ [25, "藁人形"],
200
+ [26, "パワー餌"],
201
+ [31, "王妃の鏡"],
202
+ [32, "蓄音機"],
203
+ [33, "無限の心臓(名刺)"],
204
+ [34, "星籠"],
205
+ [35, "水晶球"],
206
+ [36, "転ばぬ先の杖"],
207
+ [41, "悟りの書"],
208
+ [42, "操りロープ"],
209
+ [43, "盗賊の七つ道具"],
210
+ [44, "携帯算術機(名刺)"],
211
+ [45, "棺桶"],
212
+ [46, "カメラ"],
213
+ [51, "不思議なたまご"],
214
+ [52, "ブーケ"],
215
+ [53, "露眼鏡"],
216
+ [54, "災厄王の遺物"],
217
+ [55, "経験値"],
218
+ [56, "鞍"],
219
+ [61, "視肉"],
220
+ [62, "玉璽"],
221
+ [63, "衛星帯"],
222
+ [64, "軍配"],
223
+ [65, "聖杯"],
224
+ [66, "愛"],
225
+ ]
226
+
227
+ return get_table_by_number(num, table)
228
+ end
229
+
230
+ # アイテムの特性決定表(2D6)
231
+ def mk_item_features_table(num)
232
+ output = ""
233
+ dice = @randomizer.roll_sum(2, 6)
234
+
235
+ if num <= 2
236
+ output = "「" + mk_item_power_table(@randomizer.roll_once(6)) + "」の神力を宿す"
237
+ elsif num <= 3
238
+ output = "寿命を持つ。寿命の値を決定する。" + "\n"
239
+ output += "さらに、" + mk_item_features_table(dice)
240
+ elsif num <= 4
241
+ output = "境界障壁を持つ。《HP》の値を決定する。"
242
+ elsif num <= 5
243
+ output = "銘を持つ。銘を決定する。"
244
+ elsif num <= 6
245
+ output = "合成具である。もう1つの機能は「" + mk_item_decide_table(@randomizer.roll_once(6)) + "」である。"
246
+ elsif num <= 7
247
+ output = "そのアイテムにレベルがあれば、レベルを1点上昇する。" + "\n"
248
+ output += "レベルが設定されていなければ、" + mk_item_features_table(dice)
249
+ elsif num <= 8
250
+ output = "「" + mk_item_jyumon_table(dice) + "」の呪紋を持つ。"
251
+ elsif num <= 9
252
+ output = "「" + mk_item_jyuka_table(@randomizer.roll_once(6)) + "」の呪禍を持つ。" + "\n"
253
+ output += "さらに、" + mk_item_features_table(dice)
254
+ elsif num <= 10
255
+ output = "高価だ。価格を設定する。"
256
+ elsif num <= 11
257
+ output = "「条件:" + mk_item_aptitude_table(@randomizer.roll_once(6)) + "」の適性を持つ。" + "\n"
258
+ output += "さらに、" + mk_item_features_table(dice)
259
+ else
260
+ output = "「" + mk_item_attribute_table(@randomizer.roll_once(6)) + "」の属性を持つ。"
261
+ end
262
+
263
+ return "特性[" + num.to_s + "]:" + output
264
+ end
265
+
266
+ # 神力決定表(1D6)
267
+ def mk_item_power_table(num)
268
+ table = [
269
+ [1, "〔才覚〕"],
270
+ [2, "〔魅力〕"],
271
+ [3, "〔探索〕"],
272
+ [4, "〔武勇〕"],
273
+ [5, "〈器〉"],
274
+ [6, "〈回避値〉"],
275
+ ]
276
+
277
+ return "[#{num}]" + get_table_by_number(num, table)
278
+ end
279
+
280
+ # 呪紋決定表(2D6)
281
+ def mk_item_jyumon_table(num)
282
+ table = [
283
+ [2, "モンスタースキル"],
284
+ [3, "便利スキル"],
285
+ [4, "芸能スキル"],
286
+ [5, "迷宮スキル"],
287
+ [6, "星術スキル"],
288
+ [7, "一般スキル"],
289
+ [8, "召喚スキル"],
290
+ [9, "科学スキル"],
291
+ [10, "交渉スキル"],
292
+ [11, "神官のクラススキル"],
293
+ [12, "ジョブスキル"],
294
+ ]
295
+
296
+ return "[#{num}]" + get_table_by_number(num, table)
297
+ end
298
+
299
+ # 呪禍表(1D6)
300
+ def mk_item_jyuka_table(num)
301
+ table = [
302
+ [1, "「呪い」のバッドステータス"],
303
+ [2, "「肥満」のバッドステータス"],
304
+ [3, "「愚か」のバッドステータス"],
305
+ [4, "サイクルの終了時に《HP》が1点減少する"],
306
+ [5, "条件を満たしても誰とも人間関係を結べない"],
307
+ [6, "〈器〉が1点減少する"],
308
+ ]
309
+
310
+ return "[#{num}]" + get_table_by_number(num, table)
311
+ end
312
+
313
+ # 適正表(1D6)
314
+ def mk_item_aptitude_table(num)
315
+ table = [
316
+ [1, "ランダムなクラス1種"],
317
+ [2, lambda { mk_family_business_table(@randomizer.roll_d66(D66SortType::ASC)) }],
318
+ [3, lambda { mk_gender_table(@randomizer.roll_once(6)) + "性" }],
319
+ [4, "上級ジョブ"],
320
+ [5, "モンスタースキルを修得"],
321
+ [6, "童貞、もしくは処女"],
322
+ ]
323
+
324
+ return "[#{num}]" + get_table_by_number(num, table)
325
+ end
326
+
327
+ # 属性表(1D6)
328
+ def mk_item_attribute_table(num)
329
+ table = [
330
+ [1, "自然の力"],
331
+ [2, "幻夢の力"],
332
+ [3, "星炎の力"],
333
+ [4, "暗黒の力"],
334
+ [5, "聖なるの力"],
335
+ [6, "災厄の力"],
336
+ ]
337
+
338
+ return "[#{num}]" + get_table_by_number(num, table)
339
+ end
340
+
341
+ def mk_gender_table(num)
342
+ output = "1"
343
+
344
+ if num.odd?
345
+ output = "男"
346
+ else
347
+ output = "女"
348
+ end
349
+
350
+ return output
351
+ end
352
+
353
+ # 生まれ表(D66)
354
+ def mk_family_business_table(num)
355
+ table = [
356
+ [11, "星術師"],
357
+ [12, "魔道師"],
358
+ [13, "召喚師"],
359
+ [14, "博士"],
360
+ [15, "医者"],
361
+ [16, "貴族"],
362
+ [22, "宦官"],
363
+ [23, "武人"],
364
+ [24, "処刑人"],
365
+ [25, "衛視"],
366
+ [26, "商人"],
367
+ [33, "迷宮職人"],
368
+ [34, "亭主"],
369
+ [35, "料理人"],
370
+ [36, "寿ぎ屋"],
371
+ [44, "働きもの"],
372
+ [45, "狩人"],
373
+ [46, "冒険者"],
374
+ [55, "怠け者"],
375
+ [56, "盗賊"],
376
+ [66, "生まれ表の中から、好きなジョブ1つを選ぶ"],
377
+ ]
378
+
379
+ return "[#{num}]" + get_table_by_number(num, table)
380
+ end
381
+ end
382
+ end
383
+ end