2018-09-12 01:29:49 +02:00
|
|
|
package com.minelittlepony.unicopia.spell;
|
|
|
|
|
2019-01-22 17:39:30 +01:00
|
|
|
import com.minelittlepony.unicopia.util.serialisation.InbtSerialisable;
|
2018-09-12 01:29:49 +02:00
|
|
|
|
|
|
|
/**
|
2018-09-24 21:37:16 +02:00
|
|
|
* Interface for a magic spells
|
2018-09-12 01:29:49 +02:00
|
|
|
*/
|
2019-02-06 09:31:31 +01:00
|
|
|
public interface IMagicEffect extends InbtSerialisable, IAligned {
|
2018-09-12 01:29:49 +02:00
|
|
|
|
2019-01-22 17:39:30 +01:00
|
|
|
/**
|
|
|
|
* Gets the name used to identify this effect.
|
|
|
|
*/
|
2018-09-12 01:29:49 +02:00
|
|
|
String getName();
|
|
|
|
|
2019-01-22 17:39:30 +01:00
|
|
|
/**
|
|
|
|
* Gets the tint for this spell when applied to a gem.
|
|
|
|
*/
|
|
|
|
int getTint();
|
|
|
|
|
2018-09-12 01:29:49 +02:00
|
|
|
/**
|
|
|
|
* Sets this effect as dead.
|
|
|
|
*/
|
|
|
|
void setDead();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if this spell is dead, and must be cleaned up.
|
|
|
|
*/
|
|
|
|
boolean getDead();
|
|
|
|
|
2019-02-05 21:47:18 +01:00
|
|
|
/**
|
|
|
|
* Returns true if this effect has changes that need to be sent to the client.
|
|
|
|
*/
|
|
|
|
boolean isDirty();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Marks this effect as dirty.
|
|
|
|
*/
|
|
|
|
void setDirty(boolean dirty);
|
|
|
|
|
2019-02-04 19:29:37 +01:00
|
|
|
/**
|
|
|
|
* Returns true if this effect can be crafted into a gem.
|
|
|
|
*/
|
|
|
|
boolean isCraftable();
|
|
|
|
|
2019-02-06 09:31:31 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the highest level this spell can be safely operated at.
|
|
|
|
* Gems may go higher, however chance of explosion/exhaustion increases with every level.
|
|
|
|
*/
|
|
|
|
int getMaxLevelCutOff(ICaster<?> caster);
|
|
|
|
|
|
|
|
float getMaxExhaustion(ICaster<?> caster);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the chances of this effect turning into an innert gem or exploding.
|
|
|
|
*/
|
|
|
|
float getExhaustion(ICaster<?> caster);
|
|
|
|
|
2019-01-26 22:20:35 +01:00
|
|
|
/**
|
|
|
|
* Called when first attached to a gem.
|
|
|
|
*/
|
|
|
|
default void onPlaced(ICaster<?> caster) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2018-09-12 01:29:49 +02:00
|
|
|
/**
|
|
|
|
* Called every tick when attached to a player.
|
|
|
|
*
|
|
|
|
* @param source The entity we are currently attached to.
|
|
|
|
* @return true to keep alive
|
|
|
|
*/
|
2018-09-26 17:53:12 +02:00
|
|
|
default boolean updateOnPerson(ICaster<?> caster) {
|
2019-02-06 09:31:31 +01:00
|
|
|
return update(caster);
|
2018-09-26 17:53:12 +02:00
|
|
|
}
|
2018-09-12 01:29:49 +02:00
|
|
|
|
|
|
|
/**
|
2019-01-22 17:39:30 +01:00
|
|
|
* Called every tick when attached to an entity.
|
|
|
|
* Called on both sides.
|
2018-09-12 01:29:49 +02:00
|
|
|
*
|
2018-09-24 21:37:16 +02:00
|
|
|
* @param source The entity we are currently attached to.
|
2018-09-12 01:29:49 +02:00
|
|
|
*/
|
2019-02-06 09:31:31 +01:00
|
|
|
boolean update(ICaster<?> source);
|
2018-09-12 01:29:49 +02:00
|
|
|
|
2018-09-24 21:37:16 +02:00
|
|
|
/**
|
|
|
|
* Called every tick when attached to a player. Used to apply particle effects.
|
|
|
|
* Is only called on the client side.
|
|
|
|
*
|
|
|
|
* @param source The entity we are currently attached to.
|
|
|
|
*/
|
2018-09-26 17:53:12 +02:00
|
|
|
default void renderOnPerson(ICaster<?> source) {
|
2019-02-06 09:31:31 +01:00
|
|
|
render(source);
|
2018-09-24 21:37:16 +02:00
|
|
|
}
|
2018-09-12 01:29:49 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Called every tick when attached to an entity to produce particle effects.
|
|
|
|
* Is only called on the client side.
|
|
|
|
*
|
|
|
|
* @param source The entity we are attached to.
|
|
|
|
*/
|
2019-02-06 09:31:31 +01:00
|
|
|
void render(ICaster<?> source);
|
2018-09-12 01:29:49 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return true to allow the gem update and move.
|
|
|
|
*/
|
|
|
|
default boolean allowAI() {
|
|
|
|
return false;
|
|
|
|
}
|
2019-02-05 13:44:35 +01:00
|
|
|
|
|
|
|
default IMagicEffect copy() {
|
|
|
|
return SpellRegistry.instance().copyInstance(this);
|
|
|
|
}
|
2018-09-12 01:29:49 +02:00
|
|
|
}
|