Skip to content

Commit

Permalink
slow no longer affects allies
Browse files Browse the repository at this point in the history
  • Loading branch information
iron431 committed Dec 18, 2023
1 parent 1f81b49 commit d83299f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down

0 comments on commit d83299f

Please sign in to comment.