feat(phase-4): VFX via EntityEffect bridge — chain hits glow blue

Working POC visual : chaque cible touchée par la chaîne reçoit l'EntityEffect
`Chain_Hit_Effect` (Server/Entity/Effects/) appliqué via
`EffectControllerComponent.addEffect`. L'effet contient EntityTopTint/BottomTint
bleu + un Splash particle scale 4 tinted, duration 0.6s.

## Pourquoi pas ParticleUtil.spawnParticleEffect

Tentatives extensives via le path standalone SpawnParticleSystem packet (3-arg
auto-broadcast et 7-arg explicit playerRef) ont échoué — particles invisibles
côté client malgré delivery confirmée serveur. Pattern Java→custom particle
non supporté en l'état Hytale 2026.03.26-89796e57b (asset sync plugin custom
pas wired). Vanilla "Splash" via le path standalone : 0/5 visible.

## EntityEffect = path ECS replication

`EffectControllerComponent.addEffect` ajoute un `ActiveEntityEffect` au target,
propagé aux clients via la sync ECS automatique (path Cleric-Rod / canonique).
Le client lookup l'EntityEffect par index dans son map (broadcast au connect)
et applique ApplicationEffects (tints + particles inline) sur le modèle de
l'entity. C'est ce path qui rend.

## Limitations POC

- VFX-02 (atténuation sonore) non livré : SoundEvent custom subit le même
  problème de sync que ParticleSystem custom. Path standalone SoundUtil
  également cassé pour assets plugin. EntityEffect a un WorldSoundEventId
  field qu'on pourrait remplir avec un vanilla, deferred.
- VolumeCurve.java + ParticleTrail.java conservés (33 tests JUnit verts) mais
  inutilisés runtime — la courbe de volume était hop-indexed et l'EntityEffect
  est uniforme. Garder pour usage futur si Hytale fix le sync.
- TRAIL_DENSITY abaissé 4.0 → 1.0 (réduction du spam packet pendant les
  itérations diagnostic, pas critique vu qu'inutilisé).
- Phase 1 items en snake_case toujours warns au boot — pas bloquant, fix
  cosmétique reporté.

## Files

NEW : `src/main/resources/Server/Entity/Effects/Chain_Hit_Effect.json`
NEW : `src/main/java/com/mythlane/chainlightning/sceptre/HytaleVfxEmitter.java`
      (réécrit pour utiliser EffectControllerComponent.addEffect)
MOD : `ChainLightningSceptreInteraction.java` étape 7.5 — passe playerRef
MOD : `ParticleTrail.TRAIL_DENSITY` 4.0 → 1.0
DEL : `Server/Particles/Chain_Spark.{particlesystem,particlespawner}` +
      `Common/Particles/Chain_Spark.png` (dropped — inutilisés par EntityEffect
      qui référence vanilla Splash)
.gitignore : ignore *.zip + note (asset source temporaires)

Tests : 41/41 verts (29 baseline + 12 Phase 4 pure-Java).
Build : `./gradlew shadowJar` clean.
UAT 17:05 : confirmé visuel — mobs glow bleu sur hit chain.
This commit is contained in:
2026-04-27 19:08:39 +02:00
parent 4ffa0e28ef
commit ee9ac1ab53
8 changed files with 131 additions and 44 deletions
@@ -136,6 +136,17 @@ public final class ChainLightningSceptreInteraction extends SimpleInstantInterac
ChainDamageApplier.apply(hits, playerRef, commandBuffer, commandBuffer);
LOGGER.info("[ChainLightning][7/9] damage application returned");
// --- Étape 7.5 : émettre VFX/SFX (best-effort) ---
// CONTEXT failure-mode decision : damage déjà appliqué — si l'emit échoue, log + continue
// vers le cooldown. Pas de propagation : le tick serveur ne doit pas crash sur un bug VFX.
try {
LOGGER.info(String.format("[ChainLightning][7.5/9] vfx emit START hits=%d", hits.size()));
HytaleVfxEmitter.playChainEffects(hits, playerRef, commandBuffer);
LOGGER.info("[ChainLightning][7.5/9] vfx emit DONE");
} catch (Throwable t) {
LOGGER.log(Level.WARNING, "[ChainLightning][7.5/9] vfx emit failed (damage already applied)", t);
}
// --- Étape 8 : démarrer le cooldown APRÈS succès ---
cooldown.deductCharge();
LOGGER.info(String.format("[ChainLightning][8/9] cooldown deducted (next available in %.1fs)", COOLDOWN_TIME));