Building8 added
This commit is contained in:
@@ -0,0 +1,34 @@
|
|||||||
|
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.Builder;
|
||||||
|
import it.polimi.ingsw.gc14.Model.Player;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
public class Building8 extends BuildingCard {
|
||||||
|
|
||||||
|
public Building8(int era, int price) {
|
||||||
|
super(era,price);
|
||||||
|
effectType= EffectType.FINAL;
|
||||||
|
effectId=5;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public BuildingCard clone() {
|
||||||
|
return new Building8(getEra(),getPrice());
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void applyEffect(Player player) {
|
||||||
|
ArrayList<Builder> builders = player.getCharacterCards().stream()
|
||||||
|
.filter(c -> c instanceof Builder)
|
||||||
|
.map(c -> (Builder) c)
|
||||||
|
.collect(Collectors.toCollection(ArrayList::new));
|
||||||
|
|
||||||
|
for (Builder builder : builders) {
|
||||||
|
player.addPrestige(builder.getPrestigeValue() * 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -6,7 +6,7 @@ import it.polimi.ingsw.gc14.Model.Cards.TribeCards.CharacterType;
|
|||||||
public class Builder extends Character
|
public class Builder extends Character
|
||||||
{
|
{
|
||||||
private int reductionValue;
|
private int reductionValue;
|
||||||
|
private int prestigeValue;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return Builder specific reduction value
|
* @return Builder specific reduction value
|
||||||
@@ -14,19 +14,28 @@ public class Builder extends Character
|
|||||||
public int getReductionValue() {
|
public int getReductionValue() {
|
||||||
return reductionValue;
|
return reductionValue;
|
||||||
}
|
}
|
||||||
public Builder(int Era, int reductionValue) throws IllegalArgumentException {
|
public int getPrestigeValue() {
|
||||||
|
return prestigeValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder(int Era, int reductionValue, int prestigeValue) throws IllegalArgumentException {
|
||||||
super(Era,CharacterType.BUILDER);
|
super(Era,CharacterType.BUILDER);
|
||||||
if(reductionValue < 0) {
|
if(reductionValue < 0) {
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
}
|
}
|
||||||
this.reductionValue = reductionValue;
|
this.reductionValue = reductionValue;
|
||||||
|
|
||||||
|
if(prestigeValue < 0) {
|
||||||
|
throw new IllegalArgumentException();
|
||||||
|
}
|
||||||
|
this.prestigeValue = prestigeValue;
|
||||||
}
|
}
|
||||||
public Builder(Builder copy)
|
public Builder(Builder copy)
|
||||||
{
|
{
|
||||||
this(copy.getEra(),copy.getReductionValue());
|
this(copy.getEra(),copy.getReductionValue(), copy.getPrestigeValue());
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public String toString() { return super.toString()+" Reduction Value: " + String.valueOf(reductionValue); }
|
public String toString() { return super.toString()+" Reduction Value: " + String.valueOf(reductionValue) + "\n Prestige Value: " + String.valueOf(prestigeValue); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Character clone() {
|
public Character clone() {
|
||||||
|
|||||||
Reference in New Issue
Block a user