public void StealCard(EnumMilkType milk, out int deck)
        {
            MilkRunCardInformation thisCard;

            if (milk == EnumMilkType.Chocolate)
            {
                if (ChocolatePiles !.HasCard(2) == false)
                {
                    throw new BasicBlankException("Cannot steal a chocolate card because there are none");
                }
                thisCard             = ChocolatePiles.GetLastCard(2);
                deck                 = thisCard.Deck;
                ChocolateDeliveries -= thisCard.Points;
                ChocolatePiles.RemoveCardFromPile(2);
                return;
            }
            if (milk == EnumMilkType.Strawberry)
            {
                if (StrawberryPiles !.HasCard(2) == false)
                {
                    throw new BasicBlankException("Cannot steal a chocolate card because there are none");
                }
                thisCard              = StrawberryPiles.GetLastCard(2);
                StrawberryDeliveries -= thisCard.Points;
                StrawberryPiles.RemoveCardFromPile(2);
                deck = thisCard.Deck;
                return;
            }
            throw new BasicBlankException("Must be chocolate or strawberry");
        }
        private void ModifyData(int chosen, EnumMilkType tempMilk)
        {
            MilkCategory = tempMilk;
            Deck         = chosen;
            int tempDeck;

            if (Deck <= 61)
            {
                tempDeck = chosen;
            }
            else
            {
                tempDeck = chosen - 61;
            }
            int c;
            int z = 0;

            for (int x = 1; x <= 12; x++)
            {
                c = GetPointFreq(x);
                for (int y = 1; y <= c; y++)
                {
                    z++;
                    if (z == tempDeck)
                    {
                        CardCategory = EnumCardCategory.Points;
                        Points       = x;
                        return;
                    }
                }
            }
            for (int x = 1; x <= 7; x++)
            {
                z++;
                if (z == tempDeck)
                {
                    CardCategory = EnumCardCategory.Go;
                    return;
                }
            }
            for (int x = 1; x <= 3; x++)
            {
                z++;
                if (z == tempDeck)
                {
                    CardCategory = EnumCardCategory.Stop;
                    return;
                }
            }
            for (int x = 1; x <= 3; x++)
            {
                z++;
                if (z == tempDeck)
                {
                    CardCategory = EnumCardCategory.Joker;
                    return;
                }
            }
            throw new BasicBlankException("cannot find deck.  rethink");
        }
        public async Task AnimatePlayAsync(MilkRunCardInformation thisCard, EnumMilkType milk, EnumPileType pile, EnumAnimcationDirection direction)
        {
            BasicPileInfo <MilkRunCardInformation> tempPile;

            if (milk == EnumMilkType.Strawberry)
            {
                tempPile = StrawberryPiles !.PileList ![(int)pile - 1];
 public bool HasCard(EnumMilkType milk)
 {
     if (milk == EnumMilkType.Chocolate)
     {
         return(ChocolatePiles !.HasCard(2));
     }
     return(StrawberryPiles !.HasCard(2));
 }
Exemplo n.º 5
0
        private StackLayout GetLabelGroup(EnumMilkType milk, bool isOpponent)
        {
            StackLayout thisStack = new StackLayout();

            thisStack.Orientation       = StackOrientation.Horizontal;
            thisStack.HorizontalOptions = LayoutOptions.Center;
            var thisLabel = GetSpecialLabel(milk);

            if (milk == EnumMilkType.Chocolate)
            {
                thisLabel.Text = "Chocolate Deliveries ";
            }
            else
            {
                thisLabel.Text = "Strawberry Deliveries ";
            }
            thisStack.Children.Add(thisLabel);
            thisLabel = GetSpecialLabel(milk);
            string path;

            if (milk == EnumMilkType.Chocolate)
            {
                path = nameof(MilkRunPlayerItem.ChocolateDeliveries);
            }
            else
            {
                path = nameof(MilkRunPlayerItem.StrawberryDeliveries);
            }
            thisLabel.SetBinding(Label.TextProperty, new Binding(path));
            thisStack.Children.Add(thisLabel);
            if (isOpponent == true && milk == EnumMilkType.Chocolate)
            {
                _opponentChocolateDeliveries = thisLabel;
            }
            else if (isOpponent == true && milk == EnumMilkType.Strawberry)
            {
                _opponentStrawberryDeliveries = thisLabel;
            }
            else if (isOpponent == false && milk == EnumMilkType.Chocolate)
            {
                _yourChocolateDeliveries = thisLabel;
            }
            else if (isOpponent == false && milk == EnumMilkType.Strawberry)
            {
                _yourStrawberryDeliveries = thisLabel;
            }
            else
            {
                throw new Exception("Not supported");
            }
            return(thisStack);
        }
Exemplo n.º 6
0
        private Label GetSpecialLabel(EnumMilkType milk)
        {
            Label thisText = new Label();

            thisText.FontAttributes = FontAttributes.Bold;
            if (milk == EnumMilkType.Chocolate)
            {
                thisText.TextColor = Color.Chocolate;
            }
            else
            {
                thisText.TextColor = Color.DeepPink;
            }
            return(thisText);
        }
Exemplo n.º 7
0
        private TextBlock GetSpecialLabel(EnumMilkType milk)
        {
            TextBlock thisText = new TextBlock();

            thisText.FontWeight = FontWeights.Bold;
            if (milk == EnumMilkType.Chocolate)
            {
                thisText.Foreground = Brushes.Chocolate;
            }
            else
            {
                thisText.Foreground = Brushes.DeepPink;// to represent strawberry
            }
            return(thisText);
        }
        private void TempAddCard(int deck, EnumMilkType milk, int pile)
        {
            var thisCard = _gameContainer !.DeckList !.GetSpecificItem(deck);

            thisCard.Drew       = false;
            thisCard.IsSelected = false;
            if (milk != EnumMilkType.Chocolate && milk != EnumMilkType.Strawberry)
            {
                throw new BasicBlankException("Can only add to strawberry or chocolcate at the beginning of adding card");
            }
            if (pile == 3 || pile == 1)
            {
                if (thisCard.CardCategory != EnumCardCategory.Points)
                {
                    throw new BasicBlankException("Must Add Points Only For Deliveries Or Limits");
                }
            }
            else if (pile == 2)
            {
                if (thisCard.CardCategory == EnumCardCategory.Points)
                {
                    throw new BasicBlankException("Cannot play points to the stop piles");
                }
            }
            else
            {
                throw new BasicBlankException("The piles must be 1 to 3");
            }
            if (milk == EnumMilkType.Strawberry)
            {
                if (pile == 3)
                {
                    StrawberryDeliveries += thisCard.Points;
                }
                StrawberryPiles !.AddCardToPile(pile - 1, thisCard);
                return;
            }
            if (milk == EnumMilkType.Chocolate)
            {
                if (pile == 3)
                {
                    ChocolateDeliveries += thisCard.Points;
                }
                ChocolatePiles !.AddCardToPile(pile - 1, thisCard);
                return;
            }
            throw new BasicBlankException("Can only add cards to chocolate or strawberry");
        }
        public int DeliveryLimit(EnumMilkType milk)
        {
            MilkRunCardInformation thisCard;

            if (milk == EnumMilkType.Strawberry)
            {
                if (StrawberryPiles !.HasCard(0) == false)
                {
                    return(0);
                }
                thisCard = StrawberryPiles.GetLastCard(0);
                return(thisCard.Points);
            }
            if (milk == EnumMilkType.Chocolate)
            {
                if (ChocolatePiles !.HasCard(0) == false)
                {
                    return(0);
                }
                thisCard = ChocolatePiles.GetLastCard(0);
                return(thisCard.Points);
            }
            throw new BasicBlankException("Must be strawberry of chocolate");
        }
        public bool HasGo(EnumMilkType milk)
        {
            MilkRunCardInformation thisCard;

            if (milk == EnumMilkType.Chocolate)
            {
                if (ChocolatePiles !.HasCard(1) == false)
                {
                    return(false);
                }
                thisCard = ChocolatePiles.GetLastCard(1);
                return(thisCard.CardCategory == EnumCardCategory.Go);
            }
            if (milk == EnumMilkType.Strawberry)
            {
                if (StrawberryPiles !.HasCard(1) == false)
                {
                    return(false);
                }
                thisCard = StrawberryPiles.GetLastCard(1);
                return(thisCard.CardCategory == EnumCardCategory.Go);
            }
            throw new BasicBlankException("Must be chocolate or strawberry");
        }
 public bool CanMakeMove(int player, int deck, EnumPileType pile, EnumMilkType milk)
 {
     MilkRunPlayerItem      tempPlayer = PlayerList ![player];
Exemplo n.º 12
0
        private static void MilkTypePropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var thisItem = (CardGraphicsWPF)sender;

            thisItem.MainObject !.MilkType = (EnumMilkType)e.NewValue;
        }
        private static void MilkTypePropertyChanged(BindableObject bindable, object oldValue, object newValue)
        {
            var thisItem = (CardGraphicsXF)bindable;

            thisItem.MainObject !.MilkType = (EnumMilkType)newValue;
        }
 public void AddGo(int deck, EnumMilkType milk)
 {
     TempAddCard(deck, milk, 2);
 }
 public void AddLimit(int deck, EnumMilkType milk)
 {
     TempAddCard(deck, milk, 1);
 }
 public void AddToDeliveries(int deck, EnumMilkType milk)
 {
     TempAddCard(deck, milk, 3);
 }