# SPDX-FileCopyrightText: 2025 GoobBot <uristmchands@proton.me>
# SPDX-FileCopyrightText: 2025 Ilya246 <57039557+Ilya246@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 Ilya246 <ilyukarno@gmail.com>
# SPDX-FileCopyrightText: 2025 loltart <lo1tartyt@gmail.com>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

# midround event table - change BasicGameRulesTable if you want to add more midround event types
# if you want to add more midround event types to secret+ specifically, make a new table and add it as a new entry here
# if you want to make your own gamemode with its own gamerules, make a new table with entries of your choice
- type: entityTable
  id: SecretPlusTable
  table: !type:AllSelector # we need to pass a list of rules, since rules have further restrictions to consider via StationEventComp
    children:
      - !type:NestedSelector
        tableId: SpaceTrafficControlTable
      - !type:NestedSelector
        tableId: BasicGameRulesTable

# repeatedly rolled after the primary until we eat up all our chaos, if the primary wasn't enough
- type: weightedRandom
  id: SecretPlus
  weights:
    # subgamemodes
    Thief: 0.2
    Shadowling: 0.02
    # normal
    Traitor: 0.25
    Changeling: 0.10
    Heretic: 0.11
    CorporateAgent: 0.025
    XenomorphsInfestationRoundstart: 0.02

# important note: those (and especially the above) weights aren't entirely accurate,
# as secret+ can randomly decide it's not going to use this gamerule
# if it doesn't entirely fit into its remaining budget,
# so if we rolled 450 budget and a rule takes 1000, we effectively rolled 900 (doubled for reroll consideration for primary gamerule only),
# which is not enough so we have a 10% chance to skip it
# however the amount of effective budget used is reduced for primary rule so this only matters on low/midpop
- type: weightedRandom
  id: SecretPlusPrimary
  weights:
    Traitor: 0.25
    Changeling: 0.10
    Heretic: 0.11
    Nukeops: 0.05
    Revolutionary: 0.05
    Zombie: 0.04 # in search of how to make a rule always run alone? just tag it with LoneRunRule like zombies are
    BlobGameMode: 0.05
    Wizard: 0.025
    CosmicCult: 0.05
    CorporateAgent: 0.025
    XenomorphsInfestationRoundstart: 0.02
    OopsAllThieves: 0.02

# all roundstart antags
- type: weightedRandom
  id: SecretPlusChaos
  weights:
    Thief: 0.2
    Shadowling: 0.09
    Traitor: 0.25
    Changeling: 0.10
    Heretic: 0.11
    Nukeops: 0.05
    Revolutionary: 0.05
    Zombie: 0.04
    BlobGameMode: 0.05
    Wizard: 0.025
    CosmicCult: 0.05
    CorporateAgent: 0.025
    XenomorphsInfestationRoundstart: 0.02


# ⠀⠀⠀⠀⠀⠀⠀⢀⡀⠴⠤⠤⠴⠄⡄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
# ⠀⠀⠀⣠⠄⠒⠉⠀⠀⠀⠀⠀⠀⠀⠀⠁⠃⠆⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
# ⠀⢀⡜⠁⠀⠀⠀⢠⡄⠀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠑⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
# ⠀⢈⠁⠀⠀⠠⣿⠿⡟⣀⡹⠆⡿⣃⣰⣆⣤⣀⠀⠀⠹⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
# ⠀⣼⠀⠀⢀⣀⣀⣀⣀⡈⠁⠙⠁⠘⠃⠡⠽⡵⢚⠱⠂⠛⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
# ⠀⠈⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
# ⠀⡆⠀⠀⠀⠀⢐⣢⣤⣵⡄⢀⠀⢀⢈⣉⠉⠉⠒⠤⠀⠿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
# ⠘⡇⠀⠀⠀⠀⠀⠉⠉⠁⠁⠈⠀⠸⢖⣿⣿⣷⠀⠀⢰⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
# ⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⢀⠃⠀⡄⠀⠈⠉⠀⠀⠀⢴⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ want more documentation? see:
# ⢈⣇⠀⠀⠀⠀⠀⠀⠀⢰⠉⠀⠀⠱⠀⠀⠀⠀⠀⢠⡄⠀⠀⠀⠀⠀⣀⠔⠒⢒⡩⠃ Content.Goobstation.Server/StationEvents/SecretPlus/SecretPlusComponent.cs
# ⣴⣿⣤⢀⠀⠀⠀⠀⠀⠈⠓⠒⠢⠔⠀⠀⠀⠀⠀⣶⠤⠄⠒⠒⠉⠁⠀⠀⠀⢸⡀⠀
# ⠈⣿⣿⣽⣦⠀⢀⢀⠰⢰⣀⣲⣿⡐⣤⠀⠀⢠⡾⠃⠀⠀⠀⠀⠀⠀⠀⣀⡄⣠⣵⠀
# ⠘⠏⢿⣿⡁⢐⠶⠈⣰⣿⣿⣿⣿⣷⢈⣣⢰⡞⠀⠀⠀⠀⠀⠀⢀⡴⠋⠁⠀⠀⠀⠀
# ⠀⠀⠈⢿⣿⣍⠀⠀⠸⣿⣿⣿⣿⠃⢈⣿⡎⠁⠀⠀⠀⠀⣠⠞⠉⠀⠀⠀⠀⠀⠀⠀
# ⠀⠀⠀⠈⢙⣿⣆⠀⠀⠈⠛⠛⢋⢰⡼⠁⠁⠀⠀⠀⢀⠔⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀
# ⠀⠀⠀⠀⠀⠀⠚⣷⣧⣷⣤⡶⠎⠛⠁⠀⠀⠀⢀⡤⠊⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
# ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠁⠈⠁⠀⠀⠀⠀⠀⠠⠊⠀⠀⠀⠀⠀⠀⠀⠀⠀

# middle setting: supposed to be a "normal round" baseline setting
- type: entity
  id: SecretPlusMid
  parent: BaseGameRule
  categories: [ HideSpawnMenu ]
  components:
  - type: SecretPlus
    # if you've come here due to "too many antags", lower chaos change for less midrounds and lower starting chaos for less roundstarts
    minStartingChaos: 11 # scales per player
    maxStartingChaos: 22
    livingChaosChange: -0.018
    deadChaosChange: 0.020
    # chance for greenshift as well as evilshift
    chaosChangeVariationMin: 0.65
    chaosChangeVariationMax: 1.3
    # often fires chud events so relatively low
    eventIntervalMin: 90
    eventIntervalMax: 400
    # there's some misc variables in the comp if you want to try tweaking those
  - type: SelectedGameRules
    scheduledGameRules: !type:NestedSelector
      tableId: SecretPlusTable

# the Setting that Kills You
- type: entity
  id: SecretPlusAdmeme
  parent: SecretPlusMid
  categories: [ HideSpawnMenu ]
  components:
  - type: SecretPlus
    minStartingChaos: 40
    maxStartingChaos: 40 # ling-blob-nukeops is fun
    livingChaosChange: -0.03
    deadChaosChange: 0.03
    chaosExponent: 1
    eventIntervalMin: 60
    eventIntervalMax: 200 # hell
    primaryAntagsWeightTable: SecretPlusChaos
    ignoreIncompatible: true
    ignoreTimings: true # would run out of events otherwise

# greenshift setting
- type: entity
  id: SecretPlusLow
  parent: SecretPlusMid
  categories: [ HideSpawnMenu ]
  components:
  - type: SecretPlus
    minStartingChaos: 5
    maxStartingChaos: 10
    noRoundstartAntags: true
    livingChaosChange: -0.006
    deadChaosChange: 0.015
    chaosExponent: 1.2
    eventIntervalMin: 150
    eventIntervalMax: 480

# survival+
# "baseline" ramping setting
- type: entity
  id: SecretPlusRampingMid
  parent: SecretPlusMid
  categories: [ HideSpawnMenu ]
  components:
  - type: SecretPlus
    minStartingChaos: 0
    maxStartingChaos: 0
    noRoundstartAntags: true
    speedRamping: 0.0003 # ramps to 2x in about an hour, to 3x in ~2
