- 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
      shape:
      - 0,0,4,5
      heldPrefix: riot
    - type: Blocking
      passiveBlockModifier:
        flatReductions:
          Blunt: 10
          Slash: 10
          Piercing: 10
          Heat: 10
    - type: Damageable
    - type: Injurable
      damageContainer: Shield
    - type: ExaminableDamage
      messages: ShieldMessages
    - type: StaticPrice
      price: 100

- type: entity
  abstract: true
  id: BaseShieldDestructible
  components:
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 125 #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: 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, BaseShieldDestructible, BaseSecurityContraband ]
  id: RiotShield
  description: A large tower shield. Good for controlling crowds.
  components:
    - type: StaticPrice
      price: 90
    - type: Blocking
      passiveBlockModifier:
        flatReductions:
          Blunt: 15
          Slash: 15
          Piercing: 5
          Heat: 5

- type: entity
  name: laser shield
  parent: [ BaseRepairableShield, BaseShieldDestructible, 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:
        flatReductions:
          Blunt: 5
          Slash: 10
          Piercing: 5
          Heat: 20

- type: entity
  name: ballistic shield
  parent: [ BaseRepairableShield, BaseShieldDestructible, 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:
        flatReductions:
          Blunt: 10
          Slash: 5
          Piercing: 20
          Heat: 5

#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:
        flatReductions:
          Blunt: 5
          Slash: 5
          Piercing: 5
          Heat: 5
    - type: Construction
      graph: WoodenBuckler
      node: woodenBuckler
    - type: Destructible
      thresholds:
      - trigger:
          !type:DamageTrigger
          damage: 75 #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:
        flatReductions:
          Blunt: 1
          Slash: 1
          Piercing: 1
          Heat: 1
    - type: Construction
      graph: CardShield
      node: cardShield
    - type: Destructible
      thresholds:
      - trigger:
          !type:DamageTrigger
          damage: 25 #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: Construction
      graph: MakeshiftShield
      node: makeshiftShield
    - type: Destructible
      thresholds:
      - trigger:
          !type:DamageTrigger
          damage: 75
        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:
        flatReductions:
          Blunt: 5
          Piercing: 1 # Scar told me to.
    - type: Construction
      graph: WebObjects
      node: shield
    - type: Destructible
      thresholds:
      - trigger:
          !type:DamageTrigger
          damage: 50
        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, BaseShieldDestructible ]
  id: ClockworkShield
  description: Ratvar oyrffrf lbh jvgu uvf cebgrpgvba.
  components:
    - type: Sprite
      state: ratvarian-icon
    - type: Item
      heldPrefix: ratvarian
      #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:
          Heat: 0.5
        flatReductions:
          Blunt: 5
          Slash: 10
          Piercing: 5
          Heat: 25
      blockSound: !type:SoundPathSpecifier
        path: /Audio/Effects/glass_step.ogg
    - type: Destructible
      thresholds:
      - trigger:
          !type:DamageTrigger
          damage: 50
        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: ItemToggleExaminableStatus
    - 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
      activatedShape:
      - 0,0,3,3
    - 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:
          Heat: 0.5
        flatReductions:
          Blunt: 5
          Piercing: 10
          Slash: 5
          Heat: 25
    - type: Appearance
    - type: Damageable
    - type: Injurable
      damageContainer: Shield
    - type: ExaminableDamage
      messages: EnergyShieldMessages
    - type: Destructible
      thresholds:
      - trigger:
          !type:DamageTrigger
          damage: 125
        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, BaseShieldDestructible ]
  id: TelescopicShield
  description: An advanced riot shield made of lightweight materials that collapses for easy storage.
  components:
    - type: ItemToggleExaminableStatus
      onText: item-toggle-examined-active
      offText: item-toggle-examined-not-active
    - 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
      activatedShape:
      - 0,0,3,3
    - type: Sprite
      sprite: Objects/Weapons/Melee/teleriot_shield.rsi
      layers:
        - state: teleriot-icon
        - state: teleriot-on
          visible: false
          map: [ "shield" ]
    - type: Item
      size: Small
      shape:
      - 0,0,1,1
      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: StaticPrice
      price: 150
