mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-23 21:38:00 +01:00
Fixed postal spells
This commit is contained in:
parent
a0fa404767
commit
600d9f7ce9
1 changed files with 12 additions and 4 deletions
|
@ -83,6 +83,8 @@ public class SpellPortal extends AbstractSpell.RangedAreaSpell implements IUseAc
|
|||
getDestinationPortal().ifPresent(IMagicEffect::setDead);
|
||||
}
|
||||
|
||||
private SpellPortal bridge;
|
||||
|
||||
@Override
|
||||
public void onPlaced(ICaster<?> caster) {
|
||||
world = caster.getWorld();
|
||||
|
@ -93,6 +95,10 @@ public class SpellPortal extends AbstractSpell.RangedAreaSpell implements IUseAc
|
|||
sibling.destinationId = casterId;
|
||||
sibling.destinationPos = position;
|
||||
}
|
||||
|
||||
if (bridge != null) {
|
||||
bridge.onPlaced(caster);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -102,16 +108,18 @@ public class SpellPortal extends AbstractSpell.RangedAreaSpell implements IUseAc
|
|||
|
||||
IPlayer prop = PlayerSpeciesList.instance().getPlayer(player);
|
||||
|
||||
IMagicEffect other = prop.getEffect();
|
||||
if (other instanceof SpellPortal && other != this && !other.getDead()) {
|
||||
((SpellPortal)other).getActualInstance().setDestinationPortal(this);
|
||||
SpellPortal other = prop.getEffect(SpellPortal.class, true);
|
||||
if (other != null) {
|
||||
other.getActualInstance().setDestinationPortal(this);
|
||||
|
||||
if (!world.isRemote) {
|
||||
prop.setEffect(null);
|
||||
}
|
||||
} else {
|
||||
if (!world.isRemote) {
|
||||
prop.setEffect(this);
|
||||
bridge = (SpellPortal)copy();
|
||||
|
||||
prop.setEffect(bridge);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue