Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package fr.hitsumo.ouno;
- import plum.console.Clavier;
- public class MainJoueur
- {
- int[] indices = {1,2,3,4,5,6,7};
- private boolean ounojoueur = false;
- private boolean ounomachine = false;
- private String[] tJoueur;
- private String[] tCartePosee;
- private String[] tMachine;
- private String[] tPioche;
- private boolean turnjoueur = true;
- private boolean apioche;
- public void afficherMainJoueur(String[] tJoueur, String[] tCartePosee, String[] tMachine, String[] tPioche)
- {
- this.tJoueur = tJoueur;
- this.tCartePosee = tCartePosee;
- this.tMachine = tMachine;
- this.tPioche = tPioche;
- String touche = "";
- do
- {
- Ouno.afficherJeuJoueur(tJoueur);
- Ouno.afficherCarteARecouvrir(tCartePosee);
- touche = Clavier.lireTexte("Action ( ! : ouno ; p : pioche; i : indice de la carte ; n : passer; q : quitter) ? ");
- if (touche.equals("!")) faireouno();
- else if (touche.equals("p")) piocher();
- else if (touche.equals("n")) passer();
- else if (touche.equals("q")) break;
- else
- {
- jouercarte(Integer.parseInt(touche));
- }
- turnjoueur=false;
- } while (true);
- }
- private void faireouno()
- {
- if (ounojoueur == true)
- {
- System.out.println("Vous avez déjà fait un uno.");
- return;
- }
- else
- {
- if(tJoueur.length==1)
- {
- ounojoueur=true;
- System.out.println("Le joueur a crié OUNO");
- }
- else
- {
- System.out.println("Vous ne pouvez pas déclarer OUNO");
- }
- }
- }
- private void piocher()
- {
- if(turnjoueur)
- {
- if (apioche==true) System.out.println("Vous avez déjà pioché");
- else if (!Ouno.piocherUneCarte(tCartePosee, tJoueur)) System.out.println("Vous ne pouvez pas piocher car vous pouvez jouer une carte.");
- else
- {
- tJoueur = Ouno.ajouteUneCarteAuJeuDunJoueur(tJoueur,tPioche[0]);
- apioche = true;
- }
- }
- else
- {
- tMachine = Ouno.ajouteUneCarteAuJeuDunJoueur(tJoueur,tPioche[0]);
- }
- tPioche = Ouno.enleverCartePiochee(tPioche);
- }
- private void jouercarte(int i)
- {
- //Système pour jouer
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement