From d83299f0263aaf828ba6cb4d0154a72bf3fafc50 Mon Sep 17 00:00:00 2001 From: Christian Date: Mon, 18 Dec 2023 14:33:31 -0600 Subject: [PATCH] slow no longer affects allies --- .../java/io/redspace/ironsspellbooks/damage/DamageSources.java | 3 ++- .../redspace/ironsspellbooks/spells/evocation/SlowSpell.java | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/redspace/ironsspellbooks/damage/DamageSources.java b/src/main/java/io/redspace/ironsspellbooks/damage/DamageSources.java index 83df1d8f1..3e3c0a708 100644 --- a/src/main/java/io/redspace/ironsspellbooks/damage/DamageSources.java +++ b/src/main/java/io/redspace/ironsspellbooks/damage/DamageSources.java @@ -149,7 +149,8 @@ public static boolean isFriendlyFireBetween(Entity attacker, Entity target) { if (team != null) { return team.isAlliedTo(target.getTeam()) && !team.isAllowFriendlyFire(); } - return false; + //We already manually checked for teams, so this will only return true for any overrides (such as summons) + return attacker.isAlliedTo(target); } public static DamageSource directDamageSource(DamageSource source, Entity attacker) { diff --git a/src/main/java/io/redspace/ironsspellbooks/spells/evocation/SlowSpell.java b/src/main/java/io/redspace/ironsspellbooks/spells/evocation/SlowSpell.java index 9ef775706..02d715154 100644 --- a/src/main/java/io/redspace/ironsspellbooks/spells/evocation/SlowSpell.java +++ b/src/main/java/io/redspace/ironsspellbooks/spells/evocation/SlowSpell.java @@ -108,7 +108,7 @@ public void onCast(Level world, int spellLevel, LivingEntity entity, MagicData p float radius = 3; AtomicInteger targets = new AtomicInteger(0); targetEntity.level.getEntitiesOfClass(LivingEntity.class, targetEntity.getBoundingBox().inflate(radius)).forEach((victim) -> { - if (targets.get() < MAX_TARGETS && victim.distanceToSqr(targetEntity) < radius * radius && !DamageSources.isFriendlyFireBetween(entity, victim)) { + if (targets.get() < MAX_TARGETS && victim != entity && victim.distanceToSqr(targetEntity) < radius * radius && !DamageSources.isFriendlyFireBetween(entity, victim)) { victim.addEffect(new MobEffectInstance(MobEffectRegistry.SLOWED.get(), getDuration(spellLevel, entity), getAmplifier(spellLevel, entity))); targets.incrementAndGet(); }