Gamesystem-Class (PlayCard-method), NormalCard-Class, SpecialCard-Class
& SpecialAbility-EnumMAIN
parent
356354acee
commit
e95d212ddd
|
@ -14,6 +14,7 @@ public class Gamesystem {
|
||||||
private boolean hasGameEnded = false;
|
private boolean hasGameEnded = false;
|
||||||
private int playerCounter = 0;
|
private int playerCounter = 0;
|
||||||
private int playerID = 1;
|
private int playerID = 1;
|
||||||
|
private int playerPosition = 0;
|
||||||
|
|
||||||
private ArrayList<Player> playersList= new ArrayList<>();
|
private ArrayList<Player> playersList= new ArrayList<>();
|
||||||
private ArrayList<ArrayList<Card>> playerCards = new ArrayList<>();
|
private ArrayList<ArrayList<Card>> playerCards = new ArrayList<>();
|
||||||
|
@ -89,12 +90,34 @@ public class Gamesystem {
|
||||||
|
|
||||||
public void playCard (int id_Card) {
|
public void playCard (int id_Card) {
|
||||||
|
|
||||||
|
for(Card card : playerCards.get(playerPosition)) {
|
||||||
|
|
||||||
|
if(card.getID() == id_Card) {
|
||||||
|
|
||||||
|
if(!playerCards.get(playerPosition).isEmpty()) {
|
||||||
|
|
||||||
|
playedCards.add(card);
|
||||||
|
playerCards.get(playerPosition).remove(card);
|
||||||
|
playerPosition++;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (playerPosition >= 4) {
|
||||||
|
playerPosition = 0;
|
||||||
|
playedCards.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public void startGame() {
|
public void startGame() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean cardChecker() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -18,7 +18,7 @@ public class Card {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setKartenTyp(CardKind kartenTyp) {
|
public void setCardKind(CardKind kartenTyp) {
|
||||||
this.kartenTyp = kartenTyp;
|
this.kartenTyp = kartenTyp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,14 +2,19 @@ package Infrastructur;
|
||||||
|
|
||||||
public class NormalCard extends Card{
|
public class NormalCard extends Card{
|
||||||
|
|
||||||
|
private int steps;
|
||||||
|
|
||||||
private CardKind[] laufKarten = {CardKind.TWO, CardKind.THREE, CardKind.SIX, CardKind.EIGHT, CardKind.NINE,
|
private CardKind[] laufKarten = {CardKind.TWO, CardKind.THREE, CardKind.SIX, CardKind.EIGHT, CardKind.NINE,
|
||||||
CardKind.QUEEN};
|
CardKind.QUEEN};
|
||||||
|
|
||||||
public NormalCard(int id, CardKind kartenTyp) {
|
public NormalCard(int id, CardKind kartenTyp, int steps) {
|
||||||
// super(id);
|
setID(id);
|
||||||
setKartenTyp(kartenTyp);
|
setCardKind(kartenTyp);
|
||||||
// Setze den Wert basierend auf dem KartenTyp (z.B., TWO = 2, THREE = 3, etc.)
|
this.steps = steps;
|
||||||
setWert(kartenTyp.ordinal() + 2);
|
}
|
||||||
|
|
||||||
|
public int getSteps() {
|
||||||
|
return steps;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
package Infrastructur;
|
||||||
|
|
||||||
|
public enum SpecialAbility {
|
||||||
|
|
||||||
|
BACKWARDS, MOVE_OWN_OR_OTHER, DISTRIBUTE_STEPS_ON_TWO, DISCARD,
|
||||||
|
SWAP_OWN_WITH_OTHER, MOVE_FORWARD_13_TÖTEN,
|
||||||
|
MOVE_FORWARD_11, MOVE_FORWARD_1
|
||||||
|
|
||||||
|
}
|
|
@ -5,10 +5,15 @@ public class SpecialCard extends Card{
|
||||||
private CardKind[] eigenschaftKarten = {CardKind.FOUR, CardKind.FIVE, CardKind.SEVEN, CardKind.TEN,
|
private CardKind[] eigenschaftKarten = {CardKind.FOUR, CardKind.FIVE, CardKind.SEVEN, CardKind.TEN,
|
||||||
CardKind.JACK, CardKind.KING, CardKind.ACE};
|
CardKind.JACK, CardKind.KING, CardKind.ACE};
|
||||||
|
|
||||||
|
private SpecialAbility specialAbility;
|
||||||
|
|
||||||
public SpecialCard(CardKind kartenTyp) {
|
public SpecialCard(CardKind kartenTyp, SpecialAbility specialAbility) {
|
||||||
// super(id);
|
setCardKind(kartenTyp);
|
||||||
setKartenTyp(kartenTyp);
|
this.specialAbility = specialAbility;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SpecialAbility getSpecialAbility() {
|
||||||
|
return specialAbility;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue