bcdice 3.0.0.pre.alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,451 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BCDice
4
+ module GameSystem
5
+ class GardenOrder < Base
6
+ # ゲームシステムのの識別子
7
+ ID = 'GardenOrder'
8
+
9
+ # ゲームシステム名
10
+ NAME = 'ガーデンオーダー'
11
+
12
+ # ゲームシステム名の読みがな
13
+ SORT_KEY = 'かあてんおおたあ'
14
+
15
+ # ダイスボットの使い方
16
+ HELP_MESSAGE = <<~INFO_MESSAGE_TEXT
17
+ ・基本判定
18
+  GOx/y@z x:成功率、y:連続攻撃回数(省略可)、z:クリティカル値(省略可)
19
+  (連続攻撃では1回の判定のみが実施されます)
20
+  例)GO55 GO100/2 GO70@10 GO155/3@44
21
+ ・負傷表
22
+  DCxxy
23
+  xx:属性(切断:SL,銃弾:BL,衝撃:IM,灼熱:BR,冷却:RF,電撃:EL)
24
+  y:ダメージ
25
+  例)DCSL7 DCEL22
26
+ INFO_MESSAGE_TEXT
27
+
28
+ register_prefix([
29
+ 'GO(\-?\d+)(\/\d+)?(@\d+)?',
30
+ 'DC(SL|BL|IM|BR|RF|EL).+'
31
+ ])
32
+
33
+ def eval_game_system_specific_command(command)
34
+ case command
35
+ when %r{GO(\-?\d+)(/(\d+))?(@(\d+))?}i
36
+ success_rate = Regexp.last_match(1).to_i
37
+ repeat_count = (Regexp.last_match(3) || 1).to_i
38
+ critical_border_text = Regexp.last_match(5)
39
+ critical_border = get_critical_border(critical_border_text, success_rate)
40
+
41
+ return check_roll_repeat_attack(success_rate, repeat_count, critical_border)
42
+
43
+ when /^DC(SL|BL|IM|BR|RF|EL)(\d+)/i
44
+ type = Regexp.last_match(1)
45
+ damage_value = Regexp.last_match(2).to_i
46
+ return look_up_damage_chart(type, damage_value)
47
+ end
48
+
49
+ return nil
50
+ end
51
+
52
+ def get_critical_border(critical_border_text, success_rate)
53
+ return critical_border_text.to_i unless critical_border_text.nil?
54
+
55
+ critical_border = [success_rate / 5, 1].max
56
+ return critical_border
57
+ end
58
+
59
+ def check_roll_repeat_attack(success_rate, repeat_count, critical_border)
60
+ success_rate_per_one = success_rate / repeat_count
61
+
62
+ check_roll(success_rate_per_one, critical_border)
63
+ end
64
+
65
+ def check_roll(success_rate, critical_border)
66
+ success_rate = 0 if success_rate < 0
67
+ fumble_border = (success_rate < 100 ? 96 : 99)
68
+
69
+ dice_value = @randomizer.roll_once(100)
70
+ result = get_check_result(dice_value, success_rate, critical_border, fumble_border)
71
+
72
+ text = "D100<=#{success_rate}@#{critical_border} > #{dice_value} > #{result}"
73
+ return text
74
+ end
75
+
76
+ def get_check_result(dice_value, success_rate, critical_border, fumble_border)
77
+ return "クリティカル" if dice_value <= critical_border
78
+ return "ファンブル" if dice_value >= fumble_border
79
+ return "成功" if dice_value <= success_rate
80
+
81
+ return "失敗"
82
+ end
83
+
84
+ def look_up_damage_chart(type, damage_value)
85
+ name, table = get_damage_table_info_by_type(type)
86
+
87
+ row = get_table_by_number(damage_value, table, nil)
88
+ return nil if row.nil?
89
+
90
+ "負傷表:#{name}[#{damage_value}] > #{row[:damage]} | #{row[:name]} … #{row[:text]}"
91
+ end
92
+
93
+ def get_damage_table_info_by_type(type)
94
+ data = DAMAGE_TABLE[type]
95
+ return nil if data.nil?
96
+
97
+ return data[:name], data[:table]
98
+ end
99
+
100
+ DAMAGE_TABLE = {
101
+ "SL" => {
102
+ name: "切断",
103
+ table: [
104
+ [5,
105
+ {name: "切り傷",
106
+ text: "皮膚が切り裂かれる。",
107
+ damage: "軽傷1"}],
108
+ [10,
109
+ {name: "脚部負傷",
110
+ text: "足が切り裂かれ、思わずひざまずく。",
111
+ damage: "軽傷2/マヒ"}],
112
+ [13,
113
+ {name: "出血",
114
+ text: "斬り裂かれた傷から出血が続く。",
115
+ damage: "軽傷3/DOT:軽傷1"}],
116
+ [16,
117
+ {name: "胴部負傷",
118
+ text: "胴部に大きな傷を受ける。",
119
+ damage: "軽傷4"}],
120
+ [19,
121
+ {name: "腕部負傷",
122
+ text: "腕に大きな傷を受ける。",
123
+ damage: "重傷1/DOT:軽傷1"}],
124
+ [22,
125
+ {name: "腹部負傷",
126
+ text: "腹部を深く切り裂かれる。",
127
+ damage: "重傷2"}],
128
+ [25,
129
+ {name: "大量出血",
130
+ text: "傷は深く、そこから大量に出血する。",
131
+ damage: "重傷2/DOT:軽傷2"}],
132
+ [28,
133
+ {name: "裂傷",
134
+ text: "治りにくい傷をつけられる。",
135
+ damage: "重傷3"}],
136
+ [31,
137
+ {name: "視界不良",
138
+ text: "頭部に受けた傷から血が流れ、視界がふさがれる。",
139
+ damage: "重傷3/スタン"}],
140
+ [34,
141
+ {name: "胸部負傷",
142
+ text: "胸から腰にかけて大きく切り裂かれる。",
143
+ damage: "致命傷1"}],
144
+ [37,
145
+ {name: "動脈切断",
146
+ text: "動脈が切り裂かれ、噴き出るように出血する。",
147
+ damage: "致命傷1/DOT:軽傷3"}],
148
+ [39,
149
+ {name: "胸部切断",
150
+ text: "傷が肺にまで達し、喀血する。",
151
+ damage: "致命傷2"}],
152
+ [9999,
153
+ {name: "脊髄損傷",
154
+ text: "脊髄が損傷する。",
155
+ damage: "致命傷2/放心、スタン、マヒ"}],
156
+ ]
157
+ },
158
+
159
+ "BL" => {
160
+ name: "銃弾",
161
+ table: [
162
+ [5,
163
+ {name: "腕部損傷",
164
+ text: "銃弾が腕をかすめた。",
165
+ damage: "軽傷2"}],
166
+ [10,
167
+ {name: "腕部貫通",
168
+ text: "銃弾が腕を貫く。痛みはあるが動作に支障はない。",
169
+ damage: "軽傷3"}],
170
+ [13,
171
+ {name: "胴部負傷",
172
+ text: "胴部に銃弾をくらう。痛みで動きが鈍くなる。",
173
+ damage: "軽傷4/スロウ:-3"}],
174
+ [16,
175
+ {name: "肩負傷",
176
+ text: "肩を貫かれる。骨が砕けたようだ。",
177
+ damage: "重傷1"}],
178
+ [19,
179
+ {name: "腹部負傷",
180
+ text: "腹部が貫かれる。かろうじて内臓にダメージはないようだ。",
181
+ damage: "重傷2"}],
182
+ [22,
183
+ {name: "脚部貫通",
184
+ text: "脚を銃弾に貫かれ、その場でひざまずく。",
185
+ damage: "重傷2/マヒ"}],
186
+ [25,
187
+ {name: "消化器系損傷",
188
+ text: "胃などの消化器官にダメージを受ける。",
189
+ damage: "重傷3"}],
190
+ [28,
191
+ {name: "盲管銃弾",
192
+ text: "身体に弾丸が深々と刺さる。激痛が走る。",
193
+ damage: "重傷3/スロウ:-5"}],
194
+ [31,
195
+ {name: "内臓損傷",
196
+ text: "いくつかの内臓にダメージを受ける。",
197
+ damage: "致命傷1/スタン"}],
198
+ [34,
199
+ {name: "胴部貫通",
200
+ text: "腹部への攻撃が貫通し、出血する。",
201
+ damage: "致命傷1/DOT:軽傷1"}],
202
+ [37,
203
+ {name: "胸部負傷",
204
+ text: "銃弾で肺を貫かれる。",
205
+ damage: "致命傷2"}],
206
+ [39,
207
+ {name: "致命的な一撃",
208
+ text: "銃弾が頭部に命中。ショックで意識を飛ばされる。",
209
+ damage: "致命傷2/放心"}],
210
+ [9999,
211
+ {name: "必殺の一撃",
212
+ text: "銃弾が心臓の近くを貫く。動脈にダメージを受けたようだ。",
213
+ damage: "致命傷2/DOT:重傷1"}],
214
+ ]
215
+ },
216
+
217
+ "IM" => {
218
+ name: "衝撃",
219
+ table: [
220
+ [5,
221
+ {name: "打撲",
222
+ text: "攻撃を受けた箇所がどす黒く腫れ上がる。",
223
+ damage: "軽傷1"}],
224
+ [10,
225
+ {name: "転倒",
226
+ text: "衝撃で転倒する。",
227
+ damage: "軽傷1/マヒ"}],
228
+ [13,
229
+ {name: "平衡感覚喪失",
230
+ text: "衝撃で三半規管にダメージを受ける。",
231
+ damage: "軽傷2、疲労2"}],
232
+ [16,
233
+ {name: "ボディーブロー",
234
+ text: "腹部に直撃。痛みが継続し、体力を奪う。",
235
+ damage: "軽傷3/DOT:疲労3"}],
236
+ [19,
237
+ {name: "痛打",
238
+ text: "胴部や脚部などに打撃を受ける。",
239
+ damage: "軽傷4/スタン"}],
240
+ [22,
241
+ {name: "頭部痛打",
242
+ text: "頭部にクリーンヒット。意識がもうろうとする。",
243
+ damage: "軽傷5/放心"}],
244
+ [25,
245
+ {name: "脚部骨折",
246
+ text: "攻撃が足に命中し、骨折する。",
247
+ damage: "重傷1/スロウ:-5"}],
248
+ [28,
249
+ {name: "大転倒",
250
+ text: "激しい衝撃によって、負傷すると共に大きく体勢を崩す。",
251
+ damage: "重傷1/マヒ、スタン"}],
252
+ [31,
253
+ {name: "脳震盪",
254
+ text: "脳が大きく揺さぶられ、意識が飛びそうになる。",
255
+ damage: "重傷2/放心"}],
256
+ [34,
257
+ {name: "複雑骨折",
258
+ text: "攻撃を受けた部分が大きくひしゃげ、複雑骨折したようだ。",
259
+ damage: "重傷3/放心、スタン"}],
260
+ [37,
261
+ {name: "頭部裂傷",
262
+ text: "頭部に命中。皮膚が大きく裂ける。",
263
+ damage: "致命傷1、疲労3"}],
264
+ [39,
265
+ {name: "肋骨負傷",
266
+ text: "折れた肋骨が肺に突き刺さり、まともに呼吸を行なうことができない。",
267
+ damage: "致命傷1/放心、スタン"}],
268
+ [9999,
269
+ {name: "内臓損傷",
270
+ text: "衝撃が身体の芯まで届き、内臓がいくつか傷ついたようだ。",
271
+ damage: "致命傷2/DOT:重傷1"}],
272
+ ]
273
+ },
274
+
275
+ "BR" => {
276
+ name: "灼熱",
277
+ table: [
278
+ [5,
279
+ {name: "火傷",
280
+ text: "皮膚に小さな火傷を負う。",
281
+ damage: "軽傷1"}],
282
+ [10,
283
+ {name: "温度上昇",
284
+ text: "熱によって、怪我だけではなく体力も奪われる。",
285
+ damage: "軽傷2、疲労1"}],
286
+ [13,
287
+ {name: "恐怖",
288
+ text: "燃え上がる炎に恐怖を感じ、身体がすくんで動きが止まる。",
289
+ damage: "軽傷3/放心"}],
290
+ [16,
291
+ {name: "発火",
292
+ text: "衣服や身体の一部に火が燃え移る。",
293
+ damage: "軽傷3/DOT:軽傷1"}],
294
+ [19,
295
+ {name: "爆発",
296
+ text: "爆発により吹き飛ばされ、転倒する。",
297
+ damage: "重傷1/マヒ"}],
298
+ [22,
299
+ {name: "大火傷",
300
+ text: "痕が残るほどの大きな火傷を負う。",
301
+ damage: "重傷2"}],
302
+ [25,
303
+ {name: "熱波",
304
+ text: "火傷と強力な熱により意識がもうろうとする。",
305
+ damage: "重傷2/スタン"}],
306
+ [28,
307
+ {name: "大爆発",
308
+ text: "激しい爆発で吹き飛ばされ、ダメージと共に転倒する。",
309
+ damage: "重傷3/マヒ"}],
310
+ [31,
311
+ {name: "大発火",
312
+ text: "広範囲に火が燃え移る。",
313
+ damage: "重傷3/DOT:軽傷1"}],
314
+ [34,
315
+ {name: "炭化",
316
+ text: "高熱のあまり、焼けた部分が炭化してしまう。",
317
+ damage: "致命傷1"}],
318
+ [37,
319
+ {name: "内臓火傷",
320
+ text: "高温の空気を吸い込む、気道にも火傷を負ってしまう。",
321
+ damage: "致命傷1/DOT:軽傷1"}],
322
+ [39,
323
+ {name: "全身火傷",
324
+ text: "身体の各所に深い火傷を負う。",
325
+ damage: "致命傷2"}],
326
+ [9999,
327
+ {name: "致命的火傷",
328
+ text: "身体の大部分に焼けどを負う。",
329
+ damage: "致命傷2/スタン"}],
330
+ ]
331
+ },
332
+
333
+ "RF" => {
334
+ name: "冷却",
335
+ table: [
336
+ [5,
337
+ {name: "冷気",
338
+ text: "軽い凍傷を受ける。",
339
+ damage: "軽傷1"}],
340
+ [10,
341
+ {name: "霜の衣",
342
+ text: "身体が薄い氷で覆われ、動きが鈍る。",
343
+ damage: "軽傷1/疲労1"}],
344
+ [13,
345
+ {name: "凍傷",
346
+ text: "凍傷により身体が傷つけられる。",
347
+ damage: "軽傷2"}],
348
+ [16,
349
+ {name: "体温低下",
350
+ text: "冷気によって体温を奪われる。",
351
+ damage: "軽傷3/DOT:疲労1"}],
352
+ [19,
353
+ {name: "氷の枷",
354
+ text: "肘や膝などが氷で覆われ、動きが取りにくくなる。",
355
+ damage: "重傷1/マヒ"}],
356
+ [22,
357
+ {name: "大凍傷",
358
+ text: "身体の各所に凍傷を受ける。",
359
+ damage: "重傷1/DOT:疲労2"}],
360
+ [25,
361
+ {name: "氷の束縛",
362
+ text: "下半身が凍りつき、動くことができない。",
363
+ damage: "重傷2/マヒ"}],
364
+ [28,
365
+ {name: "視界不良",
366
+ text: "頭部にも氷が張り、視界がふさがれる。",
367
+ damage: "重傷2/スタン"}],
368
+ [31,
369
+ {name: "腕部凍結",
370
+ text: "腕が凍りづけになり、動かすことができない。",
371
+ damage: "重傷3/放心"}],
372
+ [34,
373
+ {name: "重度凍傷",
374
+ text: "さらに体温が低下し、深刻な凍傷を受ける。",
375
+ damage: "致命傷1"}],
376
+ [37,
377
+ {name: "全身凍結",
378
+ text: "全身が凍りづけになる。",
379
+ damage: "致命傷1/DOT:疲労2"}],
380
+ [39,
381
+ {name: "致命的凍傷",
382
+ text: "身体全身に凍傷を受ける。",
383
+ damage: "致命傷2"}],
384
+ [9999,
385
+ {name: "氷の棺",
386
+ text: "完全に氷に閉じ込められる。",
387
+ damage: "致命傷2/スタン、マヒ"}],
388
+ ]
389
+ },
390
+
391
+ "EL" => {
392
+ name: "電撃",
393
+ table: [
394
+ [5,
395
+ {name: "静電気",
396
+ text: "全身の毛が逆立つ。",
397
+ damage: "疲労3"}],
398
+ [10,
399
+ {name: "電熱傷",
400
+ text: "電流によって傷つく。",
401
+ damage: "疲労1、軽傷1"}],
402
+ [13,
403
+ {name: "感電",
404
+ text: "電流で傷つくと共に、身体が軽くしびれる。",
405
+ damage: "疲労2、軽傷2"}],
406
+ [16,
407
+ {name: "閃光",
408
+ text: "激しい電光により、一時的に視界がふさがれる。",
409
+ damage: "軽傷3/スタン"}],
410
+ [19,
411
+ {name: "脚部感電",
412
+ text: "電流により脚がしびれ、動けなくなる。",
413
+ damage: "重傷1/マヒ"}],
414
+ [22,
415
+ {name: "大電熱傷",
416
+ text: "身体の各所が電流によって傷つく。",
417
+ damage: "疲労2、重傷2"}],
418
+ [25,
419
+ {name: "腕部負傷",
420
+ text: "電流で腕がしびれ、動けなくなる。",
421
+ damage: "軽傷1、重傷2/放心"}],
422
+ [28,
423
+ {name: "大感電",
424
+ text: "電流によって身体中がしびれ、動けなくなる。",
425
+ damage: "重傷2/スタン、マヒ"}],
426
+ [31,
427
+ {name: "一時心停止",
428
+ text: "強力な電撃のショックにより、心臓がほんの一瞬だけ止まる。",
429
+ damage: "疲労3、重傷3"}],
430
+ [34,
431
+ {name: "大電流",
432
+ text: "全身に電流が駆け巡る。",
433
+ damage: "重傷3/放心、マヒ"}],
434
+ [37,
435
+ {name: "致命電熱傷",
436
+ text: "全身が電流によって傷つく。",
437
+ damage: "重傷1、致命傷1"}],
438
+ [39,
439
+ {name: "心停止",
440
+ text: "強力な電撃のショックにより、心臓が一時的に止まる。死の淵が見える。",
441
+ damage: "疲労3、重傷1、致命傷1"}],
442
+ [9999,
443
+ {name: "組織炭化",
444
+ text: "全身が電流で焼かれ、あちこちの組織が炭化する。",
445
+ damage: "致命傷2/スタン"}],
446
+ ]
447
+ }
448
+ }.freeze
449
+ end
450
+ end
451
+ end
@@ -0,0 +1,136 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BCDice
4
+ module GameSystem
5
+ class GehennaAn < Base
6
+ # ゲームシステムの識別子
7
+ ID = 'GehennaAn'
8
+
9
+ # ゲームシステム名
10
+ NAME = 'ゲヘナ・アナスタシス'
11
+
12
+ # ゲームシステム名の読みがな
13
+ SORT_KEY = 'けへなあなすたしす'
14
+
15
+ # ダイスボットの使い方
16
+ HELP_MESSAGE = <<~INFO_MESSAGE_TEXT
17
+ 戦闘判定と通常判定に対応。幸運の助け、連撃増加値(戦闘判定)、闘技チット(戦闘判定)を自動表示します。
18
+ ・戦闘判定 (nGAt+m)
19
+  ダイス数n、目標値t、修正値mで戦闘判定を行います。
20
+  幸運の助け、連撃増加値、闘技チットを自動処理します。
21
+ ・通常判定 (nGt+m)
22
+  ダイス数n、目標値t、修正値mで通常判定を行います。
23
+  幸運の助けを自動処理します。(連撃増加値、闘技チットを表示抑制します)
24
+ INFO_MESSAGE_TEXT
25
+
26
+ register_prefix(['\d+G\d+.*', '\d+GA\d+.*', '\d+R6.*'])
27
+
28
+ def initialize(command)
29
+ super(command)
30
+ @sort_add_dice = true
31
+ @sort_barabara_dice = true
32
+ end
33
+
34
+ private
35
+
36
+ def replace_text(string)
37
+ string
38
+ .gsub(/(\d+)GA(\d+)([\+\-][\+\-\d]+)/) { "#{Regexp.last_match(1)}R6#{Regexp.last_match(3)}>=#{Regexp.last_match(2)}[1]" }
39
+ .gsub(/(\d+)GA(\d+)/) { "#{Regexp.last_match(1)}R6>=#{Regexp.last_match(2)}[1]" }
40
+ .gsub(/(\d+)G(\d+)([\+\-][\+\-\d]+)/) { "#{Regexp.last_match(1)}R6#{Regexp.last_match(3)}>=#{Regexp.last_match(2)}[0]" }
41
+ .gsub(/(\d+)G(\d+)/) { "#{Regexp.last_match(1)}R6>=#{Regexp.last_match(2)}[0]" }
42
+ end
43
+
44
+ public
45
+
46
+ def eval_game_system_specific_command(string)
47
+ string = replace_text(string)
48
+
49
+ unless /(^|\s)S?((\d+)[rR]6([\+\-\d]+)?([>=]+(\d+))(\[(\d)\]))(\s|$)/i =~ string
50
+ return nil
51
+ end
52
+
53
+ string = Regexp.last_match(2)
54
+ diceCount = Regexp.last_match(3).to_i
55
+ modText = Regexp.last_match(4)
56
+ diff = Regexp.last_match(6).to_i
57
+ mode = Regexp.last_match(8).to_i
58
+
59
+ mod = ArithmeticEvaluator.eval(modText)
60
+
61
+ diceArray = @randomizer.roll_barabara(diceCount, 6).sort
62
+ diceValue = diceArray.sum()
63
+ diceText = diceArray.join(",")
64
+
65
+ dice_1st = ""
66
+ isLuck = true
67
+ diceValue = 0
68
+
69
+ # 幸運の助けチェック
70
+ diceArray.each do |i|
71
+ if dice_1st != ""
72
+ if (dice_1st != i) || (i < diff)
73
+ isLuck = false
74
+ end
75
+ else
76
+ dice_1st = i
77
+ end
78
+
79
+ diceValue += 1 if i >= diff
80
+ end
81
+
82
+ diceValue *= 2 if isLuck && (diceCount > 1)
83
+
84
+ output = "#{diceValue}[#{diceText}]"
85
+ success = diceValue + mod
86
+ success = 0 if success < 0
87
+
88
+ failed = diceCount - diceValue
89
+ failed = 0 if failed < 0
90
+
91
+ if mod > 0
92
+ output += "+#{mod}"
93
+ elsif mod < 0
94
+ output += mod.to_s
95
+ end
96
+
97
+ if /[^\d\[\]]+/ =~ output
98
+ output = "(#{string}) > #{output} > 成功#{success}、失敗#{failed}"
99
+ else
100
+ output = "(#{string}) > #{output}"
101
+ end
102
+
103
+ # 連撃増加値と闘技チット
104
+ output += getAnastasisBonusText(mode, success)
105
+
106
+ return output
107
+ end
108
+
109
+ private
110
+
111
+ def getAnastasisBonusText(mode, success)
112
+ return '' if mode == 0
113
+
114
+ ma_bonus = ((success - 1) / 2).to_i
115
+ ma_bonus = 7 if ma_bonus > 7
116
+
117
+ bonus_str = ''
118
+ bonus_str += "連撃[+#{ma_bonus}]/" if ma_bonus > 0
119
+ bonus_str += "闘技[#{getTougiBonus(success)}]"
120
+ return " > #{bonus_str}"
121
+ end
122
+
123
+ def getTougiBonus(success)
124
+ table = [
125
+ [6, '1'],
126
+ [13, '2'],
127
+ [18, '3'],
128
+ [22, '4'],
129
+ [99, '5'],
130
+ ]
131
+
132
+ return get_table_by_number(success, table)
133
+ end
134
+ end
135
+ end
136
+ end