Exemplo n.º 1
0
        /**
         * Prendre un artefact de l'ile
         */
        public bool takeArtefact()
        {
            int compteur = 0;

            Artefacts.ArtefactsName artefacts = zone.getArtefacts();
            foreach (TresorCard.TresorCardName t in playerCards)
            {
                if (TresorCard.getArtefactsAssociated(t) == artefacts && artefacts != Artefacts.ArtefactsName.None)
                {
                    compteur++;
                }
            }
            if (compteur >= 4)
            {
                zone.setArtefacts(Artefacts.ArtefactsName.None);
                modele.getListArtefacts().Add(artefacts);
                for (int i = 0; i < 4; i++)
                {
                    this.defausseCard(Artefacts.getKeyAssociated(artefacts));
                }
                return(true);
            }
            else
            {
                Console.WriteLine("Not allow here !");
                return(false);
            }
        }
Exemplo n.º 2
0
        /**
         *
         * @param tas le tas de carte tresors du modele
         * @param defausse defausse carte tresor du modele
         * @param island modele
         */
        public virtual void searchKey(List <TresorCard.TresorCardName> tas, List <TresorCard.TresorCardName> defausse, Island island)
        {
            for (int i = 0; i < 2; i++)
            {
                Debug.Log("add : " + i);
                if (tas.Count == 0)
                {
                    Island.Shuffle(defausse);
                    tas.AddRange(defausse);
                    defausse.Clear();
                }

                TresorCard.TresorCardName card = tas[0];

                if (card == TresorCard.TresorCardName.RisingWater)
                {
                    Console.WriteLine(TresorCard.ToString(card));
                    island.risingWater();
                    defausse.Add(card);
                    tas.Remove(card);
                }
                else
                {
                    this.playerCards.Insert(0, card);
                    Console.WriteLine(TresorCard.ToString(card));
                    tas.Remove(card);
                }
            }


            /**Situation où il est facile de prendre un artefact feu**/

            /*this.playerCards.add(0,TresorCard.clef_feu);
            *  this.playerCards.add(0,TresorCard.clef_feu);
            *  this.playerCards.add(0,TresorCard.clef_feu);
            *  this.playerCards.add(0,TresorCard.clef_feu);*/
        }