Compare commits
6 Commits
develop-st
...
develop-ja
| Author | SHA1 | Date | |
|---|---|---|---|
| e760cdb2c6 | |||
| c111c027ff | |||
| 2f8ff36e5e | |||
| 5cb71c5c32 | |||
| 5ab42fde4b | |||
| d5c2f06409 |
@@ -133,7 +133,7 @@ public class ElytraRace extends StatelessGame {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.playerCheckpoints.putIfAbsent(player, new CheckPointData(this.ringSpacing, this.ringSpacing * 2));
|
this.playerCheckpoints.putIfAbsent(player, new CheckPointData(0, this.ringSpacing));
|
||||||
|
|
||||||
if(newPos.z() > this.generatedUntil - this.ringSpacing) {
|
if(newPos.z() > this.generatedUntil - this.ringSpacing) {
|
||||||
this.generateRing(this.generatedUntil + this.ringSpacing);
|
this.generateRing(this.generatedUntil + this.ringSpacing);
|
||||||
@@ -224,7 +224,9 @@ public class ElytraRace extends StatelessGame {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void toCheckpoint(Player p) {
|
private void toCheckpoint(Player p) {
|
||||||
|
CheckPointData data = this.playerCheckpoints.get(p);
|
||||||
Point checkpointPos = this.getRingPositionAtZ(this.playerCheckpoints.get(p).currentCheckpoint);
|
Point checkpointPos = this.getRingPositionAtZ(this.playerCheckpoints.get(p).currentCheckpoint);
|
||||||
|
if(data.currentCheckpoint == 0) checkpointPos = this.getSpawn().add(0, 3, 0);
|
||||||
p.setVelocity(Vec.ZERO);
|
p.setVelocity(Vec.ZERO);
|
||||||
p.setFlyingWithElytra(false);
|
p.setFlyingWithElytra(false);
|
||||||
p.teleport(Pos.fromPoint(checkpointPos).add(0.5, 0, 0.5));
|
p.teleport(Pos.fromPoint(checkpointPos).add(0.5, 0, 0.5));
|
||||||
|
|||||||
@@ -28,7 +28,8 @@ public class StickFightFactory implements GameFactory {
|
|||||||
@Override
|
@Override
|
||||||
public ConfigManager configuration() {
|
public ConfigManager configuration() {
|
||||||
return new ConfigManager()
|
return new ConfigManager()
|
||||||
.addOption(new NumericOption("length", Material.SANDSTONE, TranslatedComponent.byId("optionCommon#length"), 7, 10, 13, 16, 19));
|
.addOption(new NumericOption("length", Material.SANDSTONE, TranslatedComponent.byId("optionCommon#length"), 7, 10, 13, 16, 19))
|
||||||
|
.addOption(new NumericOption("seconds", Material.CLOCK, TranslatedComponent.byId("optionCommon#seconds"), 30, 60, 90, 120));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -40,7 +41,7 @@ public class StickFightFactory implements GameFactory {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Game manufacture(Room parent, Map<String, Option<?>> configuration) {
|
public Game manufacture(Room parent, Map<String, Option<?>> configuration) {
|
||||||
return new Stickfight(configuration.get("length").getAsInt()).setParent(parent);
|
return new Stickfight(configuration.get("length").getAsInt(), configuration.get("seconds").getAsInt()).setParent(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -24,10 +24,12 @@ public class Stickfight extends StatelessGame {
|
|||||||
private final WeakHashMap<Player, Pos> spawnPoints = new WeakHashMap<>();
|
private final WeakHashMap<Player, Pos> spawnPoints = new WeakHashMap<>();
|
||||||
private final Map<Player, Integer> scoreMap = new WeakHashMap<>();
|
private final Map<Player, Integer> scoreMap = new WeakHashMap<>();
|
||||||
private boolean countdownStarted = false;
|
private boolean countdownStarted = false;
|
||||||
|
private final int seconds;
|
||||||
|
|
||||||
public Stickfight(int length) {
|
public Stickfight(int length, int seconds) {
|
||||||
super(Dimension.OVERWORLD.key, "Stickfight", new LowestPointsWinScore());
|
super(Dimension.OVERWORLD.key, "Stickfight", new LowestPointsWinScore());
|
||||||
this.radius = length;
|
this.radius = length;
|
||||||
|
this.seconds = seconds;
|
||||||
|
|
||||||
this.eventNode().addChild(
|
this.eventNode().addChild(
|
||||||
CombatFeatures.empty()
|
CombatFeatures.empty()
|
||||||
@@ -88,6 +90,11 @@ public class Stickfight extends StatelessGame {
|
|||||||
super.start();
|
super.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onStart() {
|
||||||
|
this.setTimeLimit(this.seconds);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop() {
|
protected void onStop() {
|
||||||
this.scoreMap.forEach((player, score) -> this.getScore().insertResult(player, score));
|
this.scoreMap.forEach((player, score) -> this.getScore().insertResult(player, score));
|
||||||
@@ -122,6 +129,7 @@ public class Stickfight extends StatelessGame {
|
|||||||
player.teleport(this.spawnPoints.get(player));
|
player.teleport(this.spawnPoints.get(player));
|
||||||
this.scoreMap.putIfAbsent(player, 0);
|
this.scoreMap.putIfAbsent(player, 0);
|
||||||
this.scoreMap.put(player, this.scoreMap.get(player) + 1);
|
this.scoreMap.put(player, this.scoreMap.get(player) + 1);
|
||||||
|
player.setLevel(this.scoreMap.get(player));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user