Fixed: JavaDOC of buildings 10, 11, 13 to avoid merge conflicts

This commit is contained in:
2026-04-21 14:24:39 +02:00
parent b8dc59f779
commit 339d7923c7
3 changed files with 54 additions and 58 deletions
@@ -2,23 +2,19 @@ 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.Building.EffectType;
import it.polimi.ingsw.gc14.Model.Cards.BuildingCard; 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.CharacterType; import it.polimi.ingsw.gc14.Model.Cards.TribeCards.CharacterType;
import it.polimi.ingsw.gc14.Model.Player; import it.polimi.ingsw.gc14.Model.Player;
import java.util.HashMap; import java.util.HashMap;
/**
* At the end of the game, you gain 6 Prestige Points for each set of 6 different character cards in your tribe.
*/
public class Building10 extends BuildingCard { public class Building10 extends BuildingCard {
/** /**
* Constructor of the building * Creates a Building10 card with the specified era, price, and prestige value.
* @param era the game era of the building *
* @param price the price (in food) of the building * @param era the era of the building card.
* @param prestigeValue the number of Prestige Points gained from this building at the end of the game * @param price the price of the building card.
* @param prestigeValue the prestige value of the building card.
*/ */
public Building10(int era, int price,int prestigeValue) { public Building10(int era, int price,int prestigeValue) {
super(era,price,prestigeValue); super(era,price,prestigeValue);
@@ -27,8 +23,9 @@ public class Building10 extends BuildingCard {
} }
/** /**
* Method to clone the building: it creates an exact copy. * Creates and returns a copy of this Building10 card.
* @return the new copy of the building *
* @return a clone of this Building10 card.
*/ */
@Override @Override
public BuildingCard clone() { public BuildingCard clone() {
@@ -36,15 +33,19 @@ public class Building10 extends BuildingCard {
} }
/** /**
* Counts the number of different character sets, and the player gains Prestige Points * Applies the effect of this building card to the specified player.
* equal to the number of sets multiplied by 6. * The effect grants 6 prestige points for each complete set of character cards.
* @param player the player who owns the building * owned by the player, where a complete set contains one card of each.
* @throws IllegalArgumentException thrown if the specified player does not own this building. * {@link CharacterType}.
*
* @param player the player to whom the effect is applied.
* @throws IllegalArgumentException if the player does not own this building card.
*/ */
@Override @Override
public void applyEffect(Player player) throws IllegalArgumentException { public void applyEffect(Player player) throws IllegalArgumentException {
if(!player.buildingCards.contains(this)) if(!player.buildingCards.contains(this))
throw new IllegalArgumentException(); throw new IllegalArgumentException();
HashMap<CharacterType,Integer> map = new HashMap<CharacterType,Integer>();
int numSet=player.getNType(CharacterType.INVENTOR); int numSet=player.getNType(CharacterType.INVENTOR);
for(CharacterType type : CharacterType.values()) for(CharacterType type : CharacterType.values())
@@ -56,4 +57,4 @@ public class Building10 extends BuildingCard {
player.addPrestige(6 * numSet); player.addPrestige(6 * numSet);
} }
} }
@@ -5,41 +5,33 @@ import it.polimi.ingsw.gc14.Model.Cards.BuildingCard;
import it.polimi.ingsw.gc14.Model.Cards.TribeCards.CharacterType; import it.polimi.ingsw.gc14.Model.Cards.TribeCards.CharacterType;
import it.polimi.ingsw.gc14.Model.Player; import it.polimi.ingsw.gc14.Model.Player;
import java.util.ArrayList;
/**
* At the end of the game, you gain the indicated amount of Prestige Points for each character
* card of the indicated type in your tribe.
*/
public class Building11 extends BuildingCard { public class Building11 extends BuildingCard {
/**
* Character type used by the building effect
*/
private CharacterType icon ; private CharacterType icon ;
/** /**
* @return the icon attribute * Returns the CharacterType associated with this building card effect.
*
* @return the CharacterType associated with this building card effect.
*/ */
public CharacterType getIcon() {return icon;} public CharacterType getIcon() {return icon;}
/**
* Prestige multiplier used by the building effect
*/
private int PrestigeMul; private int PrestigeMul;
/** /**
* @return the prestige multiplier attribute * Returns the prestige multiplier associated with this building card effect.
*
* @return the prestige multiplier associated with this building card effect.
*/ */
public int getPrestigeMul() {return PrestigeMul;} public int getPrestigeMul() {return PrestigeMul;}
/** /**
* Constructor of the building * Creates a Building11 card with the specified era, price, prestige value,
* @param era the game era of the building * character type icon, and prestige multiplier.
* @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 era the era of the building card.
* @param icon the character type used by the building effect * @param price the price of the building card.
* @param prestigeMul the Prestige Point multiplier used by the building effect * @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(int era, int price,int prestigeValue, CharacterType icon, int prestigeMul) { public Building11(int era, int price,int prestigeValue, CharacterType icon, int prestigeMul) {
super(era,price,prestigeValue); super(era,price,prestigeValue);
@@ -50,8 +42,9 @@ public class Building11 extends BuildingCard {
} }
/** /**
* Method to clone the building: it creates an exact copy. * Creates and returns a copy of this Building11 card.
* @return the new copy of the building *
* @return a clone of this Building11 card.
*/ */
@Override @Override
public BuildingCard clone() { public BuildingCard clone() {
@@ -59,10 +52,12 @@ public class Building11 extends BuildingCard {
} }
/** /**
* Calculates the number of characters of the indicated type. * Applies the effect of this building card to the specified player.
* Adds an amount of Prestige Points equal to the number of characters multiplied by the prestige multiplier. * The effect grants prestige points equal to the number of cards of the
* @param player the player who owns the building * associated CharacterType owned by the player, multiplied by the prestige multiplier.
* @throws IllegalArgumentException thrown if the specified player does not own this card. *
* @param player the player to whom the effect is applied-
* @throws IllegalArgumentException if the player does not own this building card-
*/ */
@Override @Override
public void applyEffect(Player player) throws IllegalArgumentException { public void applyEffect(Player player) throws IllegalArgumentException {
@@ -70,4 +65,4 @@ public class Building11 extends BuildingCard {
throw new IllegalArgumentException(); throw new IllegalArgumentException();
player.addPrestige(player.getNType(getIcon()) * this.getPrestigeMul()); player.addPrestige(player.getNType(getIcon()) * this.getPrestigeMul());
} }
} }
@@ -4,16 +4,14 @@ import it.polimi.ingsw.gc14.Model.Cards.Building.EffectType;
import it.polimi.ingsw.gc14.Model.Cards.BuildingCard; import it.polimi.ingsw.gc14.Model.Cards.BuildingCard;
import it.polimi.ingsw.gc14.Model.Player; import it.polimi.ingsw.gc14.Model.Player;
/**
* At the end of the game, you gain 25 Prestige Points.
*/
public class Building13 extends BuildingCard{ public class Building13 extends BuildingCard{
/** /**
* Constructor of the building * Creates a Building13 card with the specified era, price, and prestige value.
* @param era the game era of the building *
* @param price the price (in food) of the building * @param era the era of the building card.
* @param prestigeValue the number of Prestige Points gained from this building at the end of the game * @param price the price of the building card.
* @param prestigeValue the prestige value of the building card.
*/ */
public Building13(int era, int price,int prestigeValue) { public Building13(int era, int price,int prestigeValue) {
super(era,price,prestigeValue); super(era,price,prestigeValue);
@@ -22,8 +20,9 @@ public class Building13 extends BuildingCard{
} }
/** /**
* Method to clone the building: it creates an exact copy. * Creates and returns a copy of this Building13 card.
* @return the new copy of the building *
* @return a clone of this Building13 card.
*/ */
@Override @Override
public BuildingCard clone() { public BuildingCard clone() {
@@ -31,9 +30,10 @@ public class Building13 extends BuildingCard{
} }
/** /**
* Adds 25 Prestige Points to the player * Applies the effect of this building card to the specified player.
* @param player the player who owns the building *
* @throws IllegalArgumentException thrown if the specified player does not own this building. * @param player the player to whom the effect is applied.
* @throws IllegalArgumentException if the player does not own this building card.
*/ */
@Override @Override
public void applyEffect(Player player) throws IllegalArgumentException { public void applyEffect(Player player) throws IllegalArgumentException {
@@ -42,4 +42,4 @@ public class Building13 extends BuildingCard{
player.addPrestige(25); player.addPrestige(25);
} }
} }