|
@ -3,7 +3,6 @@ package solitaer; |
|
|
import java.awt.Color; |
|
|
import java.awt.Color; |
|
|
import java.awt.Graphics; |
|
|
import java.awt.Graphics; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class StartStack extends BaseStack { |
|
|
public class StartStack extends BaseStack { |
|
|
|
|
|
|
|
|
private static final long serialVersionUID = 1L; |
|
|
private static final long serialVersionUID = 1L; |
|
@ -17,30 +16,27 @@ public class StartStack extends BaseStack { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public boolean cardCheck(Card _topStack, Card _playerCard) { |
|
|
public boolean cardCheck(Card _topStack, Card _playerCard) { |
|
|
if(_topStack == null && _playerCard == null) { |
|
|
|
|
|
|
|
|
if (_topStack == null && _playerCard == null) { |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
if (_topStack == null) { |
|
|
if (_topStack == null) { |
|
|
// Nur der König kann auf einen leeren Stapel gelegt werden |
|
|
// Nur der König kann auf einen leeren Stapel gelegt werden |
|
|
return _playerCard.getNr() == 13; |
|
|
return _playerCard.getNr() == 13; |
|
|
}else { |
|
|
|
|
|
|
|
|
} else if (!_topStack.isFaceUp()) { |
|
|
|
|
|
return false; |
|
|
|
|
|
} else { |
|
|
return (// Nummer nur aufsteigend |
|
|
return (// Nummer nur aufsteigend |
|
|
_topStack.getNr() == _playerCard.getNr() + 1) |
|
|
|
|
|
&& |
|
|
|
|
|
// rot auf Schwarz |
|
|
|
|
|
( |
|
|
|
|
|
((_topStack.getSymbol() == Symbol.Herz || _topStack.getSymbol() == Symbol.Karo) |
|
|
|
|
|
&& (_playerCard.getSymbol() == Symbol.Pik || _playerCard.getSymbol() == Symbol.Kreuz)) |
|
|
|
|
|
|| |
|
|
|
|
|
|
|
|
_topStack.getNr() == _playerCard.getNr() + 1) && |
|
|
|
|
|
// rot auf Schwarz |
|
|
|
|
|
(((_topStack.getSymbol() == Symbol.Herz || _topStack.getSymbol() == Symbol.Karo) |
|
|
|
|
|
&& (_playerCard.getSymbol() == Symbol.Pik || _playerCard.getSymbol() == Symbol.Kreuz)) || |
|
|
// schwarz auf rot |
|
|
// schwarz auf rot |
|
|
((_topStack.getSymbol() == Symbol.Pik || _topStack.getSymbol() == Symbol.Kreuz) |
|
|
|
|
|
&& (_playerCard.getSymbol() == Symbol.Herz || _playerCard.getSymbol() == Symbol.Karo)) |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
((_topStack.getSymbol() == Symbol.Pik || _topStack.getSymbol() == Symbol.Kreuz) |
|
|
|
|
|
&& (_playerCard.getSymbol() == Symbol.Herz |
|
|
|
|
|
|| _playerCard.getSymbol() == Symbol.Karo))); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
protected void paintComponent(Graphics g) { |
|
|
protected void paintComponent(Graphics g) { |
|
|
// TODO Auto-generated method stub |
|
|
// TODO Auto-generated method stub |
|
@ -50,10 +46,8 @@ public class StartStack extends BaseStack { |
|
|
g.fillRect(0, 0, this.getWidth(), IMAGE_HIGHT); |
|
|
g.fillRect(0, 0, this.getWidth(), IMAGE_HIGHT); |
|
|
|
|
|
|
|
|
g.setColor(Color.black); |
|
|
g.setColor(Color.black); |
|
|
g.drawRect(0, 0, this.getWidth()-1, IMAGE_HIGHT-1); |
|
|
|
|
|
|
|
|
g.drawRect(0, 0, this.getWidth() - 1, IMAGE_HIGHT - 1); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |