# SPDX-FileCopyrightText: 2022 Aerocrux <69610864+Aerocrux@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 CommieFlowers <rasmus.cedergren@hotmail.com>
# SPDX-FileCopyrightText: 2022 CrudeWax <75271456+CrudeWax@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Flipp Syder <76629141+vulppine@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Paul Ritter <ritter.paul1@googlemail.com>
# SPDX-FileCopyrightText: 2022 metalgearsloth <metalgearsloth@gmail.com>
# SPDX-FileCopyrightText: 2022 mirrorcult <lunarautomaton6@gmail.com>
# SPDX-FileCopyrightText: 2022 rolfero <45628623+rolfero@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 Derby <Derby@ss14>
# SPDX-FileCopyrightText: 2023 DerbyX <50932435+DerbyX@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 DrSmugleaf <drsmugleaf@gmail.com>
# SPDX-FileCopyrightText: 2023 I.K <45953835+notquitehadouken@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 Jackrost <jackrost@mail.ru>
# SPDX-FileCopyrightText: 2023 Jezithyr <jezithyr@gmail.com>
# SPDX-FileCopyrightText: 2023 Kara <lunarautomaton6@gmail.com>
# SPDX-FileCopyrightText: 2023 PilgrimViis <PilgrimViis@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 lzk228 <124214523+lzk228@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 notquitehadouken <1isthisameme>
# SPDX-FileCopyrightText: 2024 AJCM <AJCM@tutanota.com>
# SPDX-FileCopyrightText: 2024 Aiden <aiden@djkraz.com>
# SPDX-FileCopyrightText: 2024 Alex Evgrashin <aevgrashin@yandex.ru>
# SPDX-FileCopyrightText: 2024 Alex Pavlenko <diraven@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Alice "Arimah" Heurlin <30327355+arimah@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Alzore <140123969+Blackern5000@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 ArkiveDev <95712736+ArkiveDev@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Boaz1111 <149967078+Boaz1111@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Brandon Hu <103440971+Brandon-Huu@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 CaasGit <87243814+CaasGit@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Chief-Engineer <119664036+Chief-Engineer@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Cojoke <83733158+Cojoke-dot@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Doomsdrayk <robotdoughnut@comcast.net>
# SPDX-FileCopyrightText: 2024 DrSmugleaf <10968691+DrSmugleaf@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 DrSmugleaf <DrSmugleaf@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Ed <96445749+TheShuEd@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Emisse <99158783+Emisse@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 EmoGarbage404 <retron404@gmail.com>
# SPDX-FileCopyrightText: 2024 Eoin Mcloughlin <helloworld@eoinrul.es>
# SPDX-FileCopyrightText: 2024 Fishbait <Fishbait@git.ml>
# SPDX-FileCopyrightText: 2024 Flareguy <78941145+Flareguy@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Ghagliiarghii <68826635+Ghagliiarghii@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 HS <81934438+HolySSSS@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Hrosts <35345601+Hrosts@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 IProduceWidgets <107586145+IProduceWidgets@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Ian <ignaz.k@live.de>
# SPDX-FileCopyrightText: 2024 Joel Zimmerman <JoelZimmerman@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 JustCone <141039037+JustCone14@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Killerqu00 <47712032+Killerqu00@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Ko4ergaPunk <62609550+Ko4ergaPunk@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Kukutis96513 <146854220+Kukutis96513@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Leon Friedrich <60421075+ElectroJr@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Lye <128915833+Lyroth001@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 MerrytheManokit <167581110+MerrytheManokit@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Mervill <mervills.email@gmail.com>
# SPDX-FileCopyrightText: 2024 MilenVolf <63782763+MilenVolf@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Mr. 27 <45323883+Dutch-VanDerLinde@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 MureixloI <132683811+MureixloI@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 NakataRin <45946146+NakataRin@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Nemanja <98561806+EmoGarbage404@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 OrangeMoronage9622 <whyteterry0092@gmail.com>
# SPDX-FileCopyrightText: 2024 PJBot <pieterjan.briers+bot@gmail.com>
# SPDX-FileCopyrightText: 2024 Partmedia <kevinz5000@gmail.com>
# SPDX-FileCopyrightText: 2024 Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
# SPDX-FileCopyrightText: 2024 Piras314 <p1r4s@proton.me>
# SPDX-FileCopyrightText: 2024 Plykiya <58439124+Plykiya@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Preston Smith <92108534+thetolbean@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Psychpsyo <60073468+Psychpsyo@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Redfire1331 <125223432+Redfire1331@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Repo <47093363+Titian3@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 RiceMar1244 <138547931+RiceMar1244@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Rouge2t7 <81053047+Sarahon@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 ShadowCommander <10494922+ShadowCommander@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Simon <63975668+Simyon264@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 SlamBamActionman <83650252+SlamBamActionman@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 SoulFN <164462467+SoulFN@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Stalen <33173619+stalengd@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 TakoDragon <69509841+BackeTako@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Tayrtahn <tayrtahn@gmail.com>
# SPDX-FileCopyrightText: 2024 Thomas <87614336+Aeshus@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Truoizys <153248924+Truoizys@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 TsjipTsjip <19798667+TsjipTsjip@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Ubaser <134914314+UbaserB@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Unkn0wn_Gh0st <shadowstalkermll@gmail.com>
# SPDX-FileCopyrightText: 2024 Vasilis <vasilis@pikachu.systems>
# SPDX-FileCopyrightText: 2024 Vigers Ray <60344369+VigersRay@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Whisper <121047731+QuietlyWhisper@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 YourUsername <you@example.com>
# SPDX-FileCopyrightText: 2024 beck-thompson <107373427+beck-thompson@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 deathride58 <deathride58@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 deltanedas <39013340+deltanedas@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 deltanedas <@deltanedas:kde.org>
# SPDX-FileCopyrightText: 2024 dffdff2423 <dffdff2423@gmail.com>
# SPDX-FileCopyrightText: 2024 eoineoineoin <github@eoinrul.es>
# SPDX-FileCopyrightText: 2024 fishbait <gnesse@gmail.com>
# SPDX-FileCopyrightText: 2024 foboscheshir <156405958+foboscheshir@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 gluesniffler <159397573+gluesniffler@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 godisdeadLOL <169250097+godisdeadLOL@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 lzk <124214523+lzk228@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 metalgearsloth <comedian_vs_clown@hotmail.com>
# SPDX-FileCopyrightText: 2024 neutrino <67447925+neutrino-laser@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 nikthechampiongr <32041239+nikthechampiongr@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 no <165581243+pissdemon@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 osjarw <62134478+osjarw@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 plykiya <plykiya@protonmail.com>
# SPDX-FileCopyrightText: 2024 redfire1331 <Redfire1331@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 saintmuntzer <47153094+saintmuntzer@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 shamp <140359015+shampunj@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 strO0pwafel <153459934+strO0pwafel@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 stroopwafel <j.o.luijkx@student.tudelft.nl>
# SPDX-FileCopyrightText: 2024 themias <89101928+themias@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 to4no_fix <156101927+chavonadelal@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 voidnull000 <18663194+voidnull000@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Арт <123451459+JustArt1m@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 Aidenkrz <aiden@djkraz.com>
# SPDX-FileCopyrightText: 2025 Aviu00 <93730715+Aviu00@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 Errant <35878406+Errant-4@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 ExponentialWizard <38435756+ExponentialWizard@users.noreply.github.com>
# 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 Rinary <72972221+Rinary1@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 Roudenn <romabond091@gmail.com>
# SPDX-FileCopyrightText: 2025 Spatison <137375981+Spatison@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 Theodore Lukin <66275205+pheenty@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 gus <august.eymann@gmail.com>
# SPDX-FileCopyrightText: 2025 slarticodefast <161409025+slarticodefast@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 thebiggestbruh <marcus2008stoke@gmail.com>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

- type: entity
  parent: [ SimpleSpaceMobBase, FlyingMobBase ]
  id: BaseMobDragon
  suffix: ""
  name: space dragon
  description: A flying leviathan, loosely related to space carps.
  abstract: true
  components:
  - type: Body # Shitmed
    prototype: SpaceDragon
  - type: SurgeryTarget # Shitmed
  - type: UserInterface # Shitmed
    interfaces:
      enum.SurgeryUIKey.Key:
        type: SurgeryBui
  - type: Bloodstream
    bloodMaxVolume: 650
    bleedReductionAmount: 5 #goob
  - type: GhostRole
    allowMovement: true
    allowSpeech: true
    makeSentient: true
    name: ghost-role-information-space-dragon-name
    description: ghost-role-information-space-dragon-description
    rules: ghost-role-information-space-dragon-rules
    mindRoles:
    - MindRoleGhostRoleTeamAntagonist
    raffle:
      settings: default
    requirements: # Goobstation - ghost roles requirements
    - !type:OverallPlaytimeRequirement
      time: 18000 #5 hours
  - type: GhostTakeoverAvailable
  - type: HTN
    rootTask:
      task: XenoCompound
    blackboard:
      NavInteract: !type:Bool
        true
      NavPry: !type:Bool
        true
      NavSmash: !type:Bool
        true
  - type: NpcFactionMember
    factions:
    - Dragon
  - type: Speech
    speechVerb: LargeMob
  - type: CombatMode
  - type: MobMover
  - type: InputMover
  - type: MovementSpeedModifier
    baseWalkSpeed: 3
    baseSprintSpeed: 5
    baseWeightlessModifier: 1.5
  - type: RandomSprite
    available:
    - enum.DamageStateVisualLayers.Base:
        alive: Rainbow
  - type: Sprite
    sprite: Mobs/Aliens/Carps/dragon.rsi
    noRot: true
    layers:
    - map: [ "enum.DamageStateVisualLayers.Base" ]
      state: alive
    - map: [ "enum.DamageStateVisualLayers.BaseUnshaded" ]
      state: alive-unshaded
      shader: unshaded
  - type: Appearance
  - type: DamageStateVisuals
    states:
      Alive:
        Base: alive
        BaseUnshaded: alive-unshaded
      Critical:
        Base: crit
      Dead:
        Base: dead
        BaseUnshaded: dead-unshaded
  - type: Physics
    bodyType: KinematicController
  - type: Fixtures
    fixtures:
      fix1:
        shape:
          !type:PhysShapeCircle
          radius: 0.40
        density: 100
        mask:
        - FlyingMobMask
        layer:
        - FlyingMobLayer
  - type: MobState
  - type: MobStateActions
    actions:
      Critical:
      - ActionCritSuccumb
      - ActionCritLastWords
  - type: MobThresholds
    thresholds:
      0: Alive
      450: Critical
      500: Dead
  - type: SlowOnDamage
    speedModifierThresholds:
      250: 0.7
      400: 0.5
  # disable taking damage from fire, since its a fire breathing dragon
  - type: Flammable
    damage:
      types: {}
  - type: StatusEffects # Overwriting basesimplemob to remove flash, getting flashed as dragon just feelsbad
    allowed:
    - SlowedDown
    - Stutter
    - Electrocution
    - TemporaryBlindness
    - Pacified
    - RadiationProtection
    - Adrenaline
  - type: Temperature
    heatDamageThreshold: 800
  - type: Metabolizer
    solutionOnBody: false
    updateInterval: 0.25
    metabolizerTypes: [ Dragon ]
    groups:
    - id: Medicine
    - id: Poison
  - type: Butcherable
    spawned:
    - id: FoodMeatDragon
      amount: 2
  - type: InteractionPopup
    successChance: 0.25 # It's no goose, but you better smell like carp.
    interactSuccessString: petting-success-dragon
    interactFailureString: petting-failure-dragon
    interactFailureSound:
      path: /Audio/Animals/space_dragon_roar.ogg
    soundPerceivedByOthers: false # A 75% chance for a loud roar would get old fast.
  - type: MeleeWeapon
    altDisarm: false
    soundHit:
      path: /Audio/Weapons/Xeno/alien_claw_flesh3.ogg
    damage:
      types:
        Piercing: 15
        Slash: 15
  - type: Devourer
    foodPreferenceWhitelist:
      components:
      - HumanoidAppearance
    stomachStorageWhitelist:
      components:
      - MobState
      - Item
    chemical: Ichor
    healRate: 7.5
    whitelist:
      components:
      - MobState
      - Door
      - Item
      tags:
      - Wall
  - type: Tag
    tags:
    - CannotSuicide
    - DoorBumpOpener
  # Goobstation - Collective mind
  - type: CollectiveMind
    defaultChannel: Dragonmind
    channels:
    - Dragonmind
  - type: Damageable # Goobstation
    damageContainer: Biological
    damageModifierSet: Dragon
  - type: Puller
    needsHands: false
  - type: RandomMetadata
    nameSegments:
    - NamesDragon
    - NamesDragonTitle
    nameFormat: name-format-dragon
  - type: NightVision # Goobstation - Nigthvision
    color: "#808080"
    activateSound: null
    deactivateSound: null
  - type: CombatPower # Goobstation
    factor: 4 # times more dangerous than a crew-member
  - type: Fauna # Lavaland Change
  - type: Prying
    pryPowered: true
    force: true
    speedModifier: 2.5 # fast because dragon strong
    useSound:
      path: /Audio/Items/crowbar.ogg
  - type: LanguageKnowledge # goob edit - carp language (keeping basic as an option because the space monster gloating is funny)
    speaks:
    - TauCetiBasic
    - Carptongue
    understands:
    - TauCetiBasic
    - Carptongue

- type: entity
  parent: BaseMobDragon
  id: MobDragon
  components:
  - type: Dragon
    spawnRiftAction: ActionSpawnRift
    carpRiftHealing:
      groups:
        Brute: -4
        Burn: -4
        Airloss: -3
  - type: GhostRole
    mindRoles:
    - MindRoleDragon
  #- type: ActionGun # Goobstation - remove fireball because it's tied to lungs now
  #  action: ActionDragonsBreath
  #  gunProto: DragonsBreathGun
  - type: GuideHelp
    guides:
    - MinorAntagonists

- type: entity
  categories: [ HideSpawnMenu ]
  id: DragonsBreathGun
  name: dragon's lung
  description: For dragon's breathing.
  components:
  - type: RechargeBasicEntityAmmo
    rechargeCooldown: 5
    rechargeSound:
      path: /Audio/Animals/space_dragon_roar.ogg
  - type: BasicEntityAmmoProvider
    proto: ProjectileDragonsBreath
    capacity: 1
    count: 1
  - type: Gun
    soundGunshot:
      path: /Audio/Animals/space_dragon_roar.ogg
    soundEmpty: null
    projectileSpeed: 5

- type: entity
  parent: BaseMobDragon
  id: MobDragonDungeon
  suffix: Dungeon
  components:
  - type: GhostRole
    description: ghost-role-information-space-dragon-dungeon-description
    rules: ghost-role-information-space-dragon-dungeon-rules
    raffle:
      settings: default
  - type: SlowOnDamage
    speedModifierThresholds:
      100: 0.7
  - type: MobThresholds
    thresholds:
      0: Alive
      200: Dead
  # less meat spawned since it's a lot easier to kill
  - type: Butcherable
    spawned:
    - id: FoodMeatDragon
      amount: 1
  - type: MeleeWeapon
    damage:
      groups:
        Brute: 12

- type: entity
  parent: BaseAction
  id: ActionSpawnRift
  name: Summon Carp Rift
  description: Summons a carp rift that will periodically spawns carps.
  components:
  - type: Action
    icon:
      sprite: Interface/Actions/carp_rift.rsi
      state: icon
    useDelay: 1
    priority: 3
  - type: InstantAction
    event: !type:DragonSpawnRiftActionEvent

- type: entity
  parent: BaseAction
  id: ActionDevour
  name: "[color=red]Devour[/color]"
  description: Attempt to break a structure with your jaws or swallow a creature.
  components:
  - type: Action
    icon: { sprite : Interface/Actions/devour.rsi, state: icon }
    iconOn: { sprite : Interface/Actions/devour.rsi, state: icon-on }
    itemIconStyle: BigAction
    priority: 1
  - type: TargetAction
  - type: EntityTargetAction
    canTargetSelf: false
    whitelist:
      components:
      - MobState
      - Door
      - Item # Goobstation
      tags:
      - Wall
    event: !type:DevourActionEvent

- type: entity
  parent: BaseAction
  id: ActionDragonsBreath
  name: "[color=orange]Dragon's Breath[/color]"
  description: Spew out flames at anyone foolish enough to attack you!
  components:
  - type: Action
    # TODO: actual sprite and iconOn
    icon: { sprite : Objects/Weapons/Guns/Projectiles/magic.rsi, state: fireball }
    itemIconStyle: BigAction
    priority: 2
  - type: TargetAction
    checkCanAccess: false
    range: 0
  - type: WorldTargetAction
    event: !type:ActionGunShootEvent

# Goobstation start: dragon rework
- type: entity
  parent: BaseAction
  id: ActionRiseFish
  name: Summon Carp Horde
  description: Summons 3 carps on the spot to protect you from danger!
  components:
  - type: Action
    icon:
      sprite: _Goobstation/Actions/dragon.rsi
      state: carp_horde
    useDelay: 90
    priority: 4
  - type: InstantAction
    event: !type:DragonSpawnCarpHordeActionEvent

- type: entity
  parent: BaseAction
  id: ActionDragonRoar
  name: Wing flap
  description: Flap your wings to stun all enemies around you!
  components:
  - type: Action
    icon:
      sprite: _Goobstation/Actions/dragon.rsi
      state: wing_flap
    useDelay: 45
    priority: 5
  - type: InstantAction
    event: !type:DragonRoarActionEvent
# Goobstation end
