- type: entity
  id: BaseMeleeWeaponEnergy # more generic naming in case someone makes like, idk, an energy axe
  parent: BaseItem
  abstract: true
  components:
  - type: EnergySword
  - type: ItemToggle
    soundActivate:
      path: /Audio/Weapons/ebladeon.ogg
    soundDeactivate:
      path: /Audio/Weapons/ebladeoff.ogg
    deactivateUnequippedHand: true # Sunrise-Edit
  - type: ItemToggleActiveSound
    activeSound:
      path: /Audio/Weapons/ebladehum.ogg
  - type: ComponentToggler
    components:
    - type: Sharp
    - type: DisarmMalus
      malus: 0.6
    - type: Execution
      doAfterDuration: 4.0
  - type: ItemToggleHot
  - type: ItemToggleSize
    activatedSize: Huge
  - type: ItemTogglePointLight
    toggleableVisualsColorModulatesLights: true
  - type: ItemToggleMeleeWeapon
    activatedSoundOnHit:
      path: /Audio/Weapons/eblade1.ogg
      params:
        variation: 0.250
    activatedSoundOnHitNoDamage:
      path: /Audio/Weapons/eblade1.ogg
      params:
        variation: 0.250
        volume: -10
    activatedSoundOnSwing:
      path: /Audio/Weapons/eblademiss.ogg
      params:
        variation: 0.125
    activatedDamage:
      types:
        Slash: 15
        Heat: 15
        Structural: 20
  - type: MeleeWeapon
    wideAnimationRotation: -135
    attackRate: 1
    damage:
      types:
        Blunt: 4.5
  - type: Item
    size: Small
  - type: UseDelay
    delay: 1.0
  - type: PointLight
    enabled: false
    radius: 2
    energy: 2
    color: white
    netsync: false
  - type: Appearance
  - type: ToggleableVisuals # Add support for multiple layers
    spriteLayer: blade
    inhandVisuals:
      left:
      - state: inhand-left-blade
        shader: unshaded
      right:
      - state: inhand-right-blade
        shader: unshaded
  - type: Reflect
  # Sunrise-start
  - type: SMCuttable
  - type: Tag
    tags:
    - NoPaint
  # Sunrise-end
  - type: IgnitionSource
    temperature: 700

- type: entity
  name: energy sword
  parent: [BaseMeleeWeaponEnergy, BaseSyndicateContraband]
  id: EnergySword
  description: A very loud & dangerous sword with a beam made of pure, concentrated plasma. Cuts through unarmored targets like butter.
  components:
  - type: Sprite
    sprite: Objects/Weapons/Melee/e_sword.rsi
    layers:
    - state: e_sword
    - state: e_sword_blade
      color: "#FFFFFF"
      visible: false
      shader: unshaded
      map: [ "blade" ]
  - type: Item
    sprite: Objects/Weapons/Melee/e_sword-inhands.rsi
  - type: StaticPrice
    price: 2500
  # Sunrise-start
  - type: Scalpel
  - type: SurgeryTool
    successRate: 0.6
    startSound:
      path: /Audio/_Sunrise/Medical/Surgery/scalpel1.ogg
    endSound:
      path: /Audio/_Sunrise/Medical/Surgery/scalpel2.ogg
  # Sunrise-end

- type: entity
  name: energy dagger
  parent: [BaseMeleeWeaponEnergy, BaseSyndicateContraband]
  id: EnergyDaggerLoud
  description: A not as loud and dangerous dagger with a beam made of pure, concentrated plasma. This one is completely undisguised.
  components:
  - type: ItemToggle
    soundActivate:
      path: /Audio/Weapons/ebladeon.ogg
      params:
        volume: -3
    soundDeactivate:
      path: /Audio/Weapons/ebladeoff.ogg
      params:
        volume: -3
  - type: ItemToggleMeleeWeapon
    activatedSoundOnSwing:
      path: /Audio/Weapons/eblademiss.ogg
      params:
        volume: -3
        variation: 0.250
    activatedDamage:
      types:
        Slash: 10
        Heat: 10
    deactivatedSecret: true
  - type: ItemToggleActiveSound
    activeSound:
      path: /Audio/Weapons/ebladehum.ogg
      params:
        volume: -3
  - type: ComponentToggler
    components:
    - type: Sharp
    - type: DisarmMalus
      malus: 0.4
    - type: Execution
      doAfterDuration: 4.0
  - type: Sprite
    sprite: Objects/Weapons/Melee/e_dagger_loud.rsi
    layers:
    - state: e_sword
    - state: e_sword_blade
      color: "#FFFFFF"
      visible: false
      shader: unshaded
      map: [ "blade" ]
  - type: MeleeWeapon
    wideAnimationRotation: 145
    attackRate: 1
    hidden: true
    damage:
      types:
        Blunt: 1
  - type: Item
    size: Tiny
    sprite: Objects/Weapons/Melee/e_dagger_loud.rsi
  - type: PointLight
    enabled: false
    radius: 1.5
    energy: 1.5
    color: white
    netsync: false
  # Sunrise-start
  - type: Scalpel
  - type: SurgeryTool
    successRate: 0.6
    startSound:
      path: /Audio/_Sunrise/Medical/Surgery/scalpel1.ogg
    endSound:
      path: /Audio/_Sunrise/Medical/Surgery/scalpel2.ogg
  # Sunrise-end

- type: entity
  name: pen
  parent: [BaseMeleeWeaponEnergy, SelectableLock]
  id: EnergyDagger
  suffix: E-Dagger
  description: 'A dark ink pen.'
  components:
  - type: ItemToggle
    soundActivate:
      path: /Audio/Weapons/ebladeon.ogg
      params:
        volume: -6
    soundDeactivate:
      path: /Audio/Weapons/ebladeoff.ogg
      params:
        volume: -6
  - type: ItemToggleActiveSound
    activeSound:
      path: /Audio/Weapons/ebladehum.ogg
      params:
        volume: -6
  - type: ItemToggleMeleeWeapon
    activatedSoundOnSwing:
      path: /Audio/Weapons/eblademiss.ogg
      params:
        volume: -3
        variation: 0.250
    activatedDamage:
      types:
        Slash: 10
        Heat: 10
  - type: ComponentToggler
    components:
    - type: Sharp
    - type: DisarmMalus
      malus: 0.4
    - type: Execution
      doAfterDuration: 4.0
    - type: Contraband
      severity: Syndicate
  - type: Sprite
    sprite: _Sunrise/Objects/Weapons/Melee/e_dagger.rsi # Sunrise-Edit
    layers:
    - state: e_sword
    - state: e_sword_blade
      color: "#FFFFFF"
      visible: false
      shader: unshaded
      map: [ "blade" ]
  - type: Item
    size: Tiny
    sprite: _Sunrise/Objects/Weapons/Melee/e_dagger.rsi # Sunrise-Edit
  - type: PointLight
    enabled: false
    radius: 1.5
    energy: 1.5
    color: white
    netsync: false
  - type: MeleeWeapon
    wideAnimationRotation: 145
    attackRate: 1
    hidden: true
    damage:
      types:
        Blunt: 1
  - type: EmitSoundOnUse
    sound:
      path: /Audio/Items/pen_click.ogg
      params:
        volume: -4
        maxDistance: 2
  - type: UseDelay
    delay: 1.5
  - type: ItemToggleRequiresLock #  TODO: FIX THIS VERB IS COOKED
    lockedPopup: null
  - type: Tag
    tags:
    - Write
    - NoPaint  # Sunrise-edit
  # Sunrise-start
  - type: Scalpel
  - type: SurgeryTool
    successRate: 0.6
    startSound:
      path: /Audio/_Sunrise/Medical/Surgery/scalpel1.ogg
    endSound:
      path: /Audio/_Sunrise/Medical/Surgery/scalpel2.ogg
  # Sunrise-end

- type: entity
  parent: [BaseItem, BaseSyndicateContraband]
  id: EnergyDaggerBox
  name: e-dagger box
  suffix: E-Dagger
  description: A small box containing an e-dagger. Packaging disintegrates when opened, leaving no evidence behind.
  components:
  - type: Item
    size: Tiny
  - type: Sprite
    sprite: Objects/Storage/penbox.rsi
    state: e_dagger
  - type: SpawnItemsOnUse
    items:
    - id: EnergyDaggerBiocode # Sunrise-Edit
    sound:
      path: /Audio/Effects/unwrap.ogg

- type: entity
  name: energy cutlass
  parent: [BaseMeleeWeaponEnergy, BaseMajorContraband]
  id: EnergyCutlass
  description: An exotic energy weapon.
  components:
  - type: ItemToggleMeleeWeapon
    activatedDamage:
      types:
        Slash: 10
        Heat: 12
    deactivatedSecret: true
  - type: Sprite
    sprite: Objects/Weapons/Melee/e_cutlass.rsi
    layers:
    - state: e_cutlass
    - state: e_cutlass_blade
      color: "#e95151"
      visible: false
      shader: unshaded
      map: [ "blade" ]
  - type: Item
    sprite: Objects/Weapons/Melee/e_cutlass.rsi

- type: entity
  name: double-bladed energy sword
  parent: [BaseMeleeWeaponEnergy, BaseSyndicateContraband]
  id: EnergySwordDouble
  description: Syndicate Command Interns thought that having one blade on the energy sword was not enough. This can be stored in pockets.
  components:
  - type: ItemToggle
    onUse: false # wielding events control it instead
    onActivate: false # prevents the weapon from being able to be turned on when it is on the ground
    soundActivate:
      path: /Audio/Weapons/ebladeon.ogg
      params:
        volume: 3
    soundDeactivate:
      path: /Audio/Weapons/ebladeoff.ogg
      params:
        volume: 3
  - type: ItemToggleMeleeWeapon
    activatedSoundOnSwing:
      path: /Audio/Weapons/eblademiss.ogg
      params:
        volume: 3
        variation: 0.250
    activatedDamage:
      types:
        Slash: 12
        Heat: 12
        Structural: 15
  - type: ItemToggleActiveSound
    activeSound:
      path: /Audio/Weapons/ebladehum.ogg
      params:
        volume: 3
  - type: ComponentToggler
    components:
    - type: Sharp
    - type: DisarmMalus
      malus: 0.7
    - type: Execution
      doAfterDuration: 4.0
  - type: Wieldable
    wieldSound: null # esword light sound instead
  - type: MeleeWeapon
    wideAnimationRotation: -135
    attackRate: 2
    autoAttack: true
    angle: 100
    damage:
      types:
        Blunt: 4.5
  - type: Sprite
    sprite: Objects/Weapons/Melee/e_sword_double.rsi
    layers:
    - state: e_sword_double
    - state: e_sword_double_blade
      color: "#FFFFFF"
      visible: false
      shader: unshaded
      map: [ "blade" ]
  - type: Item
    size: Small
    sprite: Objects/Weapons/Melee/e_sword_double-inhands.rsi
  - type: Reflect
    reflectProb: .75
    spread: 75
  - type: FlipOnAttack # Sunrise-Edit
    probability: 0.5 # Sunrise-Edit
  # Sunrise-start
  - type: Scalpel
  - type: SurgeryTool
    successRate: 0.6
    startSound:
      path: /Audio/_Sunrise/Medical/Surgery/scalpel1.ogg
    endSound:
      path: /Audio/_Sunrise/Medical/Surgery/scalpel2.ogg
  # Sunrise-end

# Item will look weird in handslot. Will need to adjust handstorage visuals in a future PR
- type: entity
  parent: EnergySwordDouble
  id: HyperEutacticBlade
  name: hypereutactic-blade
  description: A supermassive weapon envisioned to cleave the very fabric of space and time itself in twain, the hypereutactic blade dynamically flash-forges a hypereutactic crystaline nanostructure capable of passing through most known forms of matter like a hot knife through butter.
  components:
  - type: MeleeWeapon
    wideAnimationRotation: 180
    attackRate: 0.8 #0.7 and below is too slow
    angle: 100
    range: 2.0
    damage:
      types:
        Blunt: 4.5
  - type: ItemToggleMeleeWeapon
    activatedSoundOnSwing:
      path: /Audio/Weapons/eblademiss.ogg
      params:
        volume: -3
        variation: 0.250
    activatedDamage:
      types:
        Slash: 20
        Heat: 20
        Structural: 20
  - type: MeleeRequiresWield
  - type: HeldSpeedModifier #slowdown is what balances this compared to a dsword
    walkModifier: 0.6
    sprintModifier: 0.6
  - type: UseDelay
    delay: 1.5
  - type: Sprite
    sprite: Objects/Weapons/Melee/hypereutactic_blade.rsi
    layers:
    - state: hypereutactic
    - state: hypereutactic_blade
      color: "#FFFFFF"
      visible: false
      shader: unshaded
      map: [ "blade" ]
    - state: hypereutactic_gem
      color: "#FFFFFF"
      visible: false
      shader: unshaded
      map: [ "gem" ]
  - type: Item
    size: Small
    sprite: Objects/Weapons/Melee/hypereutactic_blade_inhands.rsi
  - type: Reflect
    reflectProb: 1.0
    spread: 75

# Borgs

- type: entity
  parent: EnergySword
  id: CyborgEnergySword
  suffix: For Borgs
  description: A very loud & dangerous sword with a beam made of pure, concentrated plasma. Specially designed for syndicate cyborgs.

- type: entity
  parent: EnergySwordDouble
  id: CyborgEnergySwordDouble # why is this invalid if ID is BorgEnergySwordDouble
  suffix: One-Handed, For Borgs
  description: Syndicate Command Interns thought that having one blade on the energy sword was not enough. Specially designed for syndicate cyborgs.
  components: # could add energy-draining like the L6C
  - type: Wieldable
    freeHandsRequired: 0 # because borg has no off-hand to wield with.  Without this, it will be unable to activate the esword

- type: entity
  parent: [ EnergyDaggerLoud, BaseXenoborgContraband ]
  id: EnergyDaggerLoudBlue
  suffix: blue
  components:
  - type: EnergySword
    colorOptions:
    - "#2288ff" # can only be blue
  # Sunrise-start
  - type: Scalpel
  - type: SurgeryTool
    successRate: 0.6
    startSound:
      path: /Audio/_Sunrise/Medical/Surgery/scalpel1.ogg
    endSound:
      path: /Audio/_Sunrise/Medical/Surgery/scalpel2.ogg
  # Sunrise-end
