Add: JavaDOC for constructor and clone methods of Buildings 1, 4, 8, 10, 11, 13

This commit is contained in:
2026-04-21 13:14:21 +02:00
parent 6fc1905221
commit ff76468089
6 changed files with 87 additions and 4 deletions
@@ -12,18 +12,27 @@ public class Building1 extends BuildingCard {
private CharacterType icon ;
public CharacterType getIcon() {return 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(int era, int price,int prestigeValue, CharacterType icon) {
super(era,price,prestigeValue);
effectType = EffectType.ON_EVENT;
effectId = 1;
this.icon = icon;
}
/**
* Method to clone the building: it creates an exact copy.
* @return the new copy of the building
*/
@Override
public BuildingCard clone() {
return new Building1(getEra(),getPrice(),getPrestigeValue(),getIcon());
}
@Override
public void applyEffect(Player player) {
};
}
@@ -9,15 +9,29 @@ import it.polimi.ingsw.gc14.Model.Player;
import java.util.HashMap;
public class Building10 extends BuildingCard {
/**
* 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 Building10(int era, int price,int prestigeValue) {
super(era,price,prestigeValue);
effectType= EffectType.FINAL;
effectId=10;
}
/**
* Method to clone the building: it creates an exact copy.
* @return the new copy of the building
*/
@Override
public BuildingCard clone() {
return new Building10(getEra(),getPrice(),getPrestigeValue());
}
@Override
public void applyEffect(Player player) throws IllegalArgumentException {
if(!player.buildingCards.contains(this))
@@ -13,7 +13,14 @@ public class Building11 extends BuildingCard {
private int PrestigeMul;
public int getPrestigeMul() {return PrestigeMul;}
/**
* 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
* @param prestigeMul the Prestige Point multiplier used by the building effect
*/
public Building11(int era, int price,int prestigeValue, CharacterType icon, int prestigeMul) {
super(era,price,prestigeValue);
effectType = EffectType.FINAL;
@@ -21,10 +28,17 @@ public class Building11 extends BuildingCard {
this.icon = icon;
this.PrestigeMul = prestigeMul;
}
/**
* Method to clone the building: it creates an exact copy.
* @return the new copy of the building
*/
@Override
public BuildingCard clone() {
return new Building11(getEra(),getPrice(),getPrestigeValue(), getIcon(), getPrestigeMul());
}
@Override
public void applyEffect(Player player) throws IllegalArgumentException {
if(!player.buildingCards.contains(this))
@@ -5,15 +5,29 @@ import it.polimi.ingsw.gc14.Model.Cards.BuildingCard;
import it.polimi.ingsw.gc14.Model.Player;
public class Building13 extends BuildingCard{
/**
* 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 Building13(int era, int price,int prestigeValue) {
super(era,price,prestigeValue);
effectType= EffectType.FINAL;
effectId=13;
}
/**
* Method to clone the building: it creates an exact copy.
* @return the new copy of the building
*/
@Override
public BuildingCard clone() {
return new Building13(getEra(),getPrice(),getPrestigeValue());
}
@Override
public void applyEffect(Player player) throws IllegalArgumentException {
if(!player.buildingCards.contains(this))
@@ -12,6 +12,13 @@ public class Building4 extends BuildingCard {
boolean purchased ;
int numPair;
/**
* 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(int era, int price,int prestigeValue) {
super(era,price,prestigeValue);
effectType= EffectType.INVENTOR_PAIR;
@@ -42,6 +49,11 @@ public class Building4 extends BuildingCard {
}
/**
* Method used to purchase the building. It also handles its initialization.
* @param player the player who buys the building
* @return the outcome of the operation
*/
@Override
public boolean buy(Player player)
{
@@ -51,10 +63,16 @@ public class Building4 extends BuildingCard {
return true;
}
/**
* Method to clone the building: it creates an exact copy.
* @return the new copy of the building
*/
@Override
public BuildingCard clone() {
return new Building4(getEra(),getPrice(),getPrestigeValue());
}
@Override
public void applyEffect(Player player) throws IllegalArgumentException {
if(!player.buildingCards.contains(this))
@@ -10,15 +10,29 @@ import java.util.stream.Collectors;
public class Building8 extends BuildingCard {
/**
* 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(int era, int price,int prestigeValue) {
super(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
*/
@Override
public BuildingCard clone() {
return new Building8(getEra(),getPrice(),getPrestigeValue());
}
@Override
public void applyEffect(Player player) throws IllegalArgumentException {
if(!player.buildingCards.contains(this))