Skip to content

Adding Cards

AgentCucco edited this page Nov 29, 2021 · 8 revisions

Function syntax.

Encyclopedia.AddCard(itemTab)
  • ItemTab: 'table'. A table containing the main arguments for the item.

List of arguments in ItemTab:

  • General Pocket item arguments
  • Adding a custom Sprite is heavily advised, as the Encyclopedia will default any modded cards to the Playing Card sprite.

How to add a card to the encyclopedia.

You can choose to register your card differently depending on how much effort you wanna put into the encyclopedia compatibility.

Just the card with no wiki.

local MyMod = RegisterMod("Super Mod", 1)
local FunkyCard = Isaac.GetCardIdByName("Funky Card")

if Encyclopedia then

Encyclopedia.AddCard({
  ID = FunkyCard,
  Sprite = Encyclopedia.RegisterSprite("mod.path/content/gfx/ui_cardfronts.anm2", "Funky Card"),
})

end

The card with no wiki or pools, but with a name tweak.

local MyMod = RegisterMod("Super Mod", 1)
local FunkyCard = Isaac.GetCardIdByName("<Funky Card>")

if Encyclopedia then

Encyclopedia.AddCard({
  ID = FunkyCard,
  Name = "Funky Card",
  Sprite = Encyclopedia.RegisterSprite("mod.path/content/gfx/ui_cardfronts.anm2", "Funky Card"),
})

end

The card with a manual wiki.

local MyMod = RegisterMod("Super Mod", 1)
local FunkyCard = Isaac.GetCardIdByName("Funky Card")

if Encyclopedia then

local Wiki = {
  Funky = {
    { -- Effect
      {str = "Effect", fsize = 2, clr = 3, halign = 0},
      {str = "Gives you some massive funk boost."},
      {str = "If you get enough funk boost (20), summon Funky Kong."},
      {str = "+1 Funk point when you are funky."},
    },
    { -- Trivia
      {str = "Trivia", fsize = 2, clr = 3, halign = 0},
      {str = "I made this card because I honestly really like funky kong."},
    },
  }
}

Encyclopedia.AddCard({
  ID = FunkyCard,
  WikiDesc = Wiki.Funky,
  Sprite = Encyclopedia.RegisterSprite("mod.path/content/gfx/ui_cardfronts.anm2", "Funky Card"),
})

end

The card with an EID wiki.

local MyMod = RegisterMod("Super Mod", 1)
local FunkyCard = Isaac.GetCardIdByName("Funky Card")

local FunkyDescription = "{{ArrowUp}} Gives you a lot of funk. #If you get enough funk, you will summon Funky Kong."

if EID then

EID:addCard(FunkyCard, FunkyDescription)

end

if Encyclopedia then

Encyclopedia.AddCard({
  ID = FunkyCard,
  WikiDesc = Encyclopedia.EIDtoWiki(FunkyDescrption),
  Sprite = Encyclopedia.RegisterSprite("mod.path/content/gfx/ui_cardfronts.anm2", "Funky Card"),
})

end

If you have a big mod.

local MyMod = RegisterMod("Super Mod", 1)
local FunkyCard = Isaac.GetCardIdByName("Funky Card")

local FunkyDescription = "{{ArrowUp}} Gives you a lot of funk. #If you get enough funk, you will summon Funky Kong."

if Encyclopedia then

Encyclopedia.AddCard({
  Class = "Funky Kong Pack (25+ Cards)",
  ID = FunkyCard,
  WikiDesc = Encyclopedia.EIDtoWiki(FunkyDescrption),
  Sprite = Encyclopedia.RegisterSprite("mod.path/content/gfx/ui_cardfronts.anm2", "Funky Card"),
})

end

If you have a custom display system.

local MyMod = RegisterMod("Super Mod", 1)
local FunkyCard = Isaac.GetCardIdByName("Funky Card")

if Encyclopedia then

Encyclopedia.AddCard({
  ID = FunkyCard,
  Sprite = Encyclopedia.RegisterSprite("mod.path/content/gfx/ui_cardfronts.anm2", "Funky Card"),
  StatusFunc = function(self)
    self.Name = "Funky Mode!"

    return self
  end,
})

end

If you have a custom unlock.

local MyMod = RegisterMod("Super Mod", 1)
local FunkyCard = Isaac.GetCardIdByName("Funky Card")
local FunkyCardUnlocked = false

if Encyclopedia then

Encyclopedia.AddCard({
  ID = FunkyCard,
  Sprite = Encyclopedia.RegisterSprite("mod.path/content/gfx/ui_cardfronts.anm2", "Funky Card"),
  UnlockFunc = function(self)
    if not FunkyCardUnlocked then
      self.Desc = "Defeat Funky Kong to unlock"
      
      return self
    end
  end,
})

end

Clone this wiki locally