示例#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();
            }
        }