예제 #1
0
 public void GameEndUpdates()
 {
     if (UsedResources.Contains(CardResources.Devotion))
     {
         var devotion       = (PlayerDevotion)Resources.Single(x => x.ResourceType == CardResources.Devotion);
         var numPrayerUnits = DeployedUnits.Where(x => x.Unit.Tags.Contains(Tags.PrayerGain)).Count();
         devotion.SetLastingPrayer(numPrayerUnits);
     }
 }
예제 #2
0
    public bool AddPassive(Passive passive)
    {
        if (passive.SourceUpgrade != null)
        {
            if (passive.SourceUpgrade.ResourcePrerequisites.Any() && !passive.SourceUpgrade.ResourcePrerequisites.Intersect(UsedResources).Any())
            {
                return(false);
            }

            if (passive.SourceUpgrade.ClassPrerequisites.Any() && !passive.SourceUpgrade.ClassPrerequisites.Contains(PlayerClass))
            {
                return(false);
            }
        }

        Passives.Add(passive);

        var cardList = new List <Card>();

        cardList.AddRange(Deck.cardList);
        cardList.AddRange(Hand.cardList);
        cardList.AddRange(Graveyard.cardList);
        cardList.AddRange(Discard.cardList);
        cardList.AddRange(DeployedUnits.Select(x => x.Unit));
        cardList.AddRange(RedeployUnits);

        if (passive.CostAdjustment != null)
        {
            foreach (var card in cardList)
            {
                if (!card.IsHero)
                {
                    if (passive.PassiveApplies(card))
                    {
                        card.ModifyCost(passive.CostAdjustment);
                    }
                }
            }
        }

        if (passive.Enchantment != null)
        {
            foreach (var card in cardList.Where(x => x.Type == CardTypes.Unit).Cast <Unit>())
            {
                if (passive.PassiveApplies(card))
                {
                    card.AddEnchantment(passive.Enchantment);
                }
            }
        }

        switch (passive.SpecialPassive)
        {
        case SpecialPassiveEffects.LunarEclipse:
            foreach (var unit in DeployedUnits.Select(x => x.Unit))
            {
                unit.AddProtected(passive.SpecialPassiveProperty);
            }
            break;

        default:
            break;
        }

        return(true);
    }