- type: entity
  abstract: true
  parent: [ BaseItem, BaseMagicalContraband ]
  id: BaseSpellbook
  name: spellbook
  components:
    - type: Sprite
      sprite: Objects/Misc/books.rsi
      layers:
      - state: paper_blood
      - state: cover_strong
        color: "#645a5a"
      - state: decor_wingette_flat
        color: "#4d0303"
      - state: icon_pentagramm
        color: "#f7e19f"
    - type: Spellbook
    - type: Tag
      tags:
      - Spellbook

# For the Wizard antagonist
# Do not add discounts or price inflation
- type: entity
  parent: [ BaseItem, StorePresetSpellbook, BaseMagicalContraband ]
  id: WizardsGrimoire
  name: wizard's grimoire
  suffix: Wizard
  description: A heavy tome containing complicated arcane formulae for preparing magic spells and conjuring supernatural equipment. Decades of study went into researching this collection of mystical secrets; now go use them to ruin someone's day.
  components:
    - type: Sprite
      sprite: Objects/Misc/books.rsi
      layers:
      - state: paper_blood
      - state: cover_strong
        color: "#645a5a"
      - state: decor_wingette_flat
        color: "#4d0303"
      - state: icon_pentagramm
        color: "#f7e19f"
    - type: UserInterface
      interfaces:
        enum.StoreUiKey.Key:
          type: StoreBoundUserInterface
    - type: ActivatableUI
      key: enum.StoreUiKey.Key
    - type: Store
      refundAllowed: true
      ownerOnly: true # Lesser minds cannot comprehend the arcane secrets within
      balance:
        WizCoin: 10 # prices are balanced around this 10 point maximum and how strong the spells are
    # Harmony Start
    - type: MeleeThrowOnHit
      stunTime: 0
      distance: 1
      speed: 1
    - type: MeleeWeapon
      wideAnimationRotation: 45
      damage:
        types:
          Blunt: 5
    # Harmony end

# No-refund version meant for manual spawning, so people can't abuse refund if they were given a tome. Not meant for wizard antag proper!
- type: entity
  parent: WizardsGrimoire
  id: WizardsGrimoireNoRefund
  suffix: Wizard, no refunding
  components:
    - type: Store
      refundAllowed: false

# For debugging purposes only! Or spawn this for an admeme so a wizard can have every spell at once, I can't stop you.
- type: entity
  parent: WizardsGrimoire
  id: WizardsGrimoireDebug
  suffix: Wizard, DEBUG
  description: A heavy tome containing complicated arcane formulae for preparing magic spells and conjuring supernatural equipment. Someone wrote "FOR EXPERIMENTAL USE ONLY" on the inside cover.
  components:
    - type: Store
      ownerOnly: false # For ease of debugging.
      balance:
        WizCoin: 99999

- type: entity
  parent: BaseSpellbook
  id: SpawnSpellbook
  name: spawn spellbook
  components:
    - type: Spellbook
      spellActions:
        ActionSpawnMagicarpSpell: null

- type: entity
  parent: BaseSpellbook
  id: ForceWallSpellbook
  name: force wall spellbook
  components:
    - type: Sprite
      sprite: Objects/Misc/books.rsi
      layers:
      - state: paper
      - state: cover_strong
        color: "#366ed6"
      - state: decor_vertical_middle
        color: "#95ffff"
      - state: decor_wingette_circle
        color: "#95ffff"
      - state: icon_magic_forcewall
        shader: unshaded
      - state: detail_rivets
        color: gold
    - type: Spellbook
      spellActions:
        ActionForceWall: null

- type: entity
  parent: BaseSpellbook
  id: BlinkBook
  name: blink spellbook
  components:
    - type: Sprite
      sprite: Objects/Misc/books.rsi
      layers:
      - state: paper
      - state: cover_old
        color: "#657e9c"
      - state: icon_text3
      - state: decor_wingette_circle
        color: gold
      - state: icon_magic
      - state: detail_rivets
        color: gold
    - type: Spellbook
      spellActions:
        ActionBlink: null

- type: entity
  parent: BaseSpellbook
  id: SmiteBook
  name: smite spellbook
  components:
    - type: Sprite
      sprite: Objects/Misc/books.rsi
      layers:
      - state: paper
      - state: cover_old
        color: "#c42b40"
      - state: decor_wingette_circle
        color: gold
      - state: icon_magic
      - state: detail_rivets
        color: gold
      - state: detail_bookmark
        color: red
      - state: overlay_blood
    - type: Spellbook
      spellActions:
        ActionSmiteNoReq: null

- type: entity
  parent: BaseSpellbook
  id: KnockSpellbook
  name: knock spellbook
  components:
    - type: Sprite
      sprite: Objects/Misc/books.rsi
      layers:
      - state: paper
      - state: cover_strong
        color: "#117045"
      - state: decor_wingette_circle
        color: gold
      - state: icon_magic_knock
      - state: detail_rivets
        color: gold
      - state: detail_bookmark
        color: "#98c495"
    - type: Spellbook
      spellActions:
        ActionKnock: null

- type: entity
  parent: BaseSpellbook
  id: FireballSpellbook
  name: fireball spellbook
  components:
    - type: Sprite
      sprite: Objects/Misc/books.rsi
      layers:
      - state: paper
      - state: cover_old
        color: "#ba5a14"
      - state: decor_wingette_circle
        color: gold
      - state: detail_rivets
        color: gold
      - state: detail_bookmark
        color: "#e89b3c"
      - state: overlay_blood
      - state: icon_magic_fireball
        shader: unshaded
    - type: Spellbook
      spellActions:
        ActionFireball: null

- type: entity
  parent: BaseSpellbook
  id: ScrollRunes
  name: scroll of runes
  components:
  - type: Item
    size: Normal
  - type: Sprite
    sprite: Objects/Magic/magicactions.rsi
    layers:
    - state: spell_default
  - type: Spellbook
    spellActions:
      ActionFlashRune: null
      ActionExplosionRune: null
      ActionIgniteRune: null
      ActionStunRune: null
