mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-28 07:37:58 +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();
|
protected abstract Collection<Spell> getDelegates();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equalsOrContains(UUID id) {
|
||||||
|
return ProjectileSpell.super.equalsOrContains(id) || getDelegates().stream().anyMatch(s -> s.equalsOrContains(id));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Affinity getAffinity() {
|
public Affinity getAffinity() {
|
||||||
return Affinity.NEUTRAL;
|
return Affinity.NEUTRAL;
|
||||||
|
|
|
@ -79,13 +79,17 @@ public class PlaceableSpell extends AbstractDelegatingSpell {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.tick(source, Situation.GROUND);
|
return !isDead();
|
||||||
} else if (situation == Situation.GROUND_ENTITY) {
|
}
|
||||||
|
|
||||||
|
if (situation == Situation.GROUND_ENTITY) {
|
||||||
particlEffect.ifAbsent(getUuid(), source, spawner -> {
|
particlEffect.ifAbsent(getUuid(), source, spawner -> {
|
||||||
spawner.addParticle(new OrientedBillboardParticleEffect(UParticles.MAGIC_RUNES, 90, 0), source.getOriginVector(), Vec3d.ZERO);
|
spawner.addParticle(new OrientedBillboardParticleEffect(UParticles.MAGIC_RUNES, 90, 0), source.getOriginVector(), Vec3d.ZERO);
|
||||||
}).ifPresent(p -> {
|
}).ifPresent(p -> {
|
||||||
p.setAttribute(1, spell.getType().getColor());
|
p.setAttribute(1, spell.getType().getColor());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return super.tick(source, Situation.GROUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
return !isDead();
|
return !isDead();
|
||||||
|
|
|
@ -2,6 +2,8 @@ package com.minelittlepony.unicopia.ability.magic.spell;
|
||||||
|
|
||||||
import java.util.UUID;
|
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.Affine;
|
||||||
import com.minelittlepony.unicopia.ability.magic.Caster;
|
import com.minelittlepony.unicopia.ability.magic.Caster;
|
||||||
import com.minelittlepony.unicopia.ability.magic.spell.effect.SpellType;
|
import com.minelittlepony.unicopia.ability.magic.spell.effect.SpellType;
|
||||||
|
@ -23,6 +25,13 @@ public interface Spell extends NbtSerialisable, Affine {
|
||||||
*/
|
*/
|
||||||
UUID getUuid();
|
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.
|
* Sets this effect as dead.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class DarkVortexSpell extends AttractiveSpell {
|
||||||
return true;
|
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);
|
accumulatedMass += 0.001F * (1 + getTraits().get(Trait.STRENGTH, 70, 120) - 70);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class EffectSync implements SpellContainer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean contains(UUID id) {
|
public boolean contains(UUID id) {
|
||||||
return spells.containsReference(id);
|
return spells.containsReference(id) || spells.getReferences().anyMatch(s -> s.equalsOrContains(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue