mlpcardgame/Classes/CardInfo.gd

42 lines
1.1 KiB
GDScript3
Raw Normal View History

extends Object
class_name CardInfo
var id := "unknown"
var name := "Unknown card"
var subname := "--"
var colors := []
var keywords := []
var traits := []
var requirements := {}
var cost := 0
var power := 0
var type := "None"
var text := "This card does not exist, if you see it it's because something failed loading"
var rarity := "UR"
var bonus := 0
var opponentPower := 0
func _init(cardEntry: Dictionary):
if not cardEntry.empty():
id = cardEntry.ID
name = cardEntry.Name
subname = cardEntry.Subname
colors = cardEntry.Element
keywords = cardEntry.Keywords
traits = cardEntry.Traits
type = cardEntry.Type
text = cardEntry.Text
rarity = cardEntry.Rarity
if cardEntry.has("Power"):
power = cardEntry.Power
if cardEntry.has("Cost"):
cost = cardEntry.Cost
if cardEntry.has("ProblemBonus"):
bonus = cardEntry.ProblemBonus
if cardEntry.has("Requirement"):
requirements = cardEntry.Requirement
elif cardEntry.has("ProblemRequirement"):
requirements = cardEntry.ProblemRequirement
if cardEntry.has("ProblemOpponentPower"):
opponentPower = cardEntry.ProblemOpponentPower