예제 #1
0
파일: Card.cs 프로젝트: Fedour/ProjetIHM
        public void MultiPlayerEffect(Player source, Player target, int cardValue, int port, Network.Client c)
        {
            switch (this.value)
            {
            case 1:
                CardEffectMullti.GuardEffect(source, target, cardValue, port, c);
                break;

            case 2:
                CardEffectMullti.PriestEffect(source, target, c);
                break;

            case 3:
                CardEffectMullti.BaronEffect(source, target, c);
                break;

            case 4:
                CardEffectMullti.HandmaidEffect(source, c);
                break;

            case 5:
                CardEffectMullti.PrinceEffect(source, target, c);
                break;

            case 6:
                CardEffectMullti.KingEffect(source, target, c);
                break;

            case 7:
                CardEffectMullti.CountessEffect(source, c);
                break;

            case 8:
                CardEffectMullti.PrincessEffect(source, port, c);
                break;
            }
        }
예제 #2
0
 public static void PrincessEffect(Player source, int port, Network.Client c)
 {
     c.ClientPrincessEffect(source);
     GameControllerMulti.killPlayer(source);
 }
예제 #3
0
 public static void CountessEffect(Player source, Network.Client c)
 {
     c.ClientCountessEffect(source);
 }
예제 #4
0
        public static void GuardEffect(Player source, Player target, int cardValue, int port, Network.Client c)
        {
            //copy list of player and remove the current playing player AND protectd player
            List <Player> availablePlayer = Player.getCurrentNonProtectedPlayer();

            availablePlayer.Remove(GameControllerMulti.currentPlayer);

            //check that there is atleast one player that the source player can choose
            if (availablePlayer.Count > 0)
            {
                //Player can try to guess 1 opponent card, if it's correct, the opponent is eliminated
                int targetNum = GameControllerMulti.gameView.selectPlayer(Localization.selectOnePlayer, false, availablePlayer);
                target = Game.Instance.getPlayerByIndex(targetNum);

                cardValue = 0; //default value in case user would left

                for (int i = 0; i < availablePlayer.Count; i++)
                {
                    if (availablePlayer.ElementAt(i).indexPlayer == targetNum)
                    {
                        target = availablePlayer.ElementAt(i);
                    }
                }

                //get all the type of cards excepting the guard
                List <Card> cardsWithoutGuard = new List <Card>(Card.cardsType);
                cardsWithoutGuard.RemoveAt(0);
                cardValue = int.Parse(GameControllerMulti.gameView.selectedTypeOfCards(Properties._string.ChooseATypeOfCard, cardsWithoutGuard));

                Card choose = Card.getCardByValue(cardValue);

                Boolean res = c.ClientGuardEffect(source, target, choose);
            }
            else
            {
                MessageBox.Show(Properties._string.ThereAreNoAvalaibleTarget);
                c.ClientNoTarget();
            }
        }