- type: entity
  parent: [ SimpleSpaceMobBase, FlyingMobBase ]
  id: BaseMobDragon
  suffix: ""
  name: space dragon
  description: A flying leviathan, loosely related to space carps.
  abstract: true
  components:
  - type: Bloodstream
    bloodReferenceSolution:
      reagents:
      - ReagentId: Blood
        Quantity: 650
  - 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
  - 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
    # begin starcup
    speechSounds: DragonSpeechSounds
    allowedEmotes: ['CreatureRoar', 'CreatureLaugh', 'CreatureGrowl', 'CreatureTrill', 'CreaturePurr']
  - type: Vocal
    sounds:
      Unsexed: DragonSpeechEmotes
    screamId: CreatureRoar
    screamAction: ActionEmitSound
  - type: TypingIndicator
    proto: alien
    # end starcup

  - 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:
    - Electrocution
    - TemporaryBlindness
    - Pacified
    - RadiationProtection
    - Adrenaline
  - type: Temperature
  - type: TemperatureDamage
    heatDamageThreshold: 2400
  - type: Metabolizer
    solutionOnBody: false
    updateInterval: 0.25
    metabolizerTypes: [ Dragon ]
    stages: [ Digestion, Bloodstream ]
  - 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:
      - HumanoidProfile
    stomachStorageWhitelist:
      components:
      - MobState
    chemical: Ichor
    healRate: 7.5
    whitelist:
      components:
      - MobState
      - Door
      tags:
      - Wall
  - type: Tag
    tags:
    - CannotSuicide
    - DoorBumpOpener
    - StunImmune
    - CreatureEmotes # starcup
  - type: Puller
    needsHands: false
  - type: RandomMetadata
    nameSegments:
    - NamesDragon
    - NamesDragonTitle
    nameFormat: name-format-dragon
  - type: Prying
    pryPowered: true
    force: true
    speedModifier: 2.5 # fast because dragon strong
    useSound:
      path: /Audio/Items/crowbar.ogg

- type: entity
  parent: BaseMobDragon
  id: MobDragon
  components:
  - type: Dragon
    spawnRiftAction: ActionSpawnRift
  - type: GhostRole
    mindRoles:
    - MindRoleDragon
  - type: ActionGun
    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
      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
