Merge pull request #82 from rubenpirreram/ID_IMAGE_ADDING
Id image adding
This commit is contained in:
@@ -23,6 +23,20 @@ public class Building0 extends BuildingCard {
|
||||
*/
|
||||
private int numSet;
|
||||
|
||||
/**
|
||||
* Constructor of the building
|
||||
* @param era The game era of the building.
|
||||
* @param price The price (in food) of the building.
|
||||
* @param prestigeValue The number of Prestige Points gained from this building at the end of the game.
|
||||
*/
|
||||
public Building0(String idImage,int era,int price,int prestigeValue) {
|
||||
super(idImage,era,price,prestigeValue);
|
||||
effectType=EffectType.CARD_SET;
|
||||
effectId=0;
|
||||
purchased = false;
|
||||
numSet = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor of the building
|
||||
* @param era The game era of the building.
|
||||
|
||||
@@ -33,6 +33,19 @@ public class Building1 extends BuildingCard {
|
||||
effectId = 1;
|
||||
this.icon = icon;
|
||||
}
|
||||
/**
|
||||
* Constructor of the building.
|
||||
* @param era The game era of the building.
|
||||
* @param price The price (in food) of the building.
|
||||
* @param prestigeValue The number of Prestige Points gained from this building at the end of the game.
|
||||
* @param icon The character type used by the building effect.
|
||||
*/
|
||||
public Building1(String idIMG,int era, int price,int prestigeValue, CharacterType icon) {
|
||||
super(idIMG,era,price,prestigeValue);
|
||||
effectType = EffectType.ON_EVENT;
|
||||
effectId = 1;
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to clone the building: it creates an exact copy.
|
||||
|
||||
@@ -22,6 +22,19 @@ public class Building10 extends BuildingCard {
|
||||
effectId=10;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a Building10 card with the specified era, price, and prestige value.
|
||||
*
|
||||
* @param era the era of the building card.
|
||||
* @param price the price of the building card.
|
||||
* @param prestigeValue the prestige value of the building card.
|
||||
*/
|
||||
public Building10(String idIMG,int era, int price,int prestigeValue) {
|
||||
super(idIMG,era,price,prestigeValue);
|
||||
effectType= EffectType.FINAL;
|
||||
effectId=10;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and returns a copy of this Building10 card.
|
||||
*
|
||||
|
||||
@@ -45,6 +45,23 @@ public class Building11 extends BuildingCard {
|
||||
this.icon = icon;
|
||||
this.PrestigeMul = prestigeMul;
|
||||
}
|
||||
/**
|
||||
* Creates a Building11 card with the specified era, price, prestige value,
|
||||
* character type icon, and prestige multiplier.
|
||||
*
|
||||
* @param era the era of the building card.
|
||||
* @param price the price of the building card.
|
||||
* @param prestigeValue the prestige value of the building card.
|
||||
* @param icon the CharacterType associated with the building card effect.
|
||||
* @param prestigeMul the prestige multiplier of the building card effect.
|
||||
*/
|
||||
public Building11(String idIMG,int era, int price,int prestigeValue, CharacterType icon, int prestigeMul) {
|
||||
super(idIMG,era,price,prestigeValue);
|
||||
effectType = EffectType.FINAL;
|
||||
effectId = 11;
|
||||
this.icon = icon;
|
||||
this.PrestigeMul = prestigeMul;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and returns a copy of this Building11 card.
|
||||
|
||||
@@ -17,6 +17,18 @@ public class Building13 extends BuildingCard{
|
||||
effectType= EffectType.FINAL;
|
||||
effectId=13;
|
||||
}
|
||||
/**
|
||||
* Creates a Building13 card with the specified era, price, and prestige value.
|
||||
*
|
||||
* @param era the era of the building card.
|
||||
* @param price the price of the building card.
|
||||
* @param prestigeValue the prestige value of the building card.
|
||||
*/
|
||||
public Building13(String idIMG,int era, int price,int prestigeValue) {
|
||||
super(idIMG,era,price,prestigeValue);
|
||||
effectType= EffectType.FINAL;
|
||||
effectId=13;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and returns a copy of this Building13 card.
|
||||
|
||||
@@ -35,6 +35,18 @@ public class Building4 extends BuildingCard {
|
||||
effectId=4;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor of the building
|
||||
* @param era The game era of the building.
|
||||
* @param price The price (in food) of the building.
|
||||
* @param prestigeValue The number of Prestige Points gained from this building at the end of the game.
|
||||
*/
|
||||
public Building4(String idIMG,int era, int price,int prestigeValue) {
|
||||
super(idIMG,era,price,prestigeValue);
|
||||
effectType= EffectType.INVENTOR_PAIR;
|
||||
effectId=4;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the building by counting the number of pairs of inventors at the moment of purchase.
|
||||
* The building can only be initialized once.
|
||||
|
||||
@@ -23,6 +23,18 @@ public class Building8 extends BuildingCard {
|
||||
effectId=8;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor of the building
|
||||
* @param era The game era of the building.
|
||||
* @param price The price (in food) of the building.
|
||||
* @param prestigeValue The number of Prestige Points gained from this building at the end of the game.
|
||||
*/
|
||||
public Building8(String idIMG,int era, int price,int prestigeValue) {
|
||||
super(idIMG,era,price,prestigeValue);
|
||||
effectType= EffectType.FINAL;
|
||||
effectId=8;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to clone the building: it creates an exact copy.
|
||||
* @return The new copy of the building.
|
||||
|
||||
@@ -93,6 +93,30 @@ public class BuildingCard extends PlayableCard implements Cloneable , BuildingEf
|
||||
bought = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a building card with the specified era, price, and prestige value.
|
||||
*
|
||||
* @param era the era of the building card.
|
||||
* @param price the price of the building card.
|
||||
* @param prestigeValue the prestige value of the building card.
|
||||
* @throws IllegalArgumentException if {@code price <= 0} or {@code prestigeValue < 0}
|
||||
*/
|
||||
protected BuildingCard(String idIMG,int era,int price,int prestigeValue) throws IllegalArgumentException{
|
||||
super(idIMG,era);
|
||||
if (price > 0) {
|
||||
this.price = price;
|
||||
} else {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
if (prestigeValue >= 0) {
|
||||
this.prestigeValue = prestigeValue;
|
||||
} else {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
bought = false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates a building card with the specified effect identifier, era, price,
|
||||
@@ -137,6 +161,49 @@ public class BuildingCard extends PlayableCard implements Cloneable , BuildingEf
|
||||
this(era,price,prestigeValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a building card with the specified effect identifier, era, price,
|
||||
* and prestige value.
|
||||
* The effect type is determined from the given effect identifier.
|
||||
*
|
||||
* @param effectId the identifier of the effect associated with the building card.
|
||||
* @param era the era of the building card.
|
||||
* @param price the price of the building card.
|
||||
* @param prestigeValue the prestige value of the building card.
|
||||
* @throws IllegalArgumentException if the effect identifier is not valid,
|
||||
* if {@code price <= 0}, or if {@code prestigeValue < 0}
|
||||
*/
|
||||
public BuildingCard(String idIMG,int effectId ,int era,int price,int prestigeValue) throws IllegalArgumentException{
|
||||
this.effectId = effectId;
|
||||
switch (effectId){
|
||||
case 2:
|
||||
this.effectType=EffectType.ON_EVENT;
|
||||
break;
|
||||
case 3:
|
||||
this.effectType=EffectType.ON_END_TURN;
|
||||
break;
|
||||
case 5:
|
||||
this.effectType=EffectType.ON_EVENT;
|
||||
break;
|
||||
case 6:
|
||||
this.effectType=EffectType.ON_EVENT;
|
||||
break;
|
||||
case 7:
|
||||
this.effectType=EffectType.ON_EVENT;
|
||||
break;
|
||||
case 9:
|
||||
this.effectType=EffectType.ON_EVENT;
|
||||
break;
|
||||
case 12:
|
||||
this.effectType=EffectType.ON_ROUND_END;
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException();
|
||||
|
||||
}
|
||||
this(idIMG,era,price,prestigeValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and returns a copy of this building card.
|
||||
*
|
||||
|
||||
@@ -50,6 +50,16 @@ public abstract class TribeCard extends PlayableCard implements Serializable {
|
||||
public TribeCard(int Era,boolean isEventCard) {
|
||||
this(Era,isEventCard,0);
|
||||
}
|
||||
/**
|
||||
* Creates a tribe card with the specified era and event-card flag.
|
||||
* The minimum number of players is set to 0.
|
||||
*
|
||||
* @param Era the era of the tribe card.
|
||||
* @param isEventCard whether the card is an event card.
|
||||
*/
|
||||
public TribeCard(String idIMG,int Era,boolean isEventCard) {
|
||||
this(idIMG,Era,isEventCard,0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a tribe card with the specified era, event-card flag,
|
||||
@@ -65,6 +75,20 @@ public abstract class TribeCard extends PlayableCard implements Serializable {
|
||||
this.isEventCard=isEventCard;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a tribe card with the specified era, event-card flag,
|
||||
* and minimum number of players.
|
||||
*
|
||||
* @param Era the era of the tribe card.
|
||||
* @param isEventCard whether the card is an event card.
|
||||
* @param nMin the minimum number of players required for the card.
|
||||
*/
|
||||
public TribeCard(String idIMG, int Era,boolean isEventCard,int nMin) {
|
||||
super(idIMG,Era);
|
||||
this.nMin=nMin;
|
||||
this.isEventCard=isEventCard;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and returns a copy of this tribe card.
|
||||
*
|
||||
|
||||
@@ -34,6 +34,17 @@ public abstract class Character extends TribeCard implements Cloneable {
|
||||
super(Era,false );
|
||||
this.type = type;
|
||||
}
|
||||
/**
|
||||
* Creates a character card with the specified era and character type.
|
||||
*
|
||||
* @param Era the era of the character card.
|
||||
* @param type the type of the character card.
|
||||
*/
|
||||
public Character(String idIMG,int Era, CharacterType type){
|
||||
super(idIMG,Era,false );
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates a character card with the specified era, character type,
|
||||
@@ -47,6 +58,18 @@ public abstract class Character extends TribeCard implements Cloneable {
|
||||
super(Era,false ,nMin);
|
||||
this.type = type;
|
||||
}
|
||||
/**
|
||||
* Creates a character card with the specified era, character type,
|
||||
* and minimum number of players.
|
||||
*
|
||||
* @param Era the era of the character card.
|
||||
* @param type the type of the character card.
|
||||
* @param nMin the minimum number of players required for the card.
|
||||
*/
|
||||
public Character(String idIMG,int Era, CharacterType type,int nMin){
|
||||
super(idIMG,Era,false ,nMin);
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the string representation of this character card.
|
||||
|
||||
@@ -25,6 +25,25 @@ public class Artist extends Character {
|
||||
super(Era, CharacterType.ARTIST,nMin);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an Artist character card with the specified era.
|
||||
*
|
||||
* @param Era the era of the Artist card
|
||||
*/
|
||||
public Artist(String idIMG,int Era) {
|
||||
super(idIMG,Era, CharacterType.ARTIST);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an Artist character card with the specified Era and minimum number of players required to play it.
|
||||
*
|
||||
* @param Era the era of the Artist card
|
||||
* @param nMin the minimum number of players required for the card
|
||||
*/
|
||||
public Artist(String idIMG,int Era,int nMin) {
|
||||
super(idIMG,Era, CharacterType.ARTIST,nMin);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the string representation of this Artist card.
|
||||
*
|
||||
|
||||
@@ -78,6 +78,51 @@ public class Builder extends Character {
|
||||
this.prestigeValue = prestigeValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a Builder character card with the specified era, reduction value,
|
||||
* and prestige value.
|
||||
*
|
||||
* @param Era the era of the Builder card.
|
||||
* @param reductionValue the reduction value of the Builder card.
|
||||
* @param prestigeValue the prestige value of the Builder card.
|
||||
* @throws IllegalArgumentException if {@code reductionValue < 0} or {@code prestigeValue < 0}.
|
||||
*/
|
||||
public Builder(String idIMG,int Era, int reductionValue, int prestigeValue) throws IllegalArgumentException {
|
||||
super(idIMG,Era,CharacterType.BUILDER);
|
||||
if(reductionValue < 0) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
this.reductionValue = reductionValue;
|
||||
|
||||
if(prestigeValue < 0) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
this.prestigeValue = prestigeValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a Builder character card with the specified era, reduction value,
|
||||
* prestige value, and minimum number of players.
|
||||
*
|
||||
* @param Era the era of the Builder card.
|
||||
* @param reductionValue the reduction value of the Builder card.
|
||||
* @param prestigeValue the prestige value of the Builder card.
|
||||
* @param nMin the minimum number of players required for the card.
|
||||
* @throws IllegalArgumentException if {@code reductionValue < 0} or {@code prestigeValue < 0}.
|
||||
*/
|
||||
public Builder(String idIMG,int Era, int reductionValue, int prestigeValue,int nMin) throws IllegalArgumentException {
|
||||
super(idIMG,Era,CharacterType.BUILDER,nMin);
|
||||
if(reductionValue < 0) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
this.reductionValue = reductionValue;
|
||||
|
||||
if(prestigeValue < 0) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
this.prestigeValue = prestigeValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the string representation of this Builder card.
|
||||
*
|
||||
|
||||
@@ -24,6 +24,25 @@ public class Gatherer extends Character {
|
||||
super(Era, CharacterType.GATHERER,nMin);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a Gatherer character card with the specified era.
|
||||
*
|
||||
* @param Era Gatherers era.
|
||||
*/
|
||||
public Gatherer(String idIMG,int Era) {
|
||||
super(idIMG,Era, CharacterType.GATHERER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a Gatherer character card with the specified era and minimum number of players.
|
||||
*
|
||||
* @param Era the era of the Gatherer card.
|
||||
* @param nMin the minimum number of players required for the card.
|
||||
*/
|
||||
public Gatherer(String idIMG,int Era, int nMin) {
|
||||
super(idIMG,Era, CharacterType.GATHERER,nMin);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the string representation of this Gatherer card.
|
||||
*
|
||||
|
||||
@@ -45,6 +45,29 @@ public class Hunter extends Character {
|
||||
super(Era, CharacterType.HUNTER,nMin);
|
||||
this.icon = icon;
|
||||
}
|
||||
/**
|
||||
* Creates a Hunter character card with the specified era and icon value.
|
||||
*
|
||||
* @param Era the era of the Hunter card.
|
||||
* @param icon the icon value of the Hunter card.
|
||||
*/
|
||||
public Hunter(String idIMG,int Era, boolean icon) {
|
||||
super(idIMG,Era, CharacterType.HUNTER);
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a Hunter character card with the specified era, icon value,
|
||||
* and minimum number of players.
|
||||
*
|
||||
* @param Era the era of the Hunter card.
|
||||
* @param icon the icon value of the Hunter card.
|
||||
* @param nMin the minimum number of players required for the card.
|
||||
*/
|
||||
public Hunter(String idIMG,int Era, boolean icon, int nMin) {
|
||||
super(idIMG,Era, CharacterType.HUNTER,nMin);
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the string representation of this Hunter card.
|
||||
|
||||
@@ -48,6 +48,35 @@ public class Inventor extends Character {
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an Inventor character card with the specified era and icon value.
|
||||
*
|
||||
* @param Era the era of the Inventor card.
|
||||
* @param icon the icon value of the Inventor card.
|
||||
* @throws IllegalArgumentException if {@code icon < 0} or {@code icon > 9}.
|
||||
*/
|
||||
public Inventor(String idIMG,int Era,int icon) throws IllegalArgumentException {
|
||||
super(idIMG,Era, CharacterType.INVENTOR);
|
||||
if(icon<0 || icon>9)
|
||||
throw new IllegalArgumentException();
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an Inventor character card with the specified era, icon value,
|
||||
* and minimum number of players.
|
||||
*
|
||||
* @param Era the era of the Inventor card.
|
||||
* @param icon the icon value of the Inventor card.
|
||||
* @param nMin the minimum number of players required for the card.
|
||||
* @throws IllegalArgumentException if {@code icon < 0} or {@code icon > 9}.
|
||||
*/
|
||||
public Inventor(String idIMG,int Era,int icon,int nMin) throws IllegalArgumentException {
|
||||
super(idIMG,Era, CharacterType.INVENTOR,nMin);
|
||||
if(icon<0 || icon>9)
|
||||
throw new IllegalArgumentException();
|
||||
this.icon = icon;
|
||||
}
|
||||
/**
|
||||
* Returns the string representation of this Inventor card.
|
||||
*
|
||||
|
||||
@@ -47,6 +47,29 @@ public class Shaman extends Character {
|
||||
super(Era, CharacterType.SHAMAN,nMin);
|
||||
this.icon = icon;
|
||||
}
|
||||
/**
|
||||
* Creates a Shaman character card with the specified era and icon value.
|
||||
*
|
||||
* @param Era the era of the Shaman card.
|
||||
* @param icon the icon value of the Shaman card.
|
||||
*/
|
||||
public Shaman(String idIMG,int Era, int icon) {
|
||||
super(idIMG,Era, CharacterType.SHAMAN);
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a Shaman character card with the specified era, icon value,
|
||||
* and minimum number of players.
|
||||
*
|
||||
* @param Era the era of the Shaman card.
|
||||
* @param icon the icon value of the Shaman card.
|
||||
* @param nMin the minimum number of players required for the card.
|
||||
*/
|
||||
public Shaman(String idIMG,int Era, int icon, int nMin) {
|
||||
super(idIMG,Era, CharacterType.SHAMAN,nMin);
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the string representation of this Shaman card.
|
||||
|
||||
@@ -41,6 +41,16 @@ public abstract class EventCard extends TribeCard {
|
||||
super(Era,true);
|
||||
this.type = type;
|
||||
}
|
||||
/**
|
||||
* Creates an event card with the specified era and event type.
|
||||
*
|
||||
* @param Era the era of the event card.
|
||||
* @param type the type of the event card.
|
||||
*/
|
||||
public EventCard(String idIMG,int Era, EventType type) {
|
||||
super(idIMG,Era,true);
|
||||
this.type = type;
|
||||
}
|
||||
// End Constructors
|
||||
|
||||
// Function
|
||||
|
||||
@@ -42,6 +42,20 @@ public class CavePaintings extends EventCard {
|
||||
this.NPrestigeRem = NPrestigeRem;
|
||||
this.NPrestigeMul = NPrestigeMul;
|
||||
}
|
||||
/**
|
||||
* Creates a CavePaintings event card with the specified era and effect parameters.
|
||||
*
|
||||
* @param Era the era of the event card.
|
||||
* @param NLower the minimum number of Artist cards required to avoid the prestige penalty.
|
||||
* @param NPrestigeRem the amount of Prestige removed if the player has fewer Artist cards than {@code NLower}.
|
||||
* @param NPrestigeMul the Prestige multiplier applied if the player has at least {@code NLower} Artist cards.
|
||||
*/
|
||||
public CavePaintings(String idIMG,int Era, int NLower, int NPrestigeRem, int NPrestigeMul) {
|
||||
super(idIMG,Era, EventType.CAVE_PAINTINGS);
|
||||
this.NLower = NLower;
|
||||
this.NPrestigeRem = NPrestigeRem;
|
||||
this.NPrestigeMul = NPrestigeMul;
|
||||
}
|
||||
|
||||
/**
|
||||
* Activates the CavePaintings event for the specified list of players.
|
||||
|
||||
@@ -30,6 +30,17 @@ public class Hunt extends EventCard {
|
||||
this.foodMultiplier = 1;
|
||||
this.prestigeMultiplier = prestigeMultiplier;
|
||||
}
|
||||
/**
|
||||
* Creates a new Hunt event card.
|
||||
*
|
||||
* @param Era the era of the card
|
||||
* @param prestigeMultiplier prestige points multiplicator used during the event
|
||||
*/
|
||||
public Hunt(String idIMG,int Era, int prestigeMultiplier) {
|
||||
super(Era, EventType.HUNT);
|
||||
this.foodMultiplier = 1;
|
||||
this.prestigeMultiplier = prestigeMultiplier;
|
||||
}
|
||||
|
||||
/**
|
||||
* Activates the event card "Hunt".
|
||||
|
||||
@@ -33,6 +33,19 @@ public class ShamanicRitual extends EventCard {
|
||||
this.prestigeToAdd = prestigeToAdd;
|
||||
this.prestigeToRemove = prestigeToRemove;
|
||||
|
||||
}
|
||||
/**
|
||||
* Creates a new ShamanicRitual event card.
|
||||
*
|
||||
* @param Era the era of the card
|
||||
* @param prestigeToAdd prestige points awarded to the player with the most icons
|
||||
* @param prestigeToRemove prestige points removed from the player with the fewest icons
|
||||
*/
|
||||
public ShamanicRitual(String idIMG,int Era, int prestigeToAdd, int prestigeToRemove) {
|
||||
super(Era, EventType.SHAMANIC_RITUAL);
|
||||
this.prestigeToAdd = prestigeToAdd;
|
||||
this.prestigeToRemove = prestigeToRemove;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -34,6 +34,16 @@ public class Sustenance extends EventCard {
|
||||
super(Era, EventType.SUSTENANCE);
|
||||
this.PrestigeDebt = PrestigeDebt;
|
||||
}
|
||||
/**
|
||||
* Creates a Sustenance event card with the specified era and prestige debt value.
|
||||
*
|
||||
* @param Era the era of the event card.
|
||||
* @param PrestigeDebt the prestige penalty multiplier for unpaid Food units.
|
||||
*/
|
||||
public Sustenance(String idIMG,int Era, int PrestigeDebt) {
|
||||
super(idIMG,Era, EventType.SUSTENANCE);
|
||||
this.PrestigeDebt = PrestigeDebt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Activates the Sustenance event for the specified list of players.
|
||||
|
||||
@@ -133,45 +133,45 @@ public class DecksCreator {
|
||||
*/
|
||||
private static TribeCard createCard(TribeCardDefinition def) {
|
||||
int era = def.era;
|
||||
|
||||
String id = def.id;
|
||||
int[] p = def.params.stream().mapToInt(d -> ((Double) d).intValue()).toArray();
|
||||
if(def.isEvent)
|
||||
{
|
||||
return switch (def.type) {
|
||||
case "Sustenance" -> new Sustenance(era,p[0]);
|
||||
case "Hunt" -> new Hunt(era,p[0]);
|
||||
case "CavePaintings" -> new CavePaintings(era,p[0],p[1],p[2]);
|
||||
case "ShamanicRitual" -> new ShamanicRitual(era,p[0],p[1]);
|
||||
case "Sustenance" -> new Sustenance(def.id,era,p[0]);
|
||||
case "Hunt" -> new Hunt(def.id,era,p[0]);
|
||||
case "CavePaintings" -> new CavePaintings(def.id,era,p[0],p[1],p[2]);
|
||||
case "ShamanicRitual" -> new ShamanicRitual(def.id,era,p[0],p[1]);
|
||||
default -> throw new IllegalArgumentException("Tipo sconosciuto: " + def.type);
|
||||
};
|
||||
}
|
||||
return switch (def.type) {
|
||||
case "Hunter" -> p.length == 0
|
||||
? new Hunter(era, def.armed)
|
||||
: new Hunter(era, def.armed, p[0]);
|
||||
? new Hunter(def.id,era, def.armed)
|
||||
: new Hunter(def.id,era, def.armed, p[0]);
|
||||
case "Builder" -> switch (p.length) {
|
||||
case 2 -> new Builder(era, p[0], p[1]);
|
||||
case 3 -> new Builder(era, p[0], p[1], p[2]);
|
||||
case 2 -> new Builder(def.id,era, p[0], p[1]);
|
||||
case 3 -> new Builder(def.id,era, p[0], p[1], p[2]);
|
||||
default -> throw new IllegalArgumentException("Builder: parametri non validi");
|
||||
};
|
||||
case "Gatherer" -> switch (p.length) {
|
||||
case 0 -> new Gatherer(era);
|
||||
case 1 -> new Gatherer(era, p[0]);
|
||||
case 0 -> new Gatherer(def.id,era);
|
||||
case 1 -> new Gatherer(def.id,era, p[0]);
|
||||
default -> throw new IllegalArgumentException("Gatherer: parametri non validi");
|
||||
};
|
||||
case "Artist" -> switch (p.length) {
|
||||
case 0 -> new Artist(era);
|
||||
case 1 -> new Artist(era, p[0]);
|
||||
case 0 -> new Artist(def.id,era);
|
||||
case 1 -> new Artist(def.id,era, p[0]);
|
||||
default -> throw new IllegalArgumentException("Artist: parametri non validi");
|
||||
};
|
||||
case "Inventor" -> switch (p.length) {
|
||||
case 1 -> new Inventor(era, p[0]);
|
||||
case 2 -> new Inventor(era, p[0], p[1]);
|
||||
case 1 -> new Inventor(def.id,era, p[0]);
|
||||
case 2 -> new Inventor(def.id,era, p[0], p[1]);
|
||||
default -> throw new IllegalArgumentException("Inventor: parametri non validi");
|
||||
};
|
||||
case "Shaman" -> switch (p.length) {
|
||||
case 1 -> new Shaman(era, p[0]);
|
||||
case 2 -> new Shaman(era, p[0], p[1]);
|
||||
case 1 -> new Shaman(def.id,era, p[0]);
|
||||
case 2 -> new Shaman(def.id,era, p[0], p[1]);
|
||||
default -> throw new IllegalArgumentException("Shaman: parametri non validi");
|
||||
};
|
||||
default -> throw new IllegalArgumentException("Tipo sconosciuto: " + def.type);
|
||||
@@ -188,14 +188,14 @@ public class DecksCreator {
|
||||
*/
|
||||
private static BuildingCard createCard(BuildingCardDefinition def) {
|
||||
return switch (def.effectId) {
|
||||
case 0 -> new Building0(def.era, def.price, def.prestigeValue);
|
||||
case 1 -> new Building1(def.era, def.price, def.prestigeValue, CharacterType.valueOf(((String) def.params.get(0)).toUpperCase()));
|
||||
case 4 -> new Building4(def.era, def.price, def.prestigeValue);
|
||||
case 8 -> new Building8(def.era, def.price, def.prestigeValue);
|
||||
case 10 -> new Building10(def.era, def.price, def.prestigeValue);
|
||||
case 11 -> new Building11(def.era, def.price, def.prestigeValue, CharacterType.valueOf(((String) def.params.get(0)).toUpperCase()), ((Double) def.params.get(1)).intValue());
|
||||
case 13 -> new Building13(def.era, def.price, def.prestigeValue);
|
||||
default -> new BuildingCard(def.effectId, def.era, def.price, def.prestigeValue);
|
||||
case 0 -> new Building0(def.id,def.era, def.price, def.prestigeValue);
|
||||
case 1 -> new Building1(def.id,def.era, def.price, def.prestigeValue, CharacterType.valueOf(((String) def.params.get(0)).toUpperCase()));
|
||||
case 4 -> new Building4(def.id,def.era, def.price, def.prestigeValue);
|
||||
case 8 -> new Building8(def.id,def.era, def.price, def.prestigeValue);
|
||||
case 10 -> new Building10(def.id,def.era, def.price, def.prestigeValue);
|
||||
case 11 -> new Building11(def.id,def.era, def.price, def.prestigeValue, CharacterType.valueOf(((String) def.params.get(0)).toUpperCase()), ((Double) def.params.get(1)).intValue());
|
||||
case 13 -> new Building13(def.id,def.era, def.price, def.prestigeValue);
|
||||
default -> new BuildingCard(def.id,def.effectId, def.era, def.price, def.prestigeValue);
|
||||
};
|
||||
|
||||
}
|
||||
@@ -206,6 +206,7 @@ public class DecksCreator {
|
||||
* and a list of additional parameters.
|
||||
*/
|
||||
private static class TribeCardDefinition {
|
||||
String id;
|
||||
String type;
|
||||
int era;
|
||||
boolean armed;
|
||||
@@ -218,6 +219,7 @@ public class DecksCreator {
|
||||
* Contains the effect ID, era, price, prestige value, and a list of additional parameters.
|
||||
*/
|
||||
private static class BuildingCardDefinition {
|
||||
String id;
|
||||
int effectId;
|
||||
int era;
|
||||
int price;
|
||||
|
||||
@@ -8,6 +8,11 @@ import java.io.Serializable;
|
||||
*/
|
||||
public abstract class PlayableCard implements Serializable {
|
||||
|
||||
private String idIMG;
|
||||
public String getIdIMG() {
|
||||
return idIMG;
|
||||
}
|
||||
|
||||
/**
|
||||
* The era associated with this playable card.
|
||||
*/
|
||||
@@ -29,6 +34,22 @@ public abstract class PlayableCard implements Serializable {
|
||||
* @throws IllegalArgumentException if {@code Era <= 0} or {@code Era >= 4}.
|
||||
*/
|
||||
public PlayableCard (int Era) throws IllegalArgumentException{
|
||||
idIMG="-1";
|
||||
if (Era>0 && Era<4) {
|
||||
this.Era = Era;
|
||||
} else {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a playable card with the specified era.
|
||||
*
|
||||
* @param Era the era of the playable card.
|
||||
* @throws IllegalArgumentException if {@code Era <= 0} or {@code Era >= 4}.
|
||||
*/
|
||||
public PlayableCard (String idIMG,int Era) throws IllegalArgumentException{
|
||||
this.idIMG = idIMG;
|
||||
if (Era>0 && Era<4) {
|
||||
this.Era = Era;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user