Exemplo n.º 1
0
        public static Card AddGiftSpellCard(SpellDto spellDto, CardData CardData, Deck ActiveDeck)
        {
            double placeholderWidth;
            double placeholderHeight;
            Card   scroll = CreateSpellCard("Gift", spellDto, CardData, ActiveDeck);

            scroll.Description            = GetSpellDescription(spellDto, true);
            scroll.AdditionalInstructions = "Give this spell scroll to a player, NPC, or monster (enter their name below).";
            scroll.AlertMessage           = $"{userName} gave the {spellDto.name} spell scroll to {recipient}.";
            scroll.Expires = CardExpires.Never;
            CardFactory.AddPlayerNpcRecipientField(CardData, scroll, "scroll");
            if (!CardStyles.Apply(scroll))
            {
                int randomValue = CardFactory.random.Next(0, 100);
                if (randomValue < 40)
                {
                    placeholderWidth  = 155;
                    placeholderHeight = 152;
                    scroll.StylePath  = "Scrolls\\Rods";
                }
                else if (randomValue < 60)
                {
                    placeholderWidth  = 131;
                    placeholderHeight = 130;
                    scroll.StylePath  = "Scrolls\\Smooth Light";
                }
                else
                {
                    placeholderWidth  = 128;
                    placeholderHeight = 127;
                    scroll.StylePath  = "Scrolls\\Tan";
                }
                scroll.ScalePlaceholder(placeholderWidth, placeholderHeight);
            }
            return(scroll);
        }
Exemplo n.º 2
0
        public static Card AddCastSpellCard(SpellDto spellDto, CardData cardData, Deck activeDeck)
        {
            Card card = CreateSpellCard("Cast", spellDto, cardData, activeDeck);

            card.Description = GetSpellDescription(spellDto, false);
            card.Expires     = CardExpires.Immediately;
            string       alertMessage;
            const double witchcraftPlaceholderSize = 174;

            if (!CardStyles.Apply(card))
            {
                switch (CardFactory.random.Next(0, 4))
                {
                case 0:
                    card.StylePath = "Witchcraft\\Common";
                    break;

                case 1:
                    card.StylePath = "Witchcraft\\Rare";
                    break;

                case 2:
                    card.StylePath = "Witchcraft\\Epic";
                    break;

                case 3:
                    card.StylePath = "Witchcraft\\Legendary";
                    break;
                }
            }
            card.ScalePlaceholder(witchcraftPlaceholderSize);
            if (!string.IsNullOrWhiteSpace(spellDto.targetingPrompt))
            {
                // TODO: Shorten Description MaxHeight.
                Field targetField = new Field(card)
                {
                    Name     = "target",
                    Label    = spellDto.targetingPrompt,
                    Required = spellDto.targetingPrompt.ToLower().IndexOf("optional") < 0,
                    IsDirty  = true
                };
                if (TargetsOne(spellDto))
                {
                    targetField.Type = FieldType.Text;
                }
                else
                {
                    targetField.Type = FieldType.LongText;
                }

                cardData.AllKnownFields.Add(targetField);
                alertMessage = $"{userName} casts {spellDto.name}, targeting {target}.";
            }
            else
            {
                alertMessage = $"{userName} casts {spellDto.name}.";
            }
            card.AlertMessage = alertMessage;

            card.Rarity = Rarity.Legendary;
            return(card);
        }