Example #1
0
 public PermanentCountManaOutput(ManaColor color, Func <Card, bool> filter,
                                 ControlledBy controlledBy = ControlledBy.SpellOwner)
 {
     _color        = color;
     _filter       = filter;
     _controlledBy = controlledBy;
 }
Example #2
0
   public EffectRankBy(Func<Card, int> rank, ControlledBy controlledBy = ControlledBy.Any,
 Func<Card, int> forceRank = null)
   {
       _rank = rank;
         _forceRank = forceRank ?? _rank;
         _controlledBy = controlledBy;
   }
Example #3
0
        public TargetValidatorParameters Card(Func<Card, bool> filter = null, ControlledBy? controlledBy = null)
        {
            filter = filter ?? delegate { return true; };

            _p.IsValidTarget = p =>
            {
                var hasValidController = controlledBy == null || HasValidController(
                  p.Target.Controller(),
                  p.Controller,
                  controlledBy.Value);

                if (p.Target.IsCard())
                {
                    return hasValidController &&
                      filter(p.Target.Card());
                }

                if (p.Target.IsEffect())
                {
                    return hasValidController &&
                      filter(p.Target.Effect().Source.OwningCard);
                }

                return false;
            };

            return _p;
        }
   public ApplyModifiersToPermanents(Func<Effect, Card, bool> selector,
 ControlledBy controlledBy = ControlledBy.Any, params CardModifierFactory[] modifiers)
   {
       _controlledBy = controlledBy;
         _selector = selector ?? delegate { return true; };
         _modifiers.AddRange(modifiers);
   }
Example #5
0
 public ApplyModifiersToPermanents(Func <Effect, Card, bool> selector,
                                   ControlledBy controlledBy = ControlledBy.Any, params CardModifierFactory[] modifiers)
 {
     _controlledBy = controlledBy;
     _selector     = selector ?? delegate { return(true); };
     _modifiers.AddRange(modifiers);
 }
Example #6
0
 public EffectRankBy(Func <Card, int> rank, ControlledBy controlledBy = ControlledBy.Any,
                     Func <Card, int> forceRank = null)
 {
     _rank         = rank;
     _forceRank    = forceRank ?? _rank;
     _controlledBy = controlledBy;
 }
Example #7
0
	public Town(Vector2 position, ControlledBy controlledBy, ElementTypes type, bool playerPresent) {
		_position = position;
		_controlledBy = controlledBy;
		_elementType = type;
		_playerPresent = playerPresent;
		_adjacentTownIndexes = new List<int>();
		_underAttack = false;
		_turnsUntilTaken = 0;
	}
Example #8
0
 public void Send(string message)
 {
     if (ControlledBy != null)
     {
         ControlledBy.Send(message);
     }
     if (ImpersonatedBy != null)
     {
         ImpersonatedBy.Send(message);
     }
 }
        public CreaturesOfChosenTypeGainPT(int power, int toughness, ControlledBy controlledBy = ControlledBy.Any)
        {
            _power        = power;
            _toughness    = toughness;
            _controlledBy = controlledBy;

            if (_toughness < 0)
            {
                ToughnessReduction = Math.Abs(_toughness);
            }
        }
        public ModifyPowerToughnessForEachPermanent(int?power, int?toughness, CardSelector filter,
                                                    Func <IntegerModifier> modifier, ControlledBy controlledBy = ControlledBy.SpellOwner)
        {
            _modifyPower     = power;
            _modifyToughness = toughness;
            _filter          = filter;
            _controlledBy    = controlledBy;

            _toughnessModifier = modifier();
            _powerModifier     = modifier();
        }
        public IEnumerable <T> Candidates <T>(
            ControlledBy controlledBy = ControlledBy.Any,
            int selectorIndex         = 0,
            Func <TargetsCandidates, IList <TargetCandidates> > selector = null)
            where T : ITarget
        {
            Asrt.True(_candidates.HasCost || _candidates.HasEffect,
                      "No target selectors found, use AddEffect or AddCost to add them!");

            TargetCandidates candidates = null;

            if (selector == null)
            {
                candidates = _candidates.HasCost
          ? _candidates.Cost[selectorIndex]
          : _candidates.Effect[selectorIndex];
            }
            else
            {
                candidates = selector(_candidates)[selectorIndex];
            }

            switch (controlledBy)
            {
            case (ControlledBy.Opponent):
            {
                return(candidates
                       .Where(x => x.Controller() == Controller.Opponent && x is T)
                       .Select(x => (T)x));
            }

            case (ControlledBy.SpellOwner):
            {
                return(candidates
                       .Where(x => x.Controller() == Controller && x is T)
                       .Select(x => (T)x));
            }
            }

            return(candidates.OfType <T>());
        }
Example #12
0
	public void setControlledBy(ControlledBy controlledBy) {
		_controlledBy = controlledBy;
	}
Example #13
0
 public TargetValidatorParameters Creature(ControlledBy? controlledBy = null)
 {
     return Card(x => x.Is().Creature, controlledBy);
 }
Example #14
0
	public int GetElementCountForCharacter(ControlledBy character) {
		int elementCount = 0;

		foreach (Town town in _towns) {
			if (town._controlledBy == character) {
				elementCount++;
			}
		}
		return elementCount;
	}
Example #15
0
        private static bool HasValidController(Player targetController, Player sourceController, ControlledBy controlledBy)
        {
            switch (controlledBy)
            {
                case (ControlledBy.Opponent):
                    return targetController != sourceController;

                case (ControlledBy.SpellOwner):
                    return targetController == sourceController;
            }

            return true;
        }
   public void ManaAmount(ManaColor color, Func<Card, bool> filter,
 ControlledBy controlledBy = ControlledBy.SpellOwner)
   {
       ManaOutput = new PermanentCountManaOutput(color, filter, controlledBy);
         Colors = color.Indices;
   }
Example #17
0
 public EffectLandEnchantment(ControlledBy controlledBy)
 {
     _controlledBy = controlledBy;
 }
Example #18
0
 public WhenTopSpellIs(Func <Card, bool> selector, ControlledBy controlledBy = ControlledBy.Any)
 {
     _selector     = selector;
     _controlledBy = controlledBy;
 }
 public EffectLandEnchantment(ControlledBy controlledBy)
 {
     _controlledBy = controlledBy;
 }
Example #20
0
 public UntapEachPermanent(Func <Card, bool> filter, ControlledBy controlledBy = ControlledBy.Any)
 {
     _filter       = filter ?? delegate { return(true); };
     _controlledBy = controlledBy;
 }
Example #21
0
 public void ManaAmount(ManaColor color, Func <Card, bool> filter,
                        ControlledBy controlledBy = ControlledBy.SpellOwner)
 {
     ManaOutput = new PermanentCountManaOutput(color, filter, controlledBy);
     Colors     = color.Indices;
 }
        private static bool HasValidController(Player targetController, Player sourceController, ControlledBy controlledBy)
        {
            switch (controlledBy)
            {
            case (ControlledBy.Opponent):
                return(targetController != sourceController);

            case (ControlledBy.SpellOwner):
                return(targetController == sourceController);
            }

            return(true);
        }