refactor: simplify ChainResolver and RayCaster interfaces, enhance ChainDamageApplier logic
- Updated ChainResolver to remove unused shooterOrigin and shooterDirection parameters, streamlining the resolve method. - Modified RayCaster interface to reflect changes in method signature, focusing on maxBlocks only. - Enhanced ChainDamageApplier to utilize a new CauseIndexHolder for resolving the PHYSICAL damage cause index, improving clarity and performance. - Refactored ChainDamageApplier.apply method to use HytaleEntityAdapter for target references, ensuring correct damage application. - Adjusted tests in ChainResolverTest and ChainDamageApplierTest to align with the new method signatures and logic. Tests: All tests passing. Build: ./gradlew clean build successful.
This commit is contained in:
@@ -37,28 +37,17 @@ public final class HytaleVfxEmitter {
|
||||
|
||||
ComponentAccessor<EntityStore> accessor = commandBuffer;
|
||||
int applied = 0;
|
||||
int skipped = 0;
|
||||
for (int i = 0; i < hits.size(); i++) {
|
||||
Ref<EntityStore> targetRef = ((HytaleEntityAdapter) hits.get(i).target()).ref();
|
||||
if (targetRef == null || !targetRef.isValid()) {
|
||||
skipped++;
|
||||
continue;
|
||||
}
|
||||
for (ChainHit hit : hits) {
|
||||
Ref<EntityStore> targetRef = HytaleEntityAdapter.from(hit).ref();
|
||||
if (!targetRef.isValid()) continue;
|
||||
EffectControllerComponent ecc = accessor.getComponent(targetRef, EffectControllerComponent.getComponentType());
|
||||
if (ecc == null) {
|
||||
skipped++;
|
||||
continue;
|
||||
}
|
||||
boolean ok = ecc.addEffect(targetRef, entityEffect, accessor);
|
||||
if (ok) {
|
||||
if (ecc != null && ecc.addEffect(targetRef, entityEffect, accessor)) {
|
||||
applied++;
|
||||
} else {
|
||||
skipped++;
|
||||
}
|
||||
}
|
||||
|
||||
LOGGER.info(String.format(
|
||||
"[ChainLightning][Vfx] EntityEffect '%s' applied to %d/%d targets (skipped=%d, caster=%s)",
|
||||
EFFECT_ID, applied, hits.size(), skipped, playerRef));
|
||||
"[ChainLightning][Vfx] EntityEffect '%s' applied to %d/%d targets (caster=%s)",
|
||||
EFFECT_ID, applied, hits.size(), playerRef));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user