|
|
@ -3,11 +3,10 @@ package solitaer; |
|
|
|
import java.awt.Color; |
|
|
|
import java.awt.Graphics; |
|
|
|
|
|
|
|
|
|
|
|
public class StartStack extends BaseStack { |
|
|
|
|
|
|
|
private static final long serialVersionUID = 1L; |
|
|
|
|
|
|
|
|
|
|
|
public StartStack(int _x, int _y) { |
|
|
|
super(true); |
|
|
|
super.setLocation(_x, _y); |
|
|
@ -17,30 +16,27 @@ public class StartStack extends BaseStack { |
|
|
|
} |
|
|
|
|
|
|
|
public boolean cardCheck(Card _topStack, Card _playerCard) { |
|
|
|
if(_topStack == null && _playerCard == null) { |
|
|
|
if (_topStack == null && _playerCard == null) { |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
if (_topStack == null) { |
|
|
|
// Nur der König kann auf einen leeren Stapel gelegt werden |
|
|
|
return _playerCard.getNr() == 13; |
|
|
|
}else { |
|
|
|
} else if (!_topStack.isFaceUp()) { |
|
|
|
return false; |
|
|
|
} else { |
|
|
|
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 |
|
|
|
((_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 |
|
|
|
protected void paintComponent(Graphics g) { |
|
|
|
// TODO Auto-generated method stub |
|
|
@ -48,12 +44,10 @@ public class StartStack extends BaseStack { |
|
|
|
if (stackIsEmpty()) { |
|
|
|
g.setColor(Color.gray); |
|
|
|
g.fillRect(0, 0, this.getWidth(), IMAGE_HIGHT); |
|
|
|
|
|
|
|
|
|
|
|
g.setColor(Color.black); |
|
|
|
g.drawRect(0, 0, this.getWidth()-1, IMAGE_HIGHT-1); |
|
|
|
g.drawRect(0, 0, this.getWidth() - 1, IMAGE_HIGHT - 1); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |