コード例 #1
0
ファイル: Card.cs プロジェクト: longde123/grove
        public Card(CardParameters p)
        {
            Name                 = p.Name;
            ManaCost             = p.ManaCost;
            OverrideScore        = p.OverrideScore;
            Text                 = p.Text;
            FlavorText           = p.FlavorText;
            Illustration         = p.Illustration;
            MayChooseNotToUntap  = p.MayChooseToUntap;
            MinimalBlockerCount  = p.MinimalBlockerCount;
            ProducableManaColors = p.ManaColorsThisCardCanProduce;

            _strenght = new Strenght(p.Power, p.Toughness);
            _level    = new Level(p.IsLeveler ? 0 : (int?)null);
            _counters = new Counters(_strenght);
            _type     = new CardTypeCharacteristic(p.Type);
            _colors   = new CardColors(p.Colors);

            _protections = new Protections(p.ProtectionsFromColors, p.ProtectionsFromTypes);

            _simpleAbilities    = new SimpleAbilities(p.SimpleAbilities);
            _triggeredAbilities = new TriggeredAbilities(p.TriggeredAbilities);
            _activatedAbilities = new ActivatedAbilities(p.ActivatedAbilities);
            _staticAbilities    = new StaticAbilities(p.StaticAbilities);
            _castRules          = new CastRules(p.CastInstructions);
            _combatRules        = new CombatRules(p.CombatRules);
            _continuousEffects  = new ContiniousEffects(p.ContinuousEffects);

            JoinedBattlefield = new TrackableEvent(this);
            LeftBattlefield   = new TrackableEvent(this);
        }
コード例 #2
0
ファイル: Card.cs プロジェクト: leloulight/magicgrove
        public Card(CardParameters p)
        {
            Name = p.Name;
              ManaCost = p.ManaCost;
              OverrideScore = p.OverrideScore;
              Text = p.Text;
              FlavorText = p.FlavorText;
              Illustration = p.Illustration;
              MayChooseNotToUntap = p.MayChooseToUntap;
              MinimalBlockerCount = p.MinimalBlockerCount;
              ProducableManaColors = p.ManaColorsThisCardCanProduce;

              _strenght = new Strenght(p.Power, p.Toughness);
              _level = new Level(p.IsLeveler ? 0 : (int?) null);
              _counters = new Counters(_strenght);
              _type = new CardTypeCharacteristic(p.Type);
              _colors = new CardColors(p.Colors);

              _protections = new Protections(p.ProtectionsFromColors, p.ProtectionsFromTypes);

              _simpleAbilities = new SimpleAbilities(p.SimpleAbilities);
              _triggeredAbilities = new TriggeredAbilities(p.TriggeredAbilities);
              _activatedAbilities = new ActivatedAbilities(p.ActivatedAbilities);
              _staticAbilities = new StaticAbilities(p.StaticAbilities);
              _castRules = new CastRules(p.CastInstructions);
              _combatRules = new CombatRules(p.CombatRules);
              _continuousEffects = new ContiniousEffects(p.ContinuousEffects);

              JoinedBattlefield = new TrackableEvent(this);
              LeftBattlefield = new TrackableEvent(this);
        }
コード例 #3
0
ファイル: CardTemplate.cs プロジェクト: callumhutchy/grove
 private CastRule.Parameters GetDefaultCastInstructionParameters(CardParameters cp)
 {
     return(new CastRule.Parameters
     {
         Cost = new PayMana(cp.ManaCost ?? Mana.Zero, cp.HasXInCost),
         Text = string.Format("Cast {0}.", cp.Name),
         Effect = () => new CastPermanent(),
     });
 }
コード例 #4
0
ファイル: CardTemplate.cs プロジェクト: callumhutchy/grove
        private int GetDefaultManaSourcePriority(CardParameters cp)
        {
            if (cp.Type.Creature)
            {
                return(ManaSourcePriorities.Creature);
            }
            if (cp.Type.Land)
            {
                return(ManaSourcePriorities.Land);
            }

            return(ManaSourcePriorities.Land);
        }
コード例 #5
0
ファイル: CardTemplate.cs プロジェクト: callumhutchy/grove
 private static void SetDefaultTimingRules(CardParameters cp, CastRule.Parameters p)
 {
     if (cp.Type.Creature)
     {
         p.TimingRule(new DefaultCreaturesTimingRule());
     }
     else if (cp.Type.Land)
     {
         p.TimingRule(new DefaultLandsTimingRule());
     }
     else if (cp.Type.Artifact)
     {
         p.TimingRule(new OnFirstMain());
     }
 }
コード例 #6
0
ファイル: CardTemplate.cs プロジェクト: callumhutchy/grove
        public CardParameters CreateCardParameters()
        {
            var p = new CardParameters(this);

            foreach (var action in _init)
            {
                action(p);
            }

            if (p.Colors.Count == 0)
            {
                p.Colors.AddRange(GetCardColorsFromManaCost(p.ManaCost));
            }

            if (p.CastInstructions.Count == 0)
            {
                var castParams = GetDefaultCastInstructionParameters(p);
                SetDefaultTimingRules(p, castParams);
                p.CastInstructions.Add(new CastRule(castParams));
            }

            return(p);
        }
コード例 #7
0
ファイル: CardTemplate.cs プロジェクト: leloulight/magicgrove
        public Card CreateCard()
        {
            var p = new CardParameters();

              foreach (var action in _init)
              {
            action(p);
              }

              if (p.Colors.Count == 0)
              {
            p.Colors.AddRange(GetCardColorsFromManaCost(p.ManaCost));
              }

              if (p.CastInstructions.Count == 0)
              {
            var castParams = GetDefaultCastInstructionParameters(p);
            SetDefaultTimingRules(p, castParams);
            p.CastInstructions.Add(new CastRule(castParams));
              }

              return new Card(p);
        }
コード例 #8
0
ファイル: CardTemplate.cs プロジェクト: leloulight/magicgrove
        private int GetDefaultManaSourcePriority(CardParameters cp)
        {
            if (cp.Type.Creature)
            return ManaSourcePriorities.Creature;
              if (cp.Type.Land)
            return ManaSourcePriorities.Land;

              return ManaSourcePriorities.Land;
        }
コード例 #9
0
ファイル: CardTemplate.cs プロジェクト: leloulight/magicgrove
 private CastRule.Parameters GetDefaultCastInstructionParameters(CardParameters cp)
 {
     return new CastRule.Parameters
     {
       Cost = new PayMana(cp.ManaCost ?? Mana.Zero, ManaUsage.Spells, cp.HasXInCost),
       Text = string.Format("Cast {0}.", cp.Name),
       Effect = () => new PutIntoPlay(),
     };
 }
コード例 #10
0
ファイル: CardTemplate.cs プロジェクト: leloulight/magicgrove
 private static void SetDefaultTimingRules(CardParameters cp, CastRule.Parameters p)
 {
     if (cp.Type.Creature)
       {
     p.TimingRule(new DefaultCreaturesTimingRule());
       }
       else if (cp.Type.Land)
       {
     p.TimingRule(new DefaultLandsTimingRule());
       }
       else if (cp.Type.Artifact)
       {
     p.TimingRule(new OnFirstMain());
       }
 }
コード例 #11
0
 public CardBase(CardParameters cardParameters)
 {
     _parameters = new Characteristic <CardParameters>(cardParameters);
 }