Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void couleurCasePion(Case c){
- int cx = c.getAbscisse();
- int cy = c.getOrdonnee();
- // Test PION BLANC
- if(c.getPiece().getCouleur() == CouleurPiece.blanc && cx != 7){
- // Test MANGER POUR LES BLANCS
- if(cy!=7){
- if(monEchiquier[cx+1][cy+1].getPiece().getCouleur() != c.getPiece().getCouleur() && monEchiquier[cx+1][cy+1].getPiece().getCouleur() != CouleurPiece.vide){
- monEchiquier[cx+1][cy+1].setBorder(Echec1.greenline);
- }
- }
- if (cy != 0){
- if(monEchiquier[cx + 1][cy - 1].getPiece().getCouleur() != c.getPiece().getCouleur() && monEchiquier[cx + 1][cy - 1].getPiece().getCouleur() != CouleurPiece.vide){
- monEchiquier[cx + 1][cy - 1].setBorder(Echec1.greenline);
- }
- }
- // Test AVANCER POUR LES BLANCS QUAND CASE DE DEPART
- if(cx == 1){
- if(monEchiquier[cx +1][cy].getPiece().getType() == TypePiece.vide){
- monEchiquier[cx + 1][cy].setBorder(Echec1.greenline);
- }
- else{
- monEchiquier[cx + 1][cy].setBorder(Echec1.magentaline);
- }
- if(monEchiquier[cx + 2][cy].getPiece().getType() == TypePiece.vide){
- monEchiquier[cx + 2][cy].setBorder(Echec1.greenline);
- }
- else{
- monEchiquier[cx + 2][cy].setBorder(Echec1.magentaline);
- }
- }
- // Test AVANCER POUR LES BLANCS QUAND PAS CASE DE DEPART
- else{
- if(monEchiquier[cx + 1][cy].getPiece().getType() == TypePiece.vide){
- monEchiquier[cx + 1][cy].setBorder(Echec1.greenline);
- }
- else{
- monEchiquier[cx + 1][cy].setBorder(Echec1.magentaline);
- }
- }
- }
- // TEST PION NOIR
- else{
- if(c.getPiece().getCouleur() == CouleurPiece.noir && cx != 0){
- // Test MANGER POUR LES BLANCS
- if(cy!=7){
- if(monEchiquier[cx-1][cy+1].getPiece().getCouleur() != c.getPiece().getCouleur() && monEchiquier[cx-1][cy+1].getPiece().getCouleur() != CouleurPiece.vide){
- monEchiquier[cx-1][cy+1].setBorder(Echec1.greenline);
- }
- }
- if (cy != 0){
- if(monEchiquier[cx - 1][cy - 1].getPiece().getCouleur() != c.getPiece().getCouleur() && monEchiquier[cx - 1][cy - 1].getPiece().getCouleur() != CouleurPiece.vide){
- monEchiquier[cx - 1][cy - 1].setBorder(Echec1.greenline);
- }
- }
- // Test AVANCER POUR LES BLANCS QUAND CASE DE DEPART
- if(cx == 6){
- if(monEchiquier[cx - 1][cy].getPiece().getType() == TypePiece.vide){
- monEchiquier[cx - 1 ][cy].setBorder(Echec1.greenline);
- }
- else{
- monEchiquier[cx - 1][cy].setBorder(Echec1.magentaline);
- }
- if(monEchiquier[cx - 2][cy].getPiece().getType() == TypePiece.vide){
- monEchiquier[cx - 2][cy].setBorder(Echec1.greenline);
- }
- else{
- monEchiquier[cx - 2][cy].setBorder(Echec1.magentaline);
- }
- }
- // Test AVANCER POUR LES BLANCS QUAND PAS CASE DE DEPART
- else{
- if(monEchiquier[cx - 1][cy].getPiece().getType() == TypePiece.vide){
- monEchiquier[cx - 1][cy].setBorder(Echec1.greenline);
- }
- else{
- monEchiquier[cx - 1][cy].setBorder(Echec1.magentaline);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement