- 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: ExaminableDamage
      messages: ShieldMessages
    - 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: 100

- type: entity
  name: base repairable shield
  parent: BaseShield
  id: BaseRepairableShield
  description: A repairable shield!
  abstract: true
  components:
  - type: Repairable # Negative values represent healing
    damage:
      types:
        Blunt: -20
        Slash: -20
        Piercing: -20
        Heat: -20
    fuelCost: 10 # 1/2 of a Welder for a full repair
    doAfterDelay: 5
    allowSelfRepair: false

#Security Shields

- type: entity
  name: riot shield
  parent: [ BaseRepairableShield, BaseSecurityContraband ]
  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: [ BaseRepairableShield, BaseSecurityContraband ]
  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: [ BaseRepairableShield, BaseSecurityContraband ]
  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: cardboard shield
  parent: BaseShield
  id: CardShield
  description: A shield made of cardboard. Won't protect you from much.
  components:
    - type: Sprite
      state: cardshield-icon
    - type: Item
      heldPrefix: cardshield
    - type: Blocking
      passiveBlockModifier:
        coefficients:
          Blunt: 1
          Slash: 2
          Piercing: 0.6
          Heat: 3
      activeBlockModifier:
        coefficients:
          Blunt: 0.9
          Slash: 1.8
          Piercing: 0.5
          Heat: 2.5
        flatReductions:
          Blunt: 0.5
    - type: Construction
      graph: CardShield
      node: cardShield
    - type: Destructible
      thresholds:
      - trigger:
          !type:DamageTrigger
          damage: 25
        behaviors:
        - !type:DoActsBehavior
          acts: [ "Destruction" ]
      - trigger:
          !type:DamageTrigger
          damage: 10 #Very very weak shield
        behaviors:
        - !type:DoActsBehavior
          acts: [ "Destruction" ]
        - !type:PlaySoundBehavior
          sound: /Audio/Items/Toys/ToyFall2.ogg
        - !type:SpawnEntitiesBehavior
          spawn:
            MaterialCardboard:
              min: 2
              max: 4
    - type: StaticPrice
      price: 20

- type: entity
  name: makeshift shield
  parent: BaseRepairableShield
  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: BaseRepairableShield
  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, BaseMagicalContraband ]
  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, BaseSyndicateContraband]
  id: EnergyShield
  description: Exotic energy shield, when folded, can even fit in your pocket.
  components:
    - type: ItemToggle
      soundActivate:
        path: /Audio/Weapons/ebladeon.ogg
      soundDeactivate:
        path: /Audio/Weapons/ebladeoff.ogg
    - 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: ToggleableVisuals
      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: 2
      color: blue
    - type: ItemTogglePointLight
    - type: Reflect
      reflectProb: 0.95
      reflects:
        - Energy
    - type: Blocking
      passiveBlockModifier:
        coefficients:
          Blunt: 1.0
          Slash: 0.9
          Piercing: 0.85
          Heat: 0.6
      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: ExaminableDamage
      messages: EnergyShieldMessages
    - type: Destructible
      thresholds:
        - trigger:
            !type:DamageTrigger
            damage: 180
          behaviors:
            - !type:DoActsBehavior
              acts: [ "Destruction" ]
        - trigger:
            !type:DamageTrigger
            damage: 100
          behaviors:
            - !type:DoActsBehavior
              acts: [ "Destruction" ]
            - !type:PlaySoundBehavior
              sound:
                collection: GlassBreak
            - !type:SpawnEntitiesBehavior
              spawn:
                BrokenEnergyShield:
                  min: 1
                  max: 1
    - type: StaticPrice
      price: 350

- 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: entity
  name: telescopic shield
  parent: BaseRepairableShield
  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: ToggleableVisuals
      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: 150
