Exemplo n.º 1
0
        public Card(JSONTable template, ContentManager content)
        {
            name = template.getString("name");
            cost = ResourceAmount.createList(template.getJSON("cost", null));
            effect = Effect_Base.create(template.getArray("effect", null));
            if (template.hasKey("ongoing") || template.hasKey("triggers"))
            {
                ongoingType = new PermanentType(template, content);
            }
            image = content.Load<Texture2D>(template.getString("texture"));
            smallFrameTexture = content.Load<Texture2D>("square");
            Enum.TryParse<TargetType>(template.getString("target", "none"), out targetType);
            frameTexture = content.Load<Texture2D>("cardframe_large");
            description = DragonGfx.Tooltip.StringToLines(template.getString("description", ""), Game1.font, 100);
            upgradeCost = ResourceAmount.createList(template.getJSON("upgradeCost", null));
            targetTest = TriggerItemTest.create(template.getArray("targetTest", null));
            spellSet = template.getString("spellSet", null);

            foreach (JSONTable upgradeTemplate in template.getArray("upgrades", JSONArray.empty).asJSONTables())
            {
                if(upgrades == null)
                    upgrades = new List<Card>();

                upgrades.Add(new Card(upgradeTemplate, content));
            }

            switch (template.getString("type", null))
            {
                case "special":
                    frameColor = new Color(235, 200, 255);
                    break;
                case "minion":
                    frameColor = new Color(200, 255, 200);
                    break;
                case "production":
                    frameColor = new Color(255, 220, 190);
                    break;
                case "modifier":
                    frameColor = new Color(255, 190, 200);
                    break;
                default:
                    frameColor = Color.White;
                    break;
            }

            string id = template.getString("id", null);
            if (id != null)
            {
                cardsById.Add(id, this);
            }

            defaultUnlocked = template.getBool("unlocked", false);
            unlocked = defaultUnlocked;
        }
Exemplo n.º 2
0
 public Permanent(Permanent basis)
 {
     type = basis.type;
     position = basis.position;
     isEnemy = basis.isEnemy;
 }
Exemplo n.º 3
0
 public Permanent(PermanentType type, Point p, bool isEnemy)
 {
     this.type = type;
     position = p;
     this.isEnemy = isEnemy;
 }