# Okay so my general thought is this:
# 1. Generate the large mass
# 2. Generate smaller masses offset
# 3. Generate N normal dungeons around the larger mass, preferably near the border
# 4. Generate large paths / small paths around the place
# 5. Spawn ores + fill the rest and the normal stuff

# If you want mobs they needed to be added at specific steps due to how dungeons work at the moment.

- type: dungeonConfig
  id: NFVGRoidChromite
  layers:
    - !type:PrototypeDunGen
      proto: NFVGRoidBlobChromite
    - !type:PrototypeDunGen
      proto: NFVGRoidExteriorChromite
#    - !type:PrototypeDunGen
#      proto: NFVGRoidSmallerChromite
    - !type:PrototypeDunGen
      proto: NFVGRoidSmallPathsChromite
    - !type:EntityTableDunGen
      minCount: 7
      maxCount: 12
      table:
        id: NFVGRoidInteriorRoomMarker
    - !type:BiomeDunGen
      biomeTemplate: NFVGRoidShadow
      tileMask:
      - FloorChromite
    # Fill
    # - !type:PrototypeDunGen
      # proto: NFVGRoidFillChromite
    # "WarpPoint"
    - !type:OreDunGen
      tileMask:
      - FloorChromite
      entity: WarpPointDungeon
      count: 1
      minGroupSize: 1
      maxGroupSize: 1
    # "Ores"
    - !type:OreDunGen
      entityMask:
      - WallRockChromite
      entity: ChromiteElementalSpawner
      count: 100
      minGroupSize: 1
      maxGroupSize: 1
    # Ores
    - !type:OreDunGen
      entityMask:
      - WallRockChromite
      entity: WallRockChromiteTin
      count: 50
      minGroupSize: 10
      maxGroupSize: 15
    - !type:OreDunGen
      entityMask:
      - WallRockChromite
      entity: WallRockChromiteCoal
      count: 50
      minGroupSize: 8
      maxGroupSize: 12
    - !type:OreDunGen
      entityMask:
      - WallRockChromite
      entity: WallRockChromiteQuartz
      count: 50
      minGroupSize: 10
      maxGroupSize: 15
    - !type:OreDunGen
      entityMask:
      - WallRockChromite
      entity: WallRockChromiteSalt
      count: 50
      minGroupSize: 8
      maxGroupSize: 12
    - !type:OreDunGen
      entityMask:
      - WallRockChromite
      entity: WallRockChromiteGold
      count: 40
      minGroupSize: 8
      maxGroupSize: 12
    - !type:OreDunGen
      entityMask:
      - WallRockChromite
      entity: WallRockChromiteSilver
      count: 40
      minGroupSize: 8
      maxGroupSize: 12
    - !type:OreDunGen
      entityMask:
      - WallRockChromite
      entity: WallRockChromitePlasma
      count: 35
      minGroupSize: 4
      maxGroupSize: 8
    - !type:OreDunGen
      entityMask:
      - WallRockChromite
      entity: WallRockChromiteUranium
      count: 35
      minGroupSize: 4
      maxGroupSize: 8
    - !type:OreDunGen
      entityMask:
      - WallRockChromite
      entity: NFWallChromiteCobblebrick
      count: 100
      minGroupSize: 6
      maxGroupSize: 16
    - !type:OreDunGen
      entityMask:
      - WallRockChromite
      entity: WallRockChromiteArtifactFragment
      count: 25
      minGroupSize: 1
      maxGroupSize: 3
    - !type:OreDunGen
      entityMask:
      - WallRockChromite
      entity: WallRockChromiteDiamond
      count: 15
      minGroupSize: 1
      maxGroupSize: 2
    - !type:OreDunGen
      entityMask:
      - WallRockChromite
      entity: WallRockChromiteBluespace
      count: 10
      minGroupSize: 1
      maxGroupSize: 1
    # Decoration
    # - !type:OreDunGen
      # tileMask:
      # - FloorChromite
      # entity: FloraRockSolid
      # count: 20
      # minGroupSize: 1
      # maxGroupSize: 1
    # Mobs
    - !type:OreDunGen
      tileMask:
      - FloorChromite
      entity: SpawnMobBloodCultLeech
      count: 5
      minGroupSize: 1
      maxGroupSize: 1
    # Mono
    - !type:EntityTableDunGen
      minCount: 5
      maxCount: 11
      table: !type:NestedSelector
        tableId: VgroidGasDepositTable

# Configs
- type: dungeonConfig
  id: NFVGRoidBlobChromite
  layers:
  - !type:NoiseDistanceDunGen
    size: 272, 272
    distanceConfig: !type:DunGenEuclideanSquaredDistance
      blendWeight: 0.80
    layers:
    - tile: FloorChromite
      threshold: 0.50
      noise:
        frequency: 0.010
        noiseType: OpenSimplex2
        fractalType: FBm
        octaves: 5
        lacunarity: 2
        gain: 0.5

- type: dungeonConfig
  id: NFVGRoidSmallerChromite
  minOffset: 40
  maxOffset: 60
  layers:
  - !type:NoiseDistanceDunGen
    size: 150, 150
    distanceConfig: !type:DunGenEuclideanSquaredDistance
    layers:
    - tile: FloorChromite
      threshold: 0.50
      noise:
        frequency: 0.080
        noiseType: OpenSimplex2
        fractalType: FBm
        octaves: 5
        lacunarity: 1.5
        gain: 0.5

- type: dungeonConfig
  id: NFVGRoidExteriorChromite
  reserveTiles: true
  data:
    tiles:
      FallbackTile: FloorDarkHerringbone
      WidenTile: FloorChromite
  layers:
  - !type:PrototypeDunGen
    proto: NFVGRoidExteriorDungeonsChromite
  - !type:SplineDungeonConnectorDunGen

- type: dungeonConfig
  id: NFVGRoidExteriorDungeonsChromite
  reserveTiles: true
  minCount: 2
  maxCount: 3
  layers:
  - !type:ExteriorDunGen
    proto: NFVirologyLab
  - !type:EntityTableDunGen
    minCount: 25
    maxCount: 40
    table: !type:NestedSelector
      tableId: SalvageScrapSpawnerCommon
  - !type:EntityTableDunGen
    minCount: 30
    maxCount: 40
    table: !type:NestedSelector
      tableId: SalvageScrapSpawnerValuable
  - !type:EntityTableDunGen
    minCount: 15
    maxCount: 25
    table: !type:NestedSelector
      tableId: SalvageTreasureSpawnerCommon
  - !type:EntityTableDunGen
    minCount: 15
    maxCount: 25
    table: !type:NestedSelector
      tableId: SalvageEquipmentSpawnerCommon
  - !type:EntityTableDunGen
    minCount: 15
    maxCount: 20
    table: !type:NestedSelector
      tableId: SalvageTreasureSpawnerValuable
  - !type:EntityTableDunGen
    minCount: 15
    maxCount: 20
    table: !type:NestedSelector
      tableId: SalvageEquipmentSpawnerValuable
  - !type:MobsDunGen
    minCount: 1
    maxCount: 2
    groups:
    - id: SpawnMobBloodCultistPriest
      amount: 1
  - !type:MobsDunGen
    minCount: 1
    maxCount: 2
    groups:
    - id: SpawnMobBloodCultistAcolyte
      amount: 1
  - !type:MobsDunGen
    minCount: 1
    maxCount: 2
    groups:
    - id: SpawnMobBloodCultistZealotMelee
      amount: 1
  - !type:MobsDunGen
    minCount: 1
    maxCount: 2
    groups:
    - id: SpawnMobBloodCultistZealotRanged
      amount: 1
  - !type:MobsDunGen
    minCount: 1
    maxCount: 2
    groups:
    - id: SpawnMobBloodCultistCaster
      amount: 1
  - !type:MobsDunGen
    minCount: 0
    maxCount: 1
    groups:
    - id: SpawnMobBloodCultistAscended # Boss
      amount: 1
  # - !type:MobsDunGen # Dies to barotrauma - equip it for space if you want this restored
  #   minCount: 1
  #   maxCount: 1
  #   groups:
  #   - id: SpawnMobCatBloodCultLowChance
  #     amount: 1

#- type: dungeonConfig
#  id: NFVGRoidInteriorDungeonsChromite
#  minCount: 3
#  maxCount: 5
#  # Just randomly spawn these in bounds, doesn't really matter if they go out.

- type: dungeonConfig
  id: NFVGRoidSmallPathsChromite
  reserveTiles: true
  layers:
  - !type:ReplaceTileDunGen
    layers:
    - tile: FloorChromite
      threshold: 0.75
      noise:
        frequency: 0.040
        noiseType: OpenSimplex2
        fractalType: Ridged
        lacunarity: 1.5
        octaves: 2
        gain: 2.0

# Shadow -> Derived from lava
- type: biomeTemplate
  id: NFVGRoidShadow
  layers:
    - !type:BiomeEntityLayer
      threshold: 0.70
      noise:
        frequency: 1
        seed: 3
      allowedTiles:
        - FloorChromite
      entities:
        - ShadowBasaltOne
        - ShadowBasaltTwo
        - ShadowBasaltThree
        - ShadowBasaltFour
        - ShadowBasaltFive
    - !type:BiomeEntityLayer
      threshold: 0.97
      noise:
        frequency: 1
        seed: 2
      allowedTiles:
        - FloorChromite
      entities:
        - CrystalPink
    - !type:BiomeEntityLayer
      threshold: 0.97
      noise:
        seed: 1
        noiseType: OpenSimplex2
        frequency: 1
      allowedTiles:
        - FloorChromite
      entities:
        - ShadowTree
        - CrystalPink
    # Rock formations
    - !type:BiomeEntityLayer
      threshold: -0.2
      invert: true
      noise:
        seed: 0
        noiseType: Perlin
        fractalType: FBm
        octaves: 3
        frequency: 0.3
        gain: 0
      allowedTiles:
        - FloorChromite
      entities:
        - WallRockChromite
    - !type:BiomeDummyLayer
      id: Loot
    # Fill chromite
    - !type:BiomeTileLayer
      threshold: -1
      tile: FloorChromite
