Merge pull request #68

tests-fix
This commit is contained in:
GabrieleRadice
2026-05-02 17:35:41 +02:00
committed by GitHub
8 changed files with 202 additions and 30 deletions
@@ -159,8 +159,16 @@ public class BuildingCard extends PlayableCard implements Cloneable , BuildingEf
* @return {@code true} if the building card is successfully bought,
* {@code false} otherwise.
*/
// sum reduction value builder=> sconto
public boolean buy(Player player) {
if( bought || !player.removeFood(getPrice()))
int discount = 0;
discount = player.builders.stream().mapToInt(x -> x.getReductionValue()).sum();
if(discount > this.price){
discount = this.price;
}
if(bought || !player.removeFood(this.price - discount))
return false;
player.buildingCards.add(this);
bought=true;