mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-23 21:38:00 +01:00
Added disloyal mobs
This commit is contained in:
parent
4f65870803
commit
9b70be38be
1 changed files with 10 additions and 3 deletions
|
@ -56,10 +56,10 @@ public class Creature extends Living<LivingEntity> implements WeaklyOwned.Mutabl
|
|||
|
||||
private boolean discordedChanged = true;
|
||||
|
||||
private final Predicate<LivingEntity> targetPredicate = TargetSelecter.<LivingEntity>notOwnerOrFriend(this, this).and(e -> {
|
||||
private final Predicate<LivingEntity> targetPredicate = TargetSelecter.<LivingEntity>notOwnerOrFriend(() -> getOriginatingCaster().getAffinity(), this).and(e -> {
|
||||
return Equine.of(e)
|
||||
.filter(eq -> eq instanceof Creature)
|
||||
.filter(eq -> ((Creature)eq).hasCommonOwner(this))
|
||||
.filter(eq -> isDiscorded() != ((Creature)eq).hasCommonOwner(this))
|
||||
.isEmpty();
|
||||
});
|
||||
|
||||
|
@ -162,6 +162,9 @@ public class Creature extends Living<LivingEntity> implements WeaklyOwned.Mutabl
|
|||
}
|
||||
|
||||
private void initDiscordedAi() {
|
||||
if (getMasterReference().isSet()) {
|
||||
return;
|
||||
}
|
||||
targets.ifPresent(this::clearGoals);
|
||||
// the brain drain
|
||||
entity.getBrain().clear();
|
||||
|
@ -269,7 +272,11 @@ public class Creature extends Living<LivingEntity> implements WeaklyOwned.Mutabl
|
|||
@Override
|
||||
public Affinity getAffinity() {
|
||||
if (getMaster() instanceof Affine) {
|
||||
return ((Affine)getMaster()).getAffinity();
|
||||
Affinity affinity = ((Affine)getMaster()).getAffinity();
|
||||
if (isDiscorded()) {
|
||||
return affinity == Affinity.BAD ? Affinity.GOOD : affinity == Affinity.GOOD ? Affinity.BAD : affinity;
|
||||
}
|
||||
return affinity;
|
||||
}
|
||||
return Affinity.NEUTRAL;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue