This commit is contained in:
ASangarin 2021-09-03 18:21:51 +02:00
parent 87331e11ff
commit e653bf32e3

View File

@ -1,6 +1,14 @@
package net.Indyuce.mmocore.skill.list;
import io.lumine.mythic.lib.damage.DamageType;
import io.lumine.mythic.lib.version.VersionSound;
import net.Indyuce.mmocore.MMOCore;
import net.Indyuce.mmocore.api.util.math.formula.LinearValue;
import net.Indyuce.mmocore.api.util.math.particle.ParabolicProjectile;
import net.Indyuce.mmocore.skill.CasterMetadata;
import net.Indyuce.mmocore.skill.Skill;
import net.Indyuce.mmocore.skill.metadata.SkillMetadata;
import net.Indyuce.mmocore.skill.metadata.TargetSkillMetadata;
import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.Sound;
@ -9,23 +17,13 @@ import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.util.Vector;
import net.Indyuce.mmocore.MMOCore;
import net.Indyuce.mmocore.api.player.PlayerData;
import net.Indyuce.mmocore.skill.Skill;
import net.Indyuce.mmocore.skill.metadata.SkillMetadata;
import net.Indyuce.mmocore.skill.metadata.TargetSkillMetadata;
import net.Indyuce.mmocore.api.util.math.formula.LinearValue;
import net.Indyuce.mmocore.api.util.math.particle.ParabolicProjectile;
import io.lumine.mythic.lib.MythicLib;
import io.lumine.mythic.lib.api.AttackResult;
import io.lumine.mythic.lib.damage.DamageType;;
import io.lumine.mythic.lib.version.VersionSound;
public class Fire_Storm extends Skill {
public Fire_Storm() {
super();
setMaterial(Material.BLAZE_POWDER);
setLore("Casts a flurry of 6 fire projectiles onto", "nearby enemies, proritizing the initial", "target. Each projectile deals &c{damage} &7damage", "and ignite the target for &c{ignite} &7seconds.", "", "&e{cooldown}s Cooldown", "&9Costs {mana} {mana_name}");
setLore("Casts a flurry of 6 fire projectiles onto", "nearby enemies, proritizing the initial",
"target. Each projectile deals &c{damage} &7damage", "and ignite the target for &c{ignite} &7seconds.", "",
"&e{cooldown}s Cooldown", "&9Costs {mana} {mana_name}");
addModifier("mana", new LinearValue(15, 2));
addModifier("damage", new LinearValue(5, 3));
@ -36,8 +34,7 @@ public class Fire_Storm extends Skill {
@Override
public SkillMetadata whenCast(CasterMetadata caster, SkillInfo skill) {
TargetSkillMetadata cast = new TargetSkillMetadata(caster, skill, 20);
if (!cast.isSuccessful() )
return cast;
if (!cast.isSuccessful()) return cast;
LivingEntity target = cast.getTarget();
@ -50,7 +47,8 @@ public class Fire_Storm extends Skill {
@Override
public void run() {
if (j++ > 5 || caster.getPlayer().isDead() || !caster.getPlayer().isOnline() || target.isDead() || !caster.getPlayer().getWorld().equals(target.getWorld())) {
if (j++ > 5 || caster.getPlayer().isDead() || !caster.getPlayer().isOnline() || target.isDead() || !caster.getPlayer().getWorld()
.equals(target.getWorld())) {
cancel();
return;
}
@ -58,7 +56,8 @@ public class Fire_Storm extends Skill {
// TODO dynamic target location
caster.getPlayer().getWorld().playSound(caster.getPlayer().getLocation(), Sound.BLOCK_FIRE_AMBIENT, 1, 1);
new ParabolicProjectile(caster.getPlayer().getLocation().add(0, 1, 0), target.getLocation().add(0, target.getHeight() / 2, 0), randomVector(caster.getPlayer()), () -> {
new ParabolicProjectile(caster.getPlayer().getLocation().add(0, 1, 0), target.getLocation().add(0, target.getHeight() / 2, 0),
randomVector(caster.getPlayer()), () -> {
target.getWorld().playSound(target.getLocation(), VersionSound.ENTITY_FIREWORK_ROCKET_TWINKLE.toSound(), 1, 2);
target.getWorld().spawnParticle(Particle.SMOKE_NORMAL, target.getLocation().add(0, target.getHeight() / 2, 0), 8, 0, 0, 0, .15);
caster.attack(target, damage, DamageType.SKILL, DamageType.PROJECTILE, DamageType.MAGIC);