Tribe Cards ToString Added
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
package it.polimi.ingsw.gc14.Model;
|
||||
package it.polimi.ingsw.gc14.Model.Cards;
|
||||
|
||||
import javax.smartcardio.Card;
|
||||
import it.polimi.ingsw.gc14.Model.PlayableCard;
|
||||
|
||||
public abstract class TribeCard extends PlayableCard {
|
||||
public TribeCard(int Era) {
|
||||
|
||||
@@ -1,8 +1,20 @@
|
||||
package it.polimi.ingsw.gc14.Model;
|
||||
package it.polimi.ingsw.gc14.Model.Cards.TribeCards;
|
||||
|
||||
import it.polimi.ingsw.gc14.Model.Cards.TribeCard;
|
||||
|
||||
public abstract class Character extends TribeCard {
|
||||
public Character(int Era, CharacterType type){
|
||||
super(Era);
|
||||
private CharacterType type;
|
||||
public CharacterType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public Character(int Era, CharacterType type){
|
||||
super(Era);
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString()+" "+type.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package it.polimi.ingsw.gc14.Model;
|
||||
package it.polimi.ingsw.gc14.Model.Cards.TribeCards;
|
||||
|
||||
public enum CharacterType {
|
||||
INVENTOR,BUILDER,GATHERERS,ARTIST,SHAMAN,HUNTER
|
||||
|
||||
@@ -1,4 +1,32 @@
|
||||
package it.polimi.ingsw.gc14.Model.Cards.TribeCards.Characters;
|
||||
import it.polimi.ingsw.gc14.Model.Cards.TribeCards.Character;
|
||||
import it.polimi.ingsw.gc14.Model.Cards.TribeCards.CharacterType;
|
||||
|
||||
public class Inventor {
|
||||
public class Inventor extends Character {
|
||||
private int invenctionSymbol;
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Inventor Specific Symbol
|
||||
*/
|
||||
public int InvenctionSymbol() {
|
||||
return invenctionSymbol;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param Era inventor era
|
||||
* @param invenctionSymbol inventor symbol
|
||||
* @throws IllegalArgumentException
|
||||
*/
|
||||
public Inventor(int Era,int invenctionSymbol) throws IllegalArgumentException {
|
||||
super(Era, CharacterType.INVENTOR);
|
||||
if(invenctionSymbol<0 || invenctionSymbol>9)
|
||||
throw new IllegalArgumentException();
|
||||
this.invenctionSymbol = invenctionSymbol;
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + " Symbol:" + String.valueOf(invenctionSymbol);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package it.polimi.ingsw.gc14.Model;
|
||||
|
||||
import it.polimi.ingsw.gc14.Model.Cards.TribeCards.CharacterType;
|
||||
import it.polimi.ingsw.gc14.Model.Cards.TribeCards.Characters.Inventor;
|
||||
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
Inventor inventor= new Inventor(1,0);
|
||||
System.out.println(inventor);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package it.polimi.ingsw.gc14.Model.Cards;
|
||||
package it.polimi.ingsw.gc14.Model;
|
||||
|
||||
public abstract class PlayableCard {
|
||||
private int Era;
|
||||
@@ -8,4 +8,9 @@ public abstract class PlayableCard {
|
||||
public PlayableCard (int Era){
|
||||
this.Era = Era;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Era:"+String.valueOf(Era);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user