forked from SteamWar/SteamWar
Fix older replays
This commit is contained in:
@@ -143,7 +143,7 @@ public class FightSchematic extends StateDependent {
|
|||||||
team.teleportToSpawn();
|
team.teleportToSpawn();
|
||||||
|
|
||||||
boolean rotate = this.rotate;
|
boolean rotate = this.rotate;
|
||||||
if (Config.ActiveWinconditions.contains(Winconditions.RANDOM_ROTATE)) {
|
if (Fight.getRandomSeed().isInitialized() && Config.ActiveWinconditions.contains(Winconditions.RANDOM_ROTATE)) {
|
||||||
rotate = Fight.getRandomSeed().getRandom(schematic).nextBoolean();
|
rotate = Fight.getRandomSeed().getRandom(schematic).nextBoolean();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,13 +23,14 @@ import de.steamwar.fightsystem.ArenaMode;
|
|||||||
import de.steamwar.fightsystem.record.GlobalRecorder;
|
import de.steamwar.fightsystem.record.GlobalRecorder;
|
||||||
import de.steamwar.fightsystem.states.FightState;
|
import de.steamwar.fightsystem.states.FightState;
|
||||||
import de.steamwar.fightsystem.states.OneShotStateDependent;
|
import de.steamwar.fightsystem.states.OneShotStateDependent;
|
||||||
import lombok.Setter;
|
import lombok.Getter;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
public class RandomSeed {
|
public class RandomSeed {
|
||||||
|
|
||||||
@Setter
|
@Getter
|
||||||
|
private boolean initialized = false;
|
||||||
private long seed;
|
private long seed;
|
||||||
|
|
||||||
public RandomSeed() {
|
public RandomSeed() {
|
||||||
@@ -39,6 +40,11 @@ public class RandomSeed {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setSeed(long seed) {
|
||||||
|
initialized = true;
|
||||||
|
this.seed = seed;
|
||||||
|
}
|
||||||
|
|
||||||
public Random getRandom(int derivation) {
|
public Random getRandom(int derivation) {
|
||||||
return new Random(seed ^ new Random(derivation).nextLong());
|
return new Random(seed ^ new Random(derivation).nextLong());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user