Skip to content

Commit

Permalink
Merge pull request #45 from Our-Magic-Journey/teleport
Browse files Browse the repository at this point in the history
Teleport
  • Loading branch information
AmonDeShir authored Jan 5, 2024
2 parents 9f791b4 + a6af765 commit 2e4c4c5
Show file tree
Hide file tree
Showing 51 changed files with 461 additions and 74 deletions.
24 changes: 24 additions & 0 deletions assets/assets.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,30 @@ images/planet-field.png
images/planet-field-over.png
images/planet-field-down.png
images/planet-field-color.png
images/casino.png
images/casino-over.png
images/casino-down.png
images/hiper-hub.png
images/hiper-hub-over.png
images/hiper-hub-down.png
images/mine.png
images/mine-over.png
images/mine-down.png
images/nebula.png
images/nebula-over.png
images/nebula-down.png
images/start.png
images/start-over.png
images/start-down.png
images/teleport.png
images/teleport-over.png
images/teleport-down.png
images/unknown-jump.png
images/unknown-jump-over.png
images/unknown-jump-down.png
images/event.png
images/event-over.png
images/event-down.png
images/map-done.png
images/board-background.png
images/player0.png
Expand Down
Binary file added assets/images/casino-down.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/casino-over.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/casino.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/event-down.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/event-over.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/event.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/hiper-hub-down.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/hiper-hub-over.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/hiper-hub.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/mine-down.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/mine-over.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/mine.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/nebula-down.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/nebula-over.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/nebula.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/start-down.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/start-over.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/start.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/teleport-down.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/teleport-over.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/teleport.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/unknown-jump-down.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/unknown-jump-over.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/unknown-jump.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 7 additions & 7 deletions assets/skin/ui.skin.atlas
Original file line number Diff line number Diff line change
Expand Up @@ -101,17 +101,17 @@ panel
orig: 57, 96
offset: 0, 0
index: -1
white-pixel
rotate: false
xy: 1, 1
size: 1, 1
orig: 1, 1
offset: 0, 0
index: -1
panel-margin
rotate: false
xy: 60, 84
size: 5, 4
orig: 5, 4
offset: 0, 0
index: -1
white-pixel
rotate: false
xy: 1, 1
size: 1, 1
orig: 1, 1
offset: 0, 0
index: -1
Binary file modified assets/skin/ui.skin.json
Binary file not shown.
Binary file modified assets/skin/ui.skin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 10 additions & 1 deletion core/src/xyz/magicjourney/nebulaquest/board/Board.java
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,16 @@ public void setPlayerPosition(Player player, int fieldNumber, boolean isFinalMov

public void movePlayer(Player player, int moveBy, boolean isFinalMove) {
Pawn pawn = players.get(player);
int finalPos = (pawn.getField() + moveBy) % this.fields.length();
int finalPos = pawn.getField() + moveBy;

if (finalPos >= this.fields.length()) {
for (int i = pawn.getField() + 1; i < this.fields.length(); i++) {
this.fields.get(i).getEntity().onPass(player);
}

pawn.setField(-1);
finalPos -= this.fields.length();
}

for (int i = pawn.getField() + 1; i <= finalPos; i++) {
this.fields.get(i).getEntity().onPass(player);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@

public class BigField extends Field {
public BigField(Entity entity, AssetManager assets) {
super(entity, assets, 64, 64);
this(entity, "images/big-field", assets);
}

this.setTexture("images/big-field", assets);
public BigField(Entity entity, String texture, AssetManager assets) {
super(entity, texture, assets, 64, 64);
}
}
10 changes: 7 additions & 3 deletions core/src/xyz/magicjourney/nebulaquest/board/field/Field.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,22 @@ public class Field extends Button {
protected int correctPawnRotation;

public Field(Entity entity, AssetManager assets) {
this(entity, assets, 32, 64);
this(entity, "images/small-field", assets);
}

public Field(Entity entity, AssetManager assets, int width, int height) {
public Field(Entity entity, String texture, AssetManager assets) {
this(entity, texture, assets, 32, 64);
}

public Field(Entity entity, String texture, AssetManager assets, int width, int height) {
this.style = new ButtonStyle();
this.entity = entity;
this.correctPawnRotation = 0;

this.setWidth(width);
this.setHeight(height);
this.setStyle(this.style);
this.setTexture("images/small-field", assets);
this.setTexture(texture, assets);

// Rotate children with parent
this.setTransform(true);
Expand Down
2 changes: 1 addition & 1 deletion core/src/xyz/magicjourney/nebulaquest/entity/Buyable.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ default boolean isOwner(Player player) {
void setOwner(Player player);

default boolean mustPayFee(Player player) {
return this.getOwner().isPresent() && !this.isOwner(player);
return this.getOwner().isPresent() && this.getOwner().get() != player;
}

default boolean canByBought() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
public class Casino extends Entity implements Interactiveable {

public Casino() {
super("Casino", "Nice casino");
super("Suspicious\nSpace Station", "According to the local Republic administration, this space station should be abandoned. However, it appears freshly built and teeming with life. Will you dare to investigate its mysteries?");
}

@Override
Expand All @@ -23,7 +23,7 @@ public void onPass(Player player) {

@Override
public Field toField(AssetManager assets) {
return new Field(this, assets);
return new Field(this, "images/casino", assets);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package xyz.magicjourney.nebulaquest.entity.entities;

import java.util.Optional;

import com.badlogic.gdx.assets.AssetManager;

import xyz.magicjourney.nebulaquest.board.field.Field;
import xyz.magicjourney.nebulaquest.entity.Entity;
import xyz.magicjourney.nebulaquest.player.Player;

public class EmergencySignal extends Entity {
protected int value;
protected Optional<Player> owner;

public EmergencySignal() {
super("Emergency\nsignal", "");
}

@Override
public void onEnter(Player player) {
}

@Override
public void onPass(Player player) {
}

@Override
public Field toField(AssetManager assets) {
return new Field(this, "images/event", assets);
}
}
26 changes: 26 additions & 0 deletions core/src/xyz/magicjourney/nebulaquest/entity/entities/Mine.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package xyz.magicjourney.nebulaquest.entity.entities;

import com.badlogic.gdx.assets.AssetManager;

import xyz.magicjourney.nebulaquest.board.field.Field;
import xyz.magicjourney.nebulaquest.entity.Entity;
import xyz.magicjourney.nebulaquest.player.Player;

public class Mine extends Entity {
public Mine() {
super("Asteroid Mine", "");
}

@Override
public void onEnter(Player player) {
}

@Override
public void onPass(Player player) {
}

@Override
public Field toField(AssetManager assets) {
return new Field(this, "images/mine", assets);
}
}
27 changes: 27 additions & 0 deletions core/src/xyz/magicjourney/nebulaquest/entity/entities/Nebula.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package xyz.magicjourney.nebulaquest.entity.entities;

import com.badlogic.gdx.assets.AssetManager;

import xyz.magicjourney.nebulaquest.board.field.BigField;
import xyz.magicjourney.nebulaquest.board.field.Field;
import xyz.magicjourney.nebulaquest.entity.Entity;
import xyz.magicjourney.nebulaquest.player.Player;

public class Nebula extends Entity {
public Nebula() {
super("Nebula", "");
}

@Override
public void onEnter(Player player) {
}

@Override
public void onPass(Player player) {
}

@Override
public Field toField(AssetManager assets) {
return new BigField(this, "images/nebula", assets);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ public void onEnter(Player player) {

@Override
public void onPass(Player player) {
System.out.println("Give money!");
player.setMoney(player.getMoney() + MONEY_ON_PASS_START);
}

@Override
public Field toField(AssetManager assets) {
return new BigField(this, assets);
return new BigField(this, "images/start", assets);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,18 @@
public class Teleport extends Entity implements Buyable {
protected int value;
protected Optional<Player> owner;
protected int exitField;

public Teleport() {
public Teleport(int exitField) {
super("Teleport", "This is a well-known hyperspace path. It allows you to traverse to the opposite edge of the galaxy. You can fornicate the start and finish fields, then jumping players need to pay you a fee. Jump doesn't count as passing the starting field.");

this.value = 350;
this.owner = Optional.empty();
this.exitField = exitField;
}

public int getExit() {
return this.exitField;
}

@Override
Expand Down Expand Up @@ -50,6 +56,24 @@ public void onPass(Player player) {

@Override
public Field toField(AssetManager assets) {
return new Field(this, assets);
return new Field(this, "images/teleport", assets);
}

@Override
public String getInteractiveablePanelName(Player player) {
if (this.getOwner().isPresent() && this.getOwner().get() != player) {
return "TeleportPayFee";
}

return "Teleport";
}

@Override
public boolean isDecisionRequired(Player player) {
if (this.getOwner().isPresent() && this.getOwner().get() != player) {
return true;
}

return false;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package xyz.magicjourney.nebulaquest.entity.entities;

import com.badlogic.gdx.assets.AssetManager;

import xyz.magicjourney.nebulaquest.board.field.BigField;
import xyz.magicjourney.nebulaquest.board.field.Field;
import xyz.magicjourney.nebulaquest.entity.Entity;
import xyz.magicjourney.nebulaquest.player.Player;

public class TeleportHub extends Entity {
public TeleportHub() {
super("Teleport Hub", "");
}

@Override
public void onEnter(Player player) {
}

@Override
public void onPass(Player player) {
}

@Override
public Field toField(AssetManager assets) {
return new BigField(this, "images/hiper-hub", assets);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package xyz.magicjourney.nebulaquest.entity.entities;

import com.badlogic.gdx.assets.AssetManager;

import xyz.magicjourney.nebulaquest.board.field.BigField;
import xyz.magicjourney.nebulaquest.board.field.Field;
import xyz.magicjourney.nebulaquest.entity.Entity;
import xyz.magicjourney.nebulaquest.player.Player;

public class UnknownJump extends Entity {
public UnknownJump() {
super("UnknownJump", "");
}

@Override
public void onEnter(Player player) {
}

@Override
public void onPass(Player player) {
}

@Override
public Field toField(AssetManager assets) {
return new BigField(this, "images/unknown-jump", assets);
}
}
4 changes: 3 additions & 1 deletion core/src/xyz/magicjourney/nebulaquest/player/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,11 @@ public void setMoney(int money) {
}

public boolean buyProperty(Buyable property) {
if (property.canByBought() && this.pay(property.getValue())) {
if (property.canByBought() && this.getMoney() >= property.getValue()) {
this.money -= property.getValue();
this.properties.add(property);
property.setOwner(this);
this.changedEvent.emit(this);

return true;
}
Expand Down
Loading

0 comments on commit 2e4c4c5

Please sign in to comment.