Esempio n. 1
0
        public GameResultCard(CardColor color, CardPosition position)
        {
            this.color = color;
            this.position = position;

            this.Init();
        }
Esempio n. 2
0
 public Card(CardValue value, CardColor color)
 {
     Value     = value;
     Color     = color;
     Type      = ToType(value);
     DrawColor = ToColor(color);
 }
Esempio n. 3
0
    void MakeCard(CardColor color, CardStack stack)
    {
        GameObject cardObject = Instantiate(cardPrefab, stack.transform.position, Quaternion.identity, transform) as GameObject;

        cardObject.GetComponent <Card>().color = color;
        stack.ReceiveCard(cardObject);
    }
Esempio n. 4
0
            private static void OnObjAiBaseProcessSpellCast(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args)
            {
                try
                {
                    if (!sender.IsMe)
                    {
                        return;
                    }

                    if (args.SData.Name == "PickACard")
                    {
                        Status = SelectStatus.Selecting;
                    }
                    if (args.SData.Name == "goldcardlock")
                    {
                        LastCard = CardColor.Gold;
                        Status   = SelectStatus.Selected;
                    }
                    else if (args.SData.Name == "bluecardlock")
                    {
                        LastCard = CardColor.Blue;
                        Status   = SelectStatus.Selected;
                    }
                    else if (args.SData.Name == "redcardlock")
                    {
                        LastCard = CardColor.Red;
                        Status   = SelectStatus.Selected;
                    }
                }
                catch (Exception ex)
                {
                    Global.Logger.AddItem(new LogItem(ex));
                }
            }
Esempio n. 5
0
 private int GetWHits(Obj_AI_Base target, List <Obj_AI_Base> targets = null, CardColor color = CardColor.Gold)
 {
     try
     {
         if (targets != null && color == CardColor.Red)
         {
             targets = targets.Where(t => t.IsValidTarget((W.Range + W.Width) * 1.5f)).ToList();
             var pred = W.GetPrediction(target);
             if (pred.Hitchance >= HitChance.Medium)
             {
                 var circle = new Geometry.Polygon.Circle(pred.UnitPosition, target.BoundingRadius + WRedRadius);
                 return(1 + (from t in targets.Where(x => x.NetworkId != target.NetworkId)
                             let pred2 = W.GetPrediction(t)
                                         where pred2.Hitchance >= HitChance.Medium
                                         select new Geometry.Polygon.Circle(pred2.UnitPosition, t.BoundingRadius * 0.9f)).Count(
                            circle2 => circle2.Points.Any(p => circle.IsInside(p))));
             }
         }
         if (W.IsInRange(target))
         {
             return(1);
         }
     }
     catch (Exception ex)
     {
         Global.Logger.AddItem(new LogItem(ex));
     }
     return(0);
 }
Esempio n. 6
0
 static Cards()
 {
     LastCard     = CardColor.None;
     ShouldSelect = new List <CardColor>();
     Obj_AI_Base.OnProcessSpellCast += OnObjAiBaseProcessSpellCast;
     Game.OnUpdate += OnGameUpdate;
 }
Esempio n. 7
0
        public override void EndTurn()
        {
            UnoCard topCard = this.Piles["DiscardPile"][0];

            this._playClr = topCard.Color;
            this._playNum = topCard.Value;
        }
Esempio n. 8
0
    public void ClickColor()
    {
        var buttonSelf = UnityEngine.EventSystems.EventSystem.current.currentSelectedGameObject;

        if (buttonSelf.name == "ButtonRed")
        {
            suppressColor = CardColor.Red;
        }
        if (buttonSelf.name == "ButtonGreen")
        {
            suppressColor = CardColor.Green;
        }
        if (buttonSelf.name == "ButtonGray")
        {
            suppressColor = CardColor.Gray;
        }
        if (buttonSelf.name == "ButtonPurple")
        {
            suppressColor = CardColor.Purple;
        }

        foreach (var button in colors)
        {
            button.SetActive(false);
        }
        SetCondition(true);
    }
Esempio n. 9
0
        private void BuildConnection(int objectId, CardColor color, Player player)
        {
            var         connection = MapConnections.Single(c => c.Connection.Id == objectId);
            List <Card> cards;

            if (connection.Connection.IsTunnel)
            {
                int nesessaryAdditionalCards = 0;
                for (int i = 0; i < 3; i++)
                {
                    var card = Deck.Dequeue();
                    if (card.Color == color)
                    {
                        nesessaryAdditionalCards++;
                    }
                }
                cards = player.BuildTunnel(color, connection.Connection.Length + nesessaryAdditionalCards);
                if (cards != null)
                {
                    Players.Single(p => p.Color == player.Color).Cards.RemoveAll(pc => cards.Select(c => c.Id).ToList().Contains(pc.Id));
                }
                return;
            }
            cards = player.BuildTunnel(color, connection.Connection.Length);
            Players.Single(p => p.Color == player.Color).Cards.RemoveAll(pc => cards.Select(c => c.Id).ToList().Contains(pc.Id));
        }
Esempio n. 10
0
 public Card(string value, CardColor type, string owner)
 {
     this.color = type;
     this.value = value;
     isOnScreen = false;
     this.owner = owner;
 }
Esempio n. 11
0
        //bool selected = false;
        public Card(ContentManager cm, float scale, Point pos, CardColor cardColor, int cardID)
        {
            //Load content
            backOfCard = cm.Load<Texture2D>("backofcard");
            frameSheet = cm.Load<Texture2D>("frameSheet");
            numberSheet = cm.Load<Texture2D>("numbers");

            this.scale = scale;
            hexWidth = (int)(backOfCard.Width);
            hexHeight = (int)(backOfCard.Height);
            radius = hexWidth / 2 * scale;

            //Assign Numbers
            this.cardColor = cardColor;
            Tuple<byte, byte, byte> cardNumbers = CardNumbers(cardID);
            TopNumber = cardNumbers.Item1;
            LeftNumber = cardNumbers.Item2;
            RightNumber = cardNumbers.Item3;

            //Position Card Elements
            drawRectangle = new Rectangle(0, 0, (int)(hexWidth * scale), (int)(hexHeight * scale));
            drawRectangle.Location = pos;
            frameRectangle = new Rectangle((int)cardColor * hexWidth, 0, hexWidth, hexHeight);

            //This just defines the size of the draw rectangle for the numbers
            topNumSource = new Rectangle(TopNumber * 18, 0, 18, 22);
            leftNumSource = new Rectangle(LeftNumber * 18, 0, 18, 22);
            rightNumSource = new Rectangle(RightNumber * 18, 0, 18, 22);
        }
Esempio n. 12
0
        public GameResultCard(CardColor color)
        {
            this.color = color;

            this.position = CardPosition.Center;
            this.Init();
        }
Esempio n. 13
0
    public void ChangeColor()
    {
        CardColor FakeColorToChange = CardColor.Blue;

        if (EventSystem.current.IsPointerOverGameObject() && EventSystem.current.currentSelectedGameObject != null && EventSystem.current.currentSelectedGameObject.GetComponent <Button>() != null)
        {
            Button clickedButton = EventSystem.current.currentSelectedGameObject.GetComponent <Button>();
            if (clickedButton.name == "RED")
            {
                FakeColorToChange = CardColor.Red;
            }
            else if (clickedButton.name == "GREEN")
            {
                FakeColorToChange = CardColor.Green;
            }
            else if (clickedButton.name == "BLUE")
            {
                FakeColorToChange = CardColor.Blue;
            }
            else if (clickedButton.name == "YELLOW")
            {
                FakeColorToChange = CardColor.Yellow;
            }

            print(FakeColorToChange.ToString());
        }
    }
Esempio n. 14
0
        //***************************************************************************
        // Private Methods
        //
        protected override void CreateDeck()
        {
            // Each color gets 2 cards 1-9, but only one '0' card of each color.
            CardColor[] colors = new CardColor[] { CardColor.Red, CardColor.Yellow, CardColor.Green, CardColor.Blue };
            foreach (var clr in colors)
            {
                for (int t = 0; t < 2; t++)
                {
                    for (int i = 0; i <= 12; i++)
                    {
                        if (t == 0 || i > 0)
                        {
                            base.AddCard(new UnoCard(i, clr));
                        }
                    }
                }
            }

            // Create the "Wild" and "Draw 4" cards (4 each).
            for (int t = 0; t < 2; t++)
            {
                for (int i = 0; i < 4; i++)
                {
                    base.AddCard(new UnoCard(t, CardColor.Wild));
                }
            }
        }
Esempio n. 15
0
 /// <summary>
 /// This switches the color of the card, so long as it is currently a wild card
 /// </summary>
 /// <param name="newColor">The new color to set it to</param>
 public void SwitchCardColor(CardColor newColor)
 {
     if (color == CardColor.any)
     {
         color = newColor;
     }
 }
Esempio n. 16
0
        public Card(CardColor color, Shape shape, Fill fill, int count)
        {
            #region validation
            if (color == CardColor.Other)
            {
                throw new InvalidCardException("color", color);
            }
            if (shape == Shape.Other)
            {
                throw new InvalidCardException("shape", shape);
            }
            if (fill == Fill.Other)
            {
                throw new InvalidCardException("fill", fill);
            }
            if (count > 3 || count < 1)
            {
                throw new InvalidCardException("count", count);
            }
            #endregion validation

            this.Color = color;
            this.Shape = shape;
            this.Fill = fill;
            this.Count = count;
        }
Esempio n. 17
0
File: Player.cs Progetto: dorog/UNE
    public void SetSelectedColor(CardColor color)
    {
        selectedColor = color;
        colorSelected = true;

        palette.SetActive(false);
    }
Esempio n. 18
0
    // 対戦記録のロード
    public void LoadBattleData()
    {
        if (File.Exists(_filePath))
        {
            StreamReader streamReader = new StreamReader(_filePath);
            string       data         = streamReader.ReadToEnd();
            streamReader.Close();

            _cardPlayOrder.Clear();
            string[] dataArray = JsonUtility.FromJson <string>(data).Split(',');

            for (int num = 0; num < dataArray.Length; num++)
            {
                CardColor color  = (CardColor)Enum.Parse(typeof(CardColor), dataArray[num]);
                int       number = int.Parse(dataArray[num + 1]);
                Team      team   = (Team)Enum.Parse(typeof(Team), dataArray[num + 2]);

                CardData cardData = new CardData(color, number, team);

                _cardPlayOrder.Add(cardData);

                Debug.Log(color.ToString());
                Debug.Log(number);
                Debug.Log(team);
            }
        }
    }
Esempio n. 19
0
 public TableDeckCard(CardColor cc, CardType ct, bool a, CardColor FC)
 {
     //DeckCard = c;
     cardColor = cc;
     cardType  = ct;
     Active    = a;
     FakeColor = FC;
 }
Esempio n. 20
0
 protected Card GetBestCardOfChosenColor(CardColor chosenColor, IEnumerable <Card> cards)
 {
     return(cards
            .Where(x => x.Colors.Length == 1)
            .Where(x => x.Colors[0] == chosenColor)
            .OrderByDescending(GetRating)
            .FirstOrDefault());
 }
Esempio n. 21
0
 public Card(CardColor color, CardSuit suit, CardRank rank, string name, int value = 0)
 {
     Color = color;
     Suit  = suit;
     Rank  = rank;
     Name  = name;
     Value = value;
 }
Esempio n. 22
0
 public Card(Card card)
 {
     type       = card.type;
     color      = card.color;
     value      = card.value;
     isOnScreen = false;
     owner      = card.owner;
 }
Esempio n. 23
0
    /// <summary>
    /// Will be call by the UI and allow to choose a new
    /// </summary>
    /// <param name="i"> must be between 0 and 4</param>
    public void ChooseColor(int i)
    {
        i = i < 0 ? 0 : i > 3 ? 3 : i;

        CardColor changeColor = (CardColor)i;

        PlaceACard(changeColor);
    }
Esempio n. 24
0
        public Deck(CardColor color)
        {
            Color        = color;
            _cards       = new Queue <ICard>();
            _discardPile = new List <ICard>();

            CardEventManager.OnCardDiscarded += OnCardDiscarded;
        }
Esempio n. 25
0
 public AutomaticallyTriggeredDeflectParams(Player playerPlayed, Player playerTargeted, int numberOfCardsToDraw, ICard cardPlayed, CardColor targetedCardColor)
 {
     PlayerPlayed        = playerPlayed;
     PlayerTargeted      = playerTargeted;
     NumberOfCardsToDraw = numberOfCardsToDraw;
     CardPlayed          = cardPlayed;
     TargetedCardColor   = targetedCardColor;
 }
Esempio n. 26
0
        private void AddRule(Direction direction, CardColor color)
        {
            var temp = color == CardColor.Black ? new Card(1, Suit.Spades) : new Card(1, Suit.Hearts);

            Func <Direction, Card, bool> f = (dir, card) => dir == direction && card.Color == temp.Color;

            rules.Add(f);
        }
        public string PrintCard()
        {
            string c = CardColor.ToString();
            string s = CardSuit.ToString();
            string v = CardValue.ToString();

            return(c + " " + v + " of " + s);
        }
Esempio n. 28
0
 void Start()
 {
     isPause       = false;
     scollIndex    = 0;
     suppressColor = new CardColor();
     //View.GetInstance().right = (View.GetInstance().maxShowCount <View.GetInstance(). playerCards.transform.childCount ?
     //   View.GetInstance().maxShowCount : View.GetInstance().playerCards.transform.childCount) - 1;
 }
Esempio n. 29
0
 public LastCardPlayed(CardColor color, CardValue value, string imageUrl, string playerPlayed, bool wasWildCard)
 {
     Color        = color;
     Value        = value;
     ImageUrl     = imageUrl;
     PlayerPlayed = playerPlayed;
     WasWildCard  = wasWildCard;
 }
Esempio n. 30
0
 public void TellCardColor(Card playerCard, CardColor color)
 {
     if (color == CardColor.Unknown)
     {
         throw new InvalidTurnException("Color was not provided");
     }
     storeCardInfo(playerCard, color, CardRank.Unknown);
 }
Esempio n. 31
0
    private void Start()
    {
        CardColor color = CardColor.Blue;

        for (int i = 0; i < 4; i++)
        {
            for (int j = 0; j < 2; j++)
            {
                cards.Add(new Card(color, CardType.One));
                cards.Add(new Card(color, CardType.Two));
                cards.Add(new Card(color, CardType.Three));
                cards.Add(new Card(color, CardType.Four));
                cards.Add(new Card(color, CardType.Five));
                cards.Add(new Card(color, CardType.Six));
                cards.Add(new Card(color, CardType.Seven));
                cards.Add(new Card(color, CardType.Eight));
                cards.Add(new Card(color, CardType.Nine));
                cards.Add(new Card(color, CardType.Skipp));
                cards.Add(new Card(color, CardType.Switch_direction));
                cards.Add(new Card(color, CardType.Draw_2));
                cards.Add(new Card(color, CardType.Change_cards));
            }

            switch (i)
            {
            case 0:
                color = CardColor.Green;
                break;

            case 1:
                color = CardColor.Red;
                break;

            case 2:
                color = CardColor.Yellow;
                break;
            }
        }

        for (int i = 0; i < 2; i++)
        {
            cards.Add(new Card(CardColor.Black, CardType.Change_color));
            cards.Add(new Card(CardColor.Black, CardType.Draw_4));
            cards.Add(new Card(CardColor.Black, CardType.Switch_cards_all));
        }
        int count = cards.Count;
        int last  = count - 1;

        for (var i = 0; i < last; ++i)
        {
            int  r   = UnityEngine.Random.Range(i, count);
            Card tmp = cards[i];
            cards[i] = cards[r];
            cards[r] = tmp;
        }

        StartCoroutine(gameManager.DealCards());
    }
Esempio n. 32
0
 public Link(City from, City to, LinkType type, int length, int color)
 {
     this.from   = from;
     this.to     = to;
     this.type   = type;
     this.length = length;
     this.color  = (CardColor)(color);
     this.player = null;
 }
Esempio n. 33
0
 private bool IsCardForTeam(Team team, CardColor cardColor)
 {
     if (team == Team.Blue && cardColor == CardColor.Blue ||
         team == Team.Red && cardColor == CardColor.Red)
     {
         return(true);
     }
     return(false);
 }
Esempio n. 34
0
 public Card(Face faceValue, CardColor color, Suit suit, ImageSource brush, Uri uriResource)
 {
     FaceValue  = faceValue;
     Color      = color;
     Suit       = suit;
     CardImage  = brush;
     IsFaceDown = false;
     CardUri    = uriResource;
 }
Esempio n. 35
0
        ///////////////////////////////////////////////////////////////////////////////////////
        // Constructors
        ///////////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// Construct a new card
        /// </summary>
        /// <param name="theColor"></param>
        /// <param name="theFace"></param>
        public Card(CardColor theColor, CardFace theFace)
        {
            // Check the card is value, otherwise throw a runtime error
            if (!IsValidCard(theColor, theFace))
                throw new Exception(CardColorToString(theColor) + " " + CardFaceToString(theFace) + " is not a valid Uno card");

            // Save parameters in private attributes
            color = theColor;
            face = theFace;
        }
Esempio n. 36
0
 protected Card(Game game, int id, CardType type, CardSuit suit, CardRank rank)
 {
     this.game = game;
     this.id = id;
     this.type = type;
     this.suit = suit;
     this.rank = rank;
     color = GetColor(type);
     empty = new EmptyCard(this);
 }
Esempio n. 37
0
        public CardViewModel(Card card)
        {
            Card = card;
              Colors = new CardColor[] {};

              Update();

              _timer = new Timer(delegate { Update(); }, null,
            TimeSpan.FromMilliseconds(20),
            TimeSpan.FromMilliseconds(20));
        }
Esempio n. 38
0
        protected static int GetColorRank(CardColor cardColor, ColorScore[] scores)
        {
            var i = 1;
              foreach (var colorScore in scores.OrderByDescending(x => x.Score))
              {
            if (cardColor == colorScore.Color)
              return i;
              }

              return scores.Length;
        }
Esempio n. 39
0
        public List<Card> GenerateCards()
        {
            List<Card> cards = new List<Card>();
            CardColor[] validColors = new CardColor[] { CardColor.Green, CardColor.Purple, CardColor.Red };
            Fill[] validFills = new Fill[] { Fill.Dashed, Fill.Open, Fill.Solid };
            Shape[] validShapes = new Shape[] { Shape.Diamond, Shape.Oval, Shape.Squiggle };
            int[] validCounts = new int[] { 1, 2, 3 };

            foreach (CardColor color in validColors)
            {
                foreach (Fill fill in validFills)
                {
                    foreach (Shape shape in validShapes)
                    {
                        foreach(int i in validCounts)
                        {
                            cards.Add(new Card(color, shape, fill, i));
                        }
                    }
                }
            }

            return cards;
        }
Esempio n. 40
0
		}// AddCard



		protected CardView AddCardView(int player, CardColor col, int value){
			CardView cv = null;

			// Try to find a free one.
			for (int i = 0; cv == null && i < _cardViewsPerPlayer [player].Count; i++) {
				if (!_cardViewsPerPlayer [player] [i].gameObject.activeSelf)
					cv = _cardViewsPerPlayer [player] [i];
			}// for

			if (cv != null) {
				cv.SetCardColor (col);
				cv.SetCardNumber (value);
				cv.gameObject.SetActive (true);
			} else {
				cv = SpawnCard (
					col,
					value
				);

				int count = _cardViewsPerPlayer [player].Count;
				int row = Mathf.FloorToInt (((float)count) / ((float)CardsMaxPerRow));
				cv.transform.position =
					//ParentPlayerHands[p].transform.position +
					new Vector3 ((count % CardsMaxPerRow) * CardPlayerHandOffset.x, CardPlayerHandOffset.y, row * CardPlayerHandOffset.z);
				cv.transform.rotation = Quaternion.Euler (CardPlayerHandRotation);// + ParentPlayerHands[p].transform.rotation.eulerAngles);
				cv.transform.SetParent (ParentPlayerHands [player].transform, false);

				cv.gameObject.name = "CardPlayer_" + player + "_" + count;

				_cardViewsPerPlayer [player].Add (cv);
			}// fi

			return cv;
		}// AddCardView
Esempio n. 41
0
 private DrawFourCard(CardColor cc)
     : base(cc, CardFace.DF)
 {
 }
Esempio n. 42
0
 protected Card GetBestCardOfSingleColorOrColorless(IEnumerable<Card> cards, CardColor? primaryColor = null)
 {
     return cards
     .Where(x => x.Colors.Length == 1 || (primaryColor.HasValue && IsUsableNonbasicLand(x, primaryColor.Value)))
     .OrderByDescending(GetRating)
     .FirstOrDefault();
 }
Esempio n. 43
0
 protected Card GetBestCardOfChosenColor(CardColor chosenColor, IEnumerable<Card> cards)
 {
     return cards
     .Where(x => x.Colors.Length == 1)
     .Where(x => x.Colors[0] == chosenColor)
     .OrderByDescending(GetRating)
     .FirstOrDefault();
 }
Esempio n. 44
0
            private static void OnObjAiBaseProcessSpellCast(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args)
            {
                try
                {
                    if (!sender.IsMe)
                    {
                        return;
                    }

                    if (args.SData.Name == "PickACard")
                    {
                        Status = SelectStatus.Selecting;
                    }
                    if (args.SData.Name == "goldcardlock")
                    {
                        LastCard = CardColor.Gold;
                        Status = SelectStatus.Selected;
                    }
                    else if (args.SData.Name == "bluecardlock")
                    {
                        LastCard = CardColor.Blue;
                        Status = SelectStatus.Selected;
                    }
                    else if (args.SData.Name == "redcardlock")
                    {
                        LastCard = CardColor.Red;
                        Status = SelectStatus.Selected;
                    }
                }
                catch (Exception ex)
                {
                    Global.Logger.AddItem(new LogItem(ex));
                }
            }
Esempio n. 45
0
 public static bool Has(CardColor color)
 {
     return color == CardColor.Gold && ObjectManager.Player.HasBuff("goldcardpreattack") ||
            color == CardColor.Red && ObjectManager.Player.HasBuff("redcardpreattack") ||
            color == CardColor.Blue && ObjectManager.Player.HasBuff("bluecardpreattack");
 }
Esempio n. 46
0
 private DrawTwoCard(CardColor cc)
     : base(cc, CardFace.DT)
 {
 }
Esempio n. 47
0
 protected override object this[string index]
 {
     get
     {
         #region
         switch (index)
         {
             case "Id": return _id;
             case "Name": return _name;
             case "Color": return _color;
             case "Value": return _value;
             case "HeadIcon": return _headIcon;
             default: throw new ArgumentException(string.Format("PokerInfo index[{0}] isn't exist.", index));
         }
         #endregion
     }
     set
     {
         #region
         switch (index)
         {
             case "Id":
                 _id = value.ToInt();
                 break;
             case "Name":
                 _name = value.ToNotNullString();
                 break;
             case "Color":
                 _color = value.ToEnum<CardColor>();
                 break;
             case "Value":
                 _value = value.ToShort();
                 break;
             case "HeadIcon":
                 _headIcon = value.ToNotNullString();
                 break;
             default: throw new ArgumentException(string.Format("PokerInfo index[{0}] isn't exist.", index));
         }
         #endregion
     }
 }
Esempio n. 48
0
 public CardTemplate Protections(CardColor color)
 {
     _init.Add(p => p.ProtectionsFromColors.Add(color));
       return this;
 }
Esempio n. 49
0
 public Card(CardRank rank,CardColor color)
 {
     this.rank=rank;
         this.color=color;
 }
Esempio n. 50
0
 //无参构造
 public Card()
 {
     rank = (CardRank)0;
         color = (CardColor)0;
 }
Esempio n. 51
0
		}// AbortMatch


		#endregion match management




		#region view management

		protected CardView SpawnCard(CardColor color, int value){

			GameObject card = GameObject.Instantiate (PrefabCard);
			CardView view = card.GetComponent<CardView> ();
			view.SetCardColor (color);
			view.SetCardNumber (value);

			return view;
		}// SpawnCard
Esempio n. 52
0
        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);
        }
Esempio n. 53
0
		}// property



		public Card(CardColor color, int value, int position) {
			_color = color;
			_value = value;
			_position = position;
		}// Card
Esempio n. 54
0
 public bool HasColor(CardColor color)
 {
     return Effect().HasColor(color);
 }
Esempio n. 55
0
 static Cards()
 {
     LastCard = CardColor.None;
     ShouldSelect = new List<CardColor>();
     Obj_AI_Base.OnProcessSpellCast += OnObjAiBaseProcessSpellCast;
     Game.OnUpdate += OnGameUpdate;
 }
Esempio n. 56
0
 private NumberCard(CardColor cc, CardFace cf)
     : base(cc, cf)
 {
 }
Esempio n. 57
0
 public static void Select(CardColor card)
 {
     try
     {
         Select(new List<CardColor> { card });
     }
     catch (Exception ex)
     {
         Global.Logger.AddItem(new LogItem(ex));
     }
 }
Esempio n. 58
0
        private Card GetCurrentMaxCardInColor( CardColor color )
        {
            Card maxCard = null;
            CardComparer comparer = new CardComparer( _playingManager.CurrentAnnouncement.Type );

            foreach ( Card card in _playingManager.RemainingCards )
            {
                if ( card.CardColor == color )
                {
                    if ( maxCard == null )
                    {
                        maxCard = card;
                    }

                    if ( comparer.Compare( maxCard, card ) < 0 )
                    {
                        maxCard = card;
                    }
                }
            }

            foreach ( Card card in _playingManager.CurrentHand )
            {
                if ( card.CardColor == color )
                {
                    if ( maxCard == null )
                    {
                        maxCard = card;
                    }

                    if ( comparer.Compare( maxCard, card ) < 0 )
                    {
                        maxCard = card;
                    }
                }
            }

            return maxCard;
        }
Esempio n. 59
0
 private int GetWHits(Obj_AI_Base target, List<Obj_AI_Base> targets = null, CardColor color = CardColor.Gold)
 {
     try
     {
         if (targets != null && color == CardColor.Red)
         {
             targets = targets.Where(t => t.IsValidTarget((W.Range + W.Width) * 1.5f)).ToList();
             var pred = W.GetPrediction(target);
             if (pred.Hitchance >= HitChance.Medium)
             {
                 var circle = new Geometry.Polygon.Circle(pred.UnitPosition, target.BoundingRadius + WRedRadius);
                 return 1 + (from t in targets.Where(x => x.NetworkId != target.NetworkId)
                     let pred2 = W.GetPrediction(t)
                     where pred2.Hitchance >= HitChance.Medium
                     select new Geometry.Polygon.Circle(pred2.UnitPosition, t.BoundingRadius * 0.9f)).Count(
                         circle2 => circle2.Points.Any(p => circle.IsInside(p)));
             }
         }
         if (W.IsInRange(target))
         {
             return 1;
         }
     }
     catch (Exception ex)
     {
         Global.Logger.AddItem(new LogItem(ex));
     }
     return 0;
 }
Esempio n. 60
0
        protected Card GetBestCardOfChosenColorsOrColorless(CardColor color1, IEnumerable<Card> cards,
      CardColor? color2 = null)
        {
            return cards
            .Where(card =>
              {
            if (IsUsableNonbasicLand(card, color1, color2))
            {
              return true;
            }

            if (card.HasColor(CardColor.Colorless))
              return true;

            return card.Colors.All(c =>
              {
                if (color2 == null)
                {
                  return c == color1;
                }

                return c == color1 || c == color2;
              });
              })
            .OrderByDescending(GetRating)
            .FirstOrDefault();
        }