feat(phase-2): pure-Java chain resolution algorithm
Adds com.mythlane.chainlightning.chain package with 7 types (Vec3, ChainEntity, EntitySource, RayCaster, ChainParameters, ChainHit, ChainResolver). Algorithm: ray-cast primary target then BFS hops with distanceSquared closest-neighbor selection, deterministic lexicographic tie-breaker on entity id, max 5 targets, 8-block radius, damage curve [8,6,4,3,2]. Strict no-Hytale-imports boundary — runtime adapters land in Phase 3. JUnit 5 suite: 25 tests green (Vec3 5 + ChainParameters 10 + ChainResolver 10). All 10 mandatory cases covered (no primary, primary-only, full chain, overflow, out-of-radius, no-double-hit, closest, tie-breaker determinism, dead entity, custom maxTargets).
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
package com.mythlane.chainlightning.chain;
|
||||
|
||||
/**
|
||||
* Helper test record implémentant ChainEntity. Permet construction concise dans
|
||||
* les tests : entity("e1", 0, 0, 0) pour un vivant, dead("e2", 5, 0, 0) pour un mort.
|
||||
*/
|
||||
record TestChainEntity(String id, Vec3 position, boolean isAlive) implements ChainEntity {
|
||||
|
||||
static TestChainEntity entity(String id, double x, double y, double z) {
|
||||
return new TestChainEntity(id, new Vec3(x, y, z), true);
|
||||
}
|
||||
|
||||
static TestChainEntity dead(String id, double x, double y, double z) {
|
||||
return new TestChainEntity(id, new Vec3(x, y, z), false);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user