Advertisement
Guest User

MOUMOU2

a guest
Jun 17th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.29 KB | None | 0 0
  1. static void couleurCasePion(Case c){
  2.         int cx = c.getAbscisse();
  3.         int cy = c.getOrdonnee();
  4.  
  5.    
  6.  
  7.     // Test PION BLANC
  8.  
  9.         if(c.getPiece().getCouleur() == CouleurPiece.blanc && cx != 7){
  10.  
  11.         // Test MANGER POUR LES BLANCS
  12.             if(cy!=7){
  13.                 if(monEchiquier[cx+1][cy+1].getPiece().getCouleur() != c.getPiece().getCouleur() && monEchiquier[cx+1][cy+1].getPiece().getCouleur() != CouleurPiece.vide){
  14.                     monEchiquier[cx+1][cy+1].setBorder(Echec1.greenline);
  15.                 }
  16.             }
  17.             if (cy != 0){
  18.                 if(monEchiquier[cx + 1][cy - 1].getPiece().getCouleur() != c.getPiece().getCouleur() && monEchiquier[cx + 1][cy - 1].getPiece().getCouleur() != CouleurPiece.vide){
  19.                     monEchiquier[cx + 1][cy - 1].setBorder(Echec1.greenline);
  20.                 }
  21.             }
  22.  
  23.         // Test AVANCER POUR LES BLANCS QUAND CASE DE DEPART    
  24.                 if(cx == 1){
  25.                     if(monEchiquier[cx +1][cy].getPiece().getType() == TypePiece.vide){
  26.                         monEchiquier[cx + 1][cy].setBorder(Echec1.greenline);
  27.                     }
  28.                     else{
  29.                         monEchiquier[cx + 1][cy].setBorder(Echec1.magentaline);            
  30.                     }
  31.                     if(monEchiquier[cx + 2][cy].getPiece().getType() == TypePiece.vide){
  32.                         monEchiquier[cx + 2][cy].setBorder(Echec1.greenline);
  33.                     }
  34.                     else{
  35.                         monEchiquier[cx + 2][cy].setBorder(Echec1.magentaline);            
  36.                     }
  37.                 }
  38.         //  Test AVANCER POUR LES BLANCS QUAND PAS CASE DE DEPART
  39.                 else{
  40.                     if(monEchiquier[cx + 1][cy].getPiece().getType() == TypePiece.vide){
  41.                         monEchiquier[cx + 1][cy].setBorder(Echec1.greenline);
  42.                     }
  43.                     else{
  44.                         monEchiquier[cx + 1][cy].setBorder(Echec1.magentaline);            
  45.                     }
  46.                 }  
  47.             }
  48.  
  49.             // TEST PION NOIR
  50.  
  51.             else{
  52.                 if(c.getPiece().getCouleur() == CouleurPiece.noir && cx != 0){
  53.                     // Test MANGER POUR LES BLANCS
  54.                 if(cy!=7){
  55.                     if(monEchiquier[cx-1][cy+1].getPiece().getCouleur() != c.getPiece().getCouleur() && monEchiquier[cx-1][cy+1].getPiece().getCouleur() != CouleurPiece.vide){
  56.                         monEchiquier[cx-1][cy+1].setBorder(Echec1.greenline);
  57.                     }
  58.                 }
  59.                 if (cy != 0){
  60.                     if(monEchiquier[cx - 1][cy - 1].getPiece().getCouleur() != c.getPiece().getCouleur() && monEchiquier[cx - 1][cy - 1].getPiece().getCouleur() != CouleurPiece.vide){
  61.                         monEchiquier[cx - 1][cy - 1].setBorder(Echec1.greenline);
  62.                     }
  63.                 }
  64.  
  65.             // Test AVANCER POUR LES BLANCS QUAND CASE DE DEPART    
  66.                     if(cx == 6){
  67.                         if(monEchiquier[cx - 1][cy].getPiece().getType() == TypePiece.vide){
  68.                             monEchiquier[cx - 1 ][cy].setBorder(Echec1.greenline);
  69.                         }
  70.                         else{
  71.                             monEchiquier[cx - 1][cy].setBorder(Echec1.magentaline);            
  72.                         }
  73.                         if(monEchiquier[cx - 2][cy].getPiece().getType() == TypePiece.vide){
  74.                             monEchiquier[cx - 2][cy].setBorder(Echec1.greenline);
  75.                         }
  76.                         else{
  77.                             monEchiquier[cx - 2][cy].setBorder(Echec1.magentaline);            
  78.                         }
  79.                     }
  80.             //  Test AVANCER POUR LES BLANCS QUAND PAS CASE DE DEPART
  81.                     else{
  82.                         if(monEchiquier[cx - 1][cy].getPiece().getType() == TypePiece.vide){
  83.                             monEchiquier[cx - 1][cy].setBorder(Echec1.greenline);
  84.                         }
  85.                         else{
  86.                             monEchiquier[cx - 1][cy].setBorder(Echec1.magentaline);            
  87.                         }
  88.                     }
  89.                    
  90.  
  91.                 }    
  92.             }
  93.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement