示例#1
0
        public void RobotDrawingACard(Robot robot)
        {
            //Drawing a passive card
            if (robot.CurrentPosition == 5 || robot.CurrentPosition == 15 || robot.CurrentPosition == 25 || robot.CurrentPosition == 35)
            {
                PassiveCard passiveCardForm = new PassiveCard(m_BoardGameForm.CurrentTurn, player, robot1, robot2, robot3, m_GameHandler.cards);
                if (passiveCardForm.ShowDialog() == DialogResult.OK)
                {
                    if (!passiveCardForm.NoPassiveCard)
                    {
                        switch (passiveCardForm.PassiveAbility)
                        {
                        case Abilities.Kereskedelem:

                            robot.CanTrade = passiveCardForm.AbilityValue;
                            switch (m_BoardGameForm.CurrentTurn)
                            {
                            case 1:

                                m_BoardGameForm.Robot1TradeNumber.Visible = true;
                                m_BoardGameForm.Robot1TradeNumber.Text   += robot.CanTrade;

                                break;

                            case 2:

                                m_BoardGameForm.Robot2TradeNumber.Visible = true;
                                m_BoardGameForm.Robot2TradeNumber.Text   += robot.CanTrade;

                                break;

                            case 3:

                                m_BoardGameForm.Robot3TradeNumber.Visible = true;
                                m_BoardGameForm.Robot3TradeNumber.Text   += robot.CanTrade;

                                break;

                            default:
                                throw new Exception("This turn is not exist: " + m_BoardGameForm.CurrentTurn);
                            }

                            MessageBox.Show("Mostantól kereskedő lettél! Csak a köröd elején cserélhetsz, azaz ha dobtál már nem teheted meg!", robot.Name);

                            break;

                        case Abilities.Régész:

                            robot.IsArchaeologist = true;
                            MessageBox.Show("Mostantól régész vagy! Ha feltársz valamit az ásatás ideje a felére csökken.", robot.Name);

                            break;

                        case Abilities.Vállalkozó:

                            robot.IsEntrepreneur = true;
                            MessageBox.Show("Mostantól vállalkozó vagy! Miután befejezted a körödet egy bizonyos összeg kerül az egyenlegedre.", robot.Name);

                            break;

                        case Abilities.Óvatos:

                            robot.IsCareful = true;
                            MessageBox.Show("Mostantól óvatos lettél! Minden egyes hupszkártyából húzott balesetet elkerülsz, így nem maradsz ki.", robot.Name);

                            break;

                        case Abilities.Őrangyal:

                            robot.HasAGuardien = passiveCardForm.AbilityValue;
                            MessageBox.Show("Mostantól vane EGY őrangyalod! Ha netán csődbekerülnél ő kisegít.", robot.Name);

                            break;

                        case Abilities.Szárnysegéd:

                            robot.HasAFriend = true;
                            MessageBox.Show("Mostantól van egy szárnysegéded! Jöhet bármi a szárnysegéded fizet mindent, kivéve ha befejezett ásatási területre lépsz. Az neki is drága.", robot.Name);

                            break;

                        case Abilities.Talpraesett:

                            robot.IsPointful = true;
                            MessageBox.Show("Mostantól talpraesett vagy! Mindig tudod mi a dolgod.", robot.Name);

                            break;

                        case Abilities.Tolvaj:

                            robot.CanStealAPassiveAbility = passiveCardForm.AbilityValue;

                            switch (m_BoardGameForm.CurrentTurn)
                            {
                            case 1:

                                m_BoardGameForm.Robot1StealNumber.Visible = true;
                                m_BoardGameForm.Robot1StealNumber.Text   += robot.CanStealAPassiveAbility;

                                break;

                            case 2:

                                m_BoardGameForm.Robot2StealNumber.Visible = true;
                                m_BoardGameForm.Robot2StealNumber.Text   += robot.CanStealAPassiveAbility;

                                break;

                            case 3:

                                m_BoardGameForm.Robot3StealNumber.Visible = true;
                                m_BoardGameForm.Robot3StealNumber.Text   += robot.CanStealAPassiveAbility;

                                break;

                            default:
                                throw new Exception("This turn is not exist: " + m_BoardGameForm.CurrentTurn);
                            }

                            MessageBox.Show("Mostantól tolvaj vagy! Ellophatsz egy képességet valakitől.", robot.Name);

                            break;

                        default:
                            throw new Exception("This ability is not exists: " + passiveCardForm.PassiveAbility);
                        }

                        switch (m_BoardGameForm.CurrentTurn)
                        {
                        case 1:
                            m_UpdateListBoxes.UpdateRobot1PassiveCardListBox();
                            break;

                        case 2:
                            m_UpdateListBoxes.UpdateRobot2PassiveCardListBox();
                            break;

                        case 3:
                            m_UpdateListBoxes.UpdateRobot3PassiveCardListBox();
                            break;

                        default:
                            throw new Exception("Nincs körön lévő Robot");
                        }
                    }
                }
            }
            //Drawing a hupsz card
            else if (robot.CurrentPosition == 2 || robot.CurrentPosition == 12 || robot.CurrentPosition == 22 || robot.CurrentPosition == 32)
            {
                HupszCard hupszCardForm = new HupszCard(m_BoardGameForm.CurrentTurn, player, robot1, robot2, robot3, m_GameHandler.cards);
                if (hupszCardForm.ShowDialog() == DialogResult.OK)
                {
                    switch (hupszCardForm.ActionType)
                    {
                    case HupszAction.Jump:
                        m_GameHandler.JumpWithTheFigureToTheNextPosition(-hupszCardForm.Amount);
                        m_RobotActionControl.RobotAfterChangeHisPositionAction(robot);
                        break;

                    case HupszAction.Accident:
                        HupszAccident(robot, hupszCardForm);
                        break;

                    case HupszAction.Balance:
                        HupszBalance(robot, hupszCardForm);
                        break;

                    default:
                        throw new Exception("Nincs ilyen Action");
                    }
                }
            }
            //Drawing a Hurra card
            else if (robot.CurrentPosition == 8 || robot.CurrentPosition == 18 || robot.CurrentPosition == 28 || robot.CurrentPosition == 38)
            {
                HurraCard hurraCardForm = new HurraCard(m_BoardGameForm.CurrentTurn, player, robot1, robot2, robot3, m_GameHandler.cards);
                if (hurraCardForm.ShowDialog() == DialogResult.OK)
                {
                    switch (hurraCardForm.ActionType)
                    {
                    case HurraAction.Jump:
                        m_GameHandler.JumpWithTheFigureToTheNextPosition(hurraCardForm.Amount);
                        m_RobotActionControl.RobotAfterChangeHisPositionAction(robot);
                        break;

                    case HurraAction.Roll:

                        m_GameHandler.JumpWithTheFigureToTheNextPosition(m_GameHandler.RollTheDice());
                        m_RobotActionControl.RobotAfterChangeHisPositionAction(robot);
                        break;

                    case HurraAction.Balance:
                        robot.Balance += hurraCardForm.Amount;
                        m_GameHandler.ChangingTheSelectedRobotsBalanceTextValue(robot);
                        break;

                    default:
                        throw new Exception("Nincs ilyen Action");
                    }
                }
            }
            //Drawing a Property card
            else
            {
                PropertyCardForRobot PropertyCardForm = new PropertyCardForRobot(m_BoardGameForm, player, robot1, robot2, robot3, m_GameHandler.cards, m_Level);
                if (PropertyCardForm.ShowDialog() == DialogResult.OK)
                {
                    if (PropertyCardForm.IDontWannaBuy)
                    {
                        MessageBox.Show("Nem akarom megvenni!", robot.Name);
                    }
                    else if (PropertyCardForm.CantBuy)
                    {
                        MessageBox.Show("Nem tudom megvenni!", robot.Name);
                    }
                    else
                    {
                        robot.Balance -= PropertyCardForm.FieldValue;

                        m_GameHandler.ChangingTheSelectedRobotsBalanceTextValue(robot);


                        switch (m_BoardGameForm.CurrentTurn)
                        {
                        case 1:
                            m_UpdateListBoxes.UpdateRobot1PropertyCardListBox();
                            break;

                        case 2:
                            m_UpdateListBoxes.UpdateRobot2PropertyCardListBox();
                            break;

                        case 3:
                            m_UpdateListBoxes.UpdateRobot3PropertyCardListBox();
                            break;

                        default:
                            throw new Exception("Nincs körön lévő Robot");
                        }

                        Field field = new Field();
                        field.FieldName          = PropertyCardForm.FieldName;
                        field.OwnedField         = true;
                        field.FieldOwner         = robot;
                        field.FieldValue         = PropertyCardForm.FieldValue;
                        field.FieldFinishedValue = PropertyCardForm.FieldFinishedValue;
                        field.FieldLocation      = robot.CurrentPosition;

                        //the robot is an Archaeologist so he/she can do it 2x faster
                        if (robot.IsArchaeologist)
                        {
                            double fieldBuildingTurns = PropertyCardForm.FieldBuildingTurns;
                            field.FieldBuildingTurns = (int)Math.Round(fieldBuildingTurns / 2);
                        }
                        else
                        {
                            field.FieldBuildingTurns = PropertyCardForm.FieldBuildingTurns;
                        }

                        m_BoardGameForm.OwnedProperties.Add(field);

                        foreach (Field currentField in m_BoardGameForm.OwnedProperties)
                        {
                            if (robot.CurrentPosition == currentField.FieldLocation && currentField.FieldOwner == robot)
                            {
                                currentField.StartedField = true;
                                m_BoardGameForm.FieldLabel[robot.CurrentPosition].Text         = currentField.FieldBuildingTurns.ToString();
                                m_BoardGameForm.FieldLabel[robot.CurrentPosition].Visible      = true;
                                m_BoardGameForm.FieldLabelOwner[robot.CurrentPosition].Text    = field.FieldOwner.Name;
                                m_BoardGameForm.FieldLabelOwner[robot.CurrentPosition].Visible = true;
                                double Bill = field.FieldFinishedValue;
                                m_BoardGameForm.PropertyInfo.SetToolTip(m_BoardGameForm.Field[robot.CurrentPosition], "Lelet: " + field.FieldName + ",\n Fizetendő a telek befejezése esetén: " + Math.Round(Bill * 0.4) + "$,\n Fizetendő megkezdett lelet esetén: " + Math.Round(Bill * 0.25) + "$");
                            }
                        }
                    }
                }
            }
        }
示例#2
0
        public void RobotWouldLikeToStealAPassiveAbilityOrNot(Robot robot)
        {
            List <CardModelFromDatabase.PassiveCard> AvailablePassiveCards = new List <CardModelFromDatabase.PassiveCard>();

            CardModelFromDatabase.PassiveCard SelectedPassiveAbility = null;

            switch (m_BoardGameForm.CurrentTurn)
            {
            case 1:

                foreach (CardModelFromDatabase.PassiveCard Card in player.MyPassiveCards)
                {
                    AvailablePassiveCards.Add(Card);
                }
                foreach (CardModelFromDatabase.PassiveCard Card in robot2.MyPassiveCards)
                {
                    AvailablePassiveCards.Add(Card);
                }
                foreach (CardModelFromDatabase.PassiveCard Card in robot3.MyPassiveCards)
                {
                    AvailablePassiveCards.Add(Card);
                }

                break;

            case 2:

                foreach (CardModelFromDatabase.PassiveCard Card in player.MyPassiveCards)
                {
                    AvailablePassiveCards.Add(Card);
                }
                foreach (CardModelFromDatabase.PassiveCard Card in robot1.MyPassiveCards)
                {
                    AvailablePassiveCards.Add(Card);
                }
                foreach (CardModelFromDatabase.PassiveCard Card in robot3.MyPassiveCards)
                {
                    AvailablePassiveCards.Add(Card);
                }

                break;

            case 3:

                foreach (CardModelFromDatabase.PassiveCard Card in player.MyPassiveCards)
                {
                    AvailablePassiveCards.Add(Card);
                }
                foreach (CardModelFromDatabase.PassiveCard Card in robot1.MyPassiveCards)
                {
                    AvailablePassiveCards.Add(Card);
                }
                foreach (CardModelFromDatabase.PassiveCard Card in robot2.MyPassiveCards)
                {
                    AvailablePassiveCards.Add(Card);
                }

                break;

            default:
                throw new Exception("Wrong turn");
            }

            if (AvailablePassiveCards != null)
            {
                Random number            = new Random();
                int    RandomPassiveCard = number.Next(0, AvailablePassiveCards.Count);

                for (int i = 0; i < AvailablePassiveCards.Count; i++)
                {
                    if (i == RandomPassiveCard)
                    {
                        SelectedPassiveAbility = AvailablePassiveCards[i];
                    }
                }

                if (robot.CanStealAPassiveAbility > 0)
                {
                    robot.CanStealAPassiveAbility -= 1;
                    MessageBox.Show("(" + SelectedPassiveAbility + ") képességet loptam!", robot.Name);

                    switch (m_BoardGameForm.CurrentTurn)
                    {
                    case 1:

                        m_BoardGameForm.Robot1StealNumber.Text = "Ennyit lophatsz még:" + robot.CanStealAPassiveAbility;

                        break;

                    case 2:

                        m_BoardGameForm.Robot2StealNumber.Text = "Ennyit lophatsz még:" + robot.CanStealAPassiveAbility;

                        break;

                    case 3:

                        m_BoardGameForm.Robot3StealNumber.Text = "Ennyit lophatsz még:" + robot.CanStealAPassiveAbility;

                        break;

                    default:
                        throw new Exception("Wrong turn");
                    }

                    if (robot1.MyPassiveCards.Contains(SelectedPassiveAbility))
                    {
                        for (int i = 0; i < robot1.MyPassiveCards.Count; i++)
                        {
                            if (robot1.MyPassiveCards[i] == SelectedPassiveAbility)
                            {
                                GiveThePAssiveAbilityForRobot(i, robot, robot1, null);

                                robot.MyPassiveCards.Add(robot1.MyPassiveCards[i]);
                                switch (m_BoardGameForm.CurrentTurn)
                                {
                                case 1:

                                    m_BoardGameForm.Robot1PassiveCardList.Items.Add(robot1.MyPassiveCards[i]);

                                    break;

                                case 2:

                                    m_BoardGameForm.Robot2PassiveCardList.Items.Add(robot1.MyPassiveCards[i]);

                                    break;

                                case 3:

                                    m_BoardGameForm.Robot3PassiveCardList.Items.Add(robot1.MyPassiveCards[i]);

                                    break;

                                default:
                                    throw new Exception("Wrong turn");
                                }

                                m_BoardGameForm.Robot1PassiveCardList.Items.Remove(robot1.MyPassiveCards[i]);
                                robot1.MyPassiveCards.Remove(robot1.MyPassiveCards[i]);

                                m_UpdateListBoxes.UpdateRobot1PassiveCardListBox();
                            }
                        }
                    }
                    else if (robot2.MyPassiveCards.Contains(SelectedPassiveAbility))
                    {
                        for (int i = 0; i < robot2.MyPassiveCards.Count; i++)
                        {
                            if (robot2.MyPassiveCards[i] == SelectedPassiveAbility)
                            {
                                GiveThePAssiveAbilityForRobot(i, robot, robot2, null);

                                robot.MyPassiveCards.Add(robot2.MyPassiveCards[i]);
                                switch (m_BoardGameForm.CurrentTurn)
                                {
                                case 1:

                                    m_BoardGameForm.Robot1PassiveCardList.Items.Add(robot2.MyPassiveCards[i]);

                                    break;

                                case 2:

                                    m_BoardGameForm.Robot2PassiveCardList.Items.Add(robot2.MyPassiveCards[i]);

                                    break;

                                case 3:

                                    m_BoardGameForm.Robot3PassiveCardList.Items.Add(robot2.MyPassiveCards[i]);

                                    break;

                                default:
                                    throw new Exception("Wrong turn");
                                }

                                m_BoardGameForm.Robot2PassiveCardList.Items.Remove(robot2.MyPassiveCards[i]);
                                robot2.MyPassiveCards.Remove(robot2.MyPassiveCards[i]);

                                m_UpdateListBoxes.UpdateRobot2PassiveCardListBox();
                            }
                        }
                    }
                    else if (robot3.MyPassiveCards.Contains(SelectedPassiveAbility))
                    {
                        for (int i = 0; i < robot3.MyPassiveCards.Count; i++)
                        {
                            if (robot3.MyPassiveCards[i] == SelectedPassiveAbility)
                            {
                                GiveThePAssiveAbilityForRobot(i, robot, robot3, null);

                                robot.MyPassiveCards.Add(robot3.MyPassiveCards[i]);
                                switch (m_BoardGameForm.CurrentTurn)
                                {
                                case 1:

                                    m_BoardGameForm.Robot1PassiveCardList.Items.Add(robot3.MyPassiveCards[i]);

                                    break;

                                case 2:

                                    m_BoardGameForm.Robot2PassiveCardList.Items.Add(robot3.MyPassiveCards[i]);

                                    break;

                                case 3:

                                    m_BoardGameForm.Robot3PassiveCardList.Items.Add(robot3.MyPassiveCards[i]);

                                    break;

                                default:
                                    throw new Exception("Wrong turn");
                                }

                                m_BoardGameForm.Robot3PassiveCardList.Items.Remove(robot3.MyPassiveCards[i]);
                                robot3.MyPassiveCards.Remove(robot3.MyPassiveCards[i]);

                                m_UpdateListBoxes.UpdateRobot3PassiveCardListBox();
                            }
                        }
                    }
                    else if (player.MyPassiveCards.Contains(SelectedPassiveAbility))
                    {
                        for (int i = 0; i < player.MyPassiveCards.Count; i++)
                        {
                            if (player.MyPassiveCards[i] == SelectedPassiveAbility)
                            {
                                GiveThePAssiveAbilityForRobot(i, robot, null, player);

                                robot.MyPassiveCards.Add(player.MyPassiveCards[i]);
                                switch (m_BoardGameForm.CurrentTurn)
                                {
                                case 1:

                                    m_BoardGameForm.Robot1PassiveCardList.Items.Add(player.MyPassiveCards[i]);

                                    break;

                                case 2:

                                    m_BoardGameForm.Robot2PassiveCardList.Items.Add(player.MyPassiveCards[i]);

                                    break;

                                case 3:

                                    m_BoardGameForm.Robot3PassiveCardList.Items.Add(player.MyPassiveCards[i]);

                                    break;

                                default:
                                    throw new Exception("Wrong turn");
                                }

                                m_BoardGameForm.PlayerPassiveCardList.Items.Remove(player.MyPassiveCards[i]);
                                player.MyPassiveCards.Remove(player.MyPassiveCards[i]);

                                m_UpdateListBoxes.UpdatePlayerPassiveCardListBox();
                            }
                        }
                    }
                    switch (m_BoardGameForm.CurrentTurn)
                    {
                    case 1:

                        m_UpdateListBoxes.UpdateRobot1PassiveCardListBox();

                        break;

                    case 2:

                        m_UpdateListBoxes.UpdateRobot2PassiveCardListBox();

                        break;

                    case 3:

                        m_UpdateListBoxes.UpdateRobot3PassiveCardListBox();

                        break;

                    default:
                        throw new Exception("Wrong turn");
                    }
                }
                else
                {
                    MessageBox.Show("Sajnos már nem tudsz többet lopni.", robot.Name);
                    switch (m_BoardGameForm.CurrentTurn)
                    {
                    case 1:

                        m_BoardGameForm.Robot1StealNumber.Visible = false;

                        break;

                    case 2:

                        m_BoardGameForm.Robot2StealNumber.Visible = false;

                        break;

                    case 3:

                        m_BoardGameForm.Robot3StealNumber.Visible = false;

                        break;

                    default:
                        throw new Exception("Wrong turn");
                    }
                }
            }
            else
            {
                MessageBox.Show("Most nem lopok, majd legközelebb!", robot.Name);
            }
        }