Modelle Fixes

This commit is contained in:
Luca Puderbach
2024-12-02 04:19:56 +01:00
parent 93152f4073
commit 91fea83f26
2 changed files with 151 additions and 16 deletions

View File

@@ -3,7 +3,6 @@ package pp.monopoly.model.fields;
import java.util.ArrayList;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.stream.Collector;
import java.util.stream.Collectors;
import com.jme3.network.serializing.Serializable;
@@ -180,5 +179,17 @@ public class BoardManager {
return groupProperties.stream()
.allMatch(bp -> bp.getHouses() <= currentHouses);
}
/**
* Gibt eine Liste von BuildingProperty-Feldern zurück, auf denen Häuser oder Hotels stehen.
* @return Liste von BuildingProperty-Feldern mit Gebäuden
*/
public List<BuildingProperty> getPropertiesWithBuildings() {
return board.stream()
.filter(f -> f instanceof BuildingProperty)
.map(f -> (BuildingProperty) f)
.filter(bp -> bp.getHouses() > 0 || bp.getHotel() > 0)
.collect(Collectors.toList());
}
}