Prevent sombra from targetting things it shouldn't

This commit is contained in:
Sollace 2023-09-28 21:54:30 +01:00
parent 48f9d6242c
commit 8f2cd29488
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB

View file

@ -7,6 +7,7 @@ import java.util.stream.Stream;
import org.jetbrains.annotations.Nullable;
import com.google.common.collect.ImmutableSet;
import com.minelittlepony.unicopia.EquinePredicates;
import com.minelittlepony.unicopia.USounds;
import com.minelittlepony.unicopia.ability.magic.spell.AbstractDisguiseSpell;
import com.minelittlepony.unicopia.advancement.UCriteria;
@ -579,7 +580,9 @@ public class SombraEntity extends HostileEntity implements ArenaCombatant, Parti
@Override
public boolean canTarget(LivingEntity target) {
if (target instanceof PlayerEntity player && (player.isCreative() || player.isSpectator())) {
if (target instanceof SombraEntity
|| EquinePredicates.IS_MAGIC_IMMUNE.test(target)
|| !EntityPredicates.EXCEPT_CREATIVE_OR_SPECTATOR.test(target)) {
return false;
}