mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-27 23:27:59 +01:00
Fixed placed spells not functioning correctly and slot.contains not matching delegated spells
This commit is contained in:
parent
56af8f80ba
commit
613b39436f
5 changed files with 22 additions and 4 deletions
|
@ -31,6 +31,11 @@ public abstract class AbstractDelegatingSpell implements ProjectileSpell {
|
|||
|
||||
protected abstract Collection<Spell> getDelegates();
|
||||
|
||||
@Override
|
||||
public boolean equalsOrContains(UUID id) {
|
||||
return ProjectileSpell.super.equalsOrContains(id) || getDelegates().stream().anyMatch(s -> s.equalsOrContains(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Affinity getAffinity() {
|
||||
return Affinity.NEUTRAL;
|
||||
|
|
|
@ -79,13 +79,17 @@ public class PlaceableSpell extends AbstractDelegatingSpell {
|
|||
}
|
||||
}
|
||||
|
||||
return super.tick(source, Situation.GROUND);
|
||||
} else if (situation == Situation.GROUND_ENTITY) {
|
||||
return !isDead();
|
||||
}
|
||||
|
||||
if (situation == Situation.GROUND_ENTITY) {
|
||||
particlEffect.ifAbsent(getUuid(), source, spawner -> {
|
||||
spawner.addParticle(new OrientedBillboardParticleEffect(UParticles.MAGIC_RUNES, 90, 0), source.getOriginVector(), Vec3d.ZERO);
|
||||
}).ifPresent(p -> {
|
||||
p.setAttribute(1, spell.getType().getColor());
|
||||
});
|
||||
|
||||
return super.tick(source, Situation.GROUND);
|
||||
}
|
||||
|
||||
return !isDead();
|
||||
|
|
|
@ -2,6 +2,8 @@ package com.minelittlepony.unicopia.ability.magic.spell;
|
|||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.spongepowered.include.com.google.common.base.Objects;
|
||||
|
||||
import com.minelittlepony.unicopia.ability.magic.Affine;
|
||||
import com.minelittlepony.unicopia.ability.magic.Caster;
|
||||
import com.minelittlepony.unicopia.ability.magic.spell.effect.SpellType;
|
||||
|
@ -23,6 +25,13 @@ public interface Spell extends NbtSerialisable, Affine {
|
|||
*/
|
||||
UUID getUuid();
|
||||
|
||||
/**
|
||||
* Determines whether this spell is a valid surrogate for the given spell's id.
|
||||
*/
|
||||
default boolean equalsOrContains(UUID id) {
|
||||
return Objects.equal(getUuid(), id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets this effect as dead.
|
||||
*/
|
||||
|
|
|
@ -42,7 +42,7 @@ public class DarkVortexSpell extends AttractiveSpell {
|
|||
return true;
|
||||
}
|
||||
|
||||
if (!source.isClient()) {
|
||||
if (!source.isClient() && source.getWorld().random.nextInt(200) == 0) {
|
||||
accumulatedMass += 0.001F * (1 + getTraits().get(Trait.STRENGTH, 70, 120) - 70);
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ public class EffectSync implements SpellContainer {
|
|||
|
||||
@Override
|
||||
public boolean contains(UUID id) {
|
||||
return spells.containsReference(id);
|
||||
return spells.containsReference(id) || spells.getReferences().anyMatch(s -> s.equalsOrContains(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue