- type: entity
  abstract: true
  parent: BaseItem
  id: BaseDice
  components:
  - type: Dice
  - type: UseDelay
  - type: Sprite
    sprite: Objects/Fun/dice.rsi
    noRot: true # If their sprites rotate, the number becomes even more illegible than usual.
  - type: Tag
    tags:
    - Dice
  - type: Item
    size: Tiny

- type: entity
  parent: BaseDice
  id: PercentileDie
  name: percentile die
  description: A die with ten sides. Works better for d100 rolls than a golf ball.
  components:
  - type: Dice
    sides: 10
    multiplier: 10
    offset: 1 # first side is a 0
    currentValue: 0
  - type: Sprite
    state: percentile_0

- type: entity
  parent: BaseDice
  id: d20Dice
  name: d20
  description: A die with twenty sides. The preferred die to throw at the GM.
  components:
  - type: Dice
    sides: 20
    currentValue: 20
  - type: Sprite
    state: d20_20

- type: entity
  parent: BaseDice
  id: d12Dice
  name: d12
  description: A die with twelve sides. There's an air of neglect about it.
  components:
  - type: Dice
    sides: 12
    currentValue: 12
  - type: Sprite
    state: d12_12

- type: entity
  parent: BaseDice
  id: d10Dice
  name: d10
  description: A die with ten sides. Useful for percentages.
  components:
  - type: Dice
    sides: 10
    offset: 1
    currentValue: 0
  - type: Sprite
    state: d10_0

- type: entity
  parent: BaseDice
  id: d8Dice
  name: d8
  description: A die with eight sides. It feels... lucky.
  components:
  - type: Dice
    sides: 8
    currentValue: 8
  - type: Sprite
    state: d8_8

- type: entity
  parent: BaseDice
  id: d6Dice
  name: d6
  description: A die with six sides. Basic and serviceable.
  components:
  - type: Dice
    sides: 6
    currentValue: 6
  - type: Sprite
    state: d6_6

- type: entity
  parent: d6Dice
  id: d6DiceTricked
  suffix: Tricked
  components:
  - type: Dice
    weightedProb: 0.5
    weightedValue: 6

- type: entity
  parent: BaseDice
  id: d4Dice
  name: d4
  description: A die with four sides. The nerd's caltrop.
  components:
  - type: Dice
    sides: 4
    currentValue: 4
  - type: Sprite
    state: d4_4
  - type: CollisionWake
    enabled: false
  - type: Fixtures
    fixtures:
      slips:
        shape:
          !type:PhysShapeAabb
          bounds: "-0.2,-0.2,0.2,0.2"
        hard: false
        layer:
        - LowImpassable
      fix1:
        shape:
          !type:PhysShapeAabb
          bounds: "-0.2,-0.2,0.2,0.2"
        density: 30
        mask:
        - ItemMask
  - type: StepTrigger
    intersectRatio: 0.2
  - type: TriggerOnStepTrigger
  - type: PreventableStepTrigger
  - type: Slippery
    slipSound:
      path: /Audio/Effects/glass_step.ogg
    slipData:
      launchForwardsMultiplier: 0
  - type: DamageOnTrigger
    targetUser: true
    damage:
      types:
        Piercing: 5
    # I love this

- type: entity
  parent: BaseCoin
  id: d2Dice
  name: Heads or Tails Coin
  description: Some sort of two-sided die. Designed to represent the struggle between Nanotrasen and the Syndicate.
  components:
  - type: Sprite
    state: d2_1

- type: entity
  parent: d2Dice
  id: d2DiceTricked
  suffix: Tricked
  components:
  - type: Dice
    weightedValue: 2


# bags

- type: entity
  parent: BaseStorageItem
  id: DiceBag
  name: bag of dice
  description: Contains all the luck you'll ever need.
  components:
  - type: EntityTableContainerFill
    containers:
      storagebase: !type:AllSelector
        children:
        - id: d4Dice
        - id: d6Dice
        - id: d8Dice
        - id: d10Dice
        - id: d12Dice
        - id: d20Dice
        - id: PercentileDie
        - id: d2Dice
  - type: Sprite
    sprite: Objects/Fun/dice.rsi
    state: dicebag
  - type: Item
    size: Small
  - type: Storage
    grid:
    - 0,0,3,1
    whitelist:
      tags:
      - Dice

- type: entity
  parent: DiceBag
  id: MagicDiceBag
  name: bag of dice
  components:
  - type: Sprite
    sprite: Objects/Fun/dice.rsi
    state: magicdicebag
  - type: Storage
    grid:
    - 0,0,4,3
