mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-25 06:17:59 +01:00
29 lines
629 B
Java
29 lines
629 B
Java
package com.minelittlepony.unicopia.magic;
|
|
|
|
/**
|
|
* Object with levelling capabilities.
|
|
*/
|
|
public interface Levelled {
|
|
|
|
/**
|
|
* Maximum level this spell can reach or -1 for unlimited.
|
|
* <br>
|
|
* If a gem goes past this level it is more likely to explode.
|
|
*/
|
|
default int getMaxLevel() {
|
|
return 0;
|
|
}
|
|
|
|
default boolean canLevelUp() {
|
|
int max = getMaxLevel();
|
|
return max < 0 || getCurrentLevel() < max;
|
|
}
|
|
|
|
int getCurrentLevel();
|
|
|
|
void setCurrentLevel(int level);
|
|
|
|
default void addLevels(int levels) {
|
|
setCurrentLevel(getCurrentLevel() + levels);
|
|
}
|
|
}
|