当前位置: 首页>>代码示例>>C#>>正文


C# Card.Is方法代码示例

本文整理汇总了C#中Card.Is方法的典型用法代码示例。如果您正苦于以下问题:C# Card.Is方法的具体用法?C# Card.Is怎么用?C# Card.Is使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Card的用法示例。


在下文中一共展示了Card.Is方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CalculateCardInGraveyardScore

        public static int CalculateCardInGraveyardScore(Card card)
        {
            if (card.OverrideScore.Graveyard.HasValue)
            return card.OverrideScore.Graveyard.Value;

              if (card.Is().BasicLand)
            return 1;

              if (card.Is().Land)
            return 2;

              return card.ManaCost.Converted;
        }
开发者ID:leloulight,项目名称:magicgrove,代码行数:13,代码来源:ScoreCalculator.cs

示例2: CalculateDiscardScore

        public static int CalculateDiscardScore(Card card, bool isSearchInProgress)
        {
            if (isSearchInProgress && card.IsVisibleToSearchingPlayer == false)
              {
            return 220;
              }

              // the lower the score, the more likely card will be discarded
              var hand = card.Controller.Hand;
              var battlefield = card.Controller.Battlefield;

              if (card.Is().Land)
              {
            var landHandCount = hand.Count(x => x.Is().Land);
            var landBattlefieldCount = battlefield.Count(x => x.Is().Land);

            if ((landHandCount + landBattlefieldCount) < 4)
              return int.MaxValue;

            if (landHandCount < 2)
              return int.MaxValue;

            return 0 - 2*landBattlefieldCount;
              }

              return card.ConvertedCost;
        }
开发者ID:leloulight,项目名称:magicgrove,代码行数:27,代码来源:ScoreCalculator.cs

示例3: IsUsableNonbasicLand

        private bool IsUsableNonbasicLand(Card card, CardColor color1, CardColor? color2 = null)
        {
            if (!card.Is().Land)
            return false;

              var landColors = card.ProducableManaColors;

              if (landColors.Count == 0)
            return true;

              if (landColors.Count == 1)
              {
            if (landColors[0] == (int) CardColor.Colorless)
              return true;

            if (landColors[0] == (int) color1)
              return true;

            if (color2.HasValue && landColors[0] == (int) color2.Value)
              return true;

            return false;
              }

              if (!color2.HasValue)
            return false;

              return landColors.Contains((int) color1) &&
            landColors.Contains((int) color2.Value);
        }
开发者ID:leloulight,项目名称:magicgrove,代码行数:30,代码来源:DraftingStrategy.cs

示例4: GetRating

        protected double GetRating(Card card)
        {
            var baseRating = _ratings.GetRating(card.Name);

              if (card.Is().Creature && DraftedCards.Count(x => x.Is().Creature) < MinimalCreatures)
            baseRating += CreaturesBonus;

              return baseRating;
        }
开发者ID:leloulight,项目名称:magicgrove,代码行数:9,代码来源:DraftingStrategy.cs

示例5: CalculatePermanentScore

        public static int CalculatePermanentScore(Card permanent)
        {
            var score = 0;

              if (permanent.OverrideScore.Battlefield.HasValue)
            return permanent.OverrideScore.Battlefield.Value;

              if (permanent.Level > 0)
            score += 10*permanent.Level.Value;

              if (permanent.ManaCost != null)
              {
            score += CalculatePermanentScoreFromManaCost(permanent);

            if (permanent.Is().Creature)
            {
              score += (permanent.Power.Value*10 + permanent.Toughness.Value*3);

              if (permanent.HasSummoningSickness)
            score -= 1;
            }
              }
              else if (permanent.Is().Creature)
              {
            score += CalculatePermanentScoreFromPowerToughness(permanent.Power.Value, permanent.Toughness.Value);
              }
              else if (permanent.Is().Land)
              {
            score += GetLandOnBattlefieldScore(permanent);
            if (!permanent.Is().BasicLand)
              score += 10;
              }

              return score;
        }
开发者ID:leloulight,项目名称:magicgrove,代码行数:35,代码来源:ScoreCalculator.cs

示例6: CalculateTapPenalty

        public static int CalculateTapPenalty(Card card, TurnInfo turnInfo)
        {
            if (card.Is().Land)
              {
            if (card.Controller.IsActive)
            {
              if (turnInfo.Step == Step.Upkeep)
            return 10;

              return 2;
            }
              }

              return 1;
        }
开发者ID:leloulight,项目名称:magicgrove,代码行数:15,代码来源:ScoreCalculator.cs

示例7: WasPutIntoGraveyardThisTurnFromBattlefield

 private static bool WasPutIntoGraveyardThisTurnFromBattlefield(Card card, Game game)
 {
   return card.Is().Creature && game.Turn.Events.HasChangedZone(card, @from: Zone.Battlefield, to: Zone.Graveyard);
 }
开发者ID:leloulight,项目名称:magicgrove,代码行数:4,代码来源:NoRestForTheWicked.cs

示例8: TargetCreatureRemoval

        private bool TargetCreatureRemoval(Card target, TimingRuleParameters p)
        {
            if (!target.Is().Creature)
            return false;

              if (IsBeforeYouDeclareAttackers(p.Controller))
              {
            return target.CanBlock();
              }

              if (IsBeforeYouDeclareBlockers(p.Controller))
              {
            return target.IsAttacker;
              }

              if (_combatOnly)
            return false;

              if (StackHasInterestingSpells())
              {
            if (Stack.TopSpell.HasEffectTargets())
            {
              return Stack.TopSpell.HasEffectTarget(target);
            }

            // e.g Nantuko Shade gives self a +1/+1 boost
            if (Stack.TopSpell.TargetsEffectSource)
            {
              return target == Stack.TopSpell.Source.OwningCard;
            }
              }

              return false;
        }
开发者ID:leloulight,项目名称:magicgrove,代码行数:34,代码来源:TargetRemovalTimingRule.cs

示例9: TargetAuraRemoval

        private bool TargetAuraRemoval(Card target, TimingRuleParameters p)
        {
            if ((!target.Is().Aura && !target.Is().Equipment) || target.AttachedTo == null)
            return false;

              if (IsAfterOpponentDeclaresBlockers(p.Controller) && target.AttachedTo.IsBlocker)
              {
            return true;
              }

              if (IsAfterOpponentDeclaresAttackers(p.Controller) && target.AttachedTo.IsAttacker)
              {
            return true;
              }

              return false;
        }
开发者ID:leloulight,项目名称:magicgrove,代码行数:17,代码来源:TargetRemovalTimingRule.cs


注:本文中的Card.Is方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。