rework: SWOON rewrite, tension economy, DIVE physics, predictive displays
SWOON: virtual HP deleted. Damage now goes through DamageType.GENERIC_KILL, which vanilla marks as bypassing armour, enchantments, effects and shields, and which consumes no armour durability. The old mechanic cancelled the damage outright and only regenened virtual HP back to 1, so a swoon could never be escaped by any means. - cost by mob max HP: clamp(mob-base-cost + mob-cost-per-hp * HP, base, max). Player cost is flat. Chicken 14.5 -> Zombie 22.5 -> Enderman 32.5 -> Warden 137. - cooldown inversely proportional to TP spent: trash mob 40t, player 160t. Moved off Material.NETHERITE_SWORD onto a per-ability key: the material cooldown is a shared per-material table, so it blocked every netherite sword in the inventory and any inventory rebuild wiped it. New AbilityCooldown. - death message detected statelessly from the damage type plus who holds the knife, so no marker state has to survive the death. - TP is now checked BEFORE the original hit is cancelled. Cancelling first made every swing without enough TP a free block: no damage, no gain, no progress. - 257 -> ~110 lines; the VHP/SWOONED checks in DamageUtil, ParryHandler, GrenadeAttack and SkyDiveAttack are gone with the mechanic they guarded. Tension: - passive regen 0.25/tick (was 2/tick, i.e. 100 TP/s) with a hard 3s pause after the last combat action. - hit gain 7.5, crit 11.25 (1.5x base instead of 2x). - onQuit clears TP. It only dropped bossbars and caches, so a quitting player left a full bar in memory for the rest of the uptime. - shield gain and delay moved into config; they were the only remaining hardcoded economy numbers. DIVE: - setGravity(false) for the whole ability. Gravity fought setVelocity(0) every tick and the flag reaches clients, so server and client now agree and hover is a real state instead of a fight over movement prediction. - own gravity constant and an analytic apex; the old code probed velocity three different ways. - one state machine with a single exit, so death, wall, logout, respawn and damage can never leave a player with gravity off. The runnables used to return without cancel() and leaked a per-tick task per dive. - ground contact for 3 ticks aborts the dive without damage. Unimplemented before, so you could dive into the ground, walk to the target and hit them. - dash 3.0 blocks/tick over 60 ticks (was 2.8/40). - hover pins X/Z only, camera stays free, no per-tick actionbar spam. - quitting mid-dive refunds the unused knife cooldown. - fall damage cancelled only while diving and for 2.5s after, not for the whole cooldown. Displays: predictive teleport. A visual is spawned N ticks along its own trajectory and told to interpolate the teleport over those same N ticks, so the client never lags behind and the packet count is unchanged. Duration 1 is effectively no smoothing, which is why the visuals snapped on real ping. Applied to DIAMOND, DIAMOND_TRI, LUNGE (catalyst, sword, overhead, volley) and GRENADE. lead-ticks is configurable; 0 restores stock behaviour.
This commit is contained in:
@@ -31,7 +31,6 @@ public class GrenadeAttack {
|
||||
private static final double ARC_MAX = 4.0;
|
||||
|
||||
public static boolean tryUse(Player p, TensionManager tension) {
|
||||
if (SwoonHandler.isSwooned(p)) return false;
|
||||
if (tension.getTP(p) < COST) {
|
||||
p.sendActionBar(Component.text("Need 10% TP").color(NamedTextColor.RED));
|
||||
return false;
|
||||
@@ -66,7 +65,11 @@ public class GrenadeAttack {
|
||||
Location flightTarget = target.clone();
|
||||
Vector flightDir = throwDir.clone();
|
||||
int flightDuration = duration;
|
||||
int elapsed = 0;
|
||||
// Предсказание: кривая полёта параметризована временем, поэтому просто
|
||||
// начинаем отсчёт чуть позже. Траектория та же, граната летит на lead
|
||||
// тиков короче и клиент не отстаёт. Половина полёта — потолок,
|
||||
// иначе короткий бросок при lead 10 приземлился бы мгновенно.
|
||||
int elapsed = Math.min(EntityTracker.leadTicks(), Math.max(0, flightDuration / 2));
|
||||
int tick = 0;
|
||||
double arc = arcH;
|
||||
boolean targetWasSolid = flightTarget.getBlock().isSolid();
|
||||
|
||||
Reference in New Issue
Block a user