Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public void tick(Player player) {
expire();
if (!isFinished() && ticks >= nextSpawnTick && livingOrbs().size() < tier.live()) {
spawn();
nextSpawnTick = ticks + Math.max(1, (int) (OrbCache.spawnIntervalTicks / tier.speed()));
nextSpawnTick = ticks + OrbCache.spawnGap(tier.live(), tier.speed());
}
orbit();
render();
Expand Down
17 changes: 16 additions & 1 deletion src/main/java/net/tfminecraft/magic/gear/orb/OrbCache.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ public final class OrbCache {
public static int introTicks = 10;
public static int lifetimeTicks = 70;
public static int spawnIntervalTicks = 14;
public static int windowTicks = 200;
/** Opening set, good and rift, must all have spawned by this tick. */
public static int spawnBurstTicks = 40;
public static int windowTicks = 260;

public static double missPenalty = 0.08;

Expand Down Expand Up @@ -77,6 +79,19 @@ public int goodTarget() {
}
}

/**
* Ticks between spawns so {@code live} orbs, good and rift, are all out by
* {@link #spawnBurstTicks}. A shorter configured interval is kept.
*/
public static int spawnGap(int live, double speed) {
int count = Math.max(1, live);
int burst = Math.max(1, spawnBurstTicks);
int fitted = count <= 1 ? 1 : Math.max(1, (burst - 1) / (count - 1));
double pace = speed <= 0 ? 1.0 : speed;
int paced = Math.max(1, (int) (spawnIntervalTicks / pace));
return Math.min(paced, fitted);
}

public static void clearTiers() {
TIERS.clear();
}
Expand Down
1 change: 1 addition & 0 deletions src/main/java/net/tfminecraft/magic/loader/GearLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ private static boolean loadOrbs(File file) {
OrbCache.introTicks = Math.max(0, config.getInt("intro_ticks", OrbCache.introTicks));
OrbCache.lifetimeTicks = Math.max(1, config.getInt("lifetime_ticks", OrbCache.lifetimeTicks));
OrbCache.spawnIntervalTicks = Math.max(1, config.getInt("spawn_interval_ticks", OrbCache.spawnIntervalTicks));
OrbCache.spawnBurstTicks = Math.max(1, config.getInt("spawn_burst_ticks", OrbCache.spawnBurstTicks));
OrbCache.windowTicks = Math.max(20, config.getInt("window_ticks", OrbCache.windowTicks));
OrbCache.missPenalty = Math.max(0.0, config.getDouble("miss_penalty", OrbCache.missPenalty));

Expand Down
12 changes: 7 additions & 5 deletions src/main/resources/gear/orbs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@ orbit_period_ticks: 90
intro_ticks: 10
lifetime_ticks: 70
spawn_interval_ticks: 14
# The opening set, good and rift orbs together, is spawned by this tick (40 = 2s).
spawn_burst_ticks: 40

# Default window, overridden per tier below.
window_ticks: 200
window_ticks: 260

# Capture lost per good orb that expires unhit, as a fraction of the run.
miss_penalty: 0.08
Expand Down Expand Up @@ -53,23 +55,23 @@ tiers:
live: 4
good_ratio: 0.75
speed: 0.8
window_ticks: 220
window_ticks: 280
good_target: 4
2:
live: 5
good_ratio: 0.65
speed: 1.0
window_ticks: 200
window_ticks: 260
good_target: 5
3:
live: 6
good_ratio: 0.55
speed: 1.15
window_ticks: 180
window_ticks: 240
good_target: 6
4:
live: 8
good_ratio: 0.45
speed: 1.3
window_ticks: 160
window_ticks: 220
good_target: 8