mirror of
https://github.com/SimplexDevelopment/ArcanumOcculta.git
synced 2025-06-27 12:36:40 +00:00
API done (I hope)
This commit is contained in:
@ -1,32 +0,0 @@
|
||||
package app.simplexdev.arcanumocculta.api.book;
|
||||
|
||||
import app.simplexdev.arcanumocculta.api.spell.Spell;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface SpellBook {
|
||||
String getBookName();
|
||||
|
||||
void setBookName(final String name);
|
||||
|
||||
String getBookDescription();
|
||||
|
||||
void setBookDescription(final String description);
|
||||
|
||||
ItemStack getBookItem();
|
||||
|
||||
void setBookItem(final ItemStack itemStack);
|
||||
|
||||
List<Spell> getSpells();
|
||||
|
||||
void addSpell(Spell spell);
|
||||
|
||||
void removeSpell(Spell spell);
|
||||
|
||||
Spell getSpell(final String name);
|
||||
|
||||
Spell getSpell(final int index);
|
||||
|
||||
int getSpellCount();
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
package app.simplexdev.arcanumocculta.api.book;
|
||||
|
||||
import app.simplexdev.arcanumocculta.api.spell.Spell;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public interface SpellTome {
|
||||
String getTomeName();
|
||||
|
||||
String getTomeDescription();
|
||||
|
||||
ItemStack getTomeItem();
|
||||
|
||||
Spell getContainedSpell();
|
||||
}
|
@ -0,0 +1,137 @@
|
||||
package app.simplexdev.arcanumocculta.api.caster;
|
||||
|
||||
import app.simplexdev.arcanumocculta.api.wand.Wand;
|
||||
import java.util.UUID;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public abstract class AbstractCaster implements Caster
|
||||
{
|
||||
private final SpellBook spellBook;
|
||||
private final UUID playerUUID;
|
||||
private final String name;
|
||||
private Wand wand;
|
||||
private CasterLevel level;
|
||||
private double currentExperience;
|
||||
private double currentMana;
|
||||
private double maxMana;
|
||||
|
||||
protected AbstractCaster(final Player player, final Wand wand, final SpellBook spellBook, final CasterLevel level)
|
||||
{
|
||||
this.spellBook = spellBook;
|
||||
this.playerUUID = player.getUniqueId();
|
||||
this.name = player.getName();
|
||||
this.wand = wand;
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Wand getWand()
|
||||
{
|
||||
return this.wand;
|
||||
}
|
||||
|
||||
public void setWand(final Wand wand)
|
||||
{
|
||||
this.wand = wand;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SpellBook getSpellBook()
|
||||
{
|
||||
return this.spellBook;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getUniqueId()
|
||||
{
|
||||
return this.playerUUID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CasterLevel getCurrentLevel()
|
||||
{
|
||||
return this.level;
|
||||
}
|
||||
|
||||
public void setCurrentLevel(final CasterLevel level)
|
||||
{
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getCurrentExperience()
|
||||
{
|
||||
return this.currentExperience;
|
||||
}
|
||||
|
||||
public void setCurrentExperience(final double experience)
|
||||
{
|
||||
this.currentExperience = experience;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getCurrentMana()
|
||||
{
|
||||
return this.currentMana;
|
||||
}
|
||||
|
||||
public void setCurrentMana(final double mana)
|
||||
{
|
||||
this.currentMana = mana;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxMana()
|
||||
{
|
||||
return this.maxMana;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMaxMana(final double mana)
|
||||
{
|
||||
this.maxMana = mana;
|
||||
}
|
||||
|
||||
public void addExperience(final double experience)
|
||||
{
|
||||
this.currentExperience = this.currentExperience + experience;
|
||||
}
|
||||
|
||||
public void removeExperience(final double experience)
|
||||
{
|
||||
this.currentExperience = this.currentExperience - experience;
|
||||
}
|
||||
|
||||
public void addMana(final double mana)
|
||||
{
|
||||
this.currentMana = this.currentMana + mana;
|
||||
}
|
||||
|
||||
public void removeMana(final double mana)
|
||||
{
|
||||
this.currentMana = this.currentMana - mana;
|
||||
}
|
||||
|
||||
public void setManaToMax()
|
||||
{
|
||||
this.currentMana = this.maxMana;
|
||||
}
|
||||
|
||||
public void setExperienceToZero()
|
||||
{
|
||||
this.currentExperience = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Player bukkit()
|
||||
{
|
||||
return Bukkit.getPlayer(this.playerUUID);
|
||||
}
|
||||
}
|
@ -0,0 +1,97 @@
|
||||
package app.simplexdev.arcanumocculta.api.caster;
|
||||
|
||||
import app.simplexdev.arcanumocculta.api.spell.Spell;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.SplittableRandom;
|
||||
import java.util.UUID;
|
||||
|
||||
public abstract class AbstractSpellBook implements SpellBook
|
||||
{
|
||||
private final List<Spell> spells = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public boolean hasSpell(final Spell spell)
|
||||
{
|
||||
return getSpells().contains(spell);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Spell> getSpells()
|
||||
{
|
||||
return this.spells;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addSpell(Spell spell)
|
||||
{
|
||||
this.spells.add(spell);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeSpell(Spell spell)
|
||||
{
|
||||
this.spells.remove(spell);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Spell getSpell(String id)
|
||||
{
|
||||
return getSpells().stream()
|
||||
.filter(spell -> spell.getId().equalsIgnoreCase(id))
|
||||
.findFirst()
|
||||
.orElse(getSpells().get(0));
|
||||
}
|
||||
|
||||
public Spell getSpell(UUID uuid)
|
||||
{
|
||||
return getSpells().stream()
|
||||
.filter(spell -> spell.getUniqueId().equals(uuid))
|
||||
.findFirst()
|
||||
.orElse(getSpells().get(0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Spell getSpell(int index)
|
||||
{
|
||||
if (index < 0 || index > getSpells().size() - 1)
|
||||
return getSpells().get(0);
|
||||
return getSpells().get(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSpellCount()
|
||||
{
|
||||
return getSpells().size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSpell(int index, Spell spell)
|
||||
{
|
||||
this.spells.set(index, spell);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSpell(String name, Spell spell)
|
||||
{
|
||||
this.spells.set(getSpells().indexOf(getSpell(name)), spell);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearSpells()
|
||||
{
|
||||
this.spells.clear();
|
||||
}
|
||||
|
||||
public void addAll(Collection<? extends Spell> spells) {
|
||||
this.spells.addAll(spells);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Spell randomSpell()
|
||||
{
|
||||
final SplittableRandom random = new SplittableRandom();
|
||||
return getSpells().get(random.nextInt(getSpells().size()));
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package app.simplexdev.arcanumocculta.api.caster;
|
||||
|
||||
import app.simplexdev.arcanumocculta.api.wand.Wand;
|
||||
import java.util.UUID;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public interface Caster
|
||||
{
|
||||
Wand getWand();
|
||||
|
||||
void setWand(Wand wand);
|
||||
|
||||
SpellBook getSpellBook();
|
||||
|
||||
String getName();
|
||||
|
||||
UUID getUniqueId();
|
||||
|
||||
double getCurrentMana();
|
||||
|
||||
void setCurrentMana(double mana);
|
||||
|
||||
double getMaxMana();
|
||||
|
||||
void setMaxMana(double maxMana);
|
||||
|
||||
CasterLevel getCurrentLevel();
|
||||
|
||||
void setCurrentLevel(CasterLevel level);
|
||||
|
||||
double getCurrentExperience();
|
||||
|
||||
void setCurrentExperience(double experience);
|
||||
|
||||
void addMana(double mana);
|
||||
|
||||
void removeMana(double mana);
|
||||
|
||||
void addExperience(double experience);
|
||||
|
||||
void removeExperience(double experience);
|
||||
|
||||
Player bukkit();
|
||||
}
|
@ -0,0 +1,81 @@
|
||||
package app.simplexdev.arcanumocculta.api.caster;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.stream.Stream;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
public enum CasterLevel
|
||||
{
|
||||
|
||||
APPRENTICE(1, 250D, "Apprentice", "an Apprentice", ChatColor.WHITE, "Lvl1"),
|
||||
PRIMARY(2, 500D, "Primary", "a Primary", ChatColor.RED, "Lvl2"),
|
||||
SCHOLAR(3, 750D, "Scholar", "a Scholar", ChatColor.AQUA, "Lvl3"),
|
||||
PREFECT(4, 1000D, "Prefect", "a Prefect", ChatColor.BLUE, "Lvl4"),
|
||||
GRADUATE(5, 1250D, "Graduate", "a Graduate", ChatColor.GRAY, "Lvl5"),
|
||||
ADEPT(6, 1500D, "Adept", "an Adept", ChatColor.DARK_PURPLE, "Lvl6"),
|
||||
MAGISTRATE(7, 1750D, "Magister", "a Magister", ChatColor.DARK_GREEN, "Lvl7"),
|
||||
HEADMASTER(8, 2000D, "Headmaster", "a Headmaster", ChatColor.GOLD, "Lvl8"),
|
||||
ARCH_MAGE(9, 4000D, "Arch-Mage", "an Arch-Mage", ChatColor.BLACK, "Lvl9");
|
||||
|
||||
private final int level;
|
||||
private final double experienceMarker;
|
||||
private final String name;
|
||||
private final String plural;
|
||||
private final ChatColor rankColor;
|
||||
private final String suffix;
|
||||
|
||||
CasterLevel(final int level, final double experienceMarker, final String name, final String plural,
|
||||
final ChatColor rankColor,
|
||||
final String suffix)
|
||||
{
|
||||
this.experienceMarker = experienceMarker;
|
||||
this.level = level;
|
||||
this.name = name;
|
||||
this.plural = plural;
|
||||
this.rankColor = rankColor;
|
||||
this.suffix = MessageFormat.format("{0}[{1}{2}{3}]{4}",
|
||||
ChatColor.DARK_GRAY,
|
||||
rankColor,
|
||||
suffix,
|
||||
ChatColor.DARK_GRAY,
|
||||
ChatColor.RESET);
|
||||
}
|
||||
|
||||
public static CasterLevel fromOrdinal(final int ordinal)
|
||||
{
|
||||
return Stream.of(CasterLevel.values())
|
||||
.filter(lvl -> lvl.getLevel() == ordinal)
|
||||
.findFirst()
|
||||
.orElse(CasterLevel.APPRENTICE);
|
||||
}
|
||||
|
||||
public int getLevel()
|
||||
{
|
||||
return this.level;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public String getPlural()
|
||||
{
|
||||
return this.plural;
|
||||
}
|
||||
|
||||
public ChatColor getRankColor()
|
||||
{
|
||||
return this.rankColor;
|
||||
}
|
||||
|
||||
public String getSuffix()
|
||||
{
|
||||
return this.suffix;
|
||||
}
|
||||
|
||||
public double getExperienceMarker()
|
||||
{
|
||||
return this.experienceMarker;
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package app.simplexdev.arcanumocculta.api.caster;
|
||||
|
||||
import app.simplexdev.arcanumocculta.api.spell.Spell;
|
||||
import java.util.List;
|
||||
|
||||
public interface SpellBook
|
||||
{
|
||||
List<Spell> getSpells();
|
||||
|
||||
void addSpell(Spell spell);
|
||||
|
||||
void removeSpell(Spell spell);
|
||||
|
||||
Spell getSpell(String name);
|
||||
|
||||
Spell getSpell(int index);
|
||||
|
||||
int getSpellCount();
|
||||
|
||||
void setSpell(int index, Spell spell);
|
||||
|
||||
void setSpell(String name, Spell spell);
|
||||
|
||||
void clearSpells();
|
||||
|
||||
Spell randomSpell();
|
||||
|
||||
boolean hasSpell(final Spell spell);
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
package app.simplexdev.arcanumocculta.api.display;
|
||||
|
||||
import app.simplexdev.arcanumocculta.api.player.Caster;
|
||||
import app.simplexdev.arcanumocculta.api.spell.Spell;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Display;
|
||||
|
||||
public interface SpellDisplay<T extends Display> {
|
||||
T getDisplay();
|
||||
|
||||
Location getLocation();
|
||||
|
||||
World getWorld();
|
||||
|
||||
Caster getWhoCast();
|
||||
|
||||
Spell getCastSpell();
|
||||
|
||||
Particle[] getParticles();
|
||||
|
||||
void display(boolean force);
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
package app.simplexdev.arcanumocculta.api.effect;
|
||||
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
public interface CompoundEffect extends Effect {
|
||||
PotionEffectType[] getEffectTypes();
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
package app.simplexdev.arcanumocculta.api.effect;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
public interface Effect
|
||||
{
|
||||
Duration getDuration();
|
||||
|
||||
float getAmplifier();
|
||||
|
||||
boolean isAmbient();
|
||||
|
||||
boolean forceDisplay();
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
package app.simplexdev.arcanumocculta.api.effect;
|
||||
|
||||
public interface EffectProvider<T extends Effect> {
|
||||
T getEffect(Class<T> type);
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
package app.simplexdev.arcanumocculta.api.effect;
|
||||
|
||||
import app.simplexdev.arcanumocculta.api.player.Caster;
|
||||
|
||||
public interface PassiveEffect extends Effect
|
||||
{
|
||||
Caster getWandHolder();
|
||||
|
||||
void onTick();
|
||||
|
||||
PassiveEffects getPassiveEffect();
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
package app.simplexdev.arcanumocculta.api.effect;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
public enum PassiveEffects {
|
||||
MANA_REGEN(Duration.ofSeconds(10L), 2.0),
|
||||
LIFE_STEAL(Duration.ofSeconds(5L), 1.0),
|
||||
ABSORPTION(Duration.ofSeconds(30L), 4.0),
|
||||
SPELL_SHIELD(Duration.ofSeconds(5L), 5.0),
|
||||
IMMUNITY(Duration.ofSeconds(5L), 100.0),
|
||||
WITHER(Duration.ofSeconds(5L), 2.0),
|
||||
DAMAGE_BOOST(Duration.ofSeconds(5L), 2.75),
|
||||
IMPROVED_ACCURACY(Duration.ofSeconds(5L), 5.0);
|
||||
|
||||
private final Duration duration;
|
||||
private final double amount;
|
||||
|
||||
PassiveEffects(final Duration duration, final double amount) {
|
||||
this.duration = duration;
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
Duration getDuration() {
|
||||
return this.duration;
|
||||
}
|
||||
|
||||
double getAmount() {
|
||||
return this.amount;
|
||||
}
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
package app.simplexdev.arcanumocculta.api.effect;
|
||||
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
||||
public interface SpecialEffect extends Effect {
|
||||
void applyEffect(final LivingEntity target);
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
package app.simplexdev.arcanumocculta.api.effect;
|
||||
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
public interface SpellEffect extends Effect {
|
||||
PotionEffectType getEffectType();
|
||||
}
|
@ -1,96 +0,0 @@
|
||||
package app.simplexdev.arcanumocculta.api.player;
|
||||
|
||||
import app.simplexdev.arcanumocculta.api.book.SpellBook;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public interface Caster {
|
||||
/**
|
||||
* @return The {@link UUID} of the caster.
|
||||
*/
|
||||
UUID getCasterUUID();
|
||||
|
||||
/**
|
||||
* @return The name of the caster.
|
||||
*/
|
||||
String getDisplayName();
|
||||
|
||||
/**
|
||||
* @return The {@link Player} associated with this caster.
|
||||
*/
|
||||
Player bukkit();
|
||||
|
||||
/**
|
||||
* @return The amount of maximum mana the caster is allowed to have.
|
||||
*/
|
||||
double getMaximumMana();
|
||||
|
||||
/**
|
||||
* Sets the maximum amount of mana the caster is allowed to have.
|
||||
*
|
||||
* @param mana The amount of mana to set the maximum to.
|
||||
*/
|
||||
void setMaximumMana(final double mana);
|
||||
|
||||
/**
|
||||
* @return The amount of mana the caster currently has.
|
||||
*/
|
||||
double getCurrentMana();
|
||||
|
||||
/**
|
||||
* Adds mana to the caster.
|
||||
*
|
||||
* @param mana The amount of mana to add.
|
||||
* @return The players updated {@link #getCurrentMana()}.
|
||||
*/
|
||||
double addMana(final double mana);
|
||||
|
||||
/**
|
||||
* Increases the amount of maximum mana this caster is allowed to have.
|
||||
*
|
||||
* @param mana The amount of mana to increase the maximum by.
|
||||
* @return The players updated {@link #getMaximumMana()}.
|
||||
*/
|
||||
double increaseMaximumMana(final double mana);
|
||||
|
||||
/**
|
||||
* Removes mana from the caster.
|
||||
*
|
||||
* @param mana The amount of mana to remove.
|
||||
* @return The players updated {@link #getCurrentMana()}.
|
||||
*/
|
||||
double removeMana(final double mana);
|
||||
|
||||
/**
|
||||
* Decreases the amount of maximum mana this caster is allowed to have.
|
||||
*
|
||||
* @param mana The amount of mana to decrease the maximum by.
|
||||
* @return The players updated {@link #getMaximumMana()}.
|
||||
*/
|
||||
double decreaseMaximumMana(final double mana);
|
||||
|
||||
/**
|
||||
* Sets the amount of mana the caster currently has.
|
||||
*
|
||||
* @param mana The amount of mana to set the user's current mana to.
|
||||
*/
|
||||
void setMana(final double mana);
|
||||
|
||||
/**
|
||||
* @return The {@link SpellBook} of the caster.
|
||||
*/
|
||||
SpellBook getSpellbook();
|
||||
|
||||
/**
|
||||
* @return A list of {@link SpellResistance}s the caster has.
|
||||
*/
|
||||
List<SpellResistance> getSpellResistances();
|
||||
|
||||
void addSpellResistance(SpellResistance resistance);
|
||||
|
||||
void removeSpellResistance(SpellResistance resistance);
|
||||
|
||||
boolean hasResistance(int spellOrdinal);
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
package app.simplexdev.arcanumocculta.api.player;
|
||||
|
||||
public interface SpellResistance {
|
||||
String getSpellName();
|
||||
|
||||
double getResistance();
|
||||
|
||||
int getOrdinal();
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
package app.simplexdev.arcanumocculta.api.player;
|
||||
|
||||
import app.simplexdev.arcanumocculta.api.effect.PassiveEffect;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface Wand {
|
||||
String getWandName();
|
||||
|
||||
String getWandDescription();
|
||||
|
||||
ItemStack getWandItem();
|
||||
|
||||
double getManaPenalty();
|
||||
|
||||
List<PassiveEffect> getPassiveEffects();
|
||||
}
|
@ -0,0 +1,109 @@
|
||||
package app.simplexdev.arcanumocculta.api.spell;
|
||||
|
||||
import app.simplexdev.arcanumocculta.api.caster.Caster;
|
||||
import java.util.SplittableRandom;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
public abstract class AbstractSpell implements Spell
|
||||
{
|
||||
private final String name;
|
||||
private final String id;
|
||||
private final String description;
|
||||
private final int levelRequirement;
|
||||
private final double baseDamage;
|
||||
private final long effectDuration;
|
||||
private final double manaCost;
|
||||
private final long coolDown;
|
||||
private final SplittableRandom random = new SplittableRandom();
|
||||
|
||||
protected AbstractSpell(final String name, final String id,
|
||||
final String description, final int levelRequirement,
|
||||
final double baseDamage, final long effectDuration, final double manaCost,
|
||||
final long coolDown)
|
||||
{
|
||||
this.name = name;
|
||||
this.id = id;
|
||||
this.description = description;
|
||||
this.levelRequirement = levelRequirement;
|
||||
this.baseDamage = baseDamage;
|
||||
this.effectDuration = effectDuration;
|
||||
this.manaCost = manaCost;
|
||||
this.coolDown = coolDown;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getId()
|
||||
{
|
||||
return this.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription()
|
||||
{
|
||||
return description;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLevelRequirement()
|
||||
{
|
||||
return levelRequirement;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double baseDamage()
|
||||
{
|
||||
return baseDamage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long effectDuration()
|
||||
{
|
||||
return effectDuration;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double manaCost()
|
||||
{
|
||||
return manaCost;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long coolDown()
|
||||
{
|
||||
return coolDown;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Spell dupe()
|
||||
{
|
||||
try
|
||||
{
|
||||
return this.getClass()
|
||||
.getDeclaredConstructor()
|
||||
.newInstance();
|
||||
}
|
||||
catch (ReflectiveOperationException e)
|
||||
{
|
||||
Bukkit.getLogger().severe(e.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUnlocked(Caster caster)
|
||||
{
|
||||
return caster.getSpellBook().hasSpell(this)
|
||||
&& caster.getCurrentLevel().getLevel() >= this.levelRequirement;
|
||||
}
|
||||
|
||||
protected SplittableRandom random()
|
||||
{
|
||||
return random;
|
||||
}
|
||||
}
|
@ -1,23 +1,43 @@
|
||||
package app.simplexdev.arcanumocculta.api.spell;
|
||||
|
||||
import app.simplexdev.arcanumocculta.api.effect.Effect;
|
||||
import app.simplexdev.arcanumocculta.api.effect.EffectProvider;
|
||||
import org.bukkit.entity.Projectile;
|
||||
import app.simplexdev.arcanumocculta.api.caster.Caster;
|
||||
import app.simplexdev.arcanumocculta.api.wand.Wand;
|
||||
import java.util.UUID;
|
||||
|
||||
import java.time.Duration;
|
||||
public interface Spell
|
||||
{
|
||||
String getName();
|
||||
|
||||
public interface Spell<T extends Effect> {
|
||||
String getSpellName();
|
||||
String getId();
|
||||
|
||||
String getSpellDescription();
|
||||
default UUID getUniqueId()
|
||||
{
|
||||
return UUID.nameUUIDFromBytes(this.getName().getBytes());
|
||||
}
|
||||
|
||||
double getManaCost();
|
||||
String getDescription();
|
||||
|
||||
Duration getCoolDown();
|
||||
int getLevelRequirement();
|
||||
|
||||
int getSpellLevel();
|
||||
double baseDamage();
|
||||
|
||||
SpellProjectile<? extends Projectile> getSpellProjectile();
|
||||
SpellEffect[] getSpellEffects();
|
||||
|
||||
T getEffect();
|
||||
long effectDuration();
|
||||
|
||||
double manaCost();
|
||||
|
||||
long coolDown();
|
||||
|
||||
boolean isUnlocked(final Caster caster);
|
||||
|
||||
void cast(final Caster caster, final Wand wand);
|
||||
|
||||
/**
|
||||
* Used to create a copy of the spell for player spell books.
|
||||
* Should only ever be used by the primary list when initializing a player's spell book.
|
||||
*
|
||||
* @return a copy of the spell.
|
||||
*/
|
||||
Spell dupe();
|
||||
}
|
||||
|
@ -0,0 +1,10 @@
|
||||
package app.simplexdev.arcanumocculta.api.spell;
|
||||
|
||||
import app.simplexdev.arcanumocculta.api.caster.Caster;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
||||
@FunctionalInterface
|
||||
public interface SpellEffect
|
||||
{
|
||||
void apply(final LivingEntity target, final Caster caster);
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
package app.simplexdev.arcanumocculta.api.spell;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Projectile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface SpellProjectile<T extends Projectile> {
|
||||
Class<T> getProjectileType();
|
||||
|
||||
List<Particle> getParticles();
|
||||
|
||||
void cast(final Location target);
|
||||
|
||||
void cast(final LivingEntity target);
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package app.simplexdev.arcanumocculta.api.spell;
|
||||
|
||||
public enum SpellTypes
|
||||
{
|
||||
SOUL_PEBBLE, SOUL_SHARD, LARGE_SOUL_SHARD, SOUL_COMET_SHARD, SOUL_COMET, SOUL_SHARD_SPIRAL, SOUL_STARS,
|
||||
SOUL_STAR_SHOWER, SOUL_ARC, SOUL_BARRAGE, SOUL_BURST, SOUL_CANNON, SOUL_HAMMER, SOUL_BLAST, SOUL_EXPLOSION,
|
||||
SOUL_LAMP, SOUL_PHALANX, GREAT_SOUL_PHALANX, SOUL_MIST, ARS_NOVA, ARS_ENIGMA, ARS_ULTIMA,
|
||||
|
||||
FLAME_SLING, FLAME_BURST, CATCH_FLAME, FLAME_BARRAGE, FIREBALL, METEORITE, METEOR, FLAME_WHIP, FLAME_FAN,
|
||||
FLAME_ORB, FLAME_PILLARS, FLAME_WHIRLWIND,
|
||||
|
||||
WITHER_BURST, WITHER_SHOT, WITHER_SHARD, WITHER_COMET, WITHER_METEORITE,
|
||||
|
||||
HEALING, GREATER_HEALING, HEAL_OTHER, HEALING_HANDS, HEALING_WAVE, GUARDIAN_PROTECTION, SAVIORS_BLESSING,
|
||||
DIVING_BLESSING, DIVINE_GRACE, ULTIMATE_HEALING, DIVINE_INTERVENTION, DIVINE_RETRIBUTION,
|
||||
|
||||
LIGHTNING_BOLT, LIGHTNING_STORM, STAR_SHOWER, STORM_CALL, LIGHTNING_BARRAGE;
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
package app.simplexdev.arcanumocculta.api.wand;
|
||||
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public abstract class AbstractWand implements Wand
|
||||
{
|
||||
private final ItemStack item;
|
||||
private final CapType capType;
|
||||
private final CoreType coreType;
|
||||
private final GemType gemType;
|
||||
private final String name;
|
||||
private final String description;
|
||||
|
||||
protected AbstractWand(String name,
|
||||
String description, ItemStack item, CapType capType,
|
||||
CoreType coreType, GemType gemType)
|
||||
{
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.item = item;
|
||||
this.capType = capType;
|
||||
this.coreType = coreType;
|
||||
this.gemType = gemType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription()
|
||||
{
|
||||
return description;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItem()
|
||||
{
|
||||
return item;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getSpellBonus()
|
||||
{
|
||||
return getCapType().getSpellBoost()
|
||||
+ getCoreType().getSpellBoost()
|
||||
+ getGemType().getSpellBoost();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CapType getCapType()
|
||||
{
|
||||
return capType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CoreType getCoreType()
|
||||
{
|
||||
return coreType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GemType getGemType()
|
||||
{
|
||||
return gemType;
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package app.simplexdev.arcanumocculta.api.wand;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
public enum CapType
|
||||
{
|
||||
IRON(Material.IRON_NUGGET, 1.0),
|
||||
GOLD(Material.GOLD_NUGGET, 2.5),
|
||||
DIAMOND(Material.DIAMOND, 3.0),
|
||||
OBSIDIAN(Material.OBSIDIAN, 4.5),
|
||||
NETHERITE(Material.NETHERITE_INGOT, 6.0);
|
||||
|
||||
private final Material material;
|
||||
private final double spellBoost;
|
||||
|
||||
CapType(final Material material, final double spellBoost) {
|
||||
this.material = material;
|
||||
this.spellBoost = spellBoost;
|
||||
}
|
||||
|
||||
public final Material getMaterial() {
|
||||
return this.material;
|
||||
}
|
||||
|
||||
public final double getSpellBoost() {
|
||||
return this.spellBoost;
|
||||
}
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package app.simplexdev.arcanumocculta.api.wand;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
public enum CoreType
|
||||
{
|
||||
WOOD(Material.STICK, 1.0),
|
||||
IRON(Material.IRON_INGOT, 1.25),
|
||||
GOLD(Material.GOLD_INGOT, 1.5),
|
||||
OBSIDIAN(Material.OBSIDIAN, 1.75),
|
||||
BLAZE(Material.BLAZE_ROD, 2.0),
|
||||
ENDER(Material.END_ROD, 2.5);
|
||||
|
||||
private final Material material;
|
||||
private final double spellBoost;
|
||||
|
||||
CoreType(final Material material, final double spellBoost)
|
||||
{
|
||||
this.spellBoost = spellBoost;
|
||||
this.material = material;
|
||||
}
|
||||
|
||||
public Material getMaterial()
|
||||
{
|
||||
return this.material;
|
||||
}
|
||||
|
||||
public double getSpellBoost()
|
||||
{
|
||||
return spellBoost;
|
||||
}
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package app.simplexdev.arcanumocculta.api.wand;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
public enum GemType
|
||||
{
|
||||
NONE(Material.AIR, 1.0),
|
||||
LAPIS(Material.LAPIS_LAZULI, 1.25),
|
||||
REDSTONE(Material.REDSTONE, 1.5),
|
||||
EMERALD(Material.EMERALD, 2.0),
|
||||
DIAMOND(Material.DIAMOND, 3.0),
|
||||
QUARTZ(Material.QUARTZ, 4.0);
|
||||
|
||||
private final Material material;
|
||||
private final double spellBoost;
|
||||
|
||||
GemType(final Material material, final double spellBoost)
|
||||
{
|
||||
this.spellBoost = spellBoost;
|
||||
this.material = material;
|
||||
}
|
||||
|
||||
public Material getMaterial()
|
||||
{
|
||||
return this.material;
|
||||
}
|
||||
|
||||
public double getSpellBoost()
|
||||
{
|
||||
return spellBoost;
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package app.simplexdev.arcanumocculta.api.wand;
|
||||
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public interface Wand
|
||||
{
|
||||
String getName();
|
||||
|
||||
String getDescription();
|
||||
|
||||
ItemStack getItem();
|
||||
|
||||
double getSpellBonus();
|
||||
|
||||
CapType getCapType();
|
||||
|
||||
CoreType getCoreType();
|
||||
|
||||
GemType getGemType();
|
||||
}
|
Reference in New Issue
Block a user