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,35 @@
|
|
1
|
+
module BCDice
|
2
|
+
module DiceTable
|
3
|
+
# 表を表すクラス
|
4
|
+
class Table
|
5
|
+
# @param [String] name 表の名前
|
6
|
+
# @param [String] type 項目を選ぶときのダイスロールの方法 '1D6'など
|
7
|
+
# @param [Array<String>] items 表の項目の配列
|
8
|
+
def initialize(name, type, items)
|
9
|
+
@name = name
|
10
|
+
@items = items.freeze
|
11
|
+
|
12
|
+
m = /(\d+)D(\d+)/i.match(type)
|
13
|
+
unless m
|
14
|
+
raise ArgumentError, "Unexpected table type: #{type}"
|
15
|
+
end
|
16
|
+
|
17
|
+
@times = m[1].to_i
|
18
|
+
@sides = m[2].to_i
|
19
|
+
end
|
20
|
+
|
21
|
+
# 表を振る
|
22
|
+
# @param [BCDice] bcdice ランダマイザ
|
23
|
+
# @return [String] 結果
|
24
|
+
def roll(bcdice)
|
25
|
+
value = bcdice.roll_sum(@times, @sides)
|
26
|
+
return choice(value)
|
27
|
+
end
|
28
|
+
|
29
|
+
def choice(value)
|
30
|
+
index = value - @times
|
31
|
+
return RollResult.new(@name, value, @items[index])
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/lib/bcdice/enum.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
module BCDice
|
2
|
+
# D66のダイス入れ替え
|
3
|
+
module D66SortType
|
4
|
+
NO_SORT = :no_sort # 入れ替えない
|
5
|
+
ASC = :asc # 一の位が大きな出目になるよう、昇順にソートする
|
6
|
+
DESC = :desc # 一の位が小さな出目になるよう、降順にソートする
|
7
|
+
end
|
8
|
+
|
9
|
+
# 割り算をした後の端数の扱い
|
10
|
+
module RoundType
|
11
|
+
CEIL = :ceil # 切り上げ
|
12
|
+
FLOOR = :floor # 切り捨て
|
13
|
+
ROUND = :round # 四捨五入
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module BCDice
|
2
|
+
module Format
|
3
|
+
module_function
|
4
|
+
|
5
|
+
# 比較演算子を文字列表記にする
|
6
|
+
#
|
7
|
+
# @param op [Symbol]
|
8
|
+
# @return [String, nil]
|
9
|
+
def comparison_operator(op)
|
10
|
+
case op
|
11
|
+
when :==
|
12
|
+
"="
|
13
|
+
when :'!='
|
14
|
+
"<>"
|
15
|
+
when Symbol
|
16
|
+
op.to_s
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
# 修正値を文字列表記にする
|
21
|
+
#
|
22
|
+
# @param number [Integer, nil]
|
23
|
+
# @return [String]
|
24
|
+
def modifier(number)
|
25
|
+
if number.nil?
|
26
|
+
nil
|
27
|
+
elsif number == 0
|
28
|
+
""
|
29
|
+
elsif number > 0
|
30
|
+
"+#{number}"
|
31
|
+
else
|
32
|
+
number.to_s
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,187 @@
|
|
1
|
+
require "bcdice/game_system/AFF2e"
|
2
|
+
require "bcdice/game_system/AceKillerGene"
|
3
|
+
require "bcdice/game_system/Airgetlamh"
|
4
|
+
require "bcdice/game_system/Alsetto"
|
5
|
+
require "bcdice/game_system/Alshard"
|
6
|
+
require "bcdice/game_system/AlterRaise"
|
7
|
+
require "bcdice/game_system/Amadeus"
|
8
|
+
require "bcdice/game_system/Amadeus_Korean"
|
9
|
+
require "bcdice/game_system/AnimaAnimus"
|
10
|
+
require "bcdice/game_system/Arianrhod"
|
11
|
+
require "bcdice/game_system/ArsMagica"
|
12
|
+
require "bcdice/game_system/Avandner"
|
13
|
+
require "bcdice/game_system/BBN"
|
14
|
+
require "bcdice/game_system/BadLife"
|
15
|
+
require "bcdice/game_system/BarnaKronika"
|
16
|
+
require "bcdice/game_system/BattleTech"
|
17
|
+
require "bcdice/game_system/BeastBindTrinity"
|
18
|
+
require "bcdice/game_system/BeginningIdol"
|
19
|
+
require "bcdice/game_system/BeginningIdol_Korean"
|
20
|
+
require "bcdice/game_system/BladeOfArcana"
|
21
|
+
require "bcdice/game_system/BlindMythos"
|
22
|
+
require "bcdice/game_system/BloodCrusade"
|
23
|
+
require "bcdice/game_system/BloodMoon"
|
24
|
+
require "bcdice/game_system/CardRanker"
|
25
|
+
require "bcdice/game_system/ChaosFlare"
|
26
|
+
require "bcdice/game_system/Chill"
|
27
|
+
require "bcdice/game_system/Chill3"
|
28
|
+
require "bcdice/game_system/CodeLayerd"
|
29
|
+
require "bcdice/game_system/ColossalHunter"
|
30
|
+
require "bcdice/game_system/CrashWorld"
|
31
|
+
require "bcdice/game_system/Cthulhu"
|
32
|
+
require "bcdice/game_system/Cthulhu7th"
|
33
|
+
require "bcdice/game_system/Cthulhu7th_ChineseTraditional"
|
34
|
+
require "bcdice/game_system/Cthulhu7th_Korean"
|
35
|
+
require "bcdice/game_system/CthulhuTech"
|
36
|
+
require "bcdice/game_system/Cthulhu_ChineseTraditional"
|
37
|
+
require "bcdice/game_system/Cthulhu_Korean"
|
38
|
+
require "bcdice/game_system/DarkBlaze"
|
39
|
+
require "bcdice/game_system/DarkDaysDrive"
|
40
|
+
require "bcdice/game_system/DarkSouls"
|
41
|
+
require "bcdice/game_system/DeadlineHeroes"
|
42
|
+
require "bcdice/game_system/DemonParasite"
|
43
|
+
require "bcdice/game_system/DetatokoSaga"
|
44
|
+
require "bcdice/game_system/DetatokoSaga_Korean"
|
45
|
+
require "bcdice/game_system/DiceBot"
|
46
|
+
require "bcdice/game_system/DiceOfTheDead"
|
47
|
+
require "bcdice/game_system/DoubleCross"
|
48
|
+
require "bcdice/game_system/DoubleCross_Korean"
|
49
|
+
require "bcdice/game_system/Dracurouge"
|
50
|
+
require "bcdice/game_system/Dracurouge_Korean"
|
51
|
+
require "bcdice/game_system/DungeonsAndDragons"
|
52
|
+
require "bcdice/game_system/EarthDawn"
|
53
|
+
require "bcdice/game_system/EarthDawn3"
|
54
|
+
require "bcdice/game_system/EarthDawn4"
|
55
|
+
require "bcdice/game_system/EclipsePhase"
|
56
|
+
require "bcdice/game_system/Elric"
|
57
|
+
require "bcdice/game_system/Elysion"
|
58
|
+
require "bcdice/game_system/EmbryoMachine"
|
59
|
+
require "bcdice/game_system/EndBreaker"
|
60
|
+
require "bcdice/game_system/EtrianOdysseySRS"
|
61
|
+
require "bcdice/game_system/Fiasco"
|
62
|
+
require "bcdice/game_system/Fiasco_Korean"
|
63
|
+
require "bcdice/game_system/FilledWith"
|
64
|
+
require "bcdice/game_system/FullMetalPanic"
|
65
|
+
require "bcdice/game_system/FutariSousa"
|
66
|
+
require "bcdice/game_system/FutariSousa_Korean"
|
67
|
+
require "bcdice/game_system/Garako"
|
68
|
+
require "bcdice/game_system/GardenOrder"
|
69
|
+
require "bcdice/game_system/GehennaAn"
|
70
|
+
require "bcdice/game_system/GeishaGirlwithKatana"
|
71
|
+
require "bcdice/game_system/GoblinSlayer"
|
72
|
+
require "bcdice/game_system/GoldenSkyStories"
|
73
|
+
require "bcdice/game_system/Gorilla"
|
74
|
+
require "bcdice/game_system/GranCrest"
|
75
|
+
require "bcdice/game_system/Gundog"
|
76
|
+
require "bcdice/game_system/GundogRevised"
|
77
|
+
require "bcdice/game_system/GundogZero"
|
78
|
+
require "bcdice/game_system/Gurps"
|
79
|
+
require "bcdice/game_system/GurpsFW"
|
80
|
+
require "bcdice/game_system/HarnMaster"
|
81
|
+
require "bcdice/game_system/HatsuneMiku"
|
82
|
+
require "bcdice/game_system/Hieizan"
|
83
|
+
require "bcdice/game_system/HouraiGakuen"
|
84
|
+
require "bcdice/game_system/HuntersMoon"
|
85
|
+
require "bcdice/game_system/Illusio"
|
86
|
+
require "bcdice/game_system/InfiniteFantasia"
|
87
|
+
require "bcdice/game_system/Insane"
|
88
|
+
require "bcdice/game_system/Insane_Korean"
|
89
|
+
require "bcdice/game_system/IthaWenUa"
|
90
|
+
require "bcdice/game_system/JamesBond"
|
91
|
+
require "bcdice/game_system/Kamigakari"
|
92
|
+
require "bcdice/game_system/Kamigakari_Korean"
|
93
|
+
require "bcdice/game_system/KanColle"
|
94
|
+
require "bcdice/game_system/KemonoNoMori"
|
95
|
+
require "bcdice/game_system/KillDeathBusiness"
|
96
|
+
require "bcdice/game_system/KillDeathBusiness_Korean"
|
97
|
+
require "bcdice/game_system/KurayamiCrying"
|
98
|
+
require "bcdice/game_system/LiveraDoll"
|
99
|
+
require "bcdice/game_system/LogHorizon"
|
100
|
+
require "bcdice/game_system/LogHorizon_Korean"
|
101
|
+
require "bcdice/game_system/LostRecord"
|
102
|
+
require "bcdice/game_system/LostRoyal"
|
103
|
+
require "bcdice/game_system/MagicaLogia"
|
104
|
+
require "bcdice/game_system/MeikyuDays"
|
105
|
+
require "bcdice/game_system/MeikyuKingdom"
|
106
|
+
require "bcdice/game_system/MeikyuKingdomBasic"
|
107
|
+
require "bcdice/game_system/MetalHead"
|
108
|
+
require "bcdice/game_system/MetalHeadExtream"
|
109
|
+
require "bcdice/game_system/MetallicGuardian"
|
110
|
+
require "bcdice/game_system/MonotoneMuseum"
|
111
|
+
require "bcdice/game_system/MonotoneMuseum_Korean"
|
112
|
+
require "bcdice/game_system/Nechronica"
|
113
|
+
require "bcdice/game_system/Nechronica_Korean"
|
114
|
+
require "bcdice/game_system/NeverCloud"
|
115
|
+
require "bcdice/game_system/NightWizard"
|
116
|
+
require "bcdice/game_system/NightWizard3rd"
|
117
|
+
require "bcdice/game_system/NightmareHunterDeep"
|
118
|
+
require "bcdice/game_system/NinjaSlayer"
|
119
|
+
require "bcdice/game_system/NjslyrBattle"
|
120
|
+
require "bcdice/game_system/Nuekagami"
|
121
|
+
require "bcdice/game_system/OneWayHeroics"
|
122
|
+
require "bcdice/game_system/OracleEngine"
|
123
|
+
require "bcdice/game_system/OrgaRain"
|
124
|
+
require "bcdice/game_system/Oukahoushin3rd"
|
125
|
+
require "bcdice/game_system/Paradiso"
|
126
|
+
require "bcdice/game_system/Paranoia"
|
127
|
+
require "bcdice/game_system/ParanoiaRebooted"
|
128
|
+
require "bcdice/game_system/ParasiteBlood"
|
129
|
+
require "bcdice/game_system/Pathfinder"
|
130
|
+
require "bcdice/game_system/Peekaboo"
|
131
|
+
require "bcdice/game_system/Pendragon"
|
132
|
+
require "bcdice/game_system/PhantasmAdventure"
|
133
|
+
require "bcdice/game_system/Postman"
|
134
|
+
require "bcdice/game_system/PulpCthulhu"
|
135
|
+
require "bcdice/game_system/Raisondetre"
|
136
|
+
require "bcdice/game_system/RecordOfLodossWar"
|
137
|
+
require "bcdice/game_system/RecordOfSteam"
|
138
|
+
require "bcdice/game_system/RokumonSekai2"
|
139
|
+
require "bcdice/game_system/RoleMaster"
|
140
|
+
require "bcdice/game_system/RuneQuest"
|
141
|
+
require "bcdice/game_system/RyuTuber"
|
142
|
+
require "bcdice/game_system/Ryutama"
|
143
|
+
require "bcdice/game_system/SRS"
|
144
|
+
require "bcdice/game_system/SamsaraBallad"
|
145
|
+
require "bcdice/game_system/Satasupe"
|
146
|
+
require "bcdice/game_system/ScreamHighSchool"
|
147
|
+
require "bcdice/game_system/SevenFortressMobius"
|
148
|
+
require "bcdice/game_system/ShadowRun"
|
149
|
+
require "bcdice/game_system/ShadowRun4"
|
150
|
+
require "bcdice/game_system/ShadowRun5"
|
151
|
+
require "bcdice/game_system/SharedFantasia"
|
152
|
+
require "bcdice/game_system/ShinMegamiTenseiKakuseihen"
|
153
|
+
require "bcdice/game_system/ShinkuuGakuen"
|
154
|
+
require "bcdice/game_system/ShinobiGami"
|
155
|
+
require "bcdice/game_system/ShoujoTenrankai"
|
156
|
+
require "bcdice/game_system/Skynauts"
|
157
|
+
require "bcdice/game_system/SteamPunkers"
|
158
|
+
require "bcdice/game_system/StellarKnights"
|
159
|
+
require "bcdice/game_system/SterileLife"
|
160
|
+
require "bcdice/game_system/StrangerOfSwordCity"
|
161
|
+
require "bcdice/game_system/StratoShout"
|
162
|
+
require "bcdice/game_system/StratoShout_Korean"
|
163
|
+
require "bcdice/game_system/Strave"
|
164
|
+
require "bcdice/game_system/SwordWorld"
|
165
|
+
require "bcdice/game_system/SwordWorld2_0"
|
166
|
+
require "bcdice/game_system/SwordWorld2_5"
|
167
|
+
require "bcdice/game_system/TherapieSein"
|
168
|
+
require "bcdice/game_system/TokumeiTenkousei"
|
169
|
+
require "bcdice/game_system/TokyoGhostResearch"
|
170
|
+
require "bcdice/game_system/TokyoNova"
|
171
|
+
require "bcdice/game_system/Torg"
|
172
|
+
require "bcdice/game_system/Torg1_5"
|
173
|
+
require "bcdice/game_system/TorgEternity"
|
174
|
+
require "bcdice/game_system/TrinitySeven"
|
175
|
+
require "bcdice/game_system/TunnelsAndTrolls"
|
176
|
+
require "bcdice/game_system/TwilightGunsmoke"
|
177
|
+
require "bcdice/game_system/Utakaze"
|
178
|
+
require "bcdice/game_system/VampireTheMasquerade5th"
|
179
|
+
require "bcdice/game_system/Villaciel"
|
180
|
+
require "bcdice/game_system/WARPS"
|
181
|
+
require "bcdice/game_system/WaresBlade"
|
182
|
+
require "bcdice/game_system/Warhammer"
|
183
|
+
require "bcdice/game_system/WitchQuest"
|
184
|
+
require "bcdice/game_system/WorldOfDarkness"
|
185
|
+
require "bcdice/game_system/YankeeYogSothoth"
|
186
|
+
require "bcdice/game_system/YearZeroEngine"
|
187
|
+
require "bcdice/game_system/ZettaiReido"
|
@@ -0,0 +1,141 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BCDice
|
4
|
+
module GameSystem
|
5
|
+
class AFF2e < Base
|
6
|
+
# ゲームシステムの識別子
|
7
|
+
ID = 'AFF2e'
|
8
|
+
|
9
|
+
# ゲームシステム名
|
10
|
+
NAME = 'ADVANCED FIGHTING FANTASY 2nd Edition'
|
11
|
+
|
12
|
+
# ゲームシステム名の読みがな
|
13
|
+
SORT_KEY = 'あとはんすとふあいていんくふあんたしい2'
|
14
|
+
|
15
|
+
# ダイスボットの使い方
|
16
|
+
HELP_MESSAGE = <<~MESSAGETEXT
|
17
|
+
対抗なしロール\tFF{目標値}+{補正}
|
18
|
+
対抗ロール\tFR{能力値}+{補正}
|
19
|
+
武器ロール\tFD[2,3,3,3,3,3,4]+{補正}
|
20
|
+
防具ロール\tFD[0,0,0,0,1+1,1+1,2+2]+{補正}
|
21
|
+
MESSAGETEXT
|
22
|
+
|
23
|
+
# ダイスボットで使用するコマンドを配列で列挙する
|
24
|
+
register_prefix(['FF.+', 'FR.+', 'FD.+'])
|
25
|
+
|
26
|
+
def explicit_sign(i)
|
27
|
+
format('%+d', i)
|
28
|
+
end
|
29
|
+
|
30
|
+
def eval_term(term)
|
31
|
+
value = 0
|
32
|
+
term.scan(/[+-]?\d+/) do |fact|
|
33
|
+
value += fact.to_i
|
34
|
+
end
|
35
|
+
value
|
36
|
+
end
|
37
|
+
|
38
|
+
def parentheses(str)
|
39
|
+
'(' + str + ')'
|
40
|
+
end
|
41
|
+
|
42
|
+
def successful_or_failed(total, diff)
|
43
|
+
case total
|
44
|
+
when 2
|
45
|
+
diff <= 1 ? '成功(大成功ではない)' : '大成功!'
|
46
|
+
when 12
|
47
|
+
diff >= 12 ? '失敗(大失敗ではない)' : '大失敗!'
|
48
|
+
else
|
49
|
+
total <= diff ? '成功' : '失敗'
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def critical(total)
|
54
|
+
case total
|
55
|
+
when 2
|
56
|
+
'ファンブル!'
|
57
|
+
when 12
|
58
|
+
'強打!'
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def clamp(i, min, max)
|
63
|
+
if i < min
|
64
|
+
min
|
65
|
+
elsif i > max
|
66
|
+
max
|
67
|
+
else
|
68
|
+
i
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def eval_game_system_specific_command(command)
|
73
|
+
case command
|
74
|
+
when /\AFF/
|
75
|
+
# 対抗なしロール
|
76
|
+
# '成功' or '失敗' を出力する
|
77
|
+
#
|
78
|
+
md = Regexp.last_match
|
79
|
+
term = md.post_match
|
80
|
+
|
81
|
+
# 目標値
|
82
|
+
diff = eval_term(term)
|
83
|
+
|
84
|
+
dice_command = "2D6<=#{diff}"
|
85
|
+
dice_list = @randomizer.roll_barabara(2, 6)
|
86
|
+
total = dice_list.sum()
|
87
|
+
dice_str = dice_list.join(",")
|
88
|
+
expr = "#{total}[#{dice_str}]"
|
89
|
+
succ = successful_or_failed(total, diff)
|
90
|
+
sequence = [parentheses(dice_command), expr, succ]
|
91
|
+
when /\AFR/
|
92
|
+
# 対抗ロール
|
93
|
+
# 値を出力する
|
94
|
+
#
|
95
|
+
md = Regexp.last_match
|
96
|
+
term = md.post_match
|
97
|
+
|
98
|
+
# 補正値
|
99
|
+
corr = eval_term(term)
|
100
|
+
|
101
|
+
dice_command = "2D6#{explicit_sign corr}"
|
102
|
+
dice_list = @randomizer.roll_barabara(2, 6)
|
103
|
+
total = dice_list.sum()
|
104
|
+
dice_str = dice_list.join(",")
|
105
|
+
expr = "#{total}[#{dice_str}]#{explicit_sign corr}"
|
106
|
+
crit = critical(total)
|
107
|
+
sequence = [parentheses(dice_command), expr, crit, total + corr].compact
|
108
|
+
when /\AFD/
|
109
|
+
# 武器防具ロール
|
110
|
+
# ダメージを出力する
|
111
|
+
#
|
112
|
+
md = Regexp.last_match
|
113
|
+
term = md.post_match
|
114
|
+
md = /\A\[(.+)\]/.match(term)
|
115
|
+
unless md
|
116
|
+
return 'ダメージスロットは必須です。'
|
117
|
+
end
|
118
|
+
|
119
|
+
term = md.post_match
|
120
|
+
damage_slots = md[1].split(',').map { |t| eval_term(t) }
|
121
|
+
if damage_slots.size != 7
|
122
|
+
return 'ダメージスロットの長さに誤りがあります。'
|
123
|
+
end
|
124
|
+
|
125
|
+
# 補正値
|
126
|
+
corr = eval_term(term)
|
127
|
+
|
128
|
+
dice_command = "1D6#{explicit_sign corr}"
|
129
|
+
total = @randomizer.roll_once(6)
|
130
|
+
expr = "#{total}#{explicit_sign corr}"
|
131
|
+
slot_number = clamp(total + corr, 1, 7)
|
132
|
+
damage = damage_slots[slot_number - 1]
|
133
|
+
sequence = [parentheses(dice_command), expr, total + corr, "#{damage}ダメージ"]
|
134
|
+
end
|
135
|
+
|
136
|
+
result = sequence.join(' > ')
|
137
|
+
return result
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'bcdice/game_system/GardenOrder'
|
4
|
+
|
5
|
+
module BCDice
|
6
|
+
module GameSystem
|
7
|
+
class AceKillerGene < GardenOrder
|
8
|
+
# ゲームシステムの識別子
|
9
|
+
ID = 'AceKillerGene'
|
10
|
+
|
11
|
+
# ゲームシステム名
|
12
|
+
NAME = 'エースキラージーン'
|
13
|
+
|
14
|
+
# ゲームシステム名の読みがな
|
15
|
+
SORT_KEY = 'ええすきらあしいん'
|
16
|
+
|
17
|
+
# ダイスボットの使い方
|
18
|
+
HELP_MESSAGE = <<~INFO_MESSAGE_TEXT
|
19
|
+
・基本判定
|
20
|
+
AKx/y@z x:成功率、y:連続攻撃回数(省略可)、z:クリティカル値(省略可)
|
21
|
+
(連続攻撃では1回の判定のみが実施されます)
|
22
|
+
例)AK55 AK100/2 AK70@10 AK155/3@44
|
23
|
+
・負傷表
|
24
|
+
DCxxy
|
25
|
+
xx:属性(切断:SL,銃弾:BL,衝撃:IM,灼熱:BR,冷却:RF,電撃:EL)
|
26
|
+
y:ダメージ
|
27
|
+
例)DCSL7 DCEL22
|
28
|
+
INFO_MESSAGE_TEXT
|
29
|
+
|
30
|
+
register_prefix([
|
31
|
+
'(AK|AKG)(\-?\d+)(\/\d+)?(@\d+)?',
|
32
|
+
'DC(SL|BL|IM|BR|RF|EL).+'
|
33
|
+
])
|
34
|
+
|
35
|
+
def eval_game_system_specific_command(command)
|
36
|
+
case command
|
37
|
+
when %r{(AK|AKG)(\-?\d+)(/(\d+))?(@(\d+))?}i
|
38
|
+
success_rate = Regexp.last_match(2).to_i
|
39
|
+
repeat_count = (Regexp.last_match(4) || 1).to_i
|
40
|
+
critical_border_text = Regexp.last_match(6)
|
41
|
+
critical_border = get_critical_border(critical_border_text, success_rate)
|
42
|
+
|
43
|
+
return check_roll_repeat_attack(success_rate, repeat_count, critical_border)
|
44
|
+
|
45
|
+
when /^DC(SL|BL|IM|BR|RF|EL)(\d+)/i
|
46
|
+
type = Regexp.last_match(1)
|
47
|
+
damage_value = Regexp.last_match(2).to_i
|
48
|
+
return look_up_damage_chart(type, damage_value)
|
49
|
+
end
|
50
|
+
|
51
|
+
return nil
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|