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.
- checksums.yaml +7 -0
- data/.editorconfig +21 -0
- data/.github/.codecov.yaml +10 -0
- data/.github/workflows/coverage.yaml +21 -0
- data/.github/workflows/lint.yaml +13 -0
- data/.github/workflows/test.yml +20 -0
- data/.gitignore +14 -0
- data/.rubocop.yml +96 -0
- data/.rubocop_todo.yml +113 -0
- data/CHANGELOG.md +868 -0
- data/Gemfile +11 -0
- data/LICENSE +29 -0
- data/README.md +38 -0
- data/ROADMAP.md +30 -0
- data/Rakefile +118 -0
- data/bcdice.gemspec +27 -0
- data/bin/repl.rb +21 -0
- data/docs/README.txt +2028 -0
- data/docs/dicebot_sort_key.md +72 -0
- data/docs/how_to_make_dicebot.md +453 -0
- data/lib/bcdice.rb +8 -0
- data/lib/bcdice/arithmetic_evaluator.rb +167 -0
- data/lib/bcdice/base.rb +423 -0
- data/lib/bcdice/command_parser.rb +242 -0
- data/lib/bcdice/common_command.rb +23 -0
- data/lib/bcdice/common_command/add_dice.rb +54 -0
- data/lib/bcdice/common_command/add_dice/node.rb +488 -0
- data/lib/bcdice/common_command/add_dice/parser.rb +282 -0
- data/lib/bcdice/common_command/add_dice/randomizer.rb +48 -0
- data/lib/bcdice/common_command/barabara_dice.rb +57 -0
- data/lib/bcdice/common_command/calc.rb +39 -0
- data/lib/bcdice/common_command/choice.rb +35 -0
- data/lib/bcdice/common_command/d66_dice.rb +63 -0
- data/lib/bcdice/common_command/reroll_dice.rb +190 -0
- data/lib/bcdice/common_command/upper_dice.rb +165 -0
- data/lib/bcdice/common_command/version.rb +26 -0
- data/lib/bcdice/dice_table.rb +8 -0
- data/lib/bcdice/dice_table/chain_table.rb +33 -0
- data/lib/bcdice/dice_table/d66_grid_table.rb +26 -0
- data/lib/bcdice/dice_table/d66_range_table.rb +26 -0
- data/lib/bcdice/dice_table/d66_table.rb +34 -0
- data/lib/bcdice/dice_table/range_table.rb +267 -0
- data/lib/bcdice/dice_table/roll_result.rb +43 -0
- data/lib/bcdice/dice_table/sai_fic_skill_table.rb +32 -0
- data/lib/bcdice/dice_table/table.rb +35 -0
- data/lib/bcdice/enum.rb +15 -0
- data/lib/bcdice/format.rb +36 -0
- data/lib/bcdice/game_system.rb +187 -0
- data/lib/bcdice/game_system/AFF2e.rb +141 -0
- data/lib/bcdice/game_system/AceKillerGene.rb +55 -0
- data/lib/bcdice/game_system/Airgetlamh.rb +117 -0
- data/lib/bcdice/game_system/Alsetto.rb +124 -0
- data/lib/bcdice/game_system/Alshard.rb +27 -0
- data/lib/bcdice/game_system/AlterRaise.rb +282 -0
- data/lib/bcdice/game_system/Amadeus.rb +622 -0
- data/lib/bcdice/game_system/Amadeus_Korean.rb +501 -0
- data/lib/bcdice/game_system/AnimaAnimus.rb +96 -0
- data/lib/bcdice/game_system/Arianrhod.rb +50 -0
- data/lib/bcdice/game_system/ArsMagica.rb +149 -0
- data/lib/bcdice/game_system/Avandner.rb +101 -0
- data/lib/bcdice/game_system/BBN.rb +143 -0
- data/lib/bcdice/game_system/BadLife.rb +435 -0
- data/lib/bcdice/game_system/BarnaKronika.rb +188 -0
- data/lib/bcdice/game_system/BattleTech.rb +530 -0
- data/lib/bcdice/game_system/BeastBindTrinity.rb +348 -0
- data/lib/bcdice/game_system/BeginningIdol.rb +2527 -0
- data/lib/bcdice/game_system/BeginningIdol_Korean.rb +2378 -0
- data/lib/bcdice/game_system/BladeOfArcana.rb +252 -0
- data/lib/bcdice/game_system/BlindMythos.rb +460 -0
- data/lib/bcdice/game_system/BloodCrusade.rb +423 -0
- data/lib/bcdice/game_system/BloodMoon.rb +213 -0
- data/lib/bcdice/game_system/CardRanker.rb +249 -0
- data/lib/bcdice/game_system/ChaosFlare.rb +181 -0
- data/lib/bcdice/game_system/Chill.rb +163 -0
- data/lib/bcdice/game_system/Chill3.rb +52 -0
- data/lib/bcdice/game_system/CodeLayerd.rb +132 -0
- data/lib/bcdice/game_system/ColossalHunter.rb +569 -0
- data/lib/bcdice/game_system/CrashWorld.rb +81 -0
- data/lib/bcdice/game_system/Cthulhu.rb +252 -0
- data/lib/bcdice/game_system/Cthulhu7th.rb +767 -0
- data/lib/bcdice/game_system/Cthulhu7th_ChineseTraditional.rb +386 -0
- data/lib/bcdice/game_system/Cthulhu7th_Korean.rb +383 -0
- data/lib/bcdice/game_system/CthulhuTech.rb +263 -0
- data/lib/bcdice/game_system/Cthulhu_ChineseTraditional.rb +243 -0
- data/lib/bcdice/game_system/Cthulhu_Korean.rb +240 -0
- data/lib/bcdice/game_system/DarkBlaze.rb +207 -0
- data/lib/bcdice/game_system/DarkDaysDrive.rb +425 -0
- data/lib/bcdice/game_system/DarkSouls.rb +91 -0
- data/lib/bcdice/game_system/DeadlineHeroes.rb +583 -0
- data/lib/bcdice/game_system/DemonParasite.rb +524 -0
- data/lib/bcdice/game_system/DetatokoSaga.rb +310 -0
- data/lib/bcdice/game_system/DetatokoSaga_Korean.rb +310 -0
- data/lib/bcdice/game_system/DiceBot.rb +17 -0
- data/lib/bcdice/game_system/DiceOfTheDead.rb +111 -0
- data/lib/bcdice/game_system/DoubleCross.rb +373 -0
- data/lib/bcdice/game_system/DoubleCross_Korean.rb +371 -0
- data/lib/bcdice/game_system/Dracurouge.rb +1856 -0
- data/lib/bcdice/game_system/Dracurouge_Korean.rb +310 -0
- data/lib/bcdice/game_system/DungeonsAndDragons.rb +19 -0
- data/lib/bcdice/game_system/EarthDawn.rb +225 -0
- data/lib/bcdice/game_system/EarthDawn3.rb +275 -0
- data/lib/bcdice/game_system/EarthDawn4.rb +272 -0
- data/lib/bcdice/game_system/EclipsePhase.rb +51 -0
- data/lib/bcdice/game_system/Elric.rb +36 -0
- data/lib/bcdice/game_system/Elysion.rb +1213 -0
- data/lib/bcdice/game_system/EmbryoMachine.rb +227 -0
- data/lib/bcdice/game_system/EndBreaker.rb +132 -0
- data/lib/bcdice/game_system/EtrianOdysseySRS.rb +27 -0
- data/lib/bcdice/game_system/Fiasco.rb +123 -0
- data/lib/bcdice/game_system/Fiasco_Korean.rb +122 -0
- data/lib/bcdice/game_system/FilledWith.rb +1543 -0
- data/lib/bcdice/game_system/FullMetalPanic.rb +27 -0
- data/lib/bcdice/game_system/FutariSousa.rb +994 -0
- data/lib/bcdice/game_system/FutariSousa_Korean.rb +994 -0
- data/lib/bcdice/game_system/Garako.rb +559 -0
- data/lib/bcdice/game_system/GardenOrder.rb +451 -0
- data/lib/bcdice/game_system/GehennaAn.rb +136 -0
- data/lib/bcdice/game_system/GeishaGirlwithKatana.rb +120 -0
- data/lib/bcdice/game_system/GoblinSlayer.rb +168 -0
- data/lib/bcdice/game_system/GoldenSkyStories.rb +77 -0
- data/lib/bcdice/game_system/Gorilla.rb +44 -0
- data/lib/bcdice/game_system/GranCrest.rb +518 -0
- data/lib/bcdice/game_system/Gundog.rb +52 -0
- data/lib/bcdice/game_system/GundogRevised.rb +294 -0
- data/lib/bcdice/game_system/GundogZero.rb +261 -0
- data/lib/bcdice/game_system/Gurps.rb +403 -0
- data/lib/bcdice/game_system/GurpsFW.rb +2330 -0
- data/lib/bcdice/game_system/HarnMaster.rb +208 -0
- data/lib/bcdice/game_system/HatsuneMiku.rb +706 -0
- data/lib/bcdice/game_system/Hieizan.rb +48 -0
- data/lib/bcdice/game_system/HouraiGakuen.rb +270 -0
- data/lib/bcdice/game_system/HuntersMoon.rb +503 -0
- data/lib/bcdice/game_system/Illusio.rb +89 -0
- data/lib/bcdice/game_system/InfiniteFantasia.rb +51 -0
- data/lib/bcdice/game_system/Insane.rb +822 -0
- data/lib/bcdice/game_system/Insane_Korean.rb +773 -0
- data/lib/bcdice/game_system/IthaWenUa.rb +38 -0
- data/lib/bcdice/game_system/JamesBond.rb +45 -0
- data/lib/bcdice/game_system/Kamigakari.rb +394 -0
- data/lib/bcdice/game_system/Kamigakari_Korean.rb +428 -0
- data/lib/bcdice/game_system/KanColle.rb +938 -0
- data/lib/bcdice/game_system/KemonoNoMori.rb +258 -0
- data/lib/bcdice/game_system/KillDeathBusiness.rb +1420 -0
- data/lib/bcdice/game_system/KillDeathBusiness_Korean.rb +1510 -0
- data/lib/bcdice/game_system/KurayamiCrying.rb +49 -0
- data/lib/bcdice/game_system/LiveraDoll.rb +375 -0
- data/lib/bcdice/game_system/LogHorizon.rb +3567 -0
- data/lib/bcdice/game_system/LogHorizon_Korean.rb +1407 -0
- data/lib/bcdice/game_system/LostRecord.rb +30 -0
- data/lib/bcdice/game_system/LostRoyal.rb +242 -0
- data/lib/bcdice/game_system/MagicaLogia.rb +1148 -0
- data/lib/bcdice/game_system/MeikyuDays.rb +415 -0
- data/lib/bcdice/game_system/MeikyuKingdom.rb +466 -0
- data/lib/bcdice/game_system/MeikyuKingdomBasic.rb +269 -0
- data/lib/bcdice/game_system/MetalHead.rb +249 -0
- data/lib/bcdice/game_system/MetalHeadExtream.rb +917 -0
- data/lib/bcdice/game_system/MetallicGuardian.rb +31 -0
- data/lib/bcdice/game_system/MonotoneMuseum.rb +354 -0
- data/lib/bcdice/game_system/MonotoneMuseum_Korean.rb +304 -0
- data/lib/bcdice/game_system/Nechronica.rb +211 -0
- data/lib/bcdice/game_system/Nechronica_Korean.rb +160 -0
- data/lib/bcdice/game_system/NeverCloud.rb +74 -0
- data/lib/bcdice/game_system/NightWizard.rb +231 -0
- data/lib/bcdice/game_system/NightWizard3rd.rb +24 -0
- data/lib/bcdice/game_system/NightmareHunterDeep.rb +117 -0
- data/lib/bcdice/game_system/NinjaSlayer.rb +274 -0
- data/lib/bcdice/game_system/NjslyrBattle.rb +54 -0
- data/lib/bcdice/game_system/Nuekagami.rb +293 -0
- data/lib/bcdice/game_system/OneWayHeroics.rb +134 -0
- data/lib/bcdice/game_system/OracleEngine.rb +265 -0
- data/lib/bcdice/game_system/OrgaRain.rb +77 -0
- data/lib/bcdice/game_system/Oukahoushin3rd.rb +162 -0
- data/lib/bcdice/game_system/Paradiso.rb +323 -0
- data/lib/bcdice/game_system/Paranoia.rb +64 -0
- data/lib/bcdice/game_system/ParanoiaRebooted.rb +109 -0
- data/lib/bcdice/game_system/ParasiteBlood.rb +231 -0
- data/lib/bcdice/game_system/Pathfinder.rb +21 -0
- data/lib/bcdice/game_system/Peekaboo.rb +324 -0
- data/lib/bcdice/game_system/Pendragon.rb +39 -0
- data/lib/bcdice/game_system/PhantasmAdventure.rb +73 -0
- data/lib/bcdice/game_system/Postman.rb +185 -0
- data/lib/bcdice/game_system/PulpCthulhu.rb +184 -0
- data/lib/bcdice/game_system/Raisondetre.rb +171 -0
- data/lib/bcdice/game_system/RecordOfLodossWar.rb +58 -0
- data/lib/bcdice/game_system/RecordOfSteam.rb +149 -0
- data/lib/bcdice/game_system/RokumonSekai2.rb +110 -0
- data/lib/bcdice/game_system/RoleMaster.rb +24 -0
- data/lib/bcdice/game_system/RuneQuest.rb +47 -0
- data/lib/bcdice/game_system/RyuTuber.rb +266 -0
- data/lib/bcdice/game_system/Ryutama.rb +199 -0
- data/lib/bcdice/game_system/SRS.rb +348 -0
- data/lib/bcdice/game_system/SamsaraBallad.rb +111 -0
- data/lib/bcdice/game_system/Satasupe.rb +1173 -0
- data/lib/bcdice/game_system/ScreamHighSchool.rb +128 -0
- data/lib/bcdice/game_system/SevenFortressMobius.rb +34 -0
- data/lib/bcdice/game_system/ShadowRun.rb +26 -0
- data/lib/bcdice/game_system/ShadowRun4.rb +49 -0
- data/lib/bcdice/game_system/ShadowRun5.rb +80 -0
- data/lib/bcdice/game_system/SharedFantasia.rb +69 -0
- data/lib/bcdice/game_system/ShinMegamiTenseiKakuseihen.rb +85 -0
- data/lib/bcdice/game_system/ShinkuuGakuen.rb +506 -0
- data/lib/bcdice/game_system/ShinobiGami.rb +680 -0
- data/lib/bcdice/game_system/ShoujoTenrankai.rb +677 -0
- data/lib/bcdice/game_system/Skynauts.rb +324 -0
- data/lib/bcdice/game_system/SteamPunkers.rb +485 -0
- data/lib/bcdice/game_system/StellarKnights.rb +856 -0
- data/lib/bcdice/game_system/SterileLife.rb +452 -0
- data/lib/bcdice/game_system/StrangerOfSwordCity.rb +103 -0
- data/lib/bcdice/game_system/StratoShout.rb +316 -0
- data/lib/bcdice/game_system/StratoShout_Korean.rb +314 -0
- data/lib/bcdice/game_system/Strave.rb +223 -0
- data/lib/bcdice/game_system/SwordWorld.rb +491 -0
- data/lib/bcdice/game_system/SwordWorld2_0.rb +295 -0
- data/lib/bcdice/game_system/SwordWorld2_5.rb +121 -0
- data/lib/bcdice/game_system/TherapieSein.rb +93 -0
- data/lib/bcdice/game_system/TokumeiTenkousei.rb +96 -0
- data/lib/bcdice/game_system/TokyoGhostResearch.rb +122 -0
- data/lib/bcdice/game_system/TokyoNova.rb +19 -0
- data/lib/bcdice/game_system/Torg.rb +364 -0
- data/lib/bcdice/game_system/Torg1_5.rb +139 -0
- data/lib/bcdice/game_system/TorgEternity.rb +414 -0
- data/lib/bcdice/game_system/TrinitySeven.rb +364 -0
- data/lib/bcdice/game_system/TunnelsAndTrolls.rb +287 -0
- data/lib/bcdice/game_system/TwilightGunsmoke.rb +527 -0
- data/lib/bcdice/game_system/Utakaze.rb +153 -0
- data/lib/bcdice/game_system/VampireTheMasquerade5th.rb +132 -0
- data/lib/bcdice/game_system/Villaciel.rb +555 -0
- data/lib/bcdice/game_system/WARPS.rb +33 -0
- data/lib/bcdice/game_system/WaresBlade.rb +34 -0
- data/lib/bcdice/game_system/Warhammer.rb +336 -0
- data/lib/bcdice/game_system/WitchQuest.rb +275 -0
- data/lib/bcdice/game_system/WorldOfDarkness.rb +135 -0
- data/lib/bcdice/game_system/YankeeYogSothoth.rb +440 -0
- data/lib/bcdice/game_system/YearZeroEngine.rb +134 -0
- data/lib/bcdice/game_system/ZettaiReido.rb +142 -0
- data/lib/bcdice/game_system/meikyu_kingdom/item_table.rb +383 -0
- data/lib/bcdice/game_system/meikyu_kingdom/kingdom_name_table.rb +89 -0
- data/lib/bcdice/game_system/meikyu_kingdom/landscape_table.rb +196 -0
- data/lib/bcdice/game_system/meikyu_kingdom/name_tables.rb +223 -0
- data/lib/bcdice/game_system/meikyu_kingdom/placename_table.rb +214 -0
- data/lib/bcdice/game_system/meikyu_kingdom/tables.rb +610 -0
- data/lib/bcdice/game_system/meikyu_kingdom/word_table.rb +117 -0
- data/lib/bcdice/game_system/meikyu_kingdom_basic/item_table.rb +380 -0
- data/lib/bcdice/game_system/meikyu_kingdom_basic/kingdom_table.rb +184 -0
- data/lib/bcdice/game_system/meikyu_kingdom_basic/name_table.rb +417 -0
- data/lib/bcdice/game_system/meikyu_kingdom_basic/table.rb +912 -0
- data/lib/bcdice/game_system/meikyu_kingdom_basic/word_table.rb +121 -0
- data/lib/bcdice/game_system/one_way_heroics/dungeon_table.rb +67 -0
- data/lib/bcdice/game_system/one_way_heroics/random_event_table.rb +166 -0
- data/lib/bcdice/game_system/one_way_heroics/tables.rb +668 -0
- data/lib/bcdice/loader.rb +37 -0
- data/lib/bcdice/normalize.rb +38 -0
- data/lib/bcdice/preprocessor.rb +87 -0
- data/lib/bcdice/randomizer.rb +137 -0
- data/lib/bcdice/repl.rb +155 -0
- data/lib/bcdice/user_defined_dice_table.rb +153 -0
- data/lib/bcdice/version.rb +3 -0
- metadata +304 -0
@@ -0,0 +1,435 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BCDice
|
4
|
+
module GameSystem
|
5
|
+
class BadLife < Base
|
6
|
+
# ゲームシステムの識別子
|
7
|
+
ID = 'BadLife'
|
8
|
+
|
9
|
+
# ゲームシステム名
|
10
|
+
NAME = 'バッドライフ'
|
11
|
+
|
12
|
+
# ゲームシステム名の読みがな
|
13
|
+
SORT_KEY = 'はつとらいふ'
|
14
|
+
|
15
|
+
# ダイスボットの使い方
|
16
|
+
HELP_MESSAGE = <<~MESSAGETEXT
|
17
|
+
・判定:nBADm[±a][Cb±c][Fd±e][@X±f][!OP] []内のコマンドは省略可。
|
18
|
+
・BADコマンドは「BL」コマンドで代用可。
|
19
|
+
・博徒は「GL」コマンドで〈波乱万丈〉の効果を適用。
|
20
|
+
|
21
|
+
「n」で振るダイス数、「m」で特性値、「±a」で達成値への修正値、
|
22
|
+
「Cb±c」でクリティカル値への修正、「Fd±e」でファンブル値への修正、
|
23
|
+
「@X」で目標難易度を指定。
|
24
|
+
「±a」「Cb±c」「Fd±e」[@X±f]部分は「4+1-3」などの複数回指定可。
|
25
|
+
「!OP」部分で、一部のスキルやガジェットの追加効果を指定可。
|
26
|
+
使用可能なコマンドは以下の通り。順不同、複数同時使用も可。
|
27
|
+
A:〈先見の明〉 H:[重撃]
|
28
|
+
|
29
|
+
【書式例】
|
30
|
+
BAD → 1ダイスで達成値を表示。
|
31
|
+
3BAD10+2-1 → 3ダイスで修正+11の達成値を表示。
|
32
|
+
BL8@15 → 1ダイスで修正+8、難易度15の判定。
|
33
|
+
2BL8C-1F1@15 → 2ダイスで修正+8、C値-1、F値+1、難易度15の判定。
|
34
|
+
GL6@20 → 1ダイスで修正+6、難易度20の判定。〈波乱万丈〉の効果。
|
35
|
+
GL6@20!HA → 上記に加えて〈先見の明〉[重撃]の効果。
|
36
|
+
|
37
|
+
・コードネーム表
|
38
|
+
怪盗:TRN 闇医者:DRN 博徒:GRN
|
39
|
+
殺シ屋:KRN 業師:SRN 遊ビ人:BRN
|
40
|
+
|
41
|
+
・スキル表:SKL
|
42
|
+
MESSAGETEXT
|
43
|
+
|
44
|
+
register_prefix(['\d?(BAD|BL|GL).*', '[TDGKSB]RN', 'SKL'])
|
45
|
+
|
46
|
+
def eval_game_system_specific_command(command)
|
47
|
+
command = command.upcase
|
48
|
+
|
49
|
+
result = judgeDice(command)
|
50
|
+
return result unless result.nil?
|
51
|
+
|
52
|
+
output =
|
53
|
+
case command
|
54
|
+
|
55
|
+
when /([TDGKSB])RN/i
|
56
|
+
initials = Regexp.last_match(1)
|
57
|
+
get_name_table(initials)
|
58
|
+
|
59
|
+
when 'SKL'
|
60
|
+
get_skill_table
|
61
|
+
|
62
|
+
end
|
63
|
+
|
64
|
+
return output
|
65
|
+
end
|
66
|
+
|
67
|
+
def judgeDice(command)
|
68
|
+
unless (m = /(\d+)?(BAD|BL|GL)([-+\d]*)((C|F)([-+\d]*)?)?((C|F)([-+\d]*))?(\@([-+\d]*))?(\!(\D*))?/i.match(command))
|
69
|
+
return nil
|
70
|
+
end
|
71
|
+
|
72
|
+
diceCount = (m[1] || 1).to_i
|
73
|
+
|
74
|
+
critical = 20
|
75
|
+
fumble = 1
|
76
|
+
|
77
|
+
isStormy = (m[2] == 'GL') # 波乱万丈
|
78
|
+
if isStormy
|
79
|
+
critical -= 3
|
80
|
+
fumble += 1
|
81
|
+
end
|
82
|
+
|
83
|
+
modify = get_value(m[3])
|
84
|
+
|
85
|
+
critical, fumble = get_critival_fumble(critical, fumble, m[5], m[6])
|
86
|
+
critical, fumble = get_critival_fumble(critical, fumble, m[8], m[9])
|
87
|
+
|
88
|
+
target = get_value(m[11])
|
89
|
+
optionalText = (m[13] || '')
|
90
|
+
|
91
|
+
return checkRoll(diceCount, modify, critical, fumble, target, isStormy, optionalText)
|
92
|
+
end
|
93
|
+
|
94
|
+
def get_critival_fumble(critical, fumble, marker, text)
|
95
|
+
case marker
|
96
|
+
when 'C'
|
97
|
+
critical += get_value(text)
|
98
|
+
when 'F'
|
99
|
+
fumble += get_value(text)
|
100
|
+
end
|
101
|
+
|
102
|
+
return critical, fumble
|
103
|
+
end
|
104
|
+
|
105
|
+
def checkRoll(diceCount, modify, critical, fumble, target, isStormy, optionalText)
|
106
|
+
isAnticipation = optionalText.include?('A') # 先見の明
|
107
|
+
isHeavyAttack = optionalText.include?('H') # 重撃
|
108
|
+
|
109
|
+
dice_list = @randomizer.roll_barabara(diceCount, 20)
|
110
|
+
diceText = dice_list.join(",")
|
111
|
+
diceMax = dice_list.max
|
112
|
+
|
113
|
+
diceMax = 5 if isHeavyAttack && diceMax <= 5 # 重撃
|
114
|
+
|
115
|
+
isCritical = (diceMax >= critical)
|
116
|
+
isFumble = (diceMax <= fumble)
|
117
|
+
|
118
|
+
diceMax = 20 if isCritical # クリティカル
|
119
|
+
total = diceMax + modify
|
120
|
+
total += 5 if isAnticipation && diceMax <= 7 # 先見の明
|
121
|
+
total = 0 if isFumble # ファンブル
|
122
|
+
|
123
|
+
result = "#{diceCount}D20\(C:#{critical},F:#{fumble}\) > "
|
124
|
+
result += "#{diceMax}\[#{diceText}\]"
|
125
|
+
result += "\+" if modify > 0
|
126
|
+
result += modify.to_s if modify != 0
|
127
|
+
result += "\+5" if isAnticipation && diceMax <= 7 # 先見の明
|
128
|
+
result += " > 達成値:#{total}"
|
129
|
+
|
130
|
+
if target > 0
|
131
|
+
success = total - target
|
132
|
+
result += ">=#{target} 成功度:#{success} > "
|
133
|
+
|
134
|
+
if isCritical
|
135
|
+
result += "成功(クリティカル)"
|
136
|
+
elsif total >= target
|
137
|
+
result += "成功"
|
138
|
+
else
|
139
|
+
result += "失敗"
|
140
|
+
result += "(ファンブル)" if isFumble
|
141
|
+
end
|
142
|
+
else
|
143
|
+
result += " クリティカル" if isCritical
|
144
|
+
result += " ファンブル" if isFumble
|
145
|
+
end
|
146
|
+
|
147
|
+
skillText = ""
|
148
|
+
skillText += "〈波乱万丈〉" if isStormy
|
149
|
+
skillText += "〈先見の明〉" if isAnticipation
|
150
|
+
skillText += "[重撃]" if isHeavyAttack
|
151
|
+
result += " #{skillText}" if skillText != ""
|
152
|
+
|
153
|
+
return result
|
154
|
+
end
|
155
|
+
|
156
|
+
def get_name_table(initials)
|
157
|
+
case initials
|
158
|
+
when 'T' # Thief
|
159
|
+
name = '怪盗コードネーム表'
|
160
|
+
table = [
|
161
|
+
[1, 'フォックス'],
|
162
|
+
[2, 'フォックス'],
|
163
|
+
[3, 'ラット'],
|
164
|
+
[4, 'ラット'],
|
165
|
+
[5, 'キャット'],
|
166
|
+
[6, 'キャット'],
|
167
|
+
[7, 'タイガー'],
|
168
|
+
[8, 'タイガー'],
|
169
|
+
[9, 'シャーク'],
|
170
|
+
[10, 'シャーク'],
|
171
|
+
[11, 'コンドル'],
|
172
|
+
[12, 'コンドル'],
|
173
|
+
[13, 'スパイダー'],
|
174
|
+
[14, 'スパイダー'],
|
175
|
+
[15, 'ウルフ'],
|
176
|
+
[16, 'ウルフ'],
|
177
|
+
[17, 'コヨーテ'],
|
178
|
+
[18, 'コヨーテ'],
|
179
|
+
[19, 'ジャガー'],
|
180
|
+
[20, 'ジャガー']
|
181
|
+
]
|
182
|
+
when 'D' # Doctor
|
183
|
+
name = '闇医者コードネーム表'
|
184
|
+
table = [
|
185
|
+
[1, 'キャンサー'],
|
186
|
+
[2, 'キャンサー'],
|
187
|
+
[3, 'ヘッドエイク'],
|
188
|
+
[4, 'ヘッドエイク'],
|
189
|
+
[5, 'ブラッド'],
|
190
|
+
[6, 'ブラッド'],
|
191
|
+
[7, 'ウーンズ'],
|
192
|
+
[8, 'ウーンズ'],
|
193
|
+
[9, 'ポイズン'],
|
194
|
+
[10, 'ポイズン'],
|
195
|
+
[11, 'ペイン'],
|
196
|
+
[12, 'ペイン'],
|
197
|
+
[13, 'スリープ'],
|
198
|
+
[14, 'スリープ'],
|
199
|
+
[15, 'キュア'],
|
200
|
+
[16, 'キュア'],
|
201
|
+
[17, 'デス'],
|
202
|
+
[18, 'デス'],
|
203
|
+
[19, 'リーンカーネイション'],
|
204
|
+
[20, 'リーンカーネイション']
|
205
|
+
]
|
206
|
+
when 'G' # Gambler
|
207
|
+
name = '博徒コードネーム表'
|
208
|
+
table = [
|
209
|
+
[1, 'リトルダイス'],
|
210
|
+
[2, 'リトルダイス'],
|
211
|
+
[3, 'プラチナム'],
|
212
|
+
[4, 'プラチナム'],
|
213
|
+
[5, 'プレジデント'],
|
214
|
+
[6, 'プレジデント'],
|
215
|
+
[7, 'ドリーム'],
|
216
|
+
[8, 'ドリーム'],
|
217
|
+
[9, 'アクシデント'],
|
218
|
+
[10, 'アクシデント'],
|
219
|
+
[11, 'グリード'],
|
220
|
+
[12, 'グリード'],
|
221
|
+
[13, 'フォーチュン'],
|
222
|
+
[14, 'フォーチュン'],
|
223
|
+
[15, 'ミラクル'],
|
224
|
+
[16, 'ミラクル'],
|
225
|
+
[17, 'ホープ'],
|
226
|
+
[18, 'ホープ'],
|
227
|
+
[19, 'ビッグヒット'],
|
228
|
+
[20, 'ビッグヒット']
|
229
|
+
]
|
230
|
+
when 'K' # Killer
|
231
|
+
name = '殺シ屋コードネーム表'
|
232
|
+
table = [
|
233
|
+
[1, 'ハンマー'],
|
234
|
+
[2, 'ハンマー'],
|
235
|
+
[3, 'アロー'],
|
236
|
+
[4, 'アロー'],
|
237
|
+
[5, 'ボマー'],
|
238
|
+
[6, 'ボマー'],
|
239
|
+
[7, 'キャノン'],
|
240
|
+
[8, 'キャノン'],
|
241
|
+
[9, 'ブレード'],
|
242
|
+
[10, 'ブレード'],
|
243
|
+
[11, 'スティング'],
|
244
|
+
[12, 'スティング'],
|
245
|
+
[13, 'ガロット'],
|
246
|
+
[14, 'ガロット'],
|
247
|
+
[15, 'パイルバンカー'],
|
248
|
+
[16, 'パイルバンカー'],
|
249
|
+
[17, 'レイザー'],
|
250
|
+
[18, 'レイザー'],
|
251
|
+
[19, 'カタナ'],
|
252
|
+
[20, 'カタナ']
|
253
|
+
]
|
254
|
+
when 'S' # Schemer
|
255
|
+
name = '業師コードネーム表'
|
256
|
+
table = [
|
257
|
+
[1, 'ローズ'],
|
258
|
+
[2, 'ローズ'],
|
259
|
+
[3, 'サクラ'],
|
260
|
+
[4, 'サクラ'],
|
261
|
+
[5, 'ライラック'],
|
262
|
+
[6, 'ライラック'],
|
263
|
+
[7, 'ダンデライオン'],
|
264
|
+
[8, 'ダンデライオン'],
|
265
|
+
[9, 'フリージア'],
|
266
|
+
[10, 'フリージア'],
|
267
|
+
[11, 'カクタス'],
|
268
|
+
[12, 'カクタス'],
|
269
|
+
[13, 'ロータス'],
|
270
|
+
[14, 'ロータス'],
|
271
|
+
[15, 'リリィ'],
|
272
|
+
[16, 'リリィ'],
|
273
|
+
[17, 'ラフレシア'],
|
274
|
+
[18, 'ラフレシア'],
|
275
|
+
[19, 'ヒヤシンス'],
|
276
|
+
[20, 'ヒヤシンス']
|
277
|
+
]
|
278
|
+
when 'B' # Bum
|
279
|
+
name = '遊ビ人コードネーム表'
|
280
|
+
table = [
|
281
|
+
[1, 'モノポリー'],
|
282
|
+
[2, 'モノポリー'],
|
283
|
+
[3, 'ブリッジ'],
|
284
|
+
[4, 'ブリッジ'],
|
285
|
+
[5, 'チェッカー'],
|
286
|
+
[6, 'チェッカー'],
|
287
|
+
[7, 'アクワイア'],
|
288
|
+
[8, 'アクワイア'],
|
289
|
+
[9, 'ジャンケン'],
|
290
|
+
[10, 'ジャンケン'],
|
291
|
+
[11, 'トランプ'],
|
292
|
+
[12, 'トランプ'],
|
293
|
+
[13, 'ケイドロ'],
|
294
|
+
[14, 'ケイドロ'],
|
295
|
+
[15, 'パンデミック'],
|
296
|
+
[16, 'パンデミック'],
|
297
|
+
[17, 'スゴロク'],
|
298
|
+
[18, 'スゴロク'],
|
299
|
+
[19, 'キャベツカンテイ'],
|
300
|
+
[20, 'キャベツカンテイ']
|
301
|
+
]
|
302
|
+
else
|
303
|
+
return nil
|
304
|
+
end
|
305
|
+
|
306
|
+
return get_badlife_1d20_table_result(name, table)
|
307
|
+
end
|
308
|
+
|
309
|
+
def get_skill_table
|
310
|
+
name = 'スキル表'
|
311
|
+
table = [
|
312
|
+
[1, '一撃離脱'],
|
313
|
+
[2, '一撃離脱'],
|
314
|
+
[3, 'チェイサー'],
|
315
|
+
[4, 'チェイサー'],
|
316
|
+
[5, '影の外套'],
|
317
|
+
[6, '影の外套'],
|
318
|
+
[7, '二段ジャンプ'],
|
319
|
+
[8, '二段ジャンプ'],
|
320
|
+
[9, '韋駄天'],
|
321
|
+
[10, '韋駄天'],
|
322
|
+
[11, '手練'],
|
323
|
+
[12, '手練'],
|
324
|
+
[13, 'ハニーテイスト'],
|
325
|
+
[14, 'ハニーテイスト'],
|
326
|
+
[15, '先見の明'],
|
327
|
+
[16, '先見の明'],
|
328
|
+
[17, 'ベテラン'],
|
329
|
+
[18, 'ベテラン'],
|
330
|
+
[19, '応急手当'],
|
331
|
+
[20, '応急手当'],
|
332
|
+
[21, 'セラピー'],
|
333
|
+
[22, 'セラピー'],
|
334
|
+
[23, '緊急治療'],
|
335
|
+
[24, '緊急治療'],
|
336
|
+
[25, 'ゴールドディガー'],
|
337
|
+
[26, 'ゴールドディガー'],
|
338
|
+
[27, 'デイリーミッション'],
|
339
|
+
[28, 'デイリーミッション'],
|
340
|
+
[29, '見切り'],
|
341
|
+
[30, '見切り'],
|
342
|
+
[31, '鷹の目'],
|
343
|
+
[32, '鷹の目'],
|
344
|
+
[33, 'しびれ罠'],
|
345
|
+
[34, 'しびれ罠'],
|
346
|
+
[35, '大逆転'],
|
347
|
+
[36, '大逆転'],
|
348
|
+
[37, '武器習熟:○○'],
|
349
|
+
[38, '武器習熟:○○'],
|
350
|
+
[39, '百発百中'],
|
351
|
+
[40, '百発百中'],
|
352
|
+
[41, '屈強な肉体'],
|
353
|
+
[42, '屈強な肉体'],
|
354
|
+
[43, '二刀流'],
|
355
|
+
[44, '二刀流'],
|
356
|
+
[45, 'クイックリカバリー'],
|
357
|
+
[46, 'クイックリカバリー'],
|
358
|
+
[47, '体験主義'],
|
359
|
+
[48, '体験主義'],
|
360
|
+
[49, '破釜沈船'],
|
361
|
+
[50, '破釜沈船'],
|
362
|
+
[51, '想定の範囲内'],
|
363
|
+
[52, '想定の範囲内'],
|
364
|
+
[53, 'セカンドチャンス'],
|
365
|
+
[54, 'セカンドチャンス'],
|
366
|
+
[55, '優秀な子分'],
|
367
|
+
[56, '優秀な子分'],
|
368
|
+
[57, '時間管理術'],
|
369
|
+
[58, '時間管理術'],
|
370
|
+
[59, '連撃術'],
|
371
|
+
[60, '連撃術'],
|
372
|
+
[61, '罵詈雑言'],
|
373
|
+
[62, '罵詈雑言'],
|
374
|
+
[63, 'ケセラセラ'],
|
375
|
+
[64, 'ケセラセラ'],
|
376
|
+
[65, 'ダンス&ミュージック'],
|
377
|
+
[66, 'ダンス&ミュージック'],
|
378
|
+
[67, 'フェイント'],
|
379
|
+
[68, 'フェイント'],
|
380
|
+
[69, 'ヘイトコントロール'],
|
381
|
+
[70, 'ヘイトコントロール'],
|
382
|
+
[71, '惜別'],
|
383
|
+
[72, '惜別'],
|
384
|
+
[73, '戦闘マシーン'],
|
385
|
+
[74, '戦闘マシーン'],
|
386
|
+
[75, '戦闘マシーン'],
|
387
|
+
[76, '名医'],
|
388
|
+
[77, '名医'],
|
389
|
+
[78, '名医'],
|
390
|
+
[79, '忍者'],
|
391
|
+
[80, '忍者'],
|
392
|
+
[81, '忍者'],
|
393
|
+
[82, '観察眼'],
|
394
|
+
[83, '観察眼'],
|
395
|
+
[84, '観察眼'],
|
396
|
+
[85, 'クレバー'],
|
397
|
+
[86, 'クレバー'],
|
398
|
+
[87, 'クレバー'],
|
399
|
+
[88, 'フェイスマン'],
|
400
|
+
[89, 'フェイスマン'],
|
401
|
+
[90, 'フェイスマン'],
|
402
|
+
[91, 'スポーツマン'],
|
403
|
+
[92, 'スポーツマン'],
|
404
|
+
[93, 'スポーツマン'],
|
405
|
+
[94, '不屈'],
|
406
|
+
[95, '不屈'],
|
407
|
+
[96, '不屈'],
|
408
|
+
[97, '慎重'],
|
409
|
+
[98, '慎重'],
|
410
|
+
[99, '慎重'],
|
411
|
+
[100, 'この表を2回振る']
|
412
|
+
]
|
413
|
+
dice = @randomizer.roll_once(100)
|
414
|
+
result = get_table_by_number(dice, table)
|
415
|
+
|
416
|
+
return get_badlife_table_result(name, dice, result)
|
417
|
+
end
|
418
|
+
|
419
|
+
def get_badlife_1d20_table_result(name, table)
|
420
|
+
dice = @randomizer.roll_once(20)
|
421
|
+
output = get_table_by_number(dice, table)
|
422
|
+
return get_badlife_table_result(name, dice, output)
|
423
|
+
end
|
424
|
+
|
425
|
+
def get_badlife_table_result(name, dice, output)
|
426
|
+
return "#{name}(#{dice}) > #{output}"
|
427
|
+
end
|
428
|
+
|
429
|
+
def get_value(text)
|
430
|
+
text ||= ""
|
431
|
+
return ArithmeticEvaluator.eval(text)
|
432
|
+
end
|
433
|
+
end
|
434
|
+
end
|
435
|
+
end
|
@@ -0,0 +1,188 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BCDice
|
4
|
+
module GameSystem
|
5
|
+
class BarnaKronika < Base
|
6
|
+
# ゲームシステムの識別子
|
7
|
+
ID = 'BarnaKronika'
|
8
|
+
|
9
|
+
# ゲームシステム名
|
10
|
+
NAME = 'バルナ・クロニカ'
|
11
|
+
|
12
|
+
# ゲームシステム名の読みがな
|
13
|
+
SORT_KEY = 'はるなくろにか'
|
14
|
+
|
15
|
+
# ダイスボットの使い方
|
16
|
+
HELP_MESSAGE = <<~INFO_MESSAGE_TEXT
|
17
|
+
・通常判定 nBK
|
18
|
+
ダイス数nで判定ロールを行います。
|
19
|
+
セット数が1以上の時はセット数も表示します。
|
20
|
+
・攻撃判定 nBA
|
21
|
+
ダイス数nで判定ロールを行い、攻撃値と命中部位も表示します。
|
22
|
+
・クリティカルコール nBKCt nBACt
|
23
|
+
判定コマンドの後ろに「Ct」を付けるとクリティカルコールです。
|
24
|
+
ダイス数n,コール数tで判定ロールを行います。
|
25
|
+
ダイス数nで判定ロールを行います。
|
26
|
+
セット数が1以上の時はセット数も表示し、攻撃判定の場合は命中部位も表示します。
|
27
|
+
INFO_MESSAGE_TEXT
|
28
|
+
|
29
|
+
register_prefix(['\d+BK.*', '\d+BA.*', '\d+BKC\d+.*', '\d+BAC\d+.*', '\d+R6.*'])
|
30
|
+
|
31
|
+
def initialize(command)
|
32
|
+
super(command)
|
33
|
+
|
34
|
+
@sort_add_dice = true
|
35
|
+
@sort_barabara_dice = true
|
36
|
+
end
|
37
|
+
|
38
|
+
def replace_text(string)
|
39
|
+
string = string.gsub(/(\d+)BKC(\d)/) { "#{Regexp.last_match(1)}R6[0,#{Regexp.last_match(2)}]" }
|
40
|
+
string = string.gsub(/(\d+)BAC(\d)/) { "#{Regexp.last_match(1)}R6[1,#{Regexp.last_match(2)}]" }
|
41
|
+
string = string.gsub(/(\d+)BK/) { "#{Regexp.last_match(1)}R6[0,0]" }
|
42
|
+
string = string.gsub(/(\d+)BA/) { "#{Regexp.last_match(1)}R6[1,0]" }
|
43
|
+
return string
|
44
|
+
end
|
45
|
+
|
46
|
+
def eval_game_system_specific_command(string)
|
47
|
+
string = replace_text(string)
|
48
|
+
|
49
|
+
return nil unless /(^|\s)S?((\d+)[rR]6(\[([,\d]+)\])?)(\s|$)/i =~ string
|
50
|
+
|
51
|
+
string = Regexp.last_match(2)
|
52
|
+
option = Regexp.last_match(5)
|
53
|
+
dice_n = Regexp.last_match(3)
|
54
|
+
dice_n ||= 1
|
55
|
+
|
56
|
+
@isBattleMode = false # 0=判定モード, 1=戦闘モード
|
57
|
+
criticalCallDice = 0 # 0=通常, 1〜6=クリティカルコール
|
58
|
+
|
59
|
+
if option
|
60
|
+
battleModeText, criticalCallDice = option.split(",").map(&:to_i)
|
61
|
+
@isBattleMode = (battleModeText == 1)
|
62
|
+
end
|
63
|
+
|
64
|
+
debug("@isBattleMode", @isBattleMode)
|
65
|
+
|
66
|
+
dice_str, suc, set, at_str = roll_barna_kronika(dice_n, criticalCallDice)
|
67
|
+
|
68
|
+
output = "(#{string}) > [#{dice_str}] > "
|
69
|
+
|
70
|
+
if @isBattleMode
|
71
|
+
output += at_str
|
72
|
+
else
|
73
|
+
debug("suc", suc)
|
74
|
+
if suc > 1
|
75
|
+
output += "成功数#{suc}"
|
76
|
+
else
|
77
|
+
output += "失敗"
|
78
|
+
end
|
79
|
+
|
80
|
+
debug("set", set)
|
81
|
+
output += ",セット#{set}" if set > 0
|
82
|
+
end
|
83
|
+
|
84
|
+
return output
|
85
|
+
end
|
86
|
+
|
87
|
+
def roll_barna_kronika(dice_n, criticalCallDice)
|
88
|
+
dice_n = dice_n.to_i
|
89
|
+
|
90
|
+
output = ''
|
91
|
+
suc = 0
|
92
|
+
set = 0
|
93
|
+
at_str = ''
|
94
|
+
diceCountList = [0, 0, 0, 0, 0, 0]
|
95
|
+
|
96
|
+
dice_n.times do |_i|
|
97
|
+
index = @randomizer.roll_index(6)
|
98
|
+
diceCountList[index] += 1
|
99
|
+
if diceCountList[index] > suc
|
100
|
+
suc = diceCountList[index]
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
6.times do |i|
|
105
|
+
diceCount = diceCountList[i]
|
106
|
+
|
107
|
+
next if diceCount == 0
|
108
|
+
|
109
|
+
diceCount.times do |_j|
|
110
|
+
output += "#{i + 1},"
|
111
|
+
end
|
112
|
+
|
113
|
+
if isCriticalCall(i, criticalCallDice)
|
114
|
+
debug("isCriticalCall")
|
115
|
+
at_str += getAttackStringWhenCriticalCall(i, diceCount)
|
116
|
+
elsif isNomalAttack(criticalCallDice, diceCount)
|
117
|
+
debug("isNomalAttack")
|
118
|
+
at_str += getAttackStringWhenNomal(i, diceCount)
|
119
|
+
end
|
120
|
+
|
121
|
+
set += 1 if diceCount > 1
|
122
|
+
end
|
123
|
+
|
124
|
+
if criticalCallDice != 0
|
125
|
+
c_cnt = diceCountList[criticalCallDice - 1]
|
126
|
+
suc = c_cnt * 2
|
127
|
+
|
128
|
+
if c_cnt != 0
|
129
|
+
set = 1
|
130
|
+
else
|
131
|
+
set = 0
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
if @isBattleMode && (suc < 2)
|
136
|
+
at_str = "失敗"
|
137
|
+
end
|
138
|
+
|
139
|
+
output = output.sub(/,$/, '')
|
140
|
+
at_str = at_str.sub(/,$/, '')
|
141
|
+
|
142
|
+
return output, suc, set, at_str
|
143
|
+
end
|
144
|
+
|
145
|
+
def isCriticalCall(index, criticalCallDice)
|
146
|
+
return false unless @isBattleMode
|
147
|
+
return false if criticalCallDice == 0
|
148
|
+
|
149
|
+
return (criticalCallDice == (index + 1))
|
150
|
+
end
|
151
|
+
|
152
|
+
def isNomalAttack(criticalCallDice, diceCount)
|
153
|
+
return false unless @isBattleMode
|
154
|
+
return false if criticalCallDice != 0
|
155
|
+
|
156
|
+
return (diceCount > 1)
|
157
|
+
end
|
158
|
+
|
159
|
+
def getAttackStringWhenCriticalCall(index, diceCount)
|
160
|
+
hitLocation = getAttackHitLocation(index + 1)
|
161
|
+
attackValue = (diceCount * 2)
|
162
|
+
result = hitLocation + ":攻撃値#{attackValue},"
|
163
|
+
return result
|
164
|
+
end
|
165
|
+
|
166
|
+
def getAttackStringWhenNomal(index, diceCount)
|
167
|
+
hitLocation = getAttackHitLocation(index + 1)
|
168
|
+
attackValue = diceCount
|
169
|
+
result = hitLocation + ":攻撃値#{attackValue},"
|
170
|
+
return result
|
171
|
+
end
|
172
|
+
|
173
|
+
# 命中部位表
|
174
|
+
def getAttackHitLocation(num)
|
175
|
+
table = [
|
176
|
+
[1, '頭部'],
|
177
|
+
[2, '右腕'],
|
178
|
+
[3, '左腕'],
|
179
|
+
[4, '右脚'],
|
180
|
+
[5, '左脚'],
|
181
|
+
[6, '胴体'],
|
182
|
+
]
|
183
|
+
|
184
|
+
return get_table_by_number(num, table)
|
185
|
+
end
|
186
|
+
end
|
187
|
+
end
|
188
|
+
end
|