|
@ -3,11 +3,10 @@ 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; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public StartStack(int _x, int _y) { |
|
|
public StartStack(int _x, int _y) { |
|
|
super(true); |
|
|
super(true); |
|
|
super.setLocation(_x, _y); |
|
|
super.setLocation(_x, _y); |
|
@ -17,30 +16,24 @@ 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.isred() && _playerCard.isblack()) || |
|
|
// schwarz auf rot |
|
|
// schwarz auf rot |
|
|
((_topStack.getSymbol() == Symbol.Pik || _topStack.getSymbol() == Symbol.Kreuz) |
|
|
|
|
|
&& (_playerCard.getSymbol() == Symbol.Herz || _playerCard.getSymbol() == Symbol.Karo)) |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
(_topStack.isblack() && _playerCard.isred()))); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
protected void paintComponent(Graphics g) { |
|
|
protected void paintComponent(Graphics g) { |
|
|
// TODO Auto-generated method stub |
|
|
// TODO Auto-generated method stub |
|
@ -48,12 +41,10 @@ public class StartStack extends BaseStack { |
|
|
if (stackIsEmpty()) { |
|
|
if (stackIsEmpty()) { |
|
|
g.setColor(Color.gray); |
|
|
g.setColor(Color.gray); |
|
|
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); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |