Exemplo n.º 1
0
        private int ChoixEffetPossible(Effet aTester)
        {
            int resultat = 0;

            if (aTester.getCible() == 10 || aTester.getCible() == 9 || aTester.getCible() == 0 || aTester.getCible() == 1 || aTester.getCible() == 12 || aTester.getCible() == 13 || aTester.getCible() == 18 || aTester.getCible() == 19)
            {
                resultat++;
            }
            if (aTester.getCible() == 11 || aTester.getCible() == 9 || aTester.getCible() == 0 || aTester.getCible() == 2 || aTester.getCible() == 12 || aTester.getCible() == 14 || aTester.getCible() == 18 || aTester.getCible() == 20)
            {
                resultat++;
            }
            if (aTester.getCible() == 0 || aTester.getCible() == 1 || aTester.getCible() == 3 || aTester.getCible() == 4 || aTester.getCible() == 15 || aTester.getCible() == 16 || aTester.getCible() == 18 || aTester.getCible() == 19)
            {
                resultat += ChampConstructionsJ2.EspaceOccupe();
            }
            if (aTester.getCible() == 0 || aTester.getCible() == 2 || aTester.getCible() == 3 || aTester.getCible() == 5 || aTester.getCible() == 15 || aTester.getCible() == 17 || aTester.getCible() == 18 || aTester.getCible() == 20)
            {
                resultat += ChampConstructionsJ1.EspaceOccupe();
            }
            if (aTester.getCible() == 0 || aTester.getCible() == 1 || aTester.getCible() == 6 || aTester.getCible() == 7 || aTester.getCible() == 12 || aTester.getCible() == 13 || aTester.getCible() == 15 || aTester.getCible() == 16)
            {
                resultat += ChampBatailleUnitesJ2.EspaceOccupe();
            }
            if (aTester.getCible() == 0 || aTester.getCible() == 2 || aTester.getCible() == 6 || aTester.getCible() == 8 || aTester.getCible() == 12 || aTester.getCible() == 14 || aTester.getCible() == 15 || aTester.getCible() == 17)
            {
                resultat += ChampBatailleUnitesJ1.EspaceOccupe();
            }

            return(resultat);
        }
Exemplo n.º 2
0
        public bool EspaceUniteEstDisponible()
        {
            if (JoueurActifEst1)
            {
                return(ChampBatailleUnitesJ1.EspaceDisponible());
            }

            return(ChampBatailleUnitesJ2.EspaceDisponible());
        }
Exemplo n.º 3
0
 /// <summary>
 /// Fonction qui rend les unités prêt à attaquer.
 /// </summary>
 public void PreparerTroupes()
 {
     if (!joueurActifEst1)
     {
         ChampBatailleUnitesJ1.Preparer();
     }
     else
     {
         ChampBatailleUnitesJ2.Preparer();
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// Fonction qui détruit un unité
        /// </summary>
        public void DetruireUnite()
        {
            List <Unite> DetruiteJoueur1;
            List <Unite> DetruiteJoueur2;

            DetruiteJoueur1 = ChampBatailleUnitesJ1.DetruireUnite();
            DetruiteJoueur2 = ChampBatailleUnitesJ2.DetruireUnite();
            foreach (Unite unUnite in DetruiteJoueur1)
            {
                LstUsineRecyclageJ1.Add(unUnite);
                PlaySound(Cosmos.Properties.Resources.doh1);
            }
            foreach (Unite unUnite in DetruiteJoueur2)
            {
                LstUsineRecyclageJ2.Add(unUnite);
                PlaySound(Cosmos.Properties.Resources.jabba);
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Fonction de jouer une carte pour l'ai
        /// </summary>
        /// <param name="index"></param>
        public void JouerCarteAI(int index)
        {
            Carte aJouer;

            aJouer = LstMainJ2[index];

            Joueur2.RessourceActive -= aJouer.Cout;

            if (aJouer is Unite)
            {
                // TODO Décider ou jouer une carte via le flag du AI
                ChampBatailleUnitesJ2.AjouterAuChamp(aJouer, 1);
            }
            else if (aJouer is Batiment)
            {
                ChampConstructionsJ2.AjouterAuChamp(aJouer);
            }
            else if (aJouer is Gadget)
            {
                LstUsineRecyclageJ2.Add(aJouer);
            }
            // On enleve la carte de la main
            LstMainJ2.Remove(aJouer);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Fonction qui permet de jouer une carte
        /// </summary>
        /// <param name="index">Position de la carte dans la main du joueur</param>
        /// <param name="position">Position dans le champs de bataille</param>
        public void JouerCarte(int index, int position)
        {
            // Le coup à pas été validé
            Carte aJouer;

            AExecuter = null;

            // Enlever la carte de la main du joueur et la mettre à l'endroit qu'elle va
            if (joueurActifEst1)
            {
                aJouer = LstMainJ1[index];

                Joueur1.RessourceActive -= aJouer.Cout;
                if (aJouer is Unite)
                {
                    ChampBatailleUnitesJ1.AjouterAuChamp(aJouer, position);
                    if (aJouer.EffetCarte != null)
                    {
                        AExecuter = aJouer.EffetCarte;
                    }
                    PlaySound(Cosmos.Properties.Resources.rebel);
                }
                else if (aJouer is Batiment)
                {
                    ChampConstructionsJ1.AjouterAuChamp(aJouer);
                    PlaySound(Cosmos.Properties.Resources.batiment);
                }
                else if (aJouer is Gadget)
                {
                    if (aJouer.EffetCarte != null)
                    {
                        AExecuter = aJouer.EffetCarte;
                        PlaySound(Cosmos.Properties.Resources.jabba);
                    }
                    LstUsineRecyclageJ1.Add(aJouer);
                }
                // On enleve la carte de la main
                LstMainJ1.Remove(aJouer);
            }
            else
            {
                aJouer = LstMainJ2[index];

                // On enleve les ressources au joueurs
                Joueur2.RessourceActive -= aJouer.Cout;

                if (aJouer is Unite)
                {
                    ChampBatailleUnitesJ2.AjouterAuChamp(aJouer, position);
                    if (aJouer.EffetCarte != null)
                    {
                        AExecuter = aJouer.EffetCarte;
                    }
                    PlaySound(Cosmos.Properties.Resources.imperial);
                }
                if (aJouer is Batiment)
                {
                    ChampConstructionsJ2.AjouterAuChamp(aJouer);
                    PlaySound(Cosmos.Properties.Resources.batiment);
                }
                if (aJouer is Gadget)
                {
                    if (aJouer.EffetCarte != null)
                    {
                        AExecuter = aJouer.EffetCarte;
                        PlaySound(Cosmos.Properties.Resources.doh1);
                    }
                    LstUsineRecyclageJ2.Add(aJouer);
                }
                // On enleve la carte de la main
                LstMainJ2.Remove(aJouer);
                // Refresh all
                RefreshAllEventArgs p  = new RefreshAllEventArgs();
                TrousseGlobale      TG = new TrousseGlobale();
                TG.OnRefreshAll(p);
            }
            if (AExecuter != null)
            {
                ExecuterEffet();
            }
        }