- type: entity
  name: base shield
  parent: BaseItem
  id: BaseShield
  description: A shield!
  abstract: true
  components:
    - type: Sprite
      sprite: Objects/Weapons/Melee/shields.rsi
      state: riot-icon
    - type: Item
      sprite: Objects/Weapons/Melee/shields.rsi
      size: Ginormous
      heldPrefix: riot
    - type: Blocking
      passiveBlockModifier:
        coefficients:
          Blunt: 0.9
          Slash: 0.9
          Piercing: 0.9
          Heat: 0.9
      activeBlockModifier:
        coefficients:
          Blunt: 0.8
          Slash: 0.8
          Piercing: 0.8
          Heat: 0.8
        flatReductions:
          Blunt: 1
          Slash: 1
          Piercing: 1
          Heat: 1
    - type: Damageable
      damageContainer: Shield
    - type: Destructible
      thresholds:
        - trigger:
            !type:DamageTrigger
            damage: 140
          behaviors:
            - !type:DoActsBehavior
              acts: [ "Destruction" ]
        - trigger:
            !type:DamageTrigger
            damage: 100 #This is probably enough damage before it breaks
          behaviors:
            - !type:DoActsBehavior
              acts: [ "Destruction" ]
            - !type:PlaySoundBehavior
              sound:
                collection: MetalBreak
            - !type:SpawnEntitiesBehavior
              spawn:
                SheetSteel:
                  min: 2
                  max: 2
                SheetGlass:
                  min: 2
                  max: 2
    - type: StaticPrice
      price: 50 # Frontier: 100<50 - TODO: material value rework

#Security Shields

- type: entity
  name: riot shield
  parent: BaseShield
  id: RiotShield
  description: A large tower shield. Good for controlling crowds.
  components:
    - type: StaticPrice
      price: 90
    - type: Blocking
      passiveBlockModifier:
        coefficients:
          Blunt: 0.7
          Slash: 0.7
      activeBlockModifier:
        coefficients:
          Blunt: 0.5
          Slash: 0.5
        flatReductions:
          Blunt: 1
          Slash: 1

- type: entity
  name: laser shield
  parent: BaseShield
  id: RiotLaserShield
  description: A shield built for withstanding lasers, but not much else.
  components:
    - type: Sprite
      state: riot_laser-icon
    - type: Item
      heldPrefix: riot_laser
    - type: Blocking
      passiveBlockModifier:
        coefficients:
          Heat: 0.7
      activeBlockModifier:
        coefficients:
          Heat: 0.5
        flatReductions:
          Heat: 1

- type: entity
  name: ballistic shield
  parent: BaseShield
  id: RiotBulletShield
  description: A shield built for protecting against ballistics, but not much else.
  components:
    - type: Sprite
      state: riot_bullet-icon
    - type: Item
      heldPrefix: riot_bullet
    - type: Blocking
      passiveBlockModifier:
        coefficients:
          Piercing: 0.7
      activeBlockModifier:
        coefficients:
          Piercing: 0.5
        flatReductions:
          Piercing: 1

#Craftable shields

- type: entity
  name: wooden buckler
  parent: BaseShield
  id: WoodenBuckler
  description: A small round wooden makeshift shield.
  components:
    - type: Sprite
      state: buckler-icon
    - type: Item
      heldPrefix: buckler
    - type: Blocking
      passiveBlockModifier:
        coefficients:
          Blunt: 0.95
          Slash: 0.95
          Piercing: 0.95
          Heat: 2
      activeBlockModifier:
        coefficients:
          Blunt: 0.85
          Slash: 0.85
          Piercing: 0.85
          Heat: 2
        flatReductions:
          Blunt: 1
          Slash: 1
          Piercing: 1
    - type: Construction
      graph: WoodenBuckler
      node: woodenBuckler
    - type: Destructible
      thresholds:
        - trigger:
            !type:DamageTrigger
            damage: 60
          behaviors:
            - !type:DoActsBehavior
              acts: [ "Destruction" ]
        - trigger:
            !type:DamageTrigger
            damage: 30 #Weaker shield
          behaviors:
            - !type:DoActsBehavior
              acts: [ "Destruction" ]
            - !type:PlaySoundBehavior
              sound:
                collection: WoodDestroy
            - !type:SpawnEntitiesBehavior
              spawn:
                MaterialWoodPlank:
                  min: 5
                  max: 5
    - type: StaticPrice
      price: 150

- type: entity
  name: makeshift shield
  parent: BaseShield
  id: MakeshiftShield
  description: A rundown looking shield, not good for much.
  components:
    - type: Sprite
      state: makeshift-icon
    - type: Item
      heldPrefix: metal
    - type: Blocking
      passiveBlockModifier:
        coefficients:
          Blunt: 0.95
          Slash: 0.95
          Piercing: 0.95
          Heat: 0.9
      activeBlockModifier:
        coefficients:
          Blunt: 0.85
          Slash: 0.85
          Piercing: 0.85
          Heat: 0.8
        flatReductions:
          Blunt: 0.5
          Slash: 0.5
          Piercing: 0.5
          Heat: 1
    - type: Construction
      graph: MakeshiftShield
      node: makeshiftShield
    - type: Destructible
      thresholds:
        - trigger:
            !type:DamageTrigger
            damage: 40
          behaviors:
            - !type:DoActsBehavior
              acts: [ "Destruction" ]
        - trigger:
            !type:DamageTrigger
            damage: 20 #Very weak shield
          behaviors:
            - !type:DoActsBehavior
              acts: [ "Destruction" ]
            - !type:PlaySoundBehavior
              sound:
                collection: MetalBreak
            - !type:SpawnEntitiesBehavior
              spawn:
                SheetSteel:
                  min: 1
                  max: 2

- type: entity
  name: web shield
  parent: BaseShield
  id: WebShield
  description: A stringy shield. It's weak, and doesn't seem to do well against heat.
  components:
    - type: Sprite
      sprite: Objects/Weapons/Melee/web-shield.rsi
      state: icon
    - type: Item
      sprite: Objects/Weapons/Melee/web-shield.rsi
      heldPrefix: icon
    - type: Blocking
      passiveBlockModifier:
        coefficients:
          Blunt: 0.95
          Slash: 0.95
          Piercing: 0.95
      activeBlockModifier:
        coefficients:
          Blunt: 0.85
          Slash: 0.85
          Piercing: 0.85
        flatReductions:
          Blunt: 0.5
          Slash: 0.5
          Piercing: 0.5
    - type: Construction
      graph: WebObjects
      node: shield
    - type: Destructible
      thresholds:
        - trigger:
            !type:DamageTrigger
            damage: 40
          behaviors:
            - !type:DoActsBehavior
              acts: [ "Destruction" ]
        - trigger:
            !type:DamageTrigger
            damage: 20
          behaviors:
            - !type:DoActsBehavior
              acts: [ "Destruction" ]
            - !type:SpawnEntitiesBehavior
              spawn:
                MaterialWebSilk:
                  min: 1
                  max: 1
            - !type:PlaySoundBehavior
              sound:
                collection: WoodDestroy

#Magic/Cult Shields (give these to wizard for now)

- type: entity
  name: clockwork shield
  parent: BaseShield
  id: ClockworkShield
  description: Ratvar oyrffrf lbh jvgu uvf cebgrpgvba.
  components:
    - type: Sprite
      state: ratvarian-icon
    - type: Item
      heldPrefix: ratvarian
    - type: Blocking
      passiveBlockModifier:
        coefficients:
          Blunt: 0.8
          Slash: 0.8
          Piercing: 0.8
          Heat: 1.5
      activeBlockModifier:
        coefficients:
          Blunt: 0.7
          Slash: 0.7
          Piercing: 0.7
          Heat: 1.5
        flatReductions:
          Blunt: 1
          Slash: 1
          Piercing: 1
      #Have it break into brass when clock cult is in

- type: entity
  name: mirror shield
  parent: BaseShield
  id: MirrorShield
  description: Eerily glows red... you hear the geometer whispering
  components:
    - type: Sprite
      state: mirror-icon
    - type: Item
      heldPrefix: mirror
    - type: Reflect
      reflectProb: 0.95
      reflects:
        - Energy
    - type: Blocking #Mirror shield reflects heat/laser, but is relatively weak to everything else.
      passiveBlockModifier:
        coefficients:
          Blunt: 1.2
          Slash: 1.2
          Piercing: 1.2
          Heat: .7
      activeBlockModifier:
        coefficients:
          Blunt: 1.2
          Slash: 1.2
          Piercing: 1.2
          Heat: .6
        flatReductions:
          Heat: 1
      blockSound: !type:SoundPathSpecifier
        path: /Audio/Effects/glass_step.ogg
    - type: Destructible
      thresholds:
        - trigger:
            !type:DamageTrigger
            damage: 40
          behaviors:
            - !type:DoActsBehavior
              acts: [ "Destruction" ]
            - !type:PlaySoundBehavior
              sound:
                collection: GlassBreak
            - !type:SpawnEntitiesBehavior
              spawn:
                SheetGlass:
                  min: 5
                  max: 5

- type: entity
  name: energy shield
  parent: BaseItem
  id: EnergyShield
  description: Exotic energy shield, when folded, can even fit in your pocket.
  components:
    - type: ItemToggle
      predictable: false # WD EDIT
      soundActivate:
        path: /Audio/Weapons/ebladeon.ogg
      soundDeactivate:
        path: /Audio/Weapons/ebladeoff.ogg
      # WD EDIT START
      soundFailToActivate:
        path: /Audio/Machines/button.ogg
        params:
          variation: 0.250
      # WD EDIT END
    - type: ItemToggleActiveSound
      activeSound:
        path: /Audio/Weapons/ebladehum.ogg
    - type: ItemToggleSize
      activatedSize: Huge
    - type: ComponentToggler
      components:
      - type: DisarmMalus
        malus: 0.6
    - type: Sprite
      sprite: Objects/Weapons/Melee/e_shield.rsi
      layers:
        - state: eshield-icon
        - state: eshield-on
          color: "#FFFFFF"
          visible: false
          shader: unshaded
          map: [ "shield" ]
    - type: Item
      size: Small
      sprite: Objects/Weapons/Melee/e_shield.rsi
      heldPrefix: eshield
    - type: UseDelay
      delay: 0.5
    - type: ToggleableLightVisuals
      spriteLayer: shield
      inhandVisuals:
        left:
          - state: inhand-left-shield
            shader: unshaded
        right:
          - state: inhand-right-shield
            shader: unshaded
    - type: PointLight
      netsync: false
      enabled: false
      radius: 1.5
      energy: 0.7 # WD EDIT
      color: "#678AD9" # WD EDIT
    - type: ItemTogglePointLight
    - type: Reflect
      reflectProb: 1 # WD EDIT
      damageOnReflectModifier: 1 # Goob edit
      reflects:
        - Energy
    - type: Blocking
      passiveBlockModifier:
        coefficients:
          Blunt: 1.0
          Slash: 0.9
          Piercing: 0.85
          Heat: 0.5 # WD EDIT
      activeBlockModifier:
        coefficients:
          Blunt: 1.2
          Slash: 0.85
          Piercing: 0.5
          Heat: 0.4
        flatReductions:
          Heat: 1
          Piercing: 1
    - type: Appearance
    - type: Damageable
      damageContainer: Shield
    - type: StaticPrice
      price: 350
      # WD EDIT START
    - type: Battery
      maxCharge: 60
      startingCharge: 60
    - type: BatterySelfRecharger
      autoRecharge: true
      autoRechargeRate: 5
    - type: RechargeableBlocking
      # WD EDIT END

- type: entity
  name: broken energy shield
  parent: BaseItem
  id: BrokenEnergyShield
  description: Something inside is burned out, it is no longer functional.
  components:
    - type: Sprite
      sprite: Objects/Weapons/Melee/e_shield.rsi
      state: eshield-icon
    - type: Item
      sprite: Objects/Weapons/Melee/e_shield.rsi
      size: Small
      heldPrefix: eshield
    - type: StaticPrice
      price: 15

- type: entity
  name: telescopic shield
  parent: BaseShield
  id: TelescopicShield
  description: An advanced riot shield made of lightweight materials that collapses for easy storage.
  components:
    - type: ItemToggle
      soundActivate:
        path: /Audio/Weapons/telescopicon.ogg
        params:
          volume: -5
      soundDeactivate:
        path: /Audio/Weapons/telescopicoff.ogg
        params:
          volume: -5
    - type: ComponentToggler
      components:
      - type: DisarmMalus
        malus: 0.6
    - type: ItemToggleSize
      activatedSize: Huge
    - type: Sprite
      sprite: Objects/Weapons/Melee/teleriot_shield.rsi
      layers:
        - state: teleriot-icon
        - state: teleriot-on
          visible: false
          map: [ "shield" ]
    - type: Item
      size: Small
      sprite: Objects/Weapons/Melee/teleriot_shield.rsi
      heldPrefix: teleriot
    - type: UseDelay
      delay: 0.5
    - type: ToggleableLightVisuals
      spriteLayer: shield
      inhandVisuals:
        left:
          - state: inhand-left-shield
        right:
          - state: inhand-right-shield
    - type: Appearance
    - type: Destructible
      thresholds:
        - trigger:
            !type:DamageTrigger
            damage: 100
          behaviors:
            - !type:DoActsBehavior
              acts: [ "Destruction" ]
        - trigger:
            !type:DamageTrigger
            damage: 70
          behaviors:
            - !type:DoActsBehavior
              acts: [ "Destruction" ]
            - !type:PlaySoundBehavior
              sound:
                collection: MetalGlassBreak
            - !type:SpawnEntitiesBehavior
              spawn:
                SheetSteel:
                  min: 1
                  max: 1
                SheetGlass:
                  min: 2
                  max: 2
    - type: StaticPrice
      price: 250
