Fixed: JavaDOC finished for Building4

This commit is contained in:
2026-04-21 14:01:02 +02:00
parent 28eed7c940
commit 98ee686aff
2 changed files with 25 additions and 7 deletions
@@ -2,13 +2,10 @@ 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.Characters.Artist;
import it.polimi.ingsw.gc14.Model.Player; 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 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. * From the moment you buy this building, every time you complete a set of 6 different characters, you gain 5 food.
@@ -22,7 +19,7 @@ public class Building0 extends BuildingCard {
boolean purchased ; boolean purchased ;
/** /**
* The numSet attribute indicates how many complete sets the player already has. * The numSet attribute indicates how many complete sets the player has.
*/ */
private int numSet; private int numSet;
@@ -2,15 +2,26 @@ 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.Characters.Inventor; import it.polimi.ingsw.gc14.Model.Cards.TribeCards.Characters.Inventor;
import it.polimi.ingsw.gc14.Model.Player; import it.polimi.ingsw.gc14.Model.Player;
import java.util.HashMap; import java.util.HashMap;
/**
* From when you purchase this Building, every time you obtain a pair of identical
* Inventors, you gain 3 Food.
* This effect doesn't apply on already owned pairs at the time of purchase.
*/
public class Building4 extends BuildingCard { public class Building4 extends BuildingCard {
/**
* The purchased attribute is used to indicate whether the card has already been initialized.
*/
boolean purchased ; boolean purchased ;
/**
* The numPair attribute indicates how many Inventors pairs the player has.
*/
int numPair; int numPair;
/** /**
@@ -25,6 +36,11 @@ public class Building4 extends BuildingCard {
effectId=4; effectId=4;
} }
/**
* Initializes the building by counting the number of Inventors pairs 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 pairs.
*/
public void initialize(Player player) public void initialize(Player player)
{ {
if(purchased) if(purchased)
@@ -72,7 +88,12 @@ public class Building4 extends BuildingCard {
return new Building4(getEra(),getPrice(),getPrestigeValue()); 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 @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))