Add: mesos rules in italian
Add: JavaDOC for Building0
This commit is contained in:
@@ -10,13 +10,28 @@ import it.polimi.ingsw.gc14.Model.Cards.TribeCards.CharacterType;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
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 {
|
public class Building0 extends BuildingCard {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The purchased attribute is used to indicate whether the card has already been initialized.
|
||||||
|
*/
|
||||||
boolean purchased ;
|
boolean purchased ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The numSet attribute indicates how many complete sets the player already has.
|
||||||
|
*/
|
||||||
private int numSet;
|
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) {
|
public Building0(int era,int price,int prestigeValue) {
|
||||||
super(era,price,prestigeValue);
|
super(era,price,prestigeValue);
|
||||||
effectType=EffectType.CARD_SET;
|
effectType=EffectType.CARD_SET;
|
||||||
@@ -25,6 +40,11 @@ public class Building0 extends BuildingCard {
|
|||||||
numSet = 0;
|
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
|
@Override
|
||||||
public boolean buy(Player player)
|
public boolean buy(Player player)
|
||||||
{
|
{
|
||||||
@@ -34,6 +54,11 @@ public class Building0 extends BuildingCard {
|
|||||||
return true;
|
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)
|
public void initialize(Player player)
|
||||||
{
|
{
|
||||||
if(purchased)
|
if(purchased)
|
||||||
@@ -49,10 +74,21 @@ public class Building0 extends BuildingCard {
|
|||||||
purchased = true;
|
purchased = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to clone the building: it creates an exact copy.
|
||||||
|
* @return the new copy of the building
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public BuildingCard clone() {
|
public BuildingCard clone() {
|
||||||
return new Building0(getEra(),getPrice(),getPrestigeValue());
|
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
|
@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))
|
||||||
|
|||||||
Reference in New Issue
Block a user