bcdice 3.0.0.pre.alpha.1
Sign up to get free protection for your applications and to get access to all the features.
- 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,96 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BCDice
|
4
|
+
module GameSystem
|
5
|
+
class TokumeiTenkousei < Base
|
6
|
+
# ゲームシステムの識別子
|
7
|
+
ID = 'TokumeiTenkousei'
|
8
|
+
|
9
|
+
# ゲームシステム名
|
10
|
+
NAME = '特命転攻生'
|
11
|
+
|
12
|
+
# ゲームシステム名の読みがな
|
13
|
+
SORT_KEY = 'とくめいてんこうせい'
|
14
|
+
|
15
|
+
# ダイスボットの使い方
|
16
|
+
HELP_MESSAGE = <<~HELP
|
17
|
+
・判定 (xD6+y>=n)
|
18
|
+
ゾロ目での自動振り足し
|
19
|
+
1の出目に応じてEPPの獲得量を表示
|
20
|
+
目標値 "?" には未対応
|
21
|
+
HELP
|
22
|
+
|
23
|
+
def initialize(command)
|
24
|
+
super(command)
|
25
|
+
|
26
|
+
@sort_add_dice = true
|
27
|
+
end
|
28
|
+
|
29
|
+
register_prefix(['\d+D6.*'])
|
30
|
+
|
31
|
+
def eval_game_system_specific_command(command)
|
32
|
+
parser = CommandParser.new(/^\d+D6$/)
|
33
|
+
cmd = parser.parse(command)
|
34
|
+
unless cmd
|
35
|
+
return nil
|
36
|
+
end
|
37
|
+
|
38
|
+
times = cmd.command.to_i
|
39
|
+
|
40
|
+
dice_list = @randomizer.roll_barabara(times, 6).sort
|
41
|
+
@dice_list = [dice_list]
|
42
|
+
while same_all_dice?(dice_list)
|
43
|
+
dice_list = @randomizer.roll_barabara(times, 6).sort
|
44
|
+
@dice_list.push(dice_list)
|
45
|
+
end
|
46
|
+
|
47
|
+
dice_list_flatten = @dice_list.flatten
|
48
|
+
dice_total = dice_list_flatten.sum()
|
49
|
+
count_one = dice_list_flatten.count(1)
|
50
|
+
|
51
|
+
total = dice_total + cmd.modify_number
|
52
|
+
|
53
|
+
result =
|
54
|
+
if cmd.cmp_op
|
55
|
+
total.send(cmd.cmp_op, cmd.target_number) ? "成功" : "失敗"
|
56
|
+
end
|
57
|
+
|
58
|
+
sequence = [
|
59
|
+
"(#{cmd})",
|
60
|
+
interim_expr(cmd, dice_total),
|
61
|
+
total.to_s,
|
62
|
+
result,
|
63
|
+
epp(count_one)
|
64
|
+
].compact
|
65
|
+
|
66
|
+
return sequence.join(" > ")
|
67
|
+
end
|
68
|
+
|
69
|
+
# 出目が全て同じか
|
70
|
+
def same_all_dice?(dice_list)
|
71
|
+
dice_list.size > 1 && dice_list.uniq.size == 1
|
72
|
+
end
|
73
|
+
|
74
|
+
def interim_expr(cmd, dice_total)
|
75
|
+
if @dice_list.flatten.size == 1 && cmd.modify_number == 0
|
76
|
+
return nil
|
77
|
+
end
|
78
|
+
|
79
|
+
dice_list = @dice_list.map { |ds| "[#{ds.join(',')}]" }.join("")
|
80
|
+
modifier = Format.modifier(cmd.modify_number)
|
81
|
+
|
82
|
+
return [dice_total.to_s, dice_list, modifier].join("")
|
83
|
+
end
|
84
|
+
|
85
|
+
# エキストラパワーポイント獲得
|
86
|
+
#
|
87
|
+
# @param count_one [Integer]
|
88
|
+
# @return [String, nil]
|
89
|
+
def epp(count_one)
|
90
|
+
if count_one > 0
|
91
|
+
"#{count_one * 5}EPP獲得"
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
@@ -0,0 +1,122 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BCDice
|
4
|
+
module GameSystem
|
5
|
+
class TokyoGhostResearch < Base
|
6
|
+
# ゲームシステムの識別子
|
7
|
+
ID = 'TokyoGhostResearch'
|
8
|
+
|
9
|
+
# ゲームシステム名
|
10
|
+
NAME = '東京ゴーストリサーチ'
|
11
|
+
|
12
|
+
# ゲームシステム名の読みがな
|
13
|
+
SORT_KEY = 'とうきようこおすとりさあち'
|
14
|
+
|
15
|
+
# ダイスボットの使い方
|
16
|
+
HELP_MESSAGE = <<~MESSAGETEXT
|
17
|
+
判定
|
18
|
+
・タスク処理は目標値以上の値で成功となります。
|
19
|
+
1d10>={目標値}
|
20
|
+
例:目標値「5」の場合、5~0で成功
|
21
|
+
各種表
|
22
|
+
・導入表 OP
|
23
|
+
・一般トラブル表 TB
|
24
|
+
MESSAGETEXT
|
25
|
+
|
26
|
+
# ダイスボットで使用するコマンドを配列で列挙する
|
27
|
+
register_prefix([
|
28
|
+
'OP', 'TB', 'TK?\(\d+\)'
|
29
|
+
])
|
30
|
+
|
31
|
+
def eval_game_system_specific_command(command)
|
32
|
+
output =
|
33
|
+
case command.upcase
|
34
|
+
|
35
|
+
when /TK/i
|
36
|
+
return getCheckResult(command)
|
37
|
+
|
38
|
+
when 'OP'
|
39
|
+
tgr_opening_table
|
40
|
+
when 'TB'
|
41
|
+
tgr_common_trouble_table
|
42
|
+
end
|
43
|
+
|
44
|
+
return output
|
45
|
+
end
|
46
|
+
|
47
|
+
def getCheckResult(command)
|
48
|
+
output = ""
|
49
|
+
diff = 0
|
50
|
+
|
51
|
+
if /TK?<=(\d+)/i =~ command
|
52
|
+
diff = Regexp.last_match(2).to_i
|
53
|
+
end
|
54
|
+
|
55
|
+
if diff > 0
|
56
|
+
output += "(1D10<=#{diff})"
|
57
|
+
|
58
|
+
total_n = @randomizer.roll_once(10)
|
59
|
+
output += ' > ' + total_n.to_s
|
60
|
+
output += ' > ' + getCheckResultText(total_n, diff)
|
61
|
+
end
|
62
|
+
return output
|
63
|
+
end
|
64
|
+
|
65
|
+
def getCheckResultText(total_n, diff)
|
66
|
+
if total_n >= diff
|
67
|
+
result = "成功"
|
68
|
+
else
|
69
|
+
result = "失敗"
|
70
|
+
end
|
71
|
+
|
72
|
+
return result
|
73
|
+
end
|
74
|
+
|
75
|
+
# 導入表(1d10)[OP]
|
76
|
+
def tgr_opening_table
|
77
|
+
name = "導入表"
|
78
|
+
table = [
|
79
|
+
[1, "【病休中断】体調不良または怪我で療養中だったが強制召喚された。"],
|
80
|
+
[2, "【忙殺中】別の業務で忙殺中であった。"],
|
81
|
+
[3, "【出張帰り】遠方での仕事から戻ったばかり。"],
|
82
|
+
[4, "【休暇取り消し】休暇中だったが呼び戻された。"],
|
83
|
+
[5, "【平常運転】いつもどおりの仕事中だった。"],
|
84
|
+
[6, "【休暇明け】十分に休養をとったあとで、心身ともに充実している。"],
|
85
|
+
[7, "【人生の岐路】人生の岐路にまさに差し掛かったところであった。"],
|
86
|
+
[8, "【同窓会】かつての同級生に会い、差を実感したばかりだった。"],
|
87
|
+
[9, "【転職活動中】転職を考えて求人サイトを見ているところだった。"],
|
88
|
+
[10, "【サボリ中】仕事をサボっているところに呼び出しがあった。"],
|
89
|
+
]
|
90
|
+
return get_1d10_table_result(name, table)
|
91
|
+
end
|
92
|
+
|
93
|
+
# 一般トラブル表(1d10)[TB]
|
94
|
+
def tgr_common_trouble_table
|
95
|
+
name = "一般トラブル表"
|
96
|
+
table = [
|
97
|
+
[1, "トラブルが生じたが、間一髪、危機を脱した。【ダメージなし】"],
|
98
|
+
[2, "どうにかタスクを処理したが、非常に疲労してしまった。【肉体ダメージ1点】"],
|
99
|
+
[3, "タスク処理の過程で負傷してしまった。【肉体ダメージ1点】"],
|
100
|
+
[4, "恐怖や混乱、ストレスなどで精神の均衡を崩してしまった。【精神ダメージ1点】"],
|
101
|
+
[5, "過去のトラウマなどを思い出し、気分が沈んでしまった。【精神ダメージ1点】"],
|
102
|
+
[6, "自身の信用をキズつけたり、汚名を背負ってしまった。【環境ダメージ1点】"],
|
103
|
+
[7, "会社や上司の不興を買ってしまった。【環境ダメージ1点】"],
|
104
|
+
[8, "疲労困憊で動くこともままならない。【肉体ダメージ1点+精神ダメージ1点】"],
|
105
|
+
[9, "負傷したうえ、会社に損害を与えてしまった。【肉体ダメージ1点+環境ダメージ1点】"],
|
106
|
+
[10, "上司から厳しく叱責され、まずい立場になった。【精神ダメージ1点+環境ダメージ1点】"],
|
107
|
+
]
|
108
|
+
return get_1d10_table_result(name, table)
|
109
|
+
end
|
110
|
+
|
111
|
+
def get_1d10_table_result(name, table)
|
112
|
+
dice = @randomizer.roll_once(10)
|
113
|
+
output = get_table_by_number(dice, table)
|
114
|
+
return get_table_result(name, dice, output)
|
115
|
+
end
|
116
|
+
|
117
|
+
def get_table_result(name, dice, output)
|
118
|
+
return "#{name}(#{dice}) > #{output}"
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BCDice
|
4
|
+
module GameSystem
|
5
|
+
class TokyoNova < Base
|
6
|
+
# ゲームシステムの識別子
|
7
|
+
ID = 'TokyoNova'
|
8
|
+
|
9
|
+
# ゲームシステム名
|
10
|
+
NAME = 'トーキョーN◎VA'
|
11
|
+
|
12
|
+
# ゲームシステム名の読みがな
|
13
|
+
SORT_KEY = 'とおきよおのは'
|
14
|
+
|
15
|
+
# ダイスボットの使い方
|
16
|
+
HELP_MESSAGE = "※このダイスボットは部屋のシステム名表示用となります。\n"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,364 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BCDice
|
4
|
+
module GameSystem
|
5
|
+
class Torg < Base
|
6
|
+
# ゲームシステムの識別子
|
7
|
+
ID = 'TORG'
|
8
|
+
|
9
|
+
# ゲームシステム名
|
10
|
+
NAME = 'トーグ'
|
11
|
+
|
12
|
+
# ゲームシステム名の読みがな
|
13
|
+
SORT_KEY = 'とおく'
|
14
|
+
|
15
|
+
# ダイスボットの使い方
|
16
|
+
HELP_MESSAGE = <<~INFO_MESSAGE_TEXT
|
17
|
+
・判定 (TGm)
|
18
|
+
TORG専用の判定コマンドです。
|
19
|
+
"TG(技能基本値)"でロールします。Rコマンドに読替されます。
|
20
|
+
振り足しを自動で行い、20の出目が出たときには技能無し値も並記します。
|
21
|
+
・各種表 "(表コマンド)(数値)"で振ります。
|
22
|
+
・一般結果表 成功度出力「RTx or RESULTx」
|
23
|
+
・威圧/威嚇 対人行為結果表「ITx or INTIMIDATEx or TESTx」
|
24
|
+
・挑発/トリック 対人行為結果表「TTx or TAUNTx or TRICKx or CTx」
|
25
|
+
・間合い 対人行為結果表「MTx or MANEUVERx」
|
26
|
+
・オーズ(一般人)ダメージ 「ODTx or ORDSx or ODAMAGEx」
|
27
|
+
・ポシビリティー能力者ダメージ「DTx or DAMAGEx」
|
28
|
+
・ボーナス表「BTx+y or BONUSx+y or TOTALx+y」 xは数値, yは技能基本値
|
29
|
+
INFO_MESSAGE_TEXT
|
30
|
+
|
31
|
+
register_prefix(['TG.*', '1R20.*', 'RT.*', 'Result.*', 'IT.*', 'Initimidate.*', 'TT.*', 'Taunt.*', 'Trick.*', 'CT.*', 'MT.*', 'Maneuver.*', 'ODT.*', 'ords.*', 'odamage.*', 'DT.*', 'damage.*', 'BT.*', 'bonus.*', 'total.*'])
|
32
|
+
|
33
|
+
def replace_text(string)
|
34
|
+
string = string.gsub(/Result/i, 'RT')
|
35
|
+
string = string.gsub(/(Intimidate|Test)/i, 'IT')
|
36
|
+
string = string.gsub(/(Taunt|Trick|CT)/i, 'TT')
|
37
|
+
string = string.gsub(/Maneuver/i, 'MT')
|
38
|
+
string = string.gsub(/(ords|odamage)/i, 'ODT')
|
39
|
+
string = string.gsub(/damage/i, 'DT')
|
40
|
+
string = string.gsub(/(bonus|total)/i, 'BT')
|
41
|
+
string = string.gsub(/TG(\d+)/i) { "1R20+#{Regexp.last_match(1)}" }
|
42
|
+
string = string.gsub(/TG/i, '1R20')
|
43
|
+
|
44
|
+
return string
|
45
|
+
end
|
46
|
+
|
47
|
+
#################### TORG ########################
|
48
|
+
def torg_check(string)
|
49
|
+
unless /(^|\s)S?(1R20([+-]\d+)*)(\s|$)/i =~ string
|
50
|
+
return nil
|
51
|
+
end
|
52
|
+
|
53
|
+
string = Regexp.last_match(2)
|
54
|
+
mod = Regexp.last_match(3)
|
55
|
+
|
56
|
+
debug(mod)
|
57
|
+
mod = ArithmeticEvaluator.eval(mod) if mod
|
58
|
+
debug(mod)
|
59
|
+
mod = mod.to_i
|
60
|
+
|
61
|
+
skilled, unskilled, dice_str = torg_dice
|
62
|
+
sk_bonus = get_torg_bonus(skilled)
|
63
|
+
|
64
|
+
if mod
|
65
|
+
if mod > 0
|
66
|
+
output = "#{sk_bonus}[#{dice_str}]+#{mod}"
|
67
|
+
else
|
68
|
+
output = "#{sk_bonus}[#{dice_str}]#{mod}"
|
69
|
+
end
|
70
|
+
else
|
71
|
+
output = "#{sk_bonus}[#{dice_str}]"
|
72
|
+
end
|
73
|
+
|
74
|
+
output += " > " + (sk_bonus + mod).to_s
|
75
|
+
|
76
|
+
if skilled != unskilled
|
77
|
+
output += "(技能無" + (get_torg_bonus(unskilled) + mod).to_s + ")"
|
78
|
+
end
|
79
|
+
|
80
|
+
output = "(#{string}) > #{output}"
|
81
|
+
|
82
|
+
return output
|
83
|
+
end
|
84
|
+
|
85
|
+
def torg_dice
|
86
|
+
isSkilledCritical = true
|
87
|
+
isCritical = true
|
88
|
+
skilled = 0
|
89
|
+
unskilled = 0
|
90
|
+
dice_str = ""
|
91
|
+
|
92
|
+
while isSkilledCritical
|
93
|
+
dice_n = @randomizer.roll_once(20)
|
94
|
+
skilled += dice_n
|
95
|
+
unskilled += dice_n if isCritical
|
96
|
+
|
97
|
+
dice_str += "," unless dice_str.empty?
|
98
|
+
dice_str += dice_n.to_s
|
99
|
+
|
100
|
+
if dice_n == 20
|
101
|
+
isCritical = false
|
102
|
+
elsif dice_n != 10
|
103
|
+
isSkilledCritical = false
|
104
|
+
isCritical = false
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
return skilled, unskilled, dice_str
|
109
|
+
end
|
110
|
+
|
111
|
+
def eval_game_system_specific_command(command)
|
112
|
+
string = command.upcase
|
113
|
+
string = replace_text(string)
|
114
|
+
|
115
|
+
if (result = torg_check(string))
|
116
|
+
return result
|
117
|
+
end
|
118
|
+
|
119
|
+
output = '1'
|
120
|
+
ttype = ""
|
121
|
+
value = 0
|
122
|
+
|
123
|
+
return nil unless /([RITMDB]T)(\d+([\+\-]\d+)*)/i =~ string
|
124
|
+
|
125
|
+
type = Regexp.last_match(1)
|
126
|
+
num = Regexp.last_match(2)
|
127
|
+
|
128
|
+
case type
|
129
|
+
when 'RT'
|
130
|
+
value = ArithmeticEvaluator.eval(num)
|
131
|
+
output = get_torg_success_level(value)
|
132
|
+
ttype = '一般結果'
|
133
|
+
when 'IT'
|
134
|
+
value = ArithmeticEvaluator.eval(num)
|
135
|
+
output = get_torg_interaction_result_intimidate_test(value)
|
136
|
+
ttype = '威圧/威嚇'
|
137
|
+
when 'TT'
|
138
|
+
value = ArithmeticEvaluator.eval(num)
|
139
|
+
output = get_torg_interaction_result_taunt_trick(value)
|
140
|
+
ttype = '挑発/トリック'
|
141
|
+
when 'MT'
|
142
|
+
value = ArithmeticEvaluator.eval(num)
|
143
|
+
output = get_torg_interaction_result_maneuver(value)
|
144
|
+
ttype = '間合い'
|
145
|
+
when 'DT'
|
146
|
+
value = ArithmeticEvaluator.eval(num)
|
147
|
+
if string =~ /ODT/i
|
148
|
+
output = get_torg_damage_ords(value)
|
149
|
+
ttype = 'オーズダメージ'
|
150
|
+
else
|
151
|
+
output = get_torg_damage_posibility(value)
|
152
|
+
ttype = 'ポシビリティ能力者ダメージ'
|
153
|
+
end
|
154
|
+
when 'BT'
|
155
|
+
output, value = get_torg_bonus_text(num)
|
156
|
+
ttype = 'ボーナス'
|
157
|
+
end
|
158
|
+
|
159
|
+
if ttype != ''
|
160
|
+
output = "#{ttype}表[#{value}] > #{output}"
|
161
|
+
end
|
162
|
+
|
163
|
+
return output
|
164
|
+
end
|
165
|
+
|
166
|
+
# 一般結果表 成功度
|
167
|
+
def get_torg_success_level(value)
|
168
|
+
success_table = [
|
169
|
+
[0, "ぎりぎり"],
|
170
|
+
[1, "ふつう"],
|
171
|
+
[3, "まあよい"],
|
172
|
+
[7, "かなりよい"],
|
173
|
+
[12, "すごい"]
|
174
|
+
]
|
175
|
+
|
176
|
+
return get_torg_table_result(value, success_table)
|
177
|
+
end
|
178
|
+
|
179
|
+
# 対人行為結果表
|
180
|
+
# 威圧/威嚇(intimidate/Test)
|
181
|
+
def get_torg_interaction_result_intimidate_test(value)
|
182
|
+
interaction_results_table = [
|
183
|
+
[0, "技能なし"],
|
184
|
+
[5, "萎縮"],
|
185
|
+
[10, "逆転負け"],
|
186
|
+
[15, "モラル崩壊"],
|
187
|
+
[17, "プレイヤーズコール"]
|
188
|
+
]
|
189
|
+
|
190
|
+
return get_torg_table_result(value, interaction_results_table)
|
191
|
+
end
|
192
|
+
|
193
|
+
# 挑発/トリック(Taunt/Trick)
|
194
|
+
def get_torg_interaction_result_taunt_trick(value)
|
195
|
+
interaction_results_table = [
|
196
|
+
[0, "技能なし"],
|
197
|
+
[5, "萎縮"],
|
198
|
+
[10, "逆転負け"],
|
199
|
+
[15, "高揚/逆転負け"],
|
200
|
+
[17, "プレイヤーズコール"]
|
201
|
+
]
|
202
|
+
|
203
|
+
return get_torg_table_result(value, interaction_results_table)
|
204
|
+
end
|
205
|
+
|
206
|
+
# 間合い(maneuver)
|
207
|
+
def get_torg_interaction_result_maneuver(value)
|
208
|
+
interaction_results_table = [
|
209
|
+
[0, "技能なし"],
|
210
|
+
[5, "疲労"],
|
211
|
+
[10, "萎縮/疲労"],
|
212
|
+
[15, "逆転負け/疲労"],
|
213
|
+
[17, "プレイヤーズコール"]
|
214
|
+
]
|
215
|
+
|
216
|
+
return get_torg_table_result(value, interaction_results_table)
|
217
|
+
end
|
218
|
+
|
219
|
+
def get_torg_table_result(value, table)
|
220
|
+
output = '1'
|
221
|
+
|
222
|
+
table.each do |item|
|
223
|
+
item_index = item[0]
|
224
|
+
|
225
|
+
if item_index > value
|
226
|
+
break
|
227
|
+
end
|
228
|
+
|
229
|
+
output = item[1]
|
230
|
+
end
|
231
|
+
|
232
|
+
return output
|
233
|
+
end
|
234
|
+
|
235
|
+
# オーズダメージチャート
|
236
|
+
def get_torg_damage_ords(value)
|
237
|
+
damage_table_ords = [
|
238
|
+
[0, "1"],
|
239
|
+
[1, "O1"],
|
240
|
+
[2, "K1"],
|
241
|
+
[3, "O2"],
|
242
|
+
[4, "O3"],
|
243
|
+
[5, "K3"],
|
244
|
+
[6, "転倒 K/O4"],
|
245
|
+
[7, "転倒 K/O5"],
|
246
|
+
[8, "1レベル負傷 K/O7"],
|
247
|
+
[9, "1レベル負傷 K/O9"],
|
248
|
+
[10, "1レベル負傷 K/O10"],
|
249
|
+
[11, "2レベル負傷 K/O11"],
|
250
|
+
[12, "2レベル負傷 KO12"],
|
251
|
+
[13, "3レベル負傷 KO13"],
|
252
|
+
[14, "3レベル負傷 KO14"],
|
253
|
+
[15, "4レベル負傷 KO15"]
|
254
|
+
]
|
255
|
+
|
256
|
+
return get_torg_damage(value,
|
257
|
+
4,
|
258
|
+
"レベル負傷 KO15",
|
259
|
+
damage_table_ords)
|
260
|
+
end
|
261
|
+
|
262
|
+
# ポシビリティー能力者ダメージチャート
|
263
|
+
def get_torg_damage_posibility(value)
|
264
|
+
damage_table_posibility = [
|
265
|
+
[0, "1"],
|
266
|
+
[1, "1"],
|
267
|
+
[2, "O1"],
|
268
|
+
[3, "K2"],
|
269
|
+
[4, "2"],
|
270
|
+
[5, "O2"],
|
271
|
+
[6, "転倒 O2"],
|
272
|
+
[7, "転倒 K2"],
|
273
|
+
[8, "転倒 K2"],
|
274
|
+
[9, "1レベル負傷 K3"],
|
275
|
+
[10, "1レベル負傷 K4"],
|
276
|
+
[11, "1レベル負傷 O4"],
|
277
|
+
[12, "1レベル負傷 K5"],
|
278
|
+
[13, "2レベル負傷 O4"],
|
279
|
+
[14, "2レベル負傷 KO5"],
|
280
|
+
[15, "3レベル負傷 KO5"]
|
281
|
+
]
|
282
|
+
|
283
|
+
return get_torg_damage(value,
|
284
|
+
3,
|
285
|
+
"レベル負傷 KO5",
|
286
|
+
damage_table_posibility)
|
287
|
+
end
|
288
|
+
|
289
|
+
def get_torg_damage(value, maxDamage, maxDamageString, damage_table)
|
290
|
+
if value < 0
|
291
|
+
return '1'
|
292
|
+
end
|
293
|
+
|
294
|
+
table_max_value = damage_table.length - 1
|
295
|
+
|
296
|
+
if value <= table_max_value
|
297
|
+
return get_torg_table_result(value, damage_table)
|
298
|
+
end
|
299
|
+
|
300
|
+
over_kill_damage = ((value - table_max_value) / 2).to_i
|
301
|
+
return "" + (over_kill_damage + maxDamage).to_s + maxDamageString
|
302
|
+
end
|
303
|
+
|
304
|
+
def get_torg_bonus_text(num)
|
305
|
+
val_arr = num.split(/\+/)
|
306
|
+
value = val_arr.shift.to_i
|
307
|
+
|
308
|
+
mod = ArithmeticEvaluator.eval(val_arr.join('+'))
|
309
|
+
resultValue = get_torg_bonus(value)
|
310
|
+
|
311
|
+
debug('TORG BT resultValue', resultValue)
|
312
|
+
debug('TORG BT mod', mod)
|
313
|
+
|
314
|
+
if mod == 0
|
315
|
+
output = resultValue.to_s
|
316
|
+
else
|
317
|
+
output = getTorgBonusOutputTextWhenModDefined(value, resultValue, mod)
|
318
|
+
value = "#{value}+#{mod}"
|
319
|
+
end
|
320
|
+
|
321
|
+
return output, value
|
322
|
+
end
|
323
|
+
|
324
|
+
def getTorgBonusOutputTextWhenModDefined(value, resultValue, mod)
|
325
|
+
debug('getTorgBonusOutputTextWhenModDefined value, mod', value, mod)
|
326
|
+
if mod > 0
|
327
|
+
return "#{resultValue}[#{value}]+#{mod} > #{resultValue + mod}"
|
328
|
+
else
|
329
|
+
debug('resultValue', resultValue)
|
330
|
+
debug('mod', mod)
|
331
|
+
return "#{resultValue}[#{value}]#{mod} > #{resultValue + mod}"
|
332
|
+
end
|
333
|
+
end
|
334
|
+
|
335
|
+
def get_torg_bonus(value)
|
336
|
+
bonus_table = [
|
337
|
+
[1, -12],
|
338
|
+
[2, -10],
|
339
|
+
[3, -8],
|
340
|
+
[5, -5],
|
341
|
+
[7, -2],
|
342
|
+
[9, -1],
|
343
|
+
[11, 0],
|
344
|
+
[13, 1],
|
345
|
+
[15, 2],
|
346
|
+
[16, 3],
|
347
|
+
[17, 4],
|
348
|
+
[18, 5],
|
349
|
+
[19, 6],
|
350
|
+
[20, 7]
|
351
|
+
]
|
352
|
+
|
353
|
+
bonus = get_torg_table_result(value, bonus_table)
|
354
|
+
|
355
|
+
if value > 20
|
356
|
+
over_value_bonus = ((value - 21) / 5).to_i + 1
|
357
|
+
bonus += over_value_bonus
|
358
|
+
end
|
359
|
+
|
360
|
+
return bonus
|
361
|
+
end
|
362
|
+
end
|
363
|
+
end
|
364
|
+
end
|