This repository has been archived on 2023-11-26. You can view files and clone it, but cannot push or open issues or pull requests.
SorceryCraft/src/main/java/com/thebrokenrail/sorcerycraft/spell/HealSpell.java
TheBrokenRail c1e935764d
All checks were successful
SorceryCraft/pipeline/head This commit looks good
1.0.8
Update to 20w10a
Add the /spell learn, /spell add, and /spell remove commands
Use CurseForge
2020-03-06 18:41:25 -05:00

54 lines
1.3 KiB
Java

package com.thebrokenrail.sorcerycraft.spell;
import com.thebrokenrail.sorcerycraft.spell.registry.Spell;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.util.Identifier;
public class HealSpell extends Spell {
public HealSpell(Identifier id, int level) {
super(id, level);
}
@Override
public void execute(Entity target, Entity source, Entity attacker) {
if (target instanceof LivingEntity) {
StatusEffects.INSTANT_HEALTH.applyInstantEffect(source, attacker, (LivingEntity) target, getLevel(), 1.0d);
}
}
@Override
public int getXPCost() {
switch (getLevel()) {
case 0: {
return 5;
}
case 1: {
return 10;
}
}
return -1;
}
@Override
public ItemStack getItemCost() {
switch (getLevel()) {
case 0: {
return ItemStack.EMPTY;
}
case 1: {
return new ItemStack(Items.GHAST_TEAR);
}
}
return ItemStack.EMPTY;
}
@Override
public int getMaxLevel() {
return 2;
}
}