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,269 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bcdice/game_system/MeikyuKingdom"
4
+ require "bcdice/dice_table/table"
5
+
6
+ module BCDice
7
+ module GameSystem
8
+ class MeikyuKingdomBasic < MeikyuKingdom
9
+ # ゲームシステムの識別子
10
+ ID = 'MeikyuKingdomBasic'
11
+
12
+ # ゲームシステム名
13
+ NAME = '迷宮キングダム 基本ルールブック'
14
+
15
+ # ゲームシステム名の読みがな
16
+ SORT_KEY = 'めいきゆうきんくたむ きほんるうるふつく'
17
+
18
+ # ダイスボットの使い方
19
+ HELP_MESSAGE = <<~INFO_MESSAGE_TEXT
20
+ ・判定 (nMK+m)
21
+  n個のD6を振って大きい物二つだけみて達成値を算出します。修正mも可能です。
22
+  絶対成功と絶対失敗も自動判定します。
23
+ ・各種表
24
+  ・休憩表:才覚 TBT/魅力 CBT/探索 SBT/武勇 VBT
25
+ お祭り FBT/空振り EBT/全体 WBT/カップル LBT
26
+  ・ハプニング表:才覚 THT/魅力 CHT/探索 SHT/武勇 VHT
27
+  ・視察表 RT/情報収集表 IGT/ランダムマップ選択表 RMS
28
+  ・痛打表 CAT/致命傷表 FWT/戦闘ファンブル表 CFT
29
+  ・道中表 TT/交渉表 NT/相場表 MPT/王国災厄表 KDT/王国変動表 KCT
30
+  ・感情表 ET/好意表 FET/敵意表 HET
31
+  ・お宝表1/2/3/4/5 T1T/T2T/T3T/T4T/T5T
32
+  ・特殊遭遇表 SE
33
+    上級:人工 ARN/水域 WEN/自然 NEN/洞窟 CEN/天空 SEN/異界 OEN
34
+ ・潜在能力:スキル決定表 SDT
35
+   基本:肉弾 BUS/射撃 SHS/星術 ASS/召喚 SUS/科学 SCS
36
+      迷宮 LAS/交渉 NES/便利 COS/芸能 ENS/道具 TOS
37
+   上級:肉弾 ABUS/射撃 ASHS/星術 AASS/召喚 ASUS/科学 ASCS
38
+      迷宮 ALAS/交渉 ANES/便利 ACOS/芸能 AENS/道具 ATOS
39
+ ・アイテム関連(上級不使用の場合、カッコ書きのものを使用して下さい)
40
+  ・コモンアイテムランダム決定表 CIR
41
+    コモンアイテム表:武具 WIT/生活 LIT/回復 RIT/探索 SIT
42
+  ・レア武具アイテムランダム決定表 RWIR/レア一般アイテムランダム決定表 RUIR(上級込)
43
+    レアアイテム表:基本武具 NRWT/基本一般 NRUT/上級武具 ARWT/上級一般 ARUT
44
+  ・デヴァイスファクトリー DFTx (xは特性の個数)
45
+ ・王国人物作成関連
46
+  ・王国名決定表1/2/3 KNT1/KNT2/KNT3
47
+  ・王国環境表 KET:技術 TET/国風 NST/資源 RET/人材 HRT/施設 FAT/血族 BLT
48
+  ・名前表 NAMEx (xは個数)
49
+    名前A NAMEA/名前B NAMEB/エキゾチック NAMEEX/ファンタジック NAMEFA
50
+  ・新名前表 NNAMEx (xは個数)
51
+    芸術 NMAR/食べ物 NMFO/日用品 NMDN/地名 NMPL/機械 NMMA/神様 NMGO
52
+  ・単語表1/2/3/4 WORD1/WORD2/WORD3/WORD4
53
+  ・生まれ決定表 BDT/生まれ表:才覚 TBO/魅力 CBO/探索 SBO/武勇 TBO
54
+  ・初期装備表 IEQ
55
+  ・地名決定表 PNTx (xは個数)/迷宮風景表 MLTx (xは個数)
56
+ ・D66ダイスあり
57
+ INFO_MESSAGE_TEXT
58
+
59
+ register_prefix([ # ダイスボットで使用するコマンドを配列で列挙すること。
60
+ '\d+MK.*', '\d+R6.*',
61
+ 'IG', 'TT', 'NT', 'RMS',
62
+ 'CFT', 'FWT', 'CAT', 'KDT', 'KCT',
63
+ 'TBT', 'CBT', 'SBT', 'VBT', 'FBT', 'EBT', 'WBT', 'LBT',
64
+ 'THT', 'CHT', 'SHT', 'VHT',
65
+ 'BDT', 'TBO', 'CBO', 'SBO', 'VBO',
66
+ 'ET', 'FET', 'HET', 'SDT', 'IEQ', 'FRT',
67
+ 'T1T', 'T2T', 'T3T', 'T4T', 'T5T',
68
+ 'MPT', 'KNT\d+', 'WORD\d+', 'NAME.*', 'NNAME.*', 'NM.*',
69
+ 'RT', 'CIR', 'RUIR', 'RWIR',
70
+ 'WIT', 'LIT', 'RIT', 'SIT', 'NRWT', 'NRUT', 'ARWT', 'ARUT',
71
+ 'KET', 'TET', 'NST', 'RET', 'FAT', 'HRT', 'BLT',
72
+ 'BUS', 'SHS', 'ASS', 'SUS', 'SCS', 'LAS', 'NES', 'COS', 'ENS', 'TOS',
73
+ 'ABUS', 'ASHS', 'AASS', 'ASUS', 'ASCS', 'ALAS', 'ANES', 'ACOS', 'AENS', 'ATOS',
74
+ 'SE', 'ARN', 'WEN', 'NEN', 'CEN', 'SEN', 'OEN',
75
+ 'DFT\d+',
76
+ ])
77
+
78
+ def initialize(command)
79
+ super(command)
80
+
81
+ @sort_add_dice = true
82
+ @enabled_d66 = true
83
+ @d66_sort_type = D66SortType::ASC
84
+ end
85
+
86
+ def getKiryokuResult(_total_n, dice_list, _diff)
87
+ num_6 = dice_list.count(6)
88
+
89
+ if num_6 == 0
90
+ ""
91
+ else
92
+ " & 《気力》#{num_6}点獲得"
93
+ end
94
+ end
95
+
96
+ def eval_game_system_specific_command(command)
97
+ output = ""
98
+ type = ""
99
+ total_n = ""
100
+
101
+ if (output = roll_tables(command, TABLES))
102
+ return output
103
+ else
104
+
105
+ case command
106
+ when /^DFT(\d*)$/i
107
+ feature_count = Regexp.last_match(1).to_i
108
+ return roll_device_factory_table(feature_count)
109
+
110
+ when /^NRWT/i
111
+ type = '基本レア武具アイテム'
112
+ total_n = @randomizer.roll_d66(D66SortType::NO_SORT)
113
+ output = mk_normal_rare_weapon_item_table(total_n)
114
+ when /^NRUT/i
115
+ type = '基本レア一般アイテム'
116
+ total_n = @randomizer.roll_d66(D66SortType::NO_SORT)
117
+ output = mk_normal_rare_item_table(total_n)
118
+ when /^ARWT/i
119
+ type = '上級レア武具アイテム'
120
+ total_n = @randomizer.roll_d66(D66SortType::NO_SORT)
121
+ output = mk_advanced_rare_weapon_item_table(total_n)
122
+ when /^ARUT/i
123
+ type = '上級レア一般アイテム'
124
+ total_n = @randomizer.roll_d66(D66SortType::NO_SORT)
125
+ output = mk_advanced_rare_item_table(total_n)
126
+ when /^CIR/i
127
+ type = 'コモンアイテムランダム決定'
128
+ total_n = @randomizer.roll_once(4)
129
+ output = mk_common_item_random_table(total_n)
130
+ when /^RWIR/i
131
+ type = 'レア武具アイテムランダム決定'
132
+ total_n = @randomizer.roll_once(6)
133
+ output = mk_rare_weapon_item_random_table(total_n)
134
+ when /^RUIR/i
135
+ type = 'レア一般アイテムランダム決定'
136
+ total_n = @randomizer.roll_once(6)
137
+ output = mk_rare_usual_item_random_table(total_n)
138
+ when /^NMAR/i
139
+ debug("namea passed")
140
+ type = '芸術系名前'
141
+ total_n = @randomizer.roll_d66(D66SortType::ASC)
142
+ output = mk_name_ar_table(total_n)
143
+ when /^NMFO/i
144
+ type = '食べ物系名前'
145
+ total_n = @randomizer.roll_d66(D66SortType::ASC)
146
+ output = mk_name_fo_table(total_n)
147
+ when /^NMDN/i
148
+ type = '日用品系名前'
149
+ total_n = @randomizer.roll_d66(D66SortType::ASC)
150
+ output = mk_name_dn_table(total_n)
151
+ when /^NMPL/i
152
+ type = '地名系名前'
153
+ total_n = @randomizer.roll_d66(D66SortType::ASC)
154
+ output = mk_name_pl_table(total_n)
155
+ when /^NMMA/i
156
+ type = '機械系名前'
157
+ total_n = @randomizer.roll_d66(D66SortType::ASC)
158
+ output = mk_name_ma_table(total_n)
159
+ when /^NMGO/i
160
+ type = '神様系名前'
161
+ total_n = @randomizer.roll_d66(D66SortType::ASC)
162
+ output = mk_name_go_table(total_n)
163
+ when /^NNAME(\d*)/i
164
+ type = '新名前'
165
+ count = getCount(Regexp.last_match(1))
166
+ names = ""
167
+ count.times do |_i|
168
+ name, dice = mk_new_name_table
169
+ names += "[#{dice}]#{name} "
170
+ output = names
171
+ total_n = count
172
+ end
173
+ output = output.strip
174
+ when /^RMS/i
175
+ type = 'ランダムマップ選択'
176
+ total_n = @randomizer.roll_d66(D66SortType::NO_SORT)
177
+ output = mk_random_map_select_table(total_n)
178
+
179
+ when /^KNT(\d+)/i
180
+ type = '王国名決定'
181
+ count = getCount(Regexp.last_match(1))
182
+ total_n = @randomizer.roll_d66(D66SortType::ASC)
183
+
184
+ case count
185
+ when 1
186
+ output = mk_kingdom_name_1_table(total_n)
187
+ when 2
188
+ output = mk_kingdom_name_2_table(total_n)
189
+ when 3
190
+ output = mk_kingdom_name_3_table(total_n)
191
+ end
192
+
193
+ when /^KET/i
194
+ type = '王国環境'
195
+ total_n = @randomizer.roll_once(6)
196
+ output = mk_kingdom_environment_table(total_n)
197
+ when /^TET/i
198
+ type = '技術決定'
199
+ total_n = @randomizer.roll_once(6)
200
+ output = mk_technic_decide_table(total_n)
201
+ when /^NST/i
202
+ type = '国風決定'
203
+ total_n = @randomizer.roll_once(6)
204
+ output = mk_national_style_decide_table(total_n)
205
+ when /^RET/i
206
+ type = '資源決定'
207
+ total_n = @randomizer.roll_once(6)
208
+ output = mk_resource_decide_table(total_n)
209
+ when /^FAT/i
210
+ type = '施設決定'
211
+ total_n = @randomizer.roll_once(6)
212
+ output = mk_facility_decide_table(total_n)
213
+ when /^HRT/i
214
+ type = '人材決定'
215
+ total_n = @randomizer.roll_once(6)
216
+ output = mk_human_resources_decide_table(total_n)
217
+ when /^BLT/i
218
+ type = '血族決定'
219
+ total_n = @randomizer.roll_once(6)
220
+ output = mk_blood_decide_table(total_n)
221
+ when /^ABUS/i
222
+ type = '上級肉弾スキル'
223
+ output, total_n = mk_advanced_bullet_skill_table
224
+ when /^ASHS/i
225
+ type = '上級射撃スキル'
226
+ output, total_n = mk_advanced_shooting_skill_table
227
+ when /^AASS/i
228
+ type = '上級星術スキル'
229
+ output, total_n = mk_advanced_astrology_skill_table
230
+ when /^ASUS/i
231
+ type = '上級召喚スキル'
232
+ output, total_n = mk_advanced_summon_skill_table
233
+ when /^ASCS/i
234
+ type = '上級科学スキル'
235
+ output, total_n = mk_advanced_science_skill_table
236
+ when /^ALAS/i
237
+ type = '上級迷宮スキル'
238
+ output, total_n = mk_advanced_labyrinth_skill_table
239
+ when /^ANES/i
240
+ type = '上級交渉スキル'
241
+ output, total_n = mk_advanced_negotiation_skill_table
242
+ when /^ACOS/i
243
+ type = '上級便利スキル'
244
+ output, total_n = mk_advanced_convenient_skill_table
245
+ when /^AENS/i
246
+ type = '上級芸能スキル'
247
+ output, total_n = mk_advanced_entertainment_skill_table
248
+ when /^ATOS/i
249
+ type = '上級道具スキル'
250
+ output, total_n = mk_advanced_tool_skill_table
251
+ end
252
+
253
+ if !output.nil?
254
+ debug("output", output)
255
+ output = "#{type}表(#{total_n}) > #{output}"
256
+ else
257
+ super(command)
258
+ end
259
+ end
260
+ end
261
+ end
262
+ end
263
+ end
264
+
265
+ require "bcdice/game_system/meikyu_kingdom_basic/item_table"
266
+ require "bcdice/game_system/meikyu_kingdom_basic/kingdom_table"
267
+ require "bcdice/game_system/meikyu_kingdom_basic/name_table"
268
+ require "bcdice/game_system/meikyu_kingdom_basic/word_table"
269
+ require "bcdice/game_system/meikyu_kingdom_basic/table"
@@ -0,0 +1,249 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bcdice/arithmetic_evaluator'
4
+ require 'bcdice/dice_table/range_table'
5
+
6
+ module BCDice
7
+ module GameSystem
8
+ class MetalHead < Base
9
+ # ゲームシステムの識別子
10
+ ID = 'MetalHead'
11
+
12
+ # ゲームシステム名
13
+ NAME = 'メタルヘッド'
14
+
15
+ # ゲームシステム名の読みがな
16
+ SORT_KEY = 'めたるへつと'
17
+
18
+ # ダイスボットの使い方
19
+ HELP_MESSAGE = <<~MESSAGETEXT
20
+ ・アビリティロール AR>=目標値
21
+ ・スキルロール SR<=目標値(%)
22
+ ・命中判定ロール HR<=目標値(%)
23
+
24
+ 例)AR>=5
25
+ 例)SR<=(40+25)
26
+ 例)HR<=(50-10)
27
+
28
+ これらのロールで成否、絶対成功/絶対失敗、クリティカル/アクシデントを自動判定します。
29
+
30
+ ・クリティカルチャート CC
31
+ ・アクシデントチャート 射撃・投擲用:ACL 格闘用:ACS
32
+ ・戦闘結果チャート CRCsn s=耐久レベル(SUV) n=数値
33
+
34
+ 例)CRCA61 SUV=Aを対象とした数値61(62に変換される)の戦闘結果を参照する。
35
+ 例)CRCM98 対物で数値98の戦闘結果を参照する。
36
+ MESSAGETEXT
37
+
38
+ register_prefix(['AR', 'SR', 'HR<=.+', 'CC', 'ACT', 'ACL', 'ACS', 'CRC[A-Z]\d+'])
39
+
40
+ def eval_game_system_specific_command(command)
41
+ result = roll_tables(command, TABLES)
42
+ return result if result
43
+
44
+ case command
45
+ when /\ACRC(\w)(\d+)\z/
46
+ suv = Regexp.last_match(1)
47
+ num = Regexp.last_match(2)
48
+ return mh_crc_table(suv, num)
49
+ when /\AHR<=(.+)/
50
+ target = ArithmeticEvaluator.eval(
51
+ Regexp.last_match(1), round_type: @round_type
52
+ )
53
+ return rollHit(target)
54
+ end
55
+
56
+ return nil
57
+ end
58
+
59
+ def change_text(string)
60
+ string = string.gsub(/^(S)?AR/i) { "#{Regexp.last_match(1)}2D6" }
61
+ string = string.gsub(/^(S)?SR/i) { "#{Regexp.last_match(1)}1D100" }
62
+ return string
63
+ end
64
+
65
+ def check_2D6(total, dice_total, _dice_list, cmp_op, target)
66
+ return '' if cmp_op != :>= || target == "?"
67
+
68
+ if dice_total >= 12
69
+ " > 絶対成功"
70
+ elsif dice_total <= 2
71
+ " > 絶対失敗"
72
+ elsif total >= target
73
+ " > 成功"
74
+ else
75
+ " > 失敗"
76
+ end
77
+ end
78
+
79
+ def rollHit(target)
80
+ total = @randomizer.roll_once(100)
81
+ resultText = getHitResult(total, total, target)
82
+
83
+ text = "(1D100<=#{target}) > #{total}#{resultText}"
84
+
85
+ return text
86
+ end
87
+
88
+ def check_1D100(total, dice_total, cmp_op, target)
89
+ return '' if target == '?'
90
+ return '' unless cmp_op == :<=
91
+
92
+ return getResult(total, dice_total, target)
93
+ end
94
+
95
+ def getHitResult(total_n, _dice_n, diff)
96
+ diceValue = total_n % 100
97
+ dice1 = diceValue % 10 # 1の位を代入
98
+
99
+ debug("total_n", total_n)
100
+
101
+ return ' > 失敗' if total_n > diff
102
+
103
+ return ' > 成功(クリティカル)' if dice1 == 1
104
+ return ' > 失敗(アクシデント)' if dice1 == 0
105
+
106
+ return ' > 成功'
107
+ end
108
+
109
+ def getResult(total_n, dice_n, diff)
110
+ return ' > 絶対成功' if dice_n <= 5
111
+ return ' > 絶対失敗' if dice_n >= 96
112
+
113
+ return ' > 成功' if total_n <= diff
114
+
115
+ return ' > 失敗'
116
+ end
117
+
118
+ # 戦闘結果チャートを振る
119
+ # @param [String] suv 耐久レベル
120
+ # @param [String] num 数値
121
+ # @return [String] 振った結果
122
+ def mh_crc_table(suv, num)
123
+ header_parts = ['戦闘結果チャート', num]
124
+ separator = ' > '
125
+
126
+ suv = suv.to_s.upcase
127
+ numbuf = num.to_i
128
+ if numbuf < 1
129
+ return (header_parts + ['数値が不正です']).join(separator)
130
+ end
131
+
132
+ num_d1 = numbuf % 10
133
+ debug("num_d1[#{num_d1}]")
134
+ if num_d1 == 1
135
+ numbuf += 1
136
+ end
137
+ if num_d1 == 0
138
+ numbuf -= 1
139
+ end
140
+ num_d1 = numbuf % 10
141
+ debug("num_d1[#{num_d1}]")
142
+
143
+ table_point = [
144
+ nil, # 0
145
+ nil, # 1
146
+ "腕部", # 2
147
+ "腕部", # 3
148
+ "脚部", # 4
149
+ "脚部", # 5
150
+ "胴部", # 6
151
+ "胴部", # 7
152
+ "胴部", # 8
153
+ "頭部", # 9
154
+ ]
155
+
156
+ table_damage = {
157
+ 'S' => [{'N' => 2}, {'LW' => 16}, {'MD' => 46}, {'MW' => 56}, {'HD' => 76}, {'HW' => 96}, {'MO' => 106}, {'K' => 116}],
158
+ 'A' => [{'LW' => 2}, {'MW' => 46}, {'HW' => 76}, {'MO' => 96}, {'K' => 116}],
159
+ 'B' => [{'LW' => 2}, {'MW' => 36}, {'HW' => 66}, {'MO' => 96}, {'K' => 106}],
160
+ 'C' => [{'LW' => 2}, {'MW' => 26}, {'HW' => 66}, {'MO' => 86}, {'K' => 106}],
161
+ 'D' => [{'LW' => 2}, {'MW' => 26}, {'HW' => 46}, {'MO' => 76}, {'K' => 96}],
162
+ 'E' => [{'LW' => 2}, {'MW' => 26}, {'HW' => 39}, {'MO' => 54}, {'K' => 76}],
163
+ 'F' => [{'LW' => 2}, {'MW' => 16}, {'HW' => 39}, {'MO' => 54}, {'K' => 66}],
164
+ 'G' => [{'LW' => 2}, {'MW' => 6}, {'HW' => 16}, {'MO' => 26}, {'K' => 39}],
165
+ 'M' => [{'0' => 2}, {'1' => 22}, {'2' => 42}, {'3' => 62}, {'4' => 82}, {'5' => 92}, {'6' => 102}, {'8' => 112}],
166
+ }
167
+
168
+ if table_damage[suv].nil?
169
+ return (header_parts + [
170
+ "耐久レベル(SUV)[#{suv}]",
171
+ "耐久レベル(SUV)の値が不正です",
172
+ ]).join(separator)
173
+ end
174
+
175
+ damage_level = ''
176
+ table_damage[suv].each do |v|
177
+ v.each do |d, n|
178
+ debug("suv[#{suv}] #{v} #{d} #{n}")
179
+ if n <= numbuf
180
+ damage_level = d
181
+ end
182
+ end
183
+ end
184
+
185
+ result_parts = []
186
+
187
+ if numbuf != num.to_i
188
+ result_parts.push(numbuf.to_s)
189
+ end
190
+
191
+ if suv == 'M'
192
+ result_parts.push('耐物', "HP[#{damage_level}]")
193
+ else
194
+ result_parts.push(
195
+ "耐久レベル(SUV)[#{suv}]",
196
+ "部位[#{table_point[num_d1]}] : 損傷種別[#{damage_level}]"
197
+ )
198
+ end
199
+
200
+ return (header_parts + result_parts).join(separator)
201
+ end
202
+
203
+ # 表を振った結果の整形処理
204
+ TABLE_ROLL_RESULT_FORMATTER = lambda do |table, result|
205
+ [table.name, result.sum, result.content].join(' > ')
206
+ end
207
+
208
+ # 表の集合
209
+ TABLES = {
210
+ 'CC' => DiceTable::RangeTable.new(
211
+ 'クリティカルチャート',
212
+ '1D10',
213
+ [
214
+ [1, '相手は知覚系に多大なダメージを受けた。PERを1にして頭部にHWのダメージ、および心理チェック。'],
215
+ [2, '相手の運動神経を断ち切った。DEXを1にして腕部にHWのダメージ、および心理チェック。さらに腕に持っていた武器などは落としてしまう。'],
216
+ [3, '相手の移動手段は完全に奪われた。REFを1にして脚部にHWダメージと心理チェック。また、次回からのこちらの攻撃は必ず命中する。'],
217
+ [4..5, '相手の急所に命中。激痛のため気絶した上、胴にHWダメージ。'],
218
+ [6, '効果的な一撃。胴にHWダメージ。心理チェック。'],
219
+ [7, '効果的な一撃。胴にMOダメージ。心理チェック。'],
220
+ [8..10, '君の一撃は相手の中枢を完全に破壊した。即死である。'],
221
+ ],
222
+ &TABLE_ROLL_RESULT_FORMATTER
223
+ ),
224
+ 'ACL' => DiceTable::RangeTable.new(
225
+ 'アクシデントチャート(射撃・投擲)',
226
+ '1D10',
227
+ [
228
+ [1..7, 'ささいなミス。特にペナルティーはない。'],
229
+ [8, '不発、またはジャム。弾を取り出さねばならない物は次のターンは射撃できない。'],
230
+ [9, 'ささいな故障。可能なら次のターンから個別武器のスキルロールで修理を行える。'],
231
+ [10, '武器の暴発、または爆発。頭部HWの心理効果ロール。さらに、その武器は破壊されPERとDEXのどちらか、または両方に計2ポイントのマイナスを与える。(遠隔操作の場合、射手への被害は無し)'],
232
+ ],
233
+ &TABLE_ROLL_RESULT_FORMATTER
234
+ ),
235
+ 'ACS' => DiceTable::RangeTable.new(
236
+ 'アクシデントチャート(格闘)',
237
+ '1D10',
238
+ [
239
+ [1..3, '足を滑らせて転倒し、起き上がるまで相手に+20の命中修正を与える。'],
240
+ [4..6, '手を滑らせて、武器を落とす。素手の時は関係ない。'],
241
+ [7..9, '使用武器の破壊。素手戦闘のときはMWのダメージを受ける。'],
242
+ [10, '手を滑らせ、不幸にも武器は飛んでいき、5m以内に人がいれば誰かに刺さるか、または打撃を与えるかもしれない。ランダムに決定し、普通どおり判定を続ける。素手のときは関係ない。'],
243
+ ],
244
+ &TABLE_ROLL_RESULT_FORMATTER
245
+ ),
246
+ }.freeze
247
+ end
248
+ end
249
+ end