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,171 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BCDice
|
4
|
+
module GameSystem
|
5
|
+
class Raisondetre < Base
|
6
|
+
# ゲームシステムの識別子
|
7
|
+
ID = 'Raisondetre'
|
8
|
+
|
9
|
+
# ゲームシステム名
|
10
|
+
NAME = '叛逆レゾンデートル'
|
11
|
+
|
12
|
+
# ゲームシステム名の読みがな
|
13
|
+
SORT_KEY = 'はんきやくれそんてとおる'
|
14
|
+
|
15
|
+
# ダイスボットの使い方
|
16
|
+
HELP_MESSAGE = <<~MESSAGETEXT
|
17
|
+
判定:[判定値]RD[技能][@目標値]
|
18
|
+
ダメージロール:[ダイス数]DD[装甲]
|
19
|
+
|
20
|
+
[]内のコマンドは省略可能。
|
21
|
+
「判定値」で判定に使用するダイス数を指定。省略時は「1」。0以下も指定可。
|
22
|
+
「技能」で有効なダイス数を指定。省略時は「1」。
|
23
|
+
達成値はクリティカルを含めて、「最も高くなる」ように計算します。
|
24
|
+
「@目標値」指定で、判定の成否を追加表示します。
|
25
|
+
|
26
|
+
ダメージロールは[装甲]指定で、有効なダイス数と0の出目の数を表示します。
|
27
|
+
[装甲]省略時は、ダイス結果のみ表示します。(複数の対象への攻撃時用)
|
28
|
+
|
29
|
+
【書式例】
|
30
|
+
・RD → 1Dで達成値を表示。
|
31
|
+
・2RD1@8 → 2D(1個選択)で目標値8の判定。
|
32
|
+
・-3RD → 1Dでダイスペナルティ-4の判定。
|
33
|
+
・4DD2 → 4Dで装甲2のダメージロール。
|
34
|
+
MESSAGETEXT
|
35
|
+
|
36
|
+
def initialize(command)
|
37
|
+
super(command)
|
38
|
+
@sort_add_dice = true # ダイスのソート有
|
39
|
+
end
|
40
|
+
|
41
|
+
register_prefix([
|
42
|
+
'(-)?(\d+)?RD(\d+)?(@(\d+))?',
|
43
|
+
'(-)?(\d+)?DD([1-9])?([\+\-]\d+)?'
|
44
|
+
])
|
45
|
+
|
46
|
+
def eval_game_system_specific_command(command)
|
47
|
+
if command =~ /(-)?(\d+)?RD(\d+)?(@(\d+))?$/i
|
48
|
+
diceCount = (Regexp.last_match(2) || 1).to_i
|
49
|
+
diceCount *= -1 unless Regexp.last_match(1).nil?
|
50
|
+
choiceCount = (Regexp.last_match(3) || 1).to_i
|
51
|
+
target = (Regexp.last_match(5) || 0).to_i
|
52
|
+
|
53
|
+
return checkRoll(diceCount, choiceCount, target)
|
54
|
+
|
55
|
+
elsif command =~ /(-)?(\d+)?DD([1-9])?([\+\-]\d+)?$/i
|
56
|
+
diceCount = (Regexp.last_match(2) || 1).to_i
|
57
|
+
diceCount *= -1 unless Regexp.last_match(1).nil?
|
58
|
+
armor = (Regexp.last_match(3) || 0).to_i
|
59
|
+
if armor > 0
|
60
|
+
armor += (Regexp.last_match(4) || 0).to_i
|
61
|
+
armor = 1 if armor < 1
|
62
|
+
armor = 9 if armor > 9
|
63
|
+
end
|
64
|
+
|
65
|
+
return checkDamage(diceCount, armor)
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
return nil
|
70
|
+
end
|
71
|
+
|
72
|
+
def checkRoll(diceCount, choiceCount, target)
|
73
|
+
if diceCount <= 0
|
74
|
+
correction = 1 + diceCount * -1
|
75
|
+
rollCount = 1
|
76
|
+
else
|
77
|
+
correction = 0
|
78
|
+
rollCount = diceCount
|
79
|
+
end
|
80
|
+
|
81
|
+
diceArray = @randomizer.roll_barabara(rollCount, 10).sort
|
82
|
+
diceText = diceArray.join(',')
|
83
|
+
|
84
|
+
diceArray.map! { |x| x == 10 ? 0 : x }
|
85
|
+
diceArray.map! { |i| i - correction }
|
86
|
+
diceText2 = diceArray.sort.join(',')
|
87
|
+
|
88
|
+
funbleArray = diceArray.select { |i| i <= 1 }
|
89
|
+
isFunble = (funbleArray.size >= rollCount)
|
90
|
+
|
91
|
+
dice = 0
|
92
|
+
success = 0
|
93
|
+
unless isFunble
|
94
|
+
criticalCount = diceArray.count(0)
|
95
|
+
critical = criticalCount * 10
|
96
|
+
|
97
|
+
choiceArray = diceArray.reverse
|
98
|
+
choiceArray.delete(0)
|
99
|
+
choiceArray = choiceArray.slice(0..(choiceCount - 1))
|
100
|
+
choiceText = choiceArray.join(',')
|
101
|
+
dice = choiceArray.inject(:+)
|
102
|
+
success = dice + critical
|
103
|
+
end
|
104
|
+
|
105
|
+
result = "#{rollCount}D10"
|
106
|
+
result += "-#{correction}" if correction > 0
|
107
|
+
result += " > [#{diceText}] > [#{diceText2}] > "
|
108
|
+
|
109
|
+
if isFunble
|
110
|
+
result += "達成値:0 (Funble)"
|
111
|
+
else
|
112
|
+
result += "#{dice}[#{choiceText}]"
|
113
|
+
result += "+#{critical}" if critical > 0
|
114
|
+
result += "=達成値:#{success}"
|
115
|
+
result += " (#{criticalCount}Critical)" if critical > 0
|
116
|
+
end
|
117
|
+
|
118
|
+
if target > 0
|
119
|
+
result += ">=#{target} "
|
120
|
+
result += "【成功】" if success >= target
|
121
|
+
result += "【失敗】" if success < target
|
122
|
+
end
|
123
|
+
|
124
|
+
return result
|
125
|
+
end
|
126
|
+
|
127
|
+
def checkDamage(diceCount, armor)
|
128
|
+
if diceCount <= 0
|
129
|
+
correction = 1 + diceCount * -1
|
130
|
+
rollCount = 1
|
131
|
+
else
|
132
|
+
correction = 0
|
133
|
+
rollCount = diceCount
|
134
|
+
end
|
135
|
+
|
136
|
+
dice_list = @randomizer.roll_barabara(rollCount, 10).sort
|
137
|
+
diceText = dice_list.join(",")
|
138
|
+
|
139
|
+
diceArray = dice_list.map { |x| x == 10 ? 0 : x }.sort
|
140
|
+
criticalCount = diceArray.count(0)
|
141
|
+
diceArray.map! { |i| i - correction }
|
142
|
+
diceText2 = diceArray.join(",")
|
143
|
+
|
144
|
+
result = "#{rollCount}D10"
|
145
|
+
result += "-#{correction}" if correction > 0
|
146
|
+
result += " > [#{diceText}] > [#{diceText2}]"
|
147
|
+
|
148
|
+
if armor > 0
|
149
|
+
resultArray = []
|
150
|
+
success = 0
|
151
|
+
|
152
|
+
diceArray.each do |i|
|
153
|
+
if i >= armor
|
154
|
+
resultArray.push(i)
|
155
|
+
success += 1
|
156
|
+
else
|
157
|
+
resultArray.push("×")
|
158
|
+
end
|
159
|
+
end
|
160
|
+
resultText = resultArray.join(',')
|
161
|
+
|
162
|
+
result += " > [#{resultText}]>=#{armor} 有効数:#{success}"
|
163
|
+
end
|
164
|
+
|
165
|
+
result += " 0=#{criticalCount}個"
|
166
|
+
|
167
|
+
return result
|
168
|
+
end
|
169
|
+
end
|
170
|
+
end
|
171
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'bcdice/command_parser'
|
2
|
+
|
3
|
+
module BCDice
|
4
|
+
module GameSystem
|
5
|
+
class RecordOfLodossWar < Base
|
6
|
+
ID = 'RecordOfLodossWar'.freeze
|
7
|
+
NAME = 'ロードス島戦記RPG'.freeze
|
8
|
+
SORT_KEY = 'ろおとすとうせんきRPG'.freeze
|
9
|
+
|
10
|
+
HELP_MESSAGE = <<~INFO_MESSAGE_TEXT.freeze
|
11
|
+
●判定
|
12
|
+
LW<=(目標値)で判定。
|
13
|
+
達成値が目標値の1/10(端数切り上げ)以下であれば大成功。1~10であれば自動成功。
|
14
|
+
91~100であれば自動失敗となります。
|
15
|
+
|
16
|
+
●回避判定
|
17
|
+
LWD<=(目標値)で回避判定。この時出目が51以上で自動失敗となります。
|
18
|
+
|
19
|
+
判定と回避判定は、どちらもコマンドだけの場合、出目の表示と自動成功と自動失敗の判定のみを行います。
|
20
|
+
INFO_MESSAGE_TEXT
|
21
|
+
|
22
|
+
register_prefix(['LW.*'])
|
23
|
+
|
24
|
+
def eval_game_system_specific_command(command)
|
25
|
+
parser = CommandParser.new("LW", "LWD")
|
26
|
+
cmd = parser.parse(command)
|
27
|
+
|
28
|
+
if cmd.nil? || ![nil, :<=].include?(cmd.cmp_op)
|
29
|
+
return nil
|
30
|
+
end
|
31
|
+
|
32
|
+
auto_failure = cmd.command == "LWD" ? 51 : 91
|
33
|
+
critical = (cmd.target_number.to_f / 10).ceil
|
34
|
+
|
35
|
+
dice_value = @randomizer.roll_once(100)
|
36
|
+
|
37
|
+
result =
|
38
|
+
if dice_value >= auto_failure
|
39
|
+
"自動失敗(#{auto_failure})"
|
40
|
+
elsif dice_value <= critical
|
41
|
+
"大成功(#{critical})"
|
42
|
+
elsif dice_value <= 10
|
43
|
+
"自動成功"
|
44
|
+
elsif cmd.cmp_op
|
45
|
+
dice_value <= cmd.target_number ? "成功" : "失敗"
|
46
|
+
end
|
47
|
+
|
48
|
+
sequence = [
|
49
|
+
"(1D100#{cmd.cmp_op}#{cmd.target_number})",
|
50
|
+
dice_value.to_s,
|
51
|
+
result
|
52
|
+
].compact
|
53
|
+
|
54
|
+
return sequence.join(" > ")
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,149 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BCDice
|
4
|
+
module GameSystem
|
5
|
+
class RecordOfSteam < Base
|
6
|
+
# ゲームシステムの識別子
|
7
|
+
ID = 'RecordOfSteam'
|
8
|
+
|
9
|
+
# ゲームシステム名
|
10
|
+
NAME = 'Record of Steam'
|
11
|
+
|
12
|
+
# ゲームシステム名の読みがな
|
13
|
+
SORT_KEY = 'れこおとおふすちいむ'
|
14
|
+
|
15
|
+
# ダイスボットの使い方
|
16
|
+
HELP_MESSAGE = <<~MESSAGETEXT
|
17
|
+
2S2@1
|
18
|
+
RecordOfSteam : (2S2@1) > 1,2,3,4 > 1回転 > 成功数2
|
19
|
+
|
20
|
+
4S3@2
|
21
|
+
RecordOfSteam : (4S3@2) > 2,1,2,4,4,4,2,3,4,5,6,6 > 4回転 > 成功数5
|
22
|
+
MESSAGETEXT
|
23
|
+
|
24
|
+
register_prefix(['\d+S\d+.*'])
|
25
|
+
|
26
|
+
# サンプルのダイスコマンドは「nSt@c」で n=ダイス個数, t=目標値, c=クリティカル値。@cのみ省略可
|
27
|
+
|
28
|
+
def eval_game_system_specific_command(command)
|
29
|
+
unless /(\d+)[sS](\d+)(@(\d+))?/i =~ command
|
30
|
+
return "1"
|
31
|
+
end
|
32
|
+
|
33
|
+
# $x の結果は正規表現マッチングすると新しい値に書き換わってしまうので、
|
34
|
+
# マッチングした直後に変数に格納してしまうのが大事なポイント!
|
35
|
+
diceCount = Regexp.last_match(1).to_i
|
36
|
+
targetNumber = Regexp.last_match(2).to_i
|
37
|
+
criticalValue = Regexp.last_match(4)
|
38
|
+
criticalValue ||= 1
|
39
|
+
criticalValue = criticalValue.to_i
|
40
|
+
|
41
|
+
if diceCount >= 150
|
42
|
+
return "(多分)無限個なので振れません! ヤメテクダサイ、(プロセスが)死んでしまいますっ"
|
43
|
+
end
|
44
|
+
|
45
|
+
if criticalValue >= 3
|
46
|
+
return "(多分)無限個なので振れません! ヤメテクダサイ、(プロセスが)死んでしまいますっ"
|
47
|
+
end
|
48
|
+
|
49
|
+
specialValue = criticalValue
|
50
|
+
|
51
|
+
rollResult, successCount, roundCount, specialCount, fumbleCount = getDiceRollResult(diceCount, targetNumber, criticalValue, specialValue)
|
52
|
+
|
53
|
+
output = "(#{command}) > #{rollResult}"
|
54
|
+
|
55
|
+
roundCountText = getRoundCountText(roundCount)
|
56
|
+
successText = getSuccessText(successCount)
|
57
|
+
specialText = getSpecialText(specialCount)
|
58
|
+
fumbleText = getFumbleText(fumbleCount)
|
59
|
+
|
60
|
+
result = "#{output}#{roundCountText}#{specialText}#{successText}#{fumbleText}"
|
61
|
+
|
62
|
+
return result
|
63
|
+
end
|
64
|
+
|
65
|
+
def getDiceRollResult(diceCount, targetNumber, criticalValue, specialValue)
|
66
|
+
successCount = 0
|
67
|
+
roundCount = 0
|
68
|
+
rollResult = ""
|
69
|
+
specialCount = 0
|
70
|
+
specialFlag = false
|
71
|
+
fumbleCount = 0
|
72
|
+
fumbleFlag = false
|
73
|
+
|
74
|
+
while diceCount > 0
|
75
|
+
diceList = @randomizer.roll_barabara(diceCount, 6)
|
76
|
+
diceListText = diceList.join(",")
|
77
|
+
|
78
|
+
rollResult += "," if rollResult != ""
|
79
|
+
rollResult += diceListText
|
80
|
+
|
81
|
+
if diceList.uniq.length == 1 && roundCount == 0
|
82
|
+
if diceList.uniq.first <= specialValue
|
83
|
+
specialFlag = true
|
84
|
+
elsif diceList.uniq.first == 6
|
85
|
+
fumbleFlag = true
|
86
|
+
end
|
87
|
+
end
|
88
|
+
debug("diceList", diceList)
|
89
|
+
|
90
|
+
if specialFlag
|
91
|
+
specialCount = 1
|
92
|
+
successCount = diceCount * 3
|
93
|
+
|
94
|
+
return rollResult, successCount, roundCount, specialCount, fumbleCount
|
95
|
+
elsif fumbleFlag
|
96
|
+
fumbleCount = 1
|
97
|
+
|
98
|
+
return rollResult, successCount, roundCount, specialCount, fumbleCount
|
99
|
+
end
|
100
|
+
|
101
|
+
diceCount = 0
|
102
|
+
|
103
|
+
diceList.map do |diceValue|
|
104
|
+
debug("diceValue", diceValue)
|
105
|
+
debug("criticalValue", criticalValue)
|
106
|
+
debug("specialValue", specialValue)
|
107
|
+
|
108
|
+
if diceValue <= criticalValue
|
109
|
+
diceCount += 2
|
110
|
+
roundCount += 1
|
111
|
+
end
|
112
|
+
|
113
|
+
successCount += 1 if diceValue <= targetNumber
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
return rollResult, successCount, roundCount, specialCount, fumbleCount
|
118
|
+
end
|
119
|
+
|
120
|
+
def getRoundCountText(roundCount)
|
121
|
+
if roundCount <= 0
|
122
|
+
return ""
|
123
|
+
end
|
124
|
+
|
125
|
+
return " > #{roundCount}回転"
|
126
|
+
end
|
127
|
+
|
128
|
+
def getSuccessText(successCount)
|
129
|
+
if successCount > 0
|
130
|
+
return " > 成功数#{successCount}"
|
131
|
+
end
|
132
|
+
|
133
|
+
return " > 失敗"
|
134
|
+
end
|
135
|
+
|
136
|
+
def getSpecialText(specialCount)
|
137
|
+
if specialCount == 1
|
138
|
+
return " > スペシャル"
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
def getFumbleText(fumbleCount)
|
143
|
+
if fumbleCount == 1
|
144
|
+
return " > ファンブル"
|
145
|
+
end
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
@@ -0,0 +1,110 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BCDice
|
4
|
+
module GameSystem
|
5
|
+
class RokumonSekai2 < Base
|
6
|
+
# ゲームシステムの識別子
|
7
|
+
ID = 'RokumonSekai2'
|
8
|
+
|
9
|
+
# ゲームシステム名
|
10
|
+
NAME = '六門世界RPG セカンドエディション'
|
11
|
+
|
12
|
+
# ゲームシステム名の読みがな
|
13
|
+
SORT_KEY = 'ろくもんせかいRPG2'
|
14
|
+
|
15
|
+
# ダイスボットの使い方
|
16
|
+
HELP_MESSAGE = <<~INFO_MESSAGE_TEXT
|
17
|
+
・判定
|
18
|
+
aRSm<=t
|
19
|
+
能力値a,修正値m,目標値tで判定ロールを行います。
|
20
|
+
Rコマンド(3R6m<=t[a])に読み替えます。
|
21
|
+
成功度、評価、ボーナスダイスを自動表示します。
|
22
|
+
例) 3RS+1<=9 3R6+1<=9[3]
|
23
|
+
INFO_MESSAGE_TEXT
|
24
|
+
|
25
|
+
register_prefix(['\d+RS.*', '3R6.*'])
|
26
|
+
|
27
|
+
def initialize(command)
|
28
|
+
super(command)
|
29
|
+
|
30
|
+
@sort_add_dice = true
|
31
|
+
end
|
32
|
+
|
33
|
+
def replace_text(string)
|
34
|
+
string = string.gsub(/(\d+)RS([\+\-][\+\-\d]+)<=(\d+)/i) { "3R6#{Regexp.last_match(2)}<=#{Regexp.last_match(3)}[#{Regexp.last_match(1)}]" }
|
35
|
+
string = string.gsub(/(\d+)RS<=(\d+)/i) { "3R6<=#{Regexp.last_match(2)}[#{Regexp.last_match(1)}]" }
|
36
|
+
|
37
|
+
return string
|
38
|
+
end
|
39
|
+
|
40
|
+
def eval_game_system_specific_command(string)
|
41
|
+
string = replace_text(string)
|
42
|
+
unless /3R6([\+\-\d]*)<=(\d+)\[(\d+)\]/i =~ string
|
43
|
+
return nil
|
44
|
+
end
|
45
|
+
|
46
|
+
modText = Regexp.last_match(1)
|
47
|
+
target = Regexp.last_match(2).to_i
|
48
|
+
abl = Regexp.last_match(3).to_i
|
49
|
+
|
50
|
+
mod = 0
|
51
|
+
if modText
|
52
|
+
mod = ArithmeticEvaluator.eval(modText)
|
53
|
+
end
|
54
|
+
|
55
|
+
dstr, suc, sum = rokumon2_roll(mod, target, abl)
|
56
|
+
output = "#{sum}[#{dstr}] > #{suc} > 評価#{rokumon2_suc_rank(suc)}"
|
57
|
+
|
58
|
+
if suc != 0
|
59
|
+
output += "(+#{suc}d6)"
|
60
|
+
end
|
61
|
+
|
62
|
+
output = "(#{string}) > #{output}"
|
63
|
+
|
64
|
+
return output
|
65
|
+
end
|
66
|
+
|
67
|
+
def rokumon2_roll(mod, target, abl)
|
68
|
+
suc = 0
|
69
|
+
|
70
|
+
dice = @randomizer.roll_barabara(3 + mod.abs, 6).sort
|
71
|
+
dicestr = dice.join(",")
|
72
|
+
|
73
|
+
mod.abs.times do |_i|
|
74
|
+
if mod < 0
|
75
|
+
dice.shift
|
76
|
+
else
|
77
|
+
dice.pop
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
cnt5 = 0
|
82
|
+
cnt2 = 0
|
83
|
+
sum = 0
|
84
|
+
|
85
|
+
dice.each do |die1|
|
86
|
+
cnt5 += 1 if die1 >= 5
|
87
|
+
cnt2 += 1 if die1 <= 2
|
88
|
+
suc += 1 if die1 <= abl
|
89
|
+
sum += die1
|
90
|
+
end
|
91
|
+
|
92
|
+
if sum < target
|
93
|
+
suc += 2
|
94
|
+
elsif sum == target
|
95
|
+
suc += 1
|
96
|
+
end
|
97
|
+
|
98
|
+
suc = 0 if cnt5 >= 3
|
99
|
+
suc = 5 if cnt2 >= 3
|
100
|
+
|
101
|
+
return dicestr, suc, sum
|
102
|
+
end
|
103
|
+
|
104
|
+
def rokumon2_suc_rank(suc)
|
105
|
+
suc_rank = ['E', 'D', 'C', 'B', 'A', 'S']
|
106
|
+
return suc_rank[suc]
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|