diff --git a/mesos_rules_it_hires.pdf b/mesos_rules_it_hires.pdf new file mode 100644 index 0000000..2a64b1c Binary files /dev/null and b/mesos_rules_it_hires.pdf differ diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building0.java b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building0.java index 50a8fd9..4dc0a38 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building0.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building0.java @@ -2,21 +2,33 @@ package it.polimi.ingsw.gc14.Model.Cards.Building.Effects; import it.polimi.ingsw.gc14.Model.Cards.Building.EffectType; import it.polimi.ingsw.gc14.Model.Cards.BuildingCard; -import it.polimi.ingsw.gc14.Model.Cards.TribeCards.Characters.Artist; import it.polimi.ingsw.gc14.Model.Player; -import it.polimi.ingsw.gc14.Model.Cards.TribeCards.Character; import it.polimi.ingsw.gc14.Model.Cards.TribeCards.CharacterType; -import java.util.ArrayList; -import java.util.HashMap; + +/** + * From the moment you buy this building, every time you complete a set of 6 different characters, you gain 5 food. + * Note: sets of characters already present before purchasing the building do not count. + */ public class Building0 extends BuildingCard { + /** + * The purchased attribute is used to indicate whether the card has already been initialized. + */ boolean purchased ; + + /** + * The numSet attribute indicates how many complete sets the player has. + */ 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(int era,int price,int prestigeValue) { super(era,price,prestigeValue); effectType=EffectType.CARD_SET; @@ -25,6 +37,11 @@ public class Building0 extends BuildingCard { numSet = 0; } + /** + * 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) { @@ -34,6 +51,11 @@ public class Building0 extends BuildingCard { return true; } + /** + * Initializes the building by counting the number of complete sets at the moment of purchase. + * The building can only be initialized once. + * @param player The player who owns the building, whose cards are counted to determine the number of sets. + */ public void initialize(Player player) { if(purchased) @@ -49,10 +71,21 @@ public class Building0 extends BuildingCard { purchased = true; } + /** + * Method to clone the building: it creates an exact copy. + * @return The new copy of the building + */ @Override public BuildingCard clone() { return new Building0(getEra(),getPrice(),getPrestigeValue()); } + + /** + * Calculates the current number of card sets and subtracts the previous value (i.e., the number of newly obtained sets). + * The player gains an amount of food equal to 5 times this result. + * @param player The player who owns the building. + * @throws IllegalArgumentException thrown if the specified player does not own this card. + */ @Override public void applyEffect(Player player) throws IllegalArgumentException { if(!player.buildingCards.contains(this)) diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building1.java b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building1.java index 8e4b82e..cdf7261 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building1.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building1.java @@ -8,22 +8,43 @@ import it.polimi.ingsw.gc14.Model.Player; import java.util.HashMap; +/** + * During the Sustenance Event, you have a discount of 1 food token on the total you + * would have to pay, for each of the indicated characters in your tribe. + */ public class Building1 extends BuildingCard { + + /** + * The icon attribute indicates the character type involved in the building effect. + */ private CharacterType icon ; + + /** + * @return The character type associated with this building effect. + */ 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) { - }; } diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building10.java b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building10.java index 6c71f51..6e3e0a5 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building10.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building10.java @@ -57,4 +57,4 @@ public class Building10 extends BuildingCard { player.addPrestige(6 * numSet); } -} +} \ No newline at end of file diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building11.java b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building11.java index 512b06f..5b47de1 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building11.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building11.java @@ -65,4 +65,4 @@ public class Building11 extends BuildingCard { throw new IllegalArgumentException(); player.addPrestige(player.getNType(getIcon()) * this.getPrestigeMul()); } -} +} \ No newline at end of file diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building13.java b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building13.java index 1559865..32cc32e 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building13.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building13.java @@ -42,4 +42,4 @@ public class Building13 extends BuildingCard{ player.addPrestige(25); } -} +} \ No newline at end of file diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building4.java b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building4.java index d7b2974..60e4d2f 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building4.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building4.java @@ -2,22 +2,44 @@ package it.polimi.ingsw.gc14.Model.Cards.Building.Effects; import it.polimi.ingsw.gc14.Model.Cards.Building.EffectType; import it.polimi.ingsw.gc14.Model.Cards.BuildingCard; -import it.polimi.ingsw.gc14.Model.Cards.TribeCards.Character; import it.polimi.ingsw.gc14.Model.Cards.TribeCards.Characters.Inventor; import it.polimi.ingsw.gc14.Model.Player; import java.util.HashMap; +/** + * From the moment you purchase this building, every time you obtain a pair of identical inventors, you gain 3 food. + * This effect doesn't apply to already owned pairs at the time of purchase. + */ public class Building4 extends BuildingCard { + /** + * The purchased attribute is used to indicate whether the card has already been initialized. + */ boolean purchased ; + + /** + * The numPair attribute indicates how many pairs of inventors the player has. + */ 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; 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. + * @param player the player who owns the building, whose inventors are counted to determine the number of pairs. + */ public void initialize(Player player) { if(purchased) @@ -42,6 +64,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 +78,21 @@ 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()); } + + /** + * Calculates the current number of pairs and subtracts the previous value (i.e., the number of newly obtained pairs). + * The player gains an amount of food equal to 3 times this result. + * @param player The player who owns the building. + * @throws IllegalArgumentException Thrown if the specified player does not own this card. + */ @Override public void applyEffect(Player player) throws IllegalArgumentException { if(!player.buildingCards.contains(this)) diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building8.java b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building8.java index a2d2a6e..d67017d 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building8.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building8.java @@ -5,20 +5,38 @@ import it.polimi.ingsw.gc14.Model.Cards.BuildingCard; import it.polimi.ingsw.gc14.Model.Cards.TribeCards.Characters.Builder; import it.polimi.ingsw.gc14.Model.Player; -import java.util.ArrayList; -import java.util.stream.Collectors; +/** + * At the end of the game, you gain double the Prestige Points indicated on the Builder cards in your tribe. + */ 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()); } + + /** + * For each builder in the player's hand, the player gains double the Prestige Point indicated on the builder card. + * @param player The player who owns the building. + * @throws IllegalArgumentException Thrown if the specified player does not own this building. + */ @Override public void applyEffect(Player player) throws IllegalArgumentException { if(!player.buildingCards.contains(this))