mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2025-08-01 06:27:40 +02:00
Compare commits
6 Commits
1e20a2ac6e
...
demo
Author | SHA1 | Date | |
---|---|---|---|
|
eb54fb1d14 | ||
|
40c550cc4d | ||
|
18300987a4 | ||
|
df4a81cbf2 | ||
|
c635df9369 | ||
|
c6ad605021 |
@@ -43,6 +43,7 @@ public class BoardAppState extends MonopolyAppState {
|
||||
* The path to the unshaded texture material.
|
||||
*/
|
||||
private static final String UNSHADED = "Common/MatDefs/Misc/Unshaded.j3md"; //NON-NLS
|
||||
private static final String LIGHTING = "Common/MatDefs/Light/Lighting.j3md";
|
||||
|
||||
/**
|
||||
* The path to the sea texture material.
|
||||
@@ -69,13 +70,8 @@ public class BoardAppState extends MonopolyAppState {
|
||||
*/
|
||||
private PopUpManager popUpManager;
|
||||
|
||||
private Vector3f currentTarget;
|
||||
|
||||
|
||||
|
||||
private Node modelNode;
|
||||
|
||||
private CameraController cameraController;
|
||||
|
||||
private CameraInputHandler cameraInputHandler;
|
||||
|
||||
|
||||
@@ -91,7 +87,7 @@ public class BoardAppState extends MonopolyAppState {
|
||||
super.initialize(stateManager, application);
|
||||
|
||||
// Initialisiere den CameraController zuerst
|
||||
cameraController = new CameraController(getApp().getCamera(), 25, 40);
|
||||
cameraController = new CameraController(getApp().getCamera(), getApp());
|
||||
|
||||
// Danach den CameraInputHandler mit dem initialisierten CameraController
|
||||
cameraInputHandler = new CameraInputHandler(cameraController, getApp().getInputManager());
|
||||
@@ -100,7 +96,8 @@ public class BoardAppState extends MonopolyAppState {
|
||||
viewNode.attachChild(sceneNode);
|
||||
|
||||
setupLights();
|
||||
setupSky();
|
||||
// setupSky();
|
||||
getApp().getViewPort().setBackgroundColor(new com.jme3.math.ColorRGBA(0.5f, 0.7f, 1.0f, 1.0f));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -158,7 +155,8 @@ public class BoardAppState extends MonopolyAppState {
|
||||
viewNode.addLight(sun);
|
||||
shRend.setLight(sun);
|
||||
|
||||
final AmbientLight ambientLight = new AmbientLight(new ColorRGBA(1f, 1f, 1f, 1f));
|
||||
final AmbientLight ambientLight = new AmbientLight();
|
||||
// ambientLight.setColor(ColorRGBA.White.mult(0.f)); // brightness
|
||||
viewNode.addLight(ambientLight);
|
||||
}
|
||||
|
||||
@@ -201,44 +199,44 @@ public class BoardAppState extends MonopolyAppState {
|
||||
addCylinderCaps();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds top and bottom caps to the cylinder sky.
|
||||
*/
|
||||
private void addCylinderCaps() {
|
||||
final AssetManager assetManager = getApp().getAssetManager();
|
||||
/**
|
||||
* Adds top and bottom caps to the cylinder sky.
|
||||
*/
|
||||
private void addCylinderCaps() {
|
||||
final AssetManager assetManager = getApp().getAssetManager();
|
||||
|
||||
float radius = 500f; // Match the cylinder's radius
|
||||
float height = 225f; // Match the cylinder's height
|
||||
int radialSamples = 64; // Match the cylinder's radial samples
|
||||
float radius = 500f; // Match the cylinder's radius
|
||||
float height = 225f; // Match the cylinder's height
|
||||
int radialSamples = 64; // Match the cylinder's radial samples
|
||||
|
||||
// Bottom Cap
|
||||
Cylinder bottomCap = new Cylinder(2, radialSamples, radius, 0.01f, true, false); // Thin bottom cap
|
||||
Geometry bottomGeometry = new Geometry("BottomCap", bottomCap);
|
||||
bottomGeometry.setLocalTranslation(0, -height / 2, 0); // Position at the bottom
|
||||
bottomGeometry.rotate(FastMath.HALF_PI, 0, 0); // Rotate to make it horizontal
|
||||
Material bottomMaterial = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
|
||||
bottomMaterial.setTexture("ColorMap", assetManager.loadTexture("Textures/grass.jpg")); // Bottom texture
|
||||
bottomMaterial.getAdditionalRenderState().setFaceCullMode(FaceCullMode.Off); // Render both sides
|
||||
bottomGeometry.setMaterial(bottomMaterial);
|
||||
bottomGeometry.setQueueBucket(RenderQueue.Bucket.Sky);
|
||||
bottomGeometry.setCullHint(Spatial.CullHint.Never);
|
||||
// Bottom Cap
|
||||
Cylinder bottomCap = new Cylinder(2, radialSamples, radius, 0.01f, true, false); // Thin bottom cap
|
||||
Geometry bottomGeometry = new Geometry("BottomCap", bottomCap);
|
||||
bottomGeometry.setLocalTranslation(0, -height / 2, 0); // Position at the bottom
|
||||
bottomGeometry.rotate(FastMath.HALF_PI, 0, 0); // Rotate to make it horizontal
|
||||
Material bottomMaterial = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
|
||||
bottomMaterial.setTexture("ColorMap", assetManager.loadTexture("Textures/grass.jpg")); // Bottom texture
|
||||
bottomMaterial.getAdditionalRenderState().setFaceCullMode(FaceCullMode.Off); // Render both sides
|
||||
bottomGeometry.setMaterial(bottomMaterial);
|
||||
bottomGeometry.setQueueBucket(RenderQueue.Bucket.Sky);
|
||||
bottomGeometry.setCullHint(Spatial.CullHint.Never);
|
||||
|
||||
// Top Cap
|
||||
Cylinder topCap = new Cylinder(2, radialSamples, radius, 0.01f, true, false); // Thin top cap
|
||||
Geometry topGeometry = new Geometry("TopCap", topCap);
|
||||
topGeometry.setLocalTranslation(0, height / 2, 0); // Position at the top
|
||||
topGeometry.rotate(FastMath.HALF_PI, 0, 0); // Rotate to make it horizontal
|
||||
Material topMaterial = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
|
||||
topMaterial.setTexture("ColorMap", assetManager.loadTexture("Textures/Top.png")); // Top texture
|
||||
topMaterial.getAdditionalRenderState().setFaceCullMode(FaceCullMode.Off); // Render both sides
|
||||
topGeometry.setMaterial(topMaterial);
|
||||
topGeometry.setQueueBucket(RenderQueue.Bucket.Sky);
|
||||
topGeometry.setCullHint(Spatial.CullHint.Never);
|
||||
// Top Cap
|
||||
Cylinder topCap = new Cylinder(2, radialSamples, radius, 0.01f, true, false); // Thin top cap
|
||||
Geometry topGeometry = new Geometry("TopCap", topCap);
|
||||
topGeometry.setLocalTranslation(0, height / 2, 0); // Position at the top
|
||||
topGeometry.rotate(FastMath.HALF_PI, 0, 0); // Rotate to make it horizontal
|
||||
Material topMaterial = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
|
||||
topMaterial.setTexture("ColorMap", assetManager.loadTexture("Textures/Top.png")); // Top texture
|
||||
topMaterial.getAdditionalRenderState().setFaceCullMode(FaceCullMode.Off); // Render both sides
|
||||
topGeometry.setMaterial(topMaterial);
|
||||
topGeometry.setQueueBucket(RenderQueue.Bucket.Sky);
|
||||
topGeometry.setCullHint(Spatial.CullHint.Never);
|
||||
|
||||
// Attach caps to the view node
|
||||
viewNode.attachChild(bottomGeometry);
|
||||
viewNode.attachChild(topGeometry);
|
||||
}
|
||||
// Attach caps to the view node
|
||||
viewNode.attachChild(bottomGeometry);
|
||||
viewNode.attachChild(topGeometry);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -257,7 +255,16 @@ private void addCylinderCaps() {
|
||||
seaGeo.setLocalRotation(rotation);
|
||||
final Material seaMat = new Material(getApp().getAssetManager(), "Common/MatDefs/Light/Lighting.j3md");
|
||||
Texture texture = getApp().getAssetManager().loadTexture("Pictures/board2.png");
|
||||
texture.setMagFilter(Texture.MagFilter.Bilinear);
|
||||
texture.setMinFilter(Texture.MinFilter.Trilinear);
|
||||
seaMat.setTexture("DiffuseMap", texture);
|
||||
|
||||
// Add specular highlights
|
||||
// seaMat.setBoolean("UseMaterialColors", true);
|
||||
seaMat.setColor("Diffuse", ColorRGBA.White);
|
||||
seaMat.setColor("Specular", ColorRGBA.White);
|
||||
// seaMat.setFloat("Shininess", 16f);
|
||||
|
||||
seaGeo.setMaterial(seaMat);
|
||||
seaGeo.setShadowMode(ShadowMode.CastAndReceive);
|
||||
TangentBinormalGenerator.generate(seaGeo);
|
||||
@@ -266,7 +273,7 @@ private void addCylinderCaps() {
|
||||
sceneNode.attachChild(seaGeo);
|
||||
|
||||
// Schneefall hinzufügen
|
||||
addSnowEffect(sceneNode);
|
||||
// addSnowEffect(sceneNode);
|
||||
}
|
||||
|
||||
private Node createCardDeck() {
|
||||
@@ -278,7 +285,7 @@ private void addCylinderCaps() {
|
||||
for (int i = 0; i < 6; i++) {
|
||||
Box box = new Box(1.2f, 0.05f, 1.8f); // Sehr flaches Rechteck
|
||||
Geometry flatCard = new Geometry("Ereigniskarten_" + i, box);
|
||||
Material mat = new Material(getApp().getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
|
||||
Material mat = new Material(getApp().getAssetManager(), UNSHADED);
|
||||
mat.setTexture("ColorMap", getApp().getAssetManager().loadTexture("Textures/Ereigniskarten.png"));
|
||||
flatCard.setMaterial(mat);
|
||||
|
||||
@@ -308,9 +315,6 @@ private void addCylinderCaps() {
|
||||
|
||||
return cardDeck;
|
||||
}
|
||||
public Vector3f getCurrentTarget(){
|
||||
return currentTarget;
|
||||
}
|
||||
|
||||
private void addSnowEffect(Node parentNode) {
|
||||
// ParticleEmitter für Schnee
|
||||
@@ -341,4 +345,10 @@ private void addCylinderCaps() {
|
||||
parentNode.attachChild(snowEmitter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(float tpf) {
|
||||
super.update(tpf);
|
||||
cameraController.update(tpf);
|
||||
}
|
||||
|
||||
}
|
@@ -292,7 +292,7 @@ public class MonopolyApp extends SimpleApplication implements MonopolyClient, Ga
|
||||
final StatsAppState stats = new StatsAppState(guiNode, normalFont);
|
||||
stateManager.attach(stats);
|
||||
}
|
||||
flyCam.setEnabled(true);
|
||||
flyCam.setEnabled(false);
|
||||
flyCam.setMoveSpeed(4f); // Setzt die Bewegungsgeschwindigkeit der Kamera (Standardwert ist 1f)
|
||||
|
||||
stateManager.detach(stateManager.getState(StatsAppState.class));
|
||||
|
@@ -56,7 +56,7 @@ public class PopUpManager implements GameEventListener {
|
||||
}
|
||||
});
|
||||
}
|
||||
}, 6000);
|
||||
}, 8000);
|
||||
} else if (event.msg().equals("Winner")) {
|
||||
new WinnerPopUp(app).open();
|
||||
} else if (event.msg().equals("Looser")) {
|
||||
|
@@ -3,7 +3,13 @@ package pp.monopoly.client.gui;
|
||||
import com.jme3.math.Vector3f;
|
||||
import com.jme3.renderer.Camera;
|
||||
|
||||
public class CameraController {
|
||||
import pp.monopoly.client.MonopolyApp; // Import MonopolyApp
|
||||
import pp.monopoly.game.server.PlayerHandler;
|
||||
import pp.monopoly.notification.GameEventListener;
|
||||
import pp.monopoly.notification.UpdatePlayerView;
|
||||
|
||||
public class CameraController implements GameEventListener{
|
||||
|
||||
public enum CameraMode {
|
||||
FOCUS_CURRENT_PLAYER,
|
||||
FOCUS_SELF,
|
||||
@@ -11,49 +17,92 @@ public class CameraController {
|
||||
}
|
||||
|
||||
private final Camera camera;
|
||||
private CameraMode currentMode = CameraMode.FOCUS_CURRENT_PLAYER;
|
||||
private CameraMode currentMode;
|
||||
|
||||
private final float height; // Höhe der Kamera
|
||||
private final float offset; // Versatz zur Spielfeldseite
|
||||
private PlayerHandler playerHandler; // Reference to PlayerHandler for player data
|
||||
private final MonopolyApp app; // Reference to MonopolyApp for self ID
|
||||
|
||||
public CameraController(Camera camera, float height, float offset) {
|
||||
public CameraController(Camera camera, MonopolyApp app) {
|
||||
this.camera = camera;
|
||||
this.height = height;
|
||||
this.offset = offset;
|
||||
setMode(currentMode);
|
||||
this.playerHandler = app.getGameLogic().getPlayerHandler();
|
||||
this.app = app;
|
||||
app.getGameLogic().addListener(this);
|
||||
setMode(CameraMode.FOCUS_SELF); // Initialize the camera mode
|
||||
}
|
||||
|
||||
public void setMode(CameraMode mode) {
|
||||
this.currentMode = mode;
|
||||
updatePosition(0); // Standardmäßig das Startfeld fokussieren
|
||||
}
|
||||
|
||||
public void update(float tpf) {
|
||||
if (currentMode != CameraMode.FREECAM) {
|
||||
camera.lookAt(Vector3f.ZERO, Vector3f.UNIT_Y);
|
||||
}
|
||||
}
|
||||
|
||||
public void updatePosition(int fieldID) {
|
||||
Vector3f newPosition = fieldIdToVector(fieldID);
|
||||
camera.setLocation(newPosition);
|
||||
if (currentMode != CameraMode.FREECAM) {
|
||||
camera.lookAt(Vector3f.ZERO, Vector3f.UNIT_Y);
|
||||
}
|
||||
}
|
||||
|
||||
private Vector3f fieldIdToVector(int fieldID) {
|
||||
switch (currentMode) {
|
||||
case FOCUS_CURRENT_PLAYER:
|
||||
if (fieldID <= 10) return new Vector3f(offset, height, 0);
|
||||
if (fieldID <= 20) return new Vector3f(0, height, offset);
|
||||
if (fieldID <= 30) return new Vector3f(-offset, height, 0);
|
||||
return new Vector3f(0, height, -offset);
|
||||
updatePosition();
|
||||
break;
|
||||
case FOCUS_SELF:
|
||||
return new Vector3f(0, height, fieldID <= 20 ? offset : -offset);
|
||||
updatePosition();
|
||||
break;
|
||||
|
||||
case FREECAM:
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
return new Vector3f(0, height, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void updatePosition() {
|
||||
Vector3f newPosition = getPos();
|
||||
camera.setLocation(newPosition);
|
||||
|
||||
camera.lookAt(app.getGameLogic().getBoard().getFigure(app.getId()).getPos(), Vector3f.UNIT_Y);
|
||||
camera.update();
|
||||
}
|
||||
|
||||
private Vector3f getPos() {
|
||||
Vector3f pos = new Vector3f();
|
||||
switch (currentMode) {
|
||||
case FOCUS_CURRENT_PLAYER:
|
||||
pos = app.getGameLogic().getBoard().getFigure(playerHandler.getPlayerById(0).getId()).getPos();
|
||||
|
||||
case FOCUS_SELF:
|
||||
pos = app.getGameLogic().getBoard().getFigure(app.getId()).getPos();
|
||||
|
||||
case FREECAM:
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
Vector3f offset = getOffset();
|
||||
pos = new Vector3f(pos.getX() + offset.getX(), pos.getY() + offset.getY(), pos.getZ() + offset.getZ());
|
||||
|
||||
return pos;
|
||||
|
||||
}
|
||||
|
||||
private Vector3f getOffset() {
|
||||
Vector3f offset = new Vector3f();
|
||||
|
||||
int fieldId = playerHandler.getPlayerById( (currentMode == CameraMode.FOCUS_SELF ? app.getId() : playerHandler.getPlayerAtIndex(0).getId()) ).getFieldID();
|
||||
// System.out.println();
|
||||
if(fieldId < 10) {
|
||||
offset = new Vector3f(0, 10, -15);
|
||||
} else if(fieldId < 20) {
|
||||
offset = new Vector3f(15 , 10, 0);
|
||||
} else if(fieldId < 30) {
|
||||
offset = new Vector3f(0, 10, 15 );
|
||||
} else {
|
||||
offset = new Vector3f(-15, 10, 0);
|
||||
}
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receivedEvent(UpdatePlayerView event) {
|
||||
playerHandler = app.getGameLogic().getPlayerHandler();
|
||||
}
|
||||
}
|
||||
|
@@ -76,11 +76,11 @@ public class GateFieldCard extends Dialog implements PopupDialog {
|
||||
propertyValuesContainer.addChild(new Label("„Preis: " + field.getPrice() + " EUR", new ElementId("label-Text")));
|
||||
propertyValuesContainer.addChild(new Label("", new ElementId("label-Text"))); // Empty line
|
||||
propertyValuesContainer.addChild(new Label("Miete: 250 EUR", new ElementId("label-Text")));
|
||||
propertyValuesContainer.addChild(new Label("Wenn man 2 Bahnhöfe", new ElementId("label-Text")));
|
||||
propertyValuesContainer.addChild(new Label("Wenn man 2 Tore", new ElementId("label-Text")));
|
||||
propertyValuesContainer.addChild(new Label("besitzt: 500 EUR", new ElementId("label-Text")));
|
||||
propertyValuesContainer.addChild(new Label("Wenn man 3 Bahnhöfe", new ElementId("label-Text")));
|
||||
propertyValuesContainer.addChild(new Label("Wenn man 3 Tore", new ElementId("label-Text")));
|
||||
propertyValuesContainer.addChild(new Label("besitzt: 1000 EUR", new ElementId("label-Text")));
|
||||
propertyValuesContainer.addChild(new Label("Wenn man 4 Bahnhöfe", new ElementId("label-Text")));
|
||||
propertyValuesContainer.addChild(new Label("Wenn man 4 Tore", new ElementId("label-Text")));
|
||||
propertyValuesContainer.addChild(new Label("besitzt: 2000 EUR", new ElementId("label-Text")));
|
||||
propertyValuesContainer.addChild(new Label("", new ElementId("label-Text"))); // Empty line
|
||||
propertyValuesContainer.addChild(new Label("„Hypothek: " + field.getHypo() + " EUR", new ElementId("label-Text")));
|
||||
|
@@ -327,6 +327,11 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker {
|
||||
|
||||
board.add(new Hotel(property.getId()));
|
||||
} else {
|
||||
|
||||
for(int i = 0; i < 4; i++) {
|
||||
board.remove(board.getHouse(msg.getId(), i+1));
|
||||
}
|
||||
|
||||
board.add(new House( property.getHouses(), property.getId()));
|
||||
}
|
||||
} else {
|
||||
|
@@ -492,7 +492,8 @@ public class Player implements FieldVisitor<Void>{
|
||||
}
|
||||
return total;
|
||||
}
|
||||
// private static int c = 0;
|
||||
private static int c = 0;
|
||||
private static int[] rolls = {4,4, 1,2, 2,3};
|
||||
|
||||
/**
|
||||
* Inner class for dice functionality in the game.
|
||||
@@ -507,8 +508,20 @@ public class Player implements FieldVisitor<Void>{
|
||||
* @return the result of a dice roll (1 to 6)
|
||||
*/
|
||||
private static int rollDice() {
|
||||
return random.nextInt(6) + 1;
|
||||
// return random.nextInt(6) + 1;
|
||||
// c++;
|
||||
if(c >= rolls.length) return random.nextInt(6) + 1;
|
||||
System.out.println();
|
||||
System.out.println();
|
||||
System.out.println();
|
||||
System.out.println();
|
||||
System.out.println("DICEEEEEEEEEEEEEEEEEEEEE");
|
||||
System.out.println();
|
||||
System.out.println();
|
||||
System.out.println();
|
||||
System.out.println();
|
||||
System.out.println();
|
||||
return rolls[c++];
|
||||
// return (c%2 == 0)? 3: 2;
|
||||
// if(c < 7) {
|
||||
// return 3;
|
||||
|
@@ -120,7 +120,7 @@ public class PlayerHandler {
|
||||
* @param index the index of the queue
|
||||
* @return the Player at the required index
|
||||
*/
|
||||
Player getPlayerAtIndex(int index) {
|
||||
public Player getPlayerAtIndex(int index) {
|
||||
return players.get(index);
|
||||
}
|
||||
|
||||
@@ -165,10 +165,11 @@ public class PlayerHandler {
|
||||
* Shuffles the players and sets their state to WaitForNextTurn, the first one will be active
|
||||
*/
|
||||
void randomOrder() {
|
||||
Collections.shuffle(players);
|
||||
for (Player player : players) {
|
||||
player.finishTurn();
|
||||
}
|
||||
// Collections.shuffle(players);
|
||||
// for (Player player : players) {
|
||||
// player.finishTurn();
|
||||
// }
|
||||
nextPlayer();
|
||||
players.get(0).setActive();
|
||||
}
|
||||
|
||||
|
@@ -229,6 +229,8 @@ public class ServerGameLogic implements ClientInterpreter {
|
||||
for (Player p : playerHandler.getPlayers()) {
|
||||
send(p, new GameStart(playerHandler));
|
||||
}
|
||||
|
||||
|
||||
playerHandler.randomOrder();
|
||||
send(playerHandler.getPlayerAtIndex(0), new NextPlayerTurn());
|
||||
}
|
||||
@@ -472,7 +474,7 @@ public class ServerGameLogic implements ClientInterpreter {
|
||||
|
||||
// Define properties to assign
|
||||
Set<Integer> p1Properties = Set.of(1, 3, 6, 8); // Gym, Sportplatz, Studium+, PhysikHörsaal
|
||||
Set<Integer> p2Properties = Set.of(21, 23, 24, 9); // Red set + Audimax
|
||||
Set<Integer> p2Properties = Set.of(21, 23, 24, 9, 11); // Red set + Audimax + Spießtor
|
||||
|
||||
// Assign properties via AlterProperty
|
||||
assignProperties(p1, p1Properties);
|
||||
@@ -483,13 +485,15 @@ public class ServerGameLogic implements ClientInterpreter {
|
||||
|
||||
// Player 2 builds houses on the Red set
|
||||
// buildHouses(p2, Set.of(21, 23, 24));
|
||||
// buildHouses(p2, Set.of(23, 24));
|
||||
// // buildHouses(p2, Set.of( 24));
|
||||
|
||||
// Set player balances
|
||||
p1.setAccountBalance(12325);
|
||||
p2.setAccountBalance(26750);
|
||||
|
||||
// Add Get Out of Jail cards
|
||||
p1.addJailCard();
|
||||
p2.addJailCard();
|
||||
|
||||
// Set player positions
|
||||
p1.setPosition(6); // Near Studium+
|
||||
@@ -514,6 +518,8 @@ public class ServerGameLogic implements ClientInterpreter {
|
||||
field.setOwner(player);
|
||||
player.addProperty(propertyId);
|
||||
}
|
||||
|
||||
updateAllPlayers();
|
||||
LOGGER.log(Level.DEBUG, "Properties assigned to player {0}: {1}", player.getName(), properties);
|
||||
}
|
||||
|
||||
@@ -532,6 +538,8 @@ public class ServerGameLogic implements ClientInterpreter {
|
||||
if (boardManager.canBuild(field) && player.getAccountBalance() >= field.getHousePrice()) {
|
||||
field.build();
|
||||
player.pay(field.getHousePrice());
|
||||
updateAllPlayers();
|
||||
sendAll( new BuildInfo(field.getId(), true));
|
||||
LOGGER.log(Level.DEBUG, "House built on property {0} for player {1}.", field.getName(), player.getName());
|
||||
}
|
||||
}
|
||||
|
@@ -147,6 +147,10 @@ public class Board {
|
||||
return getHotels().filter(hotel -> hotel.getFieldID() == fieldId).findFirst().orElse(null);
|
||||
}
|
||||
|
||||
public Figure getFigure(int playerId) {
|
||||
return getFigures().filter(figure -> figure.getId() == playerId).findFirst().orElse(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a stream of all hotels currently on the map.
|
||||
*
|
||||
|
@@ -17,25 +17,26 @@ public class DeckHelper{
|
||||
|
||||
public DeckHelper() {
|
||||
cards = new LinkedList<Card>();
|
||||
cards.add(new Card("Dein Jodel eines Schneepenis mit Unterhodenbeleuchtung geht viral. Ziehe 1000 EUR ein", "jodel-eispenis"));
|
||||
cards.add(new Card("Auf deiner Stube wurde Schimmel gefunden. Gehe ins Gulak. Begib dich direkt dorthin. Gehe nicht über Monatsgehalt. Ziehe nicht 2000 EUR ein.", "schimmel-gulak"));
|
||||
cards.add(new Card("Malkmus läd zum Pubquiz ein. Rücke vor bis zum 20er.", "pubquiz"));
|
||||
cards.add(new Card("Du wurdest mit einem Dienst KFZ geblitzt. Zahle 800 EUR", "dienst-kfz-blitzer"));
|
||||
cards.add(new Card("Die erste Spoparty steht bevor. Ziehe vor zum 23er.", "spoparty"));
|
||||
cards.add(new Card("Deine IGF-Daten sind verschwunden. Statte Padubrin einen Besuch ab und gib ihm einen Jägermeister aus. Zahle 250 EUR", "IGF-Padubrin"));
|
||||
cards.add(new Card("Du kommst aus dem Gulak frei!", "gulak-frei-1"));
|
||||
cards.add(new Card("Du kommst aus dem Gulak frei!", "gulak-frei-2"));
|
||||
cards.add(new Card("Du hast den Dienstführerschein bestanden. Ziehe vor bis Teststrecke.", "dienstfuehrerschein"));
|
||||
cards.add(new Card("Malkmus läd zum Pubquiz ein. Rücke vor bis zum 20er.", "pubquiz"));
|
||||
cards.add(new Card("Deine IGF-Daten sind verschwunden. Statte Padubrin einen Besuch ab und gib ihm einen Jägermeister aus. Zahle 250 EUR", "IGF-Padubrin"));
|
||||
cards.add(new Card("Du hast heute die Spendierhosen an und gibst eine Runde in der Unibar. Zahle jedem Spieler 400 EUR", "spendierhosen-unibar"));
|
||||
cards.add(new Card("Du musstest einen Rückstuferantrag stellen. Setze eine Runde aus.", "rueckstuferantrag"));
|
||||
cards.add(new Card("Du warst in der Prüfungsphase krank. Gehe 3 Felder zurück.", "pruefungsphase-krank"));
|
||||
cards.add(new Card("Ziehe vor bis zum nächsten Monatsgehalt.", "naechstes-monatsgehalt"));
|
||||
cards.add(new Card("Du hast ein Antreten verschlafen. Zahle 500 EUR", "antreten-verschlafen-1"));
|
||||
cards.add(new Card("Du hast den Maibock organisiert. Du erhältst 3000 EUR", "maibock-organisiert"));
|
||||
cards.add(new Card("Der Spieß macht eine unangekündigte Inventur. Zahle für jedes Haus 400 EUR und für jedes Hotel 2800 EUR", "inventur-haeuser-hotels"));
|
||||
cards.add(new Card("Es gab keine Mozzarella-Bällchen mehr für Thoma. Rücke vor bis aufs Gym.", "dienstsport-gym"));
|
||||
cards.add(new Card("Auf deiner Stube wurde Schimmel gefunden. Gehe ins Gulak. Begib dich direkt dorthin. Gehe nicht über Monatsgehalt. Ziehe nicht 2000 EUR ein.", "schimmel-gulak"));
|
||||
cards.add(new Card("Deine Stube ist nach einer Partynacht nicht mehr bewohnbar. Du ziehst ins Gulak. Begib dich direkt dorthin. Gehe nicht über Monatsgehalt. Ziehe nicht 2000 EUR ein.", "partynacht-gulak"));
|
||||
cards.add(new Card("Das Jahresabschlussantreten steht an. Ziehe vor bis Schwimmhalle.", "jahresabschlussantreten"));
|
||||
cards.add(new Card("Du wurdest beim Verkaufen von Versicherungen erwischt. Zahle 4000 EUR", "verkaufen-versicherungen"));
|
||||
cards.add(new Card("Du musstest einen Rückstuferantrag stellen. Setze eine Runde aus.", "rueckstuferantrag"));
|
||||
cards.add(new Card("Auf einer Hausfeier bist du betrunken auf der Treppe gestürzt und dabei auf einen Kameraden gefallen. Zahle 800 EUR und gehe zurück zum SanZ.", "hausfeier-sturz"));
|
||||
cards.add(new Card("Beförderung. Beim nächsten Monatsgehalt ziehst du 3000 EUR ein", "befoerderung"));
|
||||
cards.add(new Card("Du entscheidest dich für eine Dienstreise nach Lourd. Zahle 1000 EUR und setze eine Runde aus.", "dienstreise-lourd"));
|
||||
@@ -48,9 +49,8 @@ public class DeckHelper{
|
||||
cards.add(new Card("Du wurdest zur VP gewählt und schmeißt eine Einstandsparty. Zahle 800 EUR", "vp-einstandsparty"));
|
||||
cards.add(new Card("Du hast eine Party veranstaltet und dick Gewinn gemacht. Ziehe 1500 EUR ein", "party-gewinn"));
|
||||
cards.add(new Card("Zur falschen Zeit am falschen Ort. Du musst einen Bergmarsch planen und setzt eine Runde aus.", "bergmarsch"));
|
||||
cards.add(new Card("Dein Jodel eines Schneepenis mit Unterhodenbeleuchtung geht viral. Ziehe 1000 EUR ein", "jodel-eispenis"));
|
||||
|
||||
shuffle();
|
||||
// shuffle();
|
||||
}
|
||||
|
||||
public void visit(Card card, Player player) {
|
||||
|
Reference in New Issue
Block a user