mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2025-03-10 12:59:11 +01:00
!fuck me
This commit is contained in:
parent
1deb3f6252
commit
12eff188bb
2
pom.xml
2
pom.xml
@ -129,7 +129,7 @@
|
||||
<dependency>
|
||||
<groupId>io.lumine</groupId>
|
||||
<artifactId>MythicLib</artifactId>
|
||||
<version>1.1.1</version>
|
||||
<version>1.1.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
@ -146,41 +146,21 @@ public class MMOUtils {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Not being used internally
|
||||
*/
|
||||
@Deprecated
|
||||
public static String getProgressBar(double ratio, int n, String barChar) {
|
||||
StringBuilder bar = new StringBuilder();
|
||||
for (int k = 0; k < n; k++)
|
||||
bar.append(barChar);
|
||||
return bar.substring(0, (int) (ratio * n)) + ChatColor.WHITE + bar.substring((int) (ratio * n));
|
||||
}
|
||||
|
||||
public static LivingEntity getDamager(EntityDamageByEntityEvent event) {
|
||||
|
||||
/*
|
||||
* check direct damager
|
||||
*/
|
||||
// Check direct damager
|
||||
if (event.getDamager() instanceof LivingEntity) return (LivingEntity) event.getDamager();
|
||||
|
||||
/*
|
||||
* checks projectile and add damage type, which supports every vanilla
|
||||
* Checks projectile and add damage type, which supports every vanilla
|
||||
* projectile like snowballs, tridents and arrows
|
||||
*/
|
||||
if (event.getDamager() instanceof Projectile) {
|
||||
Projectile proj = (Projectile) event.getDamager();
|
||||
if (proj.getShooter() instanceof LivingEntity) return (LivingEntity) proj.getShooter();
|
||||
if (proj.getShooter() instanceof LivingEntity)
|
||||
return (LivingEntity) proj.getShooter();
|
||||
}
|
||||
|
||||
/*
|
||||
* check for last damage
|
||||
*/
|
||||
// if (event.getEntity().getLastDamageCause() instanceof
|
||||
// EntityDamageByEntityEvent && checkLastDamageCause)
|
||||
// return getDamager(result, (EntityDamageByEntityEvent)
|
||||
// event.getEntity().getLastDamageCause(), false);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -205,18 +185,6 @@ public class MMOUtils {
|
||||
caseOnWords(item.getType().name().toLowerCase().replace("_", " "));
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the player encumbered by carrying two-handed items?
|
||||
*
|
||||
* @deprecated Use PlayerData.get(player).areHandsFull() instead
|
||||
*/
|
||||
@Deprecated
|
||||
public static boolean twoHandedCase(Player player) {
|
||||
|
||||
// Straight from player data
|
||||
return PlayerData.get(player).areHandsFull();
|
||||
}
|
||||
|
||||
/**
|
||||
* Super useful to display enum names like DIAMOND_SWORD in chat
|
||||
*
|
||||
|
@ -1,29 +1,21 @@
|
||||
package net.Indyuce.mmoitems.api.ability;
|
||||
package net.Indyuce.mmoitems.ability;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackMetadata;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public abstract class Ability {
|
||||
public abstract class Ability<T extends AbilityMetadata> {
|
||||
private final String name, id;
|
||||
private final List<CastingMode> allowedModes;
|
||||
private final Map<String, Double> modifiers = new HashMap<>();
|
||||
|
||||
protected static final Random random = new Random();
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof Ability)) { return false; }
|
||||
|
||||
// Same name means same ability
|
||||
return ((Ability) obj).getName().equals(getName());
|
||||
}
|
||||
|
||||
public Ability(CastingMode... allowedModes) {
|
||||
this.id = getClass().getSimpleName().toUpperCase().replace("-", "_").replace(" ", "_").replaceAll("[^A-Z_]", "");
|
||||
this.name = getClass().getSimpleName().replace("_", " ");
|
||||
@ -88,34 +80,28 @@ public abstract class Ability {
|
||||
|
||||
/**
|
||||
* The first method called when a player uses an ability.
|
||||
*
|
||||
* @param stats
|
||||
* Cached statistics of the player casting the ability
|
||||
* @param target
|
||||
* The eventual ability target
|
||||
* @param ability
|
||||
* The ability being cast
|
||||
* @param result
|
||||
* The melee attack result, which can be edited to
|
||||
* increase/decrease final damage dealt
|
||||
*
|
||||
* @param attack Information concerning the current player attack as well
|
||||
* as his MythicLib cached stat map
|
||||
* @param target The eventual ability target
|
||||
* @param ability The ability being cast
|
||||
* @return If the ability can be cast or not. AbilityResult should cache any
|
||||
* information used by the ability: target if found, etc.
|
||||
* <p>
|
||||
* This can also return a null instance which means the ability was not cast.
|
||||
*/
|
||||
public abstract AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result);
|
||||
@Nullable
|
||||
public abstract T canBeCast(ItemAttackMetadata attack, LivingEntity target, AbilityData ability);
|
||||
|
||||
/**
|
||||
* Called when a player successfully casts an ability
|
||||
*
|
||||
* @param stats
|
||||
* Cached statistics of the player casting the ability
|
||||
* @param ability
|
||||
* All the information about the ability being cast. This is the
|
||||
* same instance as the one returned in whenRan(..)
|
||||
* @param result
|
||||
* The melee attack result, which can be edited to
|
||||
* increase/decrease final damage dealt
|
||||
*
|
||||
* @param attack Information concerning the current player attack as well
|
||||
* as his MythicLib cached stat map
|
||||
* @param ability All the information about the ability being cast. This is the
|
||||
* same instance as the one returned in whenRan(..)
|
||||
*/
|
||||
public abstract void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result);
|
||||
public abstract void whenCast(ItemAttackMetadata attack, T ability);
|
||||
|
||||
public enum CastingMode {
|
||||
|
||||
@ -178,4 +164,14 @@ public abstract class Ability {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof Ability)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Same name means same ability
|
||||
return ((Ability) obj).getName().equals(getName());
|
||||
}
|
||||
}
|
@ -1,31 +1,31 @@
|
||||
package net.Indyuce.mmoitems.api.ability;
|
||||
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
|
||||
public abstract class AbilityResult {
|
||||
private final AbilityData ability;
|
||||
|
||||
public AbilityResult(AbilityData ability) {
|
||||
this.ability = ability;
|
||||
}
|
||||
|
||||
public AbilityData getAbility() {
|
||||
return ability;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param path
|
||||
* Path of ability modifier
|
||||
* @return Calculates a new value for a given ability modifier
|
||||
*/
|
||||
public double getModifier(String path) {
|
||||
return ability.getModifier(path);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return If the ability is cast successfully. This method is used to apply
|
||||
* extra ability conditions (player must be on the ground, must aim
|
||||
* at an entity..)
|
||||
*/
|
||||
public abstract boolean isSuccessful();
|
||||
}
|
||||
package net.Indyuce.mmoitems.ability;
|
||||
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
|
||||
public abstract class AbilityMetadata {
|
||||
private final AbilityData ability;
|
||||
|
||||
public AbilityMetadata(AbilityData ability) {
|
||||
this.ability = ability;
|
||||
}
|
||||
|
||||
public AbilityData getAbility() {
|
||||
return ability;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param path
|
||||
* Path of ability modifier
|
||||
* @return Calculates a new value for a given ability modifier
|
||||
*/
|
||||
public double getModifier(String path) {
|
||||
return ability.getModifier(path);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return If the ability is cast successfully. This method is used to apply
|
||||
* extra ability conditions (player must be on the ground, must aim
|
||||
* at an entity..)
|
||||
*/
|
||||
public abstract boolean isSuccessful();
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
package net.Indyuce.mmoitems.ability;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.SimpleAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
|
||||
public class Blink extends Ability {
|
||||
public Blink() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("range", 8);
|
||||
addModifier("cooldown", 10);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) {
|
||||
return new SimpleAbilityResult(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) {
|
||||
stats.getPlayer().getWorld().spawnParticle(Particle.EXPLOSION_LARGE, stats.getPlayer().getLocation().add(0, 1, 0), 0);
|
||||
stats.getPlayer().getWorld().spawnParticle(Particle.SPELL_INSTANT, stats.getPlayer().getLocation().add(0, 1, 0), 32, 0, 0, 0, .1);
|
||||
stats.getPlayer().getWorld().playSound(stats.getPlayer().getLocation(), VersionSound.ENTITY_ENDERMAN_TELEPORT.toSound(), 1, 1);
|
||||
Location loc = stats.getPlayer().getTargetBlock(null, (int) ability.getModifier("range")).getLocation().add(0, 1, 0);
|
||||
loc.setYaw(stats.getPlayer().getLocation().getYaw());
|
||||
loc.setPitch(stats.getPlayer().getLocation().getPitch());
|
||||
stats.getPlayer().teleport(loc);
|
||||
stats.getPlayer().getWorld().spawnParticle(Particle.EXPLOSION_LARGE, stats.getPlayer().getLocation().add(0, 1, 0), 0);
|
||||
stats.getPlayer().getWorld().spawnParticle(Particle.SPELL_INSTANT, stats.getPlayer().getLocation().add(0, 1, 0), 32, 0, 0, 0, .1);
|
||||
}
|
||||
}
|
@ -1,89 +0,0 @@
|
||||
package net.Indyuce.mmoitems.ability;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Snowball;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.SimpleAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.api.util.TemporaryListener;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
|
||||
public class Blizzard extends Ability {
|
||||
public Blizzard() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK,
|
||||
CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("duration", 2.5);
|
||||
addModifier("damage", 2);
|
||||
addModifier("inaccuracy", 10);
|
||||
addModifier("force", 1);
|
||||
addModifier("cooldown", 10);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) {
|
||||
return new SimpleAbilityResult(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) {
|
||||
double duration = ability.getModifier("duration") * 10;
|
||||
double force = ability.getModifier("force");
|
||||
double inaccuracy = ability.getModifier("inaccuracy");
|
||||
|
||||
new BukkitRunnable() {
|
||||
int j = 0;
|
||||
final SnowballThrower handler = new SnowballThrower(ability.getModifier("damage"));
|
||||
|
||||
public void run() {
|
||||
if (j++ > duration) {
|
||||
handler.close(5 * 20);
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
Location loc = stats.getPlayer().getEyeLocation();
|
||||
loc.setPitch((float) (loc.getPitch() + (random.nextDouble() - .5) * inaccuracy));
|
||||
loc.setYaw((float) (loc.getYaw() + (random.nextDouble() - .5) * inaccuracy));
|
||||
|
||||
loc.getWorld().playSound(loc, Sound.ENTITY_SNOWBALL_THROW, 1, 1);
|
||||
Snowball snowball = stats.getPlayer().launchProjectile(Snowball.class);
|
||||
snowball.setVelocity(loc.getDirection().multiply(1.3 * force));
|
||||
handler.entities.add(snowball.getUniqueId());
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 2);
|
||||
}
|
||||
|
||||
public static class SnowballThrower extends TemporaryListener {
|
||||
private final List<UUID> entities = new ArrayList<>();
|
||||
private final double damage;
|
||||
|
||||
public SnowballThrower(double damage) {
|
||||
super(EntityDamageByEntityEvent.getHandlerList());
|
||||
|
||||
this.damage = damage;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void a(EntityDamageByEntityEvent event) {
|
||||
if (entities.contains(event.getDamager().getUniqueId()))
|
||||
event.setDamage(damage);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,97 +0,0 @@
|
||||
package net.Indyuce.mmoitems.ability;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.VectorAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import io.lumine.mythic.lib.api.AttackResult;
|
||||
import io.lumine.mythic.lib.api.DamageType;
|
||||
|
||||
public class Bouncy_Fireball extends Ability {
|
||||
public Bouncy_Fireball() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("cooldown", 20);
|
||||
addModifier("damage", 5);
|
||||
addModifier("ignite", 40);
|
||||
addModifier("speed", 1);
|
||||
addModifier("radius", 4);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) {
|
||||
return new VectorAbilityResult(ability, stats.getPlayer(), target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) {
|
||||
stats.getPlayer().getWorld().playSound(stats.getPlayer().getLocation(), Sound.ENTITY_SNOWBALL_THROW, 2, 0);
|
||||
new BukkitRunnable() {
|
||||
int j = 0;
|
||||
final Vector vec = ((VectorAbilityResult) ability).getTarget().setY(0).normalize().multiply(.5 * ability.getModifier("speed"));
|
||||
final Location loc = stats.getPlayer().getLocation().clone().add(0, 1.2, 0);
|
||||
int bounces = 0;
|
||||
|
||||
double y = .3;
|
||||
|
||||
public void run() {
|
||||
j++;
|
||||
if (j > 100) {
|
||||
loc.getWorld().spawnParticle(Particle.SMOKE_LARGE, loc, 32, 0, 0, 0, .05);
|
||||
loc.getWorld().playSound(loc, Sound.BLOCK_FIRE_EXTINGUISH, 1, 1);
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
loc.add(vec);
|
||||
loc.add(0, y, 0);
|
||||
if (y > -.6)
|
||||
y -= .05;
|
||||
|
||||
loc.getWorld().spawnParticle(Particle.LAVA, loc, 0);
|
||||
loc.getWorld().spawnParticle(Particle.FLAME, loc, 4, 0, 0, 0, .03);
|
||||
loc.getWorld().spawnParticle(Particle.SMOKE_NORMAL, loc, 1, 0, 0, 0, .03);
|
||||
|
||||
if (loc.getBlock().getType().isSolid()) {
|
||||
loc.add(0, -y, 0);
|
||||
loc.add(vec.clone().multiply(-1));
|
||||
y = .4;
|
||||
bounces++;
|
||||
loc.getWorld().playSound(loc, Sound.ENTITY_BLAZE_HURT, 3, 2);
|
||||
}
|
||||
|
||||
if (bounces > 2) {
|
||||
double radius = ability.getModifier("radius");
|
||||
double damage = ability.getModifier("damage");
|
||||
double ignite = ability.getModifier("ignite");
|
||||
|
||||
for (Entity entity : MMOUtils.getNearbyChunkEntities(loc))
|
||||
if (entity.getLocation().distanceSquared(loc) < radius * radius)
|
||||
if (MMOUtils.canDamage(stats.getPlayer(), entity)) {
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.MAGIC, DamageType.PROJECTILE).damage(stats.getPlayer(), (LivingEntity) entity);
|
||||
entity.setFireTicks((int) (ignite * 20));
|
||||
}
|
||||
|
||||
loc.getWorld().spawnParticle(Particle.EXPLOSION_LARGE, loc, 12, 2, 2, 2, 0);
|
||||
loc.getWorld().spawnParticle(Particle.EXPLOSION_NORMAL, loc, 48, 0, 0, 0, .2);
|
||||
loc.getWorld().playSound(loc, Sound.ENTITY_GENERIC_EXPLODE, 3, 0);
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 1);
|
||||
}
|
||||
}
|
@ -1,88 +0,0 @@
|
||||
package net.Indyuce.mmoitems.ability;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.SimpleAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.api.util.TemporaryListener;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
|
||||
public class Bunny_Mode extends Ability {
|
||||
public Bunny_Mode() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK,
|
||||
CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("duration", 20);
|
||||
addModifier("jump-force", 1);
|
||||
addModifier("cooldown", 50);
|
||||
addModifier("speed", 1);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) {
|
||||
return new SimpleAbilityResult(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) {
|
||||
double duration = ability.getModifier("duration") * 20;
|
||||
double y = ability.getModifier("jump-force");
|
||||
double xz = ability.getModifier("speed");
|
||||
|
||||
new BukkitRunnable() {
|
||||
int j = 0;
|
||||
final BunnyHandler handler = new BunnyHandler(stats.getPlayer(), duration);
|
||||
|
||||
public void run() {
|
||||
if (j++ > duration) {
|
||||
handler.close(3 * 20);
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
if (stats.getPlayer().getLocation().add(0, -.5, 0).getBlock().getType().isSolid()) {
|
||||
stats.getPlayer()
|
||||
.setVelocity(stats.getPlayer().getEyeLocation().getDirection().setY(0).normalize().multiply(.8 * xz).setY(0.5 * y / xz));
|
||||
stats.getPlayer().getWorld().playSound(stats.getPlayer().getLocation(), VersionSound.ENTITY_ENDER_DRAGON_FLAP.toSound(), 2, 1);
|
||||
for (double a = 0; a < Math.PI * 2; a += Math.PI / 12)
|
||||
stats.getPlayer().getWorld().spawnParticle(Particle.CLOUD, stats.getPlayer().getLocation(), 0, Math.cos(a), 0, Math.sin(a),
|
||||
.2);
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 1);
|
||||
|
||||
}
|
||||
|
||||
public static class BunnyHandler extends TemporaryListener {
|
||||
private final Player player;
|
||||
|
||||
public BunnyHandler(Player player, double duration) {
|
||||
super(EntityDamageEvent.getHandlerList());
|
||||
|
||||
this.player = player;
|
||||
|
||||
Bukkit.getScheduler().runTaskLater(MMOItems.plugin, (Runnable) this::close, (long) (duration * 20));
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void a(EntityDamageEvent event) {
|
||||
if (event.getEntity().equals(player) && event.getCause() == DamageCause.FALL)
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,74 +0,0 @@
|
||||
package net.Indyuce.mmoitems.ability;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.SimpleAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import io.lumine.mythic.lib.api.AttackResult;
|
||||
import io.lumine.mythic.lib.api.DamageType;
|
||||
|
||||
public class Burning_Hands extends Ability {
|
||||
public Burning_Hands() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK,
|
||||
CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("duration", 3);
|
||||
addModifier("damage", 2);
|
||||
addModifier("cooldown", 10);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) {
|
||||
return new SimpleAbilityResult(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) {
|
||||
double duration = ability.getModifier("duration") * 10;
|
||||
double damage = ability.getModifier("damage") / 2;
|
||||
|
||||
new BukkitRunnable() {
|
||||
int j = 0;
|
||||
|
||||
public void run() {
|
||||
if (j++ > duration)
|
||||
cancel();
|
||||
|
||||
Location loc = stats.getPlayer().getLocation().add(0, 1.2, 0);
|
||||
loc.getWorld().playSound(loc, Sound.BLOCK_FIRE_AMBIENT, 1, 1);
|
||||
|
||||
for (double m = -45; m < 45; m += 5) {
|
||||
double a = (m + stats.getPlayer().getEyeLocation().getYaw() + 90) * Math.PI / 180;
|
||||
Vector vec = new Vector(Math.cos(a), (random.nextDouble() - .5) * .2, Math.sin(a));
|
||||
Location source = loc.clone().add(vec.clone().setY(0));
|
||||
source.getWorld().spawnParticle(Particle.FLAME, source, 0, vec.getX(), vec.getY(), vec.getZ(), .5);
|
||||
if (j % 2 == 0)
|
||||
source.getWorld().spawnParticle(Particle.SMOKE_NORMAL, source, 0, vec.getX(), vec.getY(), vec.getZ(), .5);
|
||||
}
|
||||
|
||||
if (j % 5 == 0)
|
||||
for (Entity entity : MMOUtils.getNearbyChunkEntities(loc))
|
||||
if (entity.getLocation().distanceSquared(loc) < 60
|
||||
&& stats.getPlayer().getEyeLocation().getDirection()
|
||||
.angle(entity.getLocation().toVector().subtract(stats.getPlayer().getLocation().toVector())) < Math.PI / 6
|
||||
&& MMOUtils.canDamage(stats.getPlayer(), entity))
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.MAGIC).damage(stats.getPlayer(), (LivingEntity) entity);
|
||||
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 2);
|
||||
}
|
||||
}
|
@ -1,97 +0,0 @@
|
||||
package net.Indyuce.mmoitems.ability;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Egg;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.player.PlayerEggThrowEvent;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.SimpleAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.api.util.TemporaryListener;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
|
||||
public class Chicken_Wraith extends Ability {
|
||||
public Chicken_Wraith() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK,
|
||||
CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("duration", 2.5);
|
||||
addModifier("damage", 2);
|
||||
addModifier("inaccuracy", 10);
|
||||
addModifier("force", 1);
|
||||
addModifier("cooldown", 10);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) {
|
||||
return new SimpleAbilityResult(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) {
|
||||
double duration = ability.getModifier("duration") * 10;
|
||||
double force = ability.getModifier("force");
|
||||
double inaccuracy = ability.getModifier("inaccuracy");
|
||||
|
||||
new BukkitRunnable() {
|
||||
int j = 0;
|
||||
final EggHandler handler = new EggHandler(ability.getModifier("damage"));
|
||||
|
||||
public void run() {
|
||||
if (j++ > duration) {
|
||||
handler.close(5 * 20);
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
Location loc = stats.getPlayer().getEyeLocation();
|
||||
loc.setPitch((float) (loc.getPitch() + (random.nextDouble() - .5) * inaccuracy));
|
||||
loc.setYaw((float) (loc.getYaw() + (random.nextDouble() - .5) * inaccuracy));
|
||||
|
||||
loc.getWorld().playSound(loc, Sound.ENTITY_CHICKEN_EGG, 1, 1);
|
||||
Egg egg = stats.getPlayer().launchProjectile(Egg.class);
|
||||
egg.setVelocity(loc.getDirection().multiply(1.3 * force));
|
||||
|
||||
handler.entities.add(egg.getEntityId());
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 2);
|
||||
}
|
||||
|
||||
public static class EggHandler extends TemporaryListener {
|
||||
private final List<Integer> entities = new ArrayList<>();
|
||||
private final double damage;
|
||||
|
||||
public EggHandler(double damage) {
|
||||
super(EntityDamageByEntityEvent.getHandlerList());
|
||||
|
||||
this.damage = damage;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void a(PlayerEggThrowEvent event) {
|
||||
if (entities.contains(event.getEgg().getEntityId())) {
|
||||
event.setHatching(false);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void b(EntityDamageByEntityEvent event) {
|
||||
if (entities.contains(event.getDamager().getEntityId()))
|
||||
event.setDamage(damage);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,65 +0,0 @@
|
||||
package net.Indyuce.mmoitems.ability;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.SimpleAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import io.lumine.mythic.lib.api.AttackResult;
|
||||
import io.lumine.mythic.lib.api.DamageType;
|
||||
|
||||
public class Circular_Slash extends Ability {
|
||||
public Circular_Slash() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("damage", 6);
|
||||
addModifier("radius", 3);
|
||||
addModifier("knockback", 1);
|
||||
addModifier("cooldown", 10);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) {
|
||||
return new SimpleAbilityResult(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) {
|
||||
double damage = ability.getModifier("damage");
|
||||
double radius = ability.getModifier("radius");
|
||||
double knockback = ability.getModifier("knockback");
|
||||
|
||||
stats.getPlayer().getWorld().playSound(stats.getPlayer().getLocation(), Sound.ENTITY_ZOMBIE_ATTACK_IRON_DOOR, 2, .5f);
|
||||
stats.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 2, 254));
|
||||
for (Entity entity : stats.getPlayer().getNearbyEntities(radius, radius, radius)) {
|
||||
if (MMOUtils.canDamage(stats.getPlayer(), entity)) {
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.PHYSICAL).damage(stats.getPlayer(), (LivingEntity) entity);
|
||||
Vector v1 = entity.getLocation().toVector();
|
||||
Vector v2 = stats.getPlayer().getLocation().toVector();
|
||||
double y = .5;
|
||||
Vector v3 = v1.subtract(v2).multiply(.5 * knockback).setY(knockback == 0 ? 0 : y);
|
||||
entity.setVelocity(v3);
|
||||
}
|
||||
}
|
||||
double step = 12 + (radius * 2.5);
|
||||
for (double j = 0; j < Math.PI * 2; j += Math.PI / step) {
|
||||
Location loc = stats.getPlayer().getLocation().clone();
|
||||
loc.add(Math.cos(j) * radius, .75, Math.sin(j) * radius);
|
||||
loc.getWorld().spawnParticle(Particle.SMOKE_LARGE, loc, 0);
|
||||
}
|
||||
stats.getPlayer().getWorld().spawnParticle(Particle.EXPLOSION_LARGE, stats.getPlayer().getLocation().add(0, 1, 0), 0);
|
||||
}
|
||||
}
|
@ -1,95 +0,0 @@
|
||||
package net.Indyuce.mmoitems.ability;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.EvokerFangs;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.VectorAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.api.util.TemporaryListener;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import io.lumine.mythic.lib.api.AttackResult;
|
||||
import io.lumine.mythic.lib.api.DamageType;
|
||||
|
||||
public class Corrupted_Fangs extends Ability implements Listener {
|
||||
public Corrupted_Fangs() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK,
|
||||
CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("damage", 5);
|
||||
addModifier("cooldown", 12);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
addModifier("fangs", 6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) {
|
||||
return new VectorAbilityResult(ability, stats.getPlayer(), target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) {
|
||||
|
||||
stats.getPlayer().getWorld().playSound(stats.getPlayer().getLocation(), Sound.ENTITY_WITHER_SHOOT, 2, 2);
|
||||
new BukkitRunnable() {
|
||||
double fangAmount = ability.getModifier("fangs");
|
||||
final Vector vec = ((VectorAbilityResult) ability).getTarget().setY(0).multiply(2);
|
||||
final Location loc = stats.getPlayer().getLocation();
|
||||
double ti = 0;
|
||||
final FangsHandler handler = new FangsHandler(stats, ability.getModifier("damage"));
|
||||
|
||||
public void run() {
|
||||
if (ti++ >= fangAmount) {
|
||||
handler.close(3 * 20);
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
loc.add(vec);
|
||||
EvokerFangs evokerFangs = (EvokerFangs) stats.getPlayer().getWorld().spawnEntity(loc, EntityType.EVOKER_FANGS);
|
||||
handler.entities.add(evokerFangs.getEntityId());
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 1);
|
||||
}
|
||||
|
||||
public class FangsHandler extends TemporaryListener {
|
||||
private final List<Integer> entities = new ArrayList<>();
|
||||
private final CachedStats stats;
|
||||
private final double damage;
|
||||
|
||||
public FangsHandler(CachedStats stats, double damage) {
|
||||
super(EntityDamageByEntityEvent.getHandlerList());
|
||||
|
||||
this.stats = stats;
|
||||
this.damage = damage;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void a(EntityDamageByEntityEvent event) {
|
||||
if (event.getDamager() instanceof EvokerFangs && entities.contains(event.getDamager().getEntityId())) {
|
||||
event.setDamage(0); // Fangs do 6 damage in vanilla so lets set to 0 to not do extra damage
|
||||
if (MMOUtils.canDamage(stats.getPlayer(), event.getEntity())) {
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.MAGIC).damage(stats.getPlayer(), (LivingEntity) event.getEntity());
|
||||
} else {
|
||||
event.setCancelled(true); // Cancel the event if we cannot damage the target such as a player
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,106 +0,0 @@
|
||||
package net.Indyuce.mmoitems.ability;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.VectorAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import io.lumine.mythic.lib.api.AttackResult;
|
||||
import io.lumine.mythic.lib.api.DamageType;
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
|
||||
public class Cursed_Beam extends Ability {
|
||||
public Cursed_Beam() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("damage", 8);
|
||||
addModifier("cooldown", 10);
|
||||
addModifier("duration", 5);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) {
|
||||
return new VectorAbilityResult(ability, stats.getPlayer(), target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) {
|
||||
double duration = ability.getModifier("duration");
|
||||
|
||||
stats.getPlayer().getWorld().playSound(stats.getPlayer().getLocation(), Sound.ENTITY_WITHER_SHOOT, 2, 2);
|
||||
new BukkitRunnable() {
|
||||
final Vector dir = ((VectorAbilityResult) ability).getTarget().multiply(.3);
|
||||
final Location loc = stats.getPlayer().getEyeLocation().clone();
|
||||
final double r = 0.4;
|
||||
int ti = 0;
|
||||
|
||||
public void run() {
|
||||
ti++;
|
||||
if (ti > 50)
|
||||
cancel();
|
||||
|
||||
List<Entity> entities = MMOUtils.getNearbyChunkEntities(loc);
|
||||
for (double j = 0; j < 4; j++) {
|
||||
loc.add(dir);
|
||||
for (double i = 0; i < Math.PI * 2; i += Math.PI / 6) {
|
||||
Vector vec = MMOUtils.rotateFunc(new Vector(r * Math.cos(i), r * Math.sin(i), 0), loc);
|
||||
loc.add(vec);
|
||||
loc.getWorld().spawnParticle(Particle.SPELL_WITCH, loc, 0);
|
||||
loc.add(vec.multiply(-1));
|
||||
}
|
||||
|
||||
for (Entity target : entities)
|
||||
if (MMOUtils.canDamage(stats.getPlayer(), loc, target)) {
|
||||
effect(target);
|
||||
double damage = ability.getModifier("damage");
|
||||
loc.getWorld().playSound(loc, VersionSound.ENTITY_ENDERMAN_TELEPORT.toSound(), 2, .7f);
|
||||
|
||||
for (Entity entity : entities)
|
||||
if (MMOUtils.canDamage(stats.getPlayer(), entity) && loc.distanceSquared(entity.getLocation().add(0, 1, 0)) < 9) {
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.MAGIC, DamageType.PROJECTILE).damage(stats.getPlayer(), (LivingEntity) entity);
|
||||
((LivingEntity) entity).addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, (int) (duration * 20), 0));
|
||||
}
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 1);
|
||||
}
|
||||
|
||||
private void effect(Entity ent) {
|
||||
new BukkitRunnable() {
|
||||
final Location loc2 = ent.getLocation();
|
||||
double y = 0;
|
||||
|
||||
public void run() {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
y += .05;
|
||||
for (int j = 0; j < 2; j++) {
|
||||
double xz = y * Math.PI * .8 + (j * Math.PI);
|
||||
loc2.getWorld().spawnParticle(Particle.SPELL_WITCH, loc2.clone().add(Math.cos(xz) * 2.5, y, Math.sin(xz) * 2.5), 0);
|
||||
}
|
||||
}
|
||||
if (y >= 3)
|
||||
cancel();
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 1);
|
||||
}
|
||||
}
|
@ -1,75 +0,0 @@
|
||||
package net.Indyuce.mmoitems.ability;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.SimpleAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.VectorAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import io.lumine.mythic.lib.api.AttackResult;
|
||||
import io.lumine.mythic.lib.api.DamageType;
|
||||
|
||||
public class Earthquake extends Ability {
|
||||
public Earthquake() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("damage", 3);
|
||||
addModifier("duration", 2);
|
||||
addModifier("amplifier", 1);
|
||||
addModifier("cooldown", 10);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) {
|
||||
return ((LivingEntity) stats.getPlayer()).isOnGround() ? new VectorAbilityResult(ability, stats.getPlayer(), target) : new SimpleAbilityResult(ability, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) {
|
||||
double damage = ability.getModifier("damage");
|
||||
double slowDuration = ability.getModifier("duration");
|
||||
double slowAmplifier = ability.getModifier("amplifier");
|
||||
|
||||
new BukkitRunnable() {
|
||||
final Vector vec = ((VectorAbilityResult) ability).getTarget().setY(0);
|
||||
final Location loc = stats.getPlayer().getLocation();
|
||||
int ti = 0;
|
||||
final List<Integer> hit = new ArrayList<>();
|
||||
|
||||
public void run() {
|
||||
ti++;
|
||||
if (ti > 20)
|
||||
cancel();
|
||||
|
||||
loc.add(vec);
|
||||
loc.getWorld().spawnParticle(Particle.CLOUD, loc, 5, .5, 0, .5, 0);
|
||||
loc.getWorld().playSound(loc, Sound.BLOCK_GRAVEL_BREAK, 2, 1);
|
||||
|
||||
for (Entity entity : MMOUtils.getNearbyChunkEntities(loc))
|
||||
if (MMOUtils.canDamage(stats.getPlayer(), entity) && loc.distanceSquared(entity.getLocation()) < 2 && !hit.contains(entity.getEntityId())) {
|
||||
hit.add(entity.getEntityId());
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.MAGIC).damage(stats.getPlayer(), (LivingEntity) entity);
|
||||
((LivingEntity) entity).addPotionEffect(new PotionEffect(PotionEffectType.SLOW, (int) (slowDuration * 20), (int) slowAmplifier));
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 1);
|
||||
}
|
||||
}
|
@ -1,76 +0,0 @@
|
||||
package net.Indyuce.mmoitems.ability;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.VectorAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import io.lumine.mythic.lib.api.AttackResult;
|
||||
import io.lumine.mythic.lib.api.DamageType;
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
|
||||
public class Fire_Meteor extends Ability {
|
||||
public Fire_Meteor() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("damage", 6);
|
||||
addModifier("knockback", 1);
|
||||
addModifier("radius", 4);
|
||||
addModifier("cooldown", 10);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) {
|
||||
return new VectorAbilityResult(ability, stats.getPlayer(), target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) {
|
||||
stats.getPlayer().getWorld().playSound(stats.getPlayer().getLocation(), VersionSound.ENTITY_ENDERMAN_TELEPORT.toSound(), 3, 1);
|
||||
new BukkitRunnable() {
|
||||
double ti = 0;
|
||||
final Location loc = stats.getPlayer().getLocation().clone().add(0, 10, 0);
|
||||
final Vector vec = ((VectorAbilityResult) ability).getTarget().multiply(1.3).setY(-1).normalize();
|
||||
|
||||
public void run() {
|
||||
ti++;
|
||||
if (ti > 40)
|
||||
cancel();
|
||||
|
||||
loc.add(vec);
|
||||
loc.getWorld().spawnParticle(Particle.EXPLOSION_LARGE, loc, 0);
|
||||
loc.getWorld().spawnParticle(Particle.FLAME, loc, 4, .2, .2, .2, 0);
|
||||
if (loc.getBlock().getRelative(BlockFace.DOWN).getType().isSolid() || loc.getBlock().getType().isSolid()) {
|
||||
loc.getWorld().playSound(loc, Sound.ENTITY_GENERIC_EXPLODE, 3, .6f);
|
||||
loc.getWorld().spawnParticle(Particle.EXPLOSION_LARGE, loc, 10, 2, 2, 2, 0);
|
||||
loc.getWorld().spawnParticle(Particle.EXPLOSION_NORMAL, loc, 32, 0, 0, 0, .3);
|
||||
loc.getWorld().spawnParticle(Particle.FLAME, loc, 32, 0, 0, 0, .3);
|
||||
|
||||
double damage = ability.getModifier("damage");
|
||||
double knockback = ability.getModifier("knockback");
|
||||
double radius = ability.getModifier("radius");
|
||||
for (Entity entity : MMOUtils.getNearbyChunkEntities(loc))
|
||||
if (MMOUtils.canDamage(stats.getPlayer(), entity) && entity.getLocation().distanceSquared(loc) < radius * radius) {
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.MAGIC, DamageType.PROJECTILE).damage(stats.getPlayer(), (LivingEntity) entity);
|
||||
entity.setVelocity(entity.getLocation().toVector().subtract(loc.toVector()).multiply(.1 * knockback).setY(.4 * knockback));
|
||||
}
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 1);
|
||||
}
|
||||
}
|
@ -1,79 +0,0 @@
|
||||
package net.Indyuce.mmoitems.ability;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.VectorAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import io.lumine.mythic.lib.api.AttackResult;
|
||||
import io.lumine.mythic.lib.api.DamageType;
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
|
||||
public class Firebolt extends Ability {
|
||||
public Firebolt() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("damage", 6);
|
||||
addModifier("ignite", 3);
|
||||
addModifier("cooldown", 10);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) {
|
||||
return new VectorAbilityResult(ability, stats.getPlayer(), target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) {
|
||||
stats.getPlayer().getWorld().playSound(stats.getPlayer().getLocation(), VersionSound.ENTITY_FIREWORK_ROCKET_BLAST.toSound(), 1, 1);
|
||||
new BukkitRunnable() {
|
||||
final Vector vec = ((VectorAbilityResult) ability).getTarget().multiply(.8);
|
||||
final Location loc = stats.getPlayer().getEyeLocation();
|
||||
int ti = 0;
|
||||
|
||||
public void run() {
|
||||
ti++;
|
||||
if (ti > 20)
|
||||
cancel();
|
||||
|
||||
List<Entity> entities = MMOUtils.getNearbyChunkEntities(loc);
|
||||
loc.getWorld().playSound(loc, Sound.BLOCK_FIRE_AMBIENT, 2, 1);
|
||||
for (int j = 0; j < 2; j++) {
|
||||
loc.add(vec);
|
||||
if (loc.getBlock().getType().isSolid())
|
||||
cancel();
|
||||
|
||||
loc.getWorld().spawnParticle(Particle.FLAME, loc, 5, .12, .12, .12, 0);
|
||||
if (random.nextDouble() < .3)
|
||||
loc.getWorld().spawnParticle(Particle.LAVA, loc, 0);
|
||||
for (Entity target : entities)
|
||||
if (MMOUtils.canDamage(stats.getPlayer(), loc, target)) {
|
||||
loc.getWorld().spawnParticle(Particle.FLAME, loc, 32, 0, 0, 0, .1);
|
||||
loc.getWorld().spawnParticle(Particle.LAVA, loc, 8, 0, 0, 0, 0);
|
||||
loc.getWorld().spawnParticle(Particle.EXPLOSION_LARGE, loc, 0);
|
||||
loc.getWorld().playSound(loc, Sound.ENTITY_GENERIC_EXPLODE, 3, 1);
|
||||
new AttackResult(ability.getModifier("damage"), DamageType.SKILL, DamageType.MAGIC, DamageType.PROJECTILE).damage(stats.getPlayer(), (LivingEntity) target);
|
||||
target.setFireTicks((int) ability.getModifier("ignite") * 20);
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 1);
|
||||
}
|
||||
}
|
@ -1,94 +0,0 @@
|
||||
package net.Indyuce.mmoitems.ability;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.SimpleAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import io.lumine.mythic.lib.api.AttackResult;
|
||||
import io.lumine.mythic.lib.api.DamageType;
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
|
||||
public class Firefly extends Ability {
|
||||
public Firefly() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("damage", 6);
|
||||
addModifier("duration", 2.5);
|
||||
addModifier("knockback", 1);
|
||||
addModifier("cooldown", 10);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) {
|
||||
return new SimpleAbilityResult(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) {
|
||||
double duration = ability.getModifier("duration") * 20;
|
||||
|
||||
new BukkitRunnable() {
|
||||
int j = 0;
|
||||
|
||||
public void run() {
|
||||
j++;
|
||||
if (j > duration)
|
||||
cancel();
|
||||
|
||||
if (stats.getPlayer().getLocation().getBlock().getType() == Material.WATER) {
|
||||
stats.getPlayer().setVelocity(stats.getPlayer().getVelocity().multiply(3).setY(1.8));
|
||||
stats.getPlayer().getWorld().playSound(stats.getPlayer().getLocation(), Sound.BLOCK_FIRE_EXTINGUISH, 1, .5f);
|
||||
stats.getPlayer().getWorld().spawnParticle(Particle.EXPLOSION_NORMAL, stats.getPlayer().getLocation().add(0, 1, 0), 32, 0, 0, 0, .2);
|
||||
stats.getPlayer().getWorld().spawnParticle(Particle.CLOUD, stats.getPlayer().getLocation().add(0, 1, 0), 32, 0, 0, 0, .2);
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
for (Entity entity : stats.getPlayer().getNearbyEntities(1, 1, 1))
|
||||
if (MMOUtils.canDamage(stats.getPlayer(), entity)) {
|
||||
double damage = ability.getModifier("damage");
|
||||
double knockback = ability.getModifier("knockback");
|
||||
|
||||
stats.getPlayer().getWorld().playSound(stats.getPlayer().getLocation(), Sound.ENTITY_ZOMBIE_ATTACK_IRON_DOOR, 1, .5f);
|
||||
stats.getPlayer().getWorld().spawnParticle(Particle.LAVA, stats.getPlayer().getLocation().add(0, 1, 0), 32);
|
||||
stats.getPlayer().getWorld().spawnParticle(Particle.SMOKE_LARGE, stats.getPlayer().getLocation().add(0, 1, 0), 24, 0, 0, 0, .3);
|
||||
stats.getPlayer().getWorld().spawnParticle(Particle.FLAME, stats.getPlayer().getLocation().add(0, 1, 0), 24, 0, 0, 0, .3);
|
||||
entity.setVelocity(stats.getPlayer().getVelocity().setY(0.3).multiply(1.7 * knockback));
|
||||
stats.getPlayer().setVelocity(stats.getPlayer().getEyeLocation().getDirection().multiply(-3).setY(.5));
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.MAGIC).damage(stats.getPlayer(), (LivingEntity) entity);
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
Location loc = stats.getPlayer().getLocation().add(0, 1, 0);
|
||||
for (double a = 0; a < Math.PI * 2; a += Math.PI / 9) {
|
||||
Vector vec = new Vector(.6 * Math.cos(a), .6 * Math.sin(a), 0);
|
||||
vec = MMOUtils.rotateFunc(vec, loc);
|
||||
loc.add(vec);
|
||||
stats.getPlayer().getWorld().spawnParticle(Particle.SMOKE_NORMAL, loc, 0);
|
||||
if (random.nextDouble() < .3)
|
||||
stats.getPlayer().getWorld().spawnParticle(Particle.FLAME, loc, 0);
|
||||
loc.add(vec.multiply(-1));
|
||||
}
|
||||
|
||||
stats.getPlayer().setVelocity(stats.getPlayer().getEyeLocation().getDirection());
|
||||
stats.getPlayer().getWorld().playSound(stats.getPlayer().getLocation(), VersionSound.ENTITY_FIREWORK_ROCKET_BLAST.toSound(), 1, 1);
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 1);
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package net.Indyuce.mmoitems.ability;
|
||||
|
||||
import net.Indyuce.mmoitems.ability.metadata.FriendlyTargetAbilityMetadata;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackMetadata;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
||||
public abstract class FriendlyTargetAbility extends Ability<FriendlyTargetAbilityMetadata> {
|
||||
public FriendlyTargetAbility(CastingMode... allowedModes) {
|
||||
super(allowedModes);
|
||||
}
|
||||
|
||||
public FriendlyTargetAbility(String id, String name, CastingMode... allowedModes) {
|
||||
super(id, name, allowedModes);
|
||||
}
|
||||
|
||||
public FriendlyTargetAbilityMetadata canBeCast(ItemAttackMetadata attack, LivingEntity target, AbilityData ability) {
|
||||
return new FriendlyTargetAbilityMetadata(ability, attack.getDamager(), target);
|
||||
}
|
||||
|
||||
public abstract void whenCast(ItemAttackMetadata attack, FriendlyTargetAbilityMetadata ability);
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
package net.Indyuce.mmoitems.ability;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.SimpleAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
|
||||
public class Frog_Mode extends Ability implements Listener {
|
||||
public Frog_Mode() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("duration", 20);
|
||||
addModifier("jump-force", 1);
|
||||
addModifier("speed", 1);
|
||||
addModifier("cooldown", 50);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) {
|
||||
return new SimpleAbilityResult(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) {
|
||||
double duration = ability.getModifier("duration") * 20;
|
||||
double y = ability.getModifier("jump-force");
|
||||
double xz = ability.getModifier("speed");
|
||||
|
||||
new BukkitRunnable() {
|
||||
int j = 0;
|
||||
|
||||
public void run() {
|
||||
j++;
|
||||
if (j > duration)
|
||||
cancel();
|
||||
|
||||
if (stats.getPlayer().getLocation().getBlock().getType() == Material.WATER) {
|
||||
stats.getPlayer().setVelocity(stats.getPlayer().getEyeLocation().getDirection().setY(0).normalize().multiply(.8 * xz).setY(0.5 / xz * y));
|
||||
stats.getPlayer().getWorld().playSound(stats.getPlayer().getLocation(), VersionSound.ENTITY_ENDER_DRAGON_FLAP.toSound(), 2, 1);
|
||||
for (double a = 0; a < Math.PI * 2; a += Math.PI / 12)
|
||||
stats.getPlayer().getWorld().spawnParticle(Particle.CLOUD, stats.getPlayer().getLocation(), 0, Math.cos(a), 0, Math.sin(a), .2);
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 1);
|
||||
}
|
||||
}
|
@ -1,68 +0,0 @@
|
||||
package net.Indyuce.mmoitems.ability;
|
||||
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.SimpleAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
|
||||
public class Frozen_Aura extends Ability implements Listener {
|
||||
public Frozen_Aura() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("duration", 6);
|
||||
addModifier("amplifier", 1);
|
||||
addModifier("radius", 10);
|
||||
addModifier("cooldown", 10);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) {
|
||||
return new SimpleAbilityResult(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) {
|
||||
double duration = ability.getModifier("duration") * 20;
|
||||
double radiusSquared = Math.pow(ability.getModifier("radius"), 2);
|
||||
double amplifier = ability.getModifier("amplifier") - 1;
|
||||
|
||||
new BukkitRunnable() {
|
||||
double j = 0;
|
||||
int ti = 0;
|
||||
|
||||
public void run() {
|
||||
if (ti++ > duration)
|
||||
cancel();
|
||||
|
||||
j += Math.PI / 60;
|
||||
for (double k = 0; k < Math.PI * 2; k += Math.PI / 2)
|
||||
stats.getPlayer().getWorld().spawnParticle(Particle.SPELL_INSTANT, stats.getPlayer().getLocation().add(Math.cos(k + j) * 2, 1 + Math.sin(k + j * 7) / 3, Math.sin(k + j) * 2), 0);
|
||||
|
||||
if (ti % 2 == 0)
|
||||
stats.getPlayer().getWorld().playSound(stats.getPlayer().getLocation(), Sound.BLOCK_SNOW_BREAK, 1, 1);
|
||||
|
||||
if (ti % 7 == 0)
|
||||
for (Entity entity : MMOUtils.getNearbyChunkEntities(stats.getPlayer().getLocation()))
|
||||
if (entity.getLocation().distanceSquared(stats.getPlayer().getLocation()) < radiusSquared && MMOUtils.canDamage(stats.getPlayer(), entity)) {
|
||||
((LivingEntity) entity).removePotionEffect(PotionEffectType.SLOW);
|
||||
((LivingEntity) entity).addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 40, (int) amplifier));
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 1);
|
||||
}
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
package net.Indyuce.mmoitems.ability;
|
||||
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.SimpleAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
|
||||
public class Grand_Heal extends Ability {
|
||||
public Grand_Heal() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("heal", 5);
|
||||
addModifier("radius", 5);
|
||||
addModifier("cooldown", 15);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) {
|
||||
return new SimpleAbilityResult(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) {
|
||||
double heal = ability.getModifier("heal");
|
||||
double radius = ability.getModifier("radius");
|
||||
|
||||
MMOUtils.heal(stats.getPlayer(), heal);
|
||||
stats.getPlayer().getWorld().playSound(stats.getPlayer().getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1, 2);
|
||||
stats.getPlayer().getWorld().spawnParticle(Particle.HEART, stats.getPlayer().getLocation().add(0, .75, 0), 16, 1, 1, 1, 0);
|
||||
stats.getPlayer().getWorld().spawnParticle(Particle.VILLAGER_HAPPY, stats.getPlayer().getLocation().add(0, .75, 0), 16, 1, 1, 1, 0);
|
||||
for (Entity entity : stats.getPlayer().getNearbyEntities(radius, radius, radius))
|
||||
if (entity instanceof Player)
|
||||
MMOUtils.heal((Player) entity, heal);
|
||||
}
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
package net.Indyuce.mmoitems.ability;
|
||||
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.SimpleAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
|
||||
public class Heal extends Ability {
|
||||
public Heal() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("heal", 4);
|
||||
addModifier("cooldown", 10);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) {
|
||||
return new SimpleAbilityResult(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) {
|
||||
stats.getPlayer().getWorld().playSound(stats.getPlayer().getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1, 2);
|
||||
stats.getPlayer().getWorld().spawnParticle(Particle.HEART, stats.getPlayer().getLocation().add(0, .75, 0), 16, 1, 1, 1, 0);
|
||||
stats.getPlayer().getWorld().spawnParticle(Particle.VILLAGER_HAPPY, stats.getPlayer().getLocation().add(0, .75, 0), 16, 1, 1, 1, 0);
|
||||
MMOUtils.heal(stats.getPlayer(), ability.getModifier("heal"));
|
||||
}
|
||||
}
|
@ -1,68 +0,0 @@
|
||||
package net.Indyuce.mmoitems.ability;
|
||||
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.VectorAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import io.lumine.mythic.lib.api.AttackResult;
|
||||
import io.lumine.mythic.lib.api.DamageType;
|
||||
|
||||
public class Heavy_Charge extends Ability {
|
||||
public Heavy_Charge() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("damage", 6);
|
||||
addModifier("knockback", 1);
|
||||
addModifier("cooldown", 10);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) {
|
||||
return new VectorAbilityResult(ability, stats.getPlayer(), target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) {
|
||||
double knockback = ability.getModifier("knockback");
|
||||
|
||||
new BukkitRunnable() {
|
||||
double ti = 0;
|
||||
final Vector vec = ((VectorAbilityResult) ability).getTarget().setY(-1);
|
||||
|
||||
public void run() {
|
||||
ti++;
|
||||
if (ti > 20)
|
||||
cancel();
|
||||
|
||||
if (ti < 9) {
|
||||
stats.getPlayer().setVelocity(vec);
|
||||
stats.getPlayer().getWorld().spawnParticle(Particle.EXPLOSION_NORMAL, stats.getPlayer().getLocation().add(0, 1, 0), 3, .13, .13, .13, 0);
|
||||
}
|
||||
|
||||
for (Entity target : stats.getPlayer().getNearbyEntities(1, 1, 1))
|
||||
if (MMOUtils.canDamage(stats.getPlayer(), target)) {
|
||||
stats.getPlayer().getWorld().playSound(stats.getPlayer().getLocation(), Sound.ENTITY_ZOMBIE_ATTACK_IRON_DOOR, 1, 1);
|
||||
stats.getPlayer().getWorld().spawnParticle(Particle.EXPLOSION_LARGE, target.getLocation().add(0, 1, 0), 0);
|
||||
target.setVelocity(stats.getPlayer().getVelocity().setY(0.3).multiply(1.7 * knockback));
|
||||
stats.getPlayer().setVelocity(stats.getPlayer().getVelocity().setX(0).setY(0).setZ(0));
|
||||
new AttackResult(ability.getModifier("damage"), DamageType.SKILL, DamageType.PHYSICAL).damage(stats.getPlayer(), (LivingEntity) target);
|
||||
cancel();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 1);
|
||||
}
|
||||
}
|
@ -1,64 +0,0 @@
|
||||
package net.Indyuce.mmoitems.ability;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.SimpleAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
|
||||
public class Hoearthquake extends Ability {
|
||||
public Hoearthquake() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("cooldown", 10);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) {
|
||||
return new SimpleAbilityResult(ability, ((LivingEntity) stats.getPlayer()).isOnGround());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) {
|
||||
new BukkitRunnable() {
|
||||
final Vector vec = stats.getPlayer().getEyeLocation().getDirection().setY(0);
|
||||
final Location loc = stats.getPlayer().getLocation();
|
||||
int ti = 0;
|
||||
|
||||
public void run() {
|
||||
if (ti++ > 20)
|
||||
cancel();
|
||||
|
||||
loc.add(vec);
|
||||
loc.getWorld().playSound(loc, Sound.BLOCK_GRAVEL_BREAK, 2, 1);
|
||||
loc.getWorld().spawnParticle(Particle.CLOUD, loc, 1, .5, 0, .5, 0);
|
||||
|
||||
for (int x = -1; x < 2; x++)
|
||||
for (int z = -1; z < 2; z++) {
|
||||
Block b = loc.clone().add(x, -1, z).getBlock();
|
||||
if (b.getType() == Material.GRASS || b.getType() == Material.DIRT) {
|
||||
BlockBreakEvent event = new BlockBreakEvent(b, stats.getPlayer());
|
||||
event.setDropItems(false);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
if(!event.isCancelled()) b.setType(Material.FARMLAND);
|
||||
}
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 1);
|
||||
}
|
||||
}
|
@ -1,83 +0,0 @@
|
||||
package net.Indyuce.mmoitems.ability;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.VectorAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import io.lumine.mythic.lib.api.AttackResult;
|
||||
import io.lumine.mythic.lib.api.DamageType;
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
|
||||
public class Holy_Missile extends Ability {
|
||||
public Holy_Missile() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("damage", 6);
|
||||
addModifier("cooldown", 10);
|
||||
addModifier("duration", 4);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) {
|
||||
return new VectorAbilityResult(ability, stats.getPlayer(), target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) {
|
||||
double duration = ability.getModifier("duration") * 10;
|
||||
double damage = ability.getModifier("damage");
|
||||
|
||||
stats.getPlayer().getWorld().playSound(stats.getPlayer().getLocation(), VersionSound.ENTITY_FIREWORK_ROCKET_BLAST.toSound(), 1, 1);
|
||||
new BukkitRunnable() {
|
||||
final Vector vec = ((VectorAbilityResult) ability).getTarget().multiply(.45);
|
||||
final Location loc = stats.getPlayer().getLocation().clone().add(0, 1.3, 0);
|
||||
double ti = 0;
|
||||
|
||||
public void run() {
|
||||
if (ti++ > duration)
|
||||
cancel();
|
||||
|
||||
loc.getWorld().playSound(loc, VersionSound.BLOCK_NOTE_BLOCK_HAT.toSound(), 2, 1);
|
||||
List<Entity> entities = MMOUtils.getNearbyChunkEntities(loc);
|
||||
for (int j = 0; j < 2; j++) {
|
||||
loc.add(vec);
|
||||
if (loc.getBlock().getType().isSolid())
|
||||
cancel();
|
||||
|
||||
for (double i = -Math.PI; i < Math.PI; i += Math.PI / 2) {
|
||||
Vector v = new Vector(Math.cos(i + ti / 4), Math.sin(i + ti / 4), 0);
|
||||
v = MMOUtils.rotateFunc(v, loc);
|
||||
loc.getWorld().spawnParticle(Particle.FIREWORKS_SPARK, loc, 0, v.getX(), v.getY(), v.getZ(), .08);
|
||||
}
|
||||
|
||||
for (Entity entity : entities)
|
||||
if (MMOUtils.canDamage(stats.getPlayer(), loc, entity)) {
|
||||
loc.getWorld().spawnParticle(Particle.EXPLOSION_LARGE, loc, 1);
|
||||
loc.getWorld().spawnParticle(Particle.FIREWORKS_SPARK, loc, 32, 0, 0, 0, .2);
|
||||
loc.getWorld().playSound(loc, Sound.ENTITY_GENERIC_EXPLODE, 2, 1);
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.MAGIC, DamageType.PROJECTILE).damage(stats.getPlayer(), (LivingEntity) entity);
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 1);
|
||||
}
|
||||
}
|
||||
|
@ -1,96 +0,0 @@
|
||||
package net.Indyuce.mmoitems.ability;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.VectorAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import io.lumine.mythic.lib.api.AttackResult;
|
||||
import io.lumine.mythic.lib.api.DamageType;
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
|
||||
public class Ice_Crystal extends Ability {
|
||||
public Ice_Crystal() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK,
|
||||
CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("damage", 6);
|
||||
addModifier("duration", 3);
|
||||
addModifier("amplifier", 1);
|
||||
addModifier("cooldown", 10);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) {
|
||||
return new VectorAbilityResult(ability, stats.getPlayer(), target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) {
|
||||
stats.getPlayer().getWorld().playSound(stats.getPlayer().getLocation(), VersionSound.ENTITY_FIREWORK_ROCKET_BLAST.toSound(), 1, 1);
|
||||
new BukkitRunnable() {
|
||||
final Vector vec = ((VectorAbilityResult) ability).getTarget().multiply(.45);
|
||||
final Location loc = stats.getPlayer().getEyeLocation().clone().add(0, -.3, 0);
|
||||
int ti = 0;
|
||||
|
||||
public void run() {
|
||||
ti++;
|
||||
if (ti > 25)
|
||||
cancel();
|
||||
|
||||
loc.getWorld().playSound(loc, Sound.BLOCK_GLASS_BREAK, 2, 1);
|
||||
List<Entity> entities = MMOUtils.getNearbyChunkEntities(loc);
|
||||
for (int j = 0; j < 3; j++) {
|
||||
loc.add(vec);
|
||||
if (loc.getBlock().getType().isSolid())
|
||||
cancel();
|
||||
|
||||
/*
|
||||
* has a different particle effect since SNOW_DIG is not the
|
||||
* same as in legacy minecraft, the particle effect is now a
|
||||
* cross that rotates
|
||||
*/
|
||||
for (double r = 0; r < .4; r += .1)
|
||||
for (double a = 0; a < Math.PI * 2; a += Math.PI / 2) {
|
||||
Vector vec = MMOUtils.rotateFunc(new Vector(r * Math.cos(a + (double) ti / 10), r * Math.sin(a + (double) ti / 10), 0),
|
||||
loc);
|
||||
loc.add(vec);
|
||||
loc.getWorld().spawnParticle(Particle.REDSTONE, loc, 1, new Particle.DustOptions(Color.WHITE, .7f));
|
||||
loc.add(vec.multiply(-1));
|
||||
}
|
||||
|
||||
for (Entity entity : entities)
|
||||
if (MMOUtils.canDamage(stats.getPlayer(), loc, entity)) {
|
||||
loc.getWorld().spawnParticle(Particle.EXPLOSION_LARGE, loc, 0);
|
||||
loc.getWorld().spawnParticle(Particle.FIREWORKS_SPARK, loc, 48, 0, 0, 0, .2);
|
||||
loc.getWorld().playSound(loc, Sound.ENTITY_GENERIC_EXPLODE, 2, 1);
|
||||
new AttackResult(ability.getModifier("damage"), DamageType.SKILL, DamageType.MAGIC, DamageType.PROJECTILE)
|
||||
.damage(stats.getPlayer(), (LivingEntity) entity);
|
||||
((LivingEntity) entity).addPotionEffect(new PotionEffect(PotionEffectType.SLOW,
|
||||
(int) (ability.getModifier("duration") * 20), (int) ability.getModifier("amplifier")));
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 1);
|
||||
}
|
||||
}
|
22
src/main/java/net/Indyuce/mmoitems/ability/ItemAbility.java
Normal file
22
src/main/java/net/Indyuce/mmoitems/ability/ItemAbility.java
Normal file
@ -0,0 +1,22 @@
|
||||
package net.Indyuce.mmoitems.ability;
|
||||
|
||||
import net.Indyuce.mmoitems.ability.metadata.ItemAbilityMetadata;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackMetadata;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
||||
public abstract class ItemAbility extends Ability<ItemAbilityMetadata> {
|
||||
public ItemAbility(CastingMode... allowedModes) {
|
||||
super(allowedModes);
|
||||
}
|
||||
|
||||
public ItemAbility(String id, String name, CastingMode... allowedModes) {
|
||||
super(id, name, allowedModes);
|
||||
}
|
||||
|
||||
public ItemAbilityMetadata canBeCast(ItemAttackMetadata attack, LivingEntity target, AbilityData ability) {
|
||||
return new ItemAbilityMetadata(ability, attack.getDamager(), target);
|
||||
}
|
||||
|
||||
public abstract void whenCast(ItemAttackMetadata attack, ItemAbilityMetadata ability);
|
||||
}
|
@ -1,90 +0,0 @@
|
||||
package net.Indyuce.mmoitems.ability;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.VectorAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.api.util.NoClipItem;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import io.lumine.mythic.lib.api.AttackResult;
|
||||
import io.lumine.mythic.lib.api.DamageType;
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
|
||||
public class Item_Bomb extends Ability implements Listener {
|
||||
public Item_Bomb() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("damage", 7);
|
||||
addModifier("radius", 6);
|
||||
addModifier("slow-duration", 4);
|
||||
addModifier("slow-amplifier", 1);
|
||||
addModifier("cooldown", 15);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) {
|
||||
return new VectorAbilityResult(ability, stats.getPlayer(), target);
|
||||
}
|
||||
|
||||
// TODO getItemInMainHand? Breaks the ability when used in the offhand.
|
||||
@Override
|
||||
public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) {
|
||||
ItemStack itemStack = stats.getPlayer().getInventory().getItemInMainHand().clone();
|
||||
if (itemStack == null || itemStack.getType() == Material.AIR) {
|
||||
result.setSuccessful(false);
|
||||
return;
|
||||
}
|
||||
|
||||
final NoClipItem item = new NoClipItem(stats.getPlayer().getLocation().add(0, 1.2, 0), itemStack);
|
||||
item.getEntity().setVelocity(((VectorAbilityResult) ability).getTarget().multiply(1.3));
|
||||
stats.getPlayer().getWorld().playSound(stats.getPlayer().getLocation(), Sound.ENTITY_SNOWBALL_THROW, 2, 0);
|
||||
|
||||
new BukkitRunnable() {
|
||||
int j = 0;
|
||||
|
||||
public void run() {
|
||||
if (j++ > 40) {
|
||||
double radius = ability.getModifier("radius");
|
||||
double damage = ability.getModifier("damage");
|
||||
double slowDuration = ability.getModifier("slow-duration");
|
||||
double slowAmplifier = ability.getModifier("slow-amplifier");
|
||||
|
||||
for (Entity entity : item.getEntity().getNearbyEntities(radius, radius, radius))
|
||||
if (MMOUtils.canDamage(stats.getPlayer(), entity)) {
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.PHYSICAL).damage(stats.getPlayer(), (LivingEntity) entity);
|
||||
((LivingEntity) entity).removePotionEffect(PotionEffectType.SLOW);
|
||||
((LivingEntity) entity).addPotionEffect(new PotionEffect(PotionEffectType.SLOW, (int) (slowDuration * 20), (int) slowAmplifier));
|
||||
}
|
||||
|
||||
item.getEntity().getWorld().spawnParticle(Particle.EXPLOSION_LARGE, item.getEntity().getLocation(), 24, 2, 2, 2, 0);
|
||||
item.getEntity().getWorld().spawnParticle(Particle.EXPLOSION_NORMAL, item.getEntity().getLocation(), 48, 0, 0, 0, .2);
|
||||
item.getEntity().getWorld().playSound(item.getEntity().getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 3, 0);
|
||||
|
||||
item.close();
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
item.getEntity().getWorld().spawnParticle(Particle.SMOKE_LARGE, item.getEntity().getLocation().add(0, .2, 0), 0);
|
||||
item.getEntity().getWorld().spawnParticle(Particle.FIREWORKS_SPARK, item.getEntity().getLocation().add(0, .2, 0), 1, 0, 0, 0, .1);
|
||||
item.getEntity().getWorld().playSound(item.getEntity().getLocation(), VersionSound.BLOCK_NOTE_BLOCK_HAT.toSound(), 2, (float) (.5 + (j / 40. * 1.5)));
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 1);
|
||||
}
|
||||
}
|
@ -1,91 +0,0 @@
|
||||
package net.Indyuce.mmoitems.ability;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import io.lumine.mythic.lib.MythicLib;
|
||||
import io.lumine.mythic.lib.api.AttackResult;
|
||||
import io.lumine.mythic.lib.api.DamageType;
|
||||
import io.lumine.mythic.lib.api.item.NBTItem;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.VectorAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.api.util.NoClipItem;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class Item_Throw extends Ability implements Listener {
|
||||
public Item_Throw() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("damage", 6);
|
||||
addModifier("force", 1);
|
||||
addModifier("cooldown", 10);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) {
|
||||
return new VectorAbilityResult(ability, stats.getPlayer(), target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) {
|
||||
ItemStack itemStack = stats.getPlayer().getInventory().getItemInMainHand().clone();
|
||||
NBTItem nbtItem = NBTItem.get(itemStack);
|
||||
if (itemStack.getType() == Material.AIR || !nbtItem.hasType()) {
|
||||
result.setSuccessful(false);
|
||||
return;
|
||||
}
|
||||
boolean hasAbility = false;
|
||||
|
||||
for (JsonElement entry : MythicLib.plugin.getJson().parse(nbtItem.getString("MMOITEMS_ABILITY"), JsonArray.class)) {
|
||||
if (!entry.isJsonObject())
|
||||
continue;
|
||||
|
||||
JsonObject object = entry.getAsJsonObject();
|
||||
if (object.get("Id").getAsString().equalsIgnoreCase(getID())) {
|
||||
hasAbility = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasAbility)
|
||||
return;
|
||||
|
||||
final NoClipItem item = new NoClipItem(stats.getPlayer().getLocation().add(0, 1.2, 0), itemStack);
|
||||
item.getEntity().setVelocity(((VectorAbilityResult) ability).getTarget().multiply(1.5 * ability.getModifier("force")));
|
||||
stats.getPlayer().getWorld().playSound(stats.getPlayer().getLocation(), Sound.ENTITY_SNOWBALL_THROW, 1, 0);
|
||||
new BukkitRunnable() {
|
||||
double ti = 0;
|
||||
|
||||
public void run() {
|
||||
ti++;
|
||||
if (ti > 20 || item.getEntity().isDead()) {
|
||||
item.close();
|
||||
cancel();
|
||||
}
|
||||
|
||||
item.getEntity().getWorld().spawnParticle(Particle.CRIT, item.getEntity().getLocation(), 0);
|
||||
for (Entity target : item.getEntity().getNearbyEntities(1, 1, 1))
|
||||
if (MMOUtils.canDamage(stats.getPlayer(), target)) {
|
||||
new AttackResult(ability.getModifier("damage"), DamageType.SKILL, DamageType.PHYSICAL, DamageType.PROJECTILE).damage(stats.getPlayer(), (LivingEntity) target);
|
||||
item.close();
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 1);
|
||||
}
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
package net.Indyuce.mmoitems.ability;
|
||||
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.SimpleAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
|
||||
public class Leap extends Ability {
|
||||
public Leap() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("force", 1);
|
||||
addModifier("cooldown", 10);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) {
|
||||
return new SimpleAbilityResult(ability, ((LivingEntity) stats.getPlayer()).isOnGround());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) {
|
||||
stats.getPlayer().getWorld().playSound(stats.getPlayer().getLocation(), VersionSound.ENTITY_ENDER_DRAGON_FLAP.toSound(), 1, 0);
|
||||
stats.getPlayer().getWorld().spawnParticle(Particle.EXPLOSION_NORMAL, stats.getPlayer().getLocation(), 16, 0, 0, 0.1);
|
||||
Vector vec = stats.getPlayer().getEyeLocation().getDirection().multiply(2 * ability.getModifier("force"));
|
||||
vec.setY(vec.getY() / 2);
|
||||
stats.getPlayer().setVelocity(vec);
|
||||
new BukkitRunnable() {
|
||||
double ti = 0;
|
||||
|
||||
public void run() {
|
||||
ti++;
|
||||
if (ti > 20)
|
||||
cancel();
|
||||
|
||||
stats.getPlayer().getWorld().spawnParticle(Particle.CLOUD, stats.getPlayer().getLocation().add(0, 1, 0), 0);
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 1);
|
||||
}
|
||||
}
|
@ -1,65 +0,0 @@
|
||||
package net.Indyuce.mmoitems.ability;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.SimpleAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import io.lumine.mythic.lib.api.AttackResult;
|
||||
import io.lumine.mythic.lib.api.DamageType;
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
|
||||
public class Light_Dash extends Ability {
|
||||
public Light_Dash() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("damage", 3);
|
||||
addModifier("cooldown", 10);
|
||||
addModifier("length", 1);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) {
|
||||
return new SimpleAbilityResult(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) {
|
||||
double damage = ability.getModifier("damage");
|
||||
double length = ability.getModifier("length");
|
||||
|
||||
new BukkitRunnable() {
|
||||
int j = 0;
|
||||
final Vector vec = stats.getPlayer().getEyeLocation().getDirection();
|
||||
final List<Integer> hit = new ArrayList<>();
|
||||
|
||||
public void run() {
|
||||
if (j++ > 10 * Math.min(10, length))
|
||||
cancel();
|
||||
|
||||
stats.getPlayer().setVelocity(vec);
|
||||
stats.getPlayer().getWorld().spawnParticle(Particle.SMOKE_LARGE, stats.getPlayer().getLocation().add(0, 1, 0), 0);
|
||||
stats.getPlayer().getWorld().playSound(stats.getPlayer().getLocation(), VersionSound.ENTITY_ENDER_DRAGON_FLAP.toSound(), 1, 2);
|
||||
for (Entity entity : stats.getPlayer().getNearbyEntities(1, 1, 1))
|
||||
if (!hit.contains(entity.getEntityId()) && MMOUtils.canDamage(stats.getPlayer(), entity)) {
|
||||
hit.add(entity.getEntityId());
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.PHYSICAL).damage(stats.getPlayer(), (LivingEntity) entity);
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 2);
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package net.Indyuce.mmoitems.ability;
|
||||
|
||||
import net.Indyuce.mmoitems.ability.metadata.LocationAbilityMetadata;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackMetadata;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
||||
public abstract class LocationAbility extends Ability<LocationAbilityMetadata> {
|
||||
public LocationAbility(CastingMode... allowedModes) {
|
||||
super(allowedModes);
|
||||
}
|
||||
|
||||
public LocationAbility(String id, String name, CastingMode... allowedModes) {
|
||||
super(id, name, allowedModes);
|
||||
}
|
||||
|
||||
public LocationAbilityMetadata canBeCast(ItemAttackMetadata attack, LivingEntity target, AbilityData ability) {
|
||||
return new LocationAbilityMetadata(ability, attack.getDamager(), target);
|
||||
}
|
||||
|
||||
public abstract void whenCast(ItemAttackMetadata attack, LocationAbilityMetadata ability);
|
||||
}
|
@ -1,69 +0,0 @@
|
||||
package net.Indyuce.mmoitems.ability;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.TargetAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import io.lumine.mythic.lib.api.AttackResult;
|
||||
import io.lumine.mythic.lib.api.DamageType;
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
|
||||
public class Magma_Fissure extends Ability {
|
||||
public Magma_Fissure() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("cooldown", 10);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
addModifier("ignite", 4);
|
||||
addModifier("damage", 4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) {
|
||||
return new TargetAbilityResult(ability, stats.getPlayer(), target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) {
|
||||
LivingEntity target = ((TargetAbilityResult) ability).getTarget();
|
||||
|
||||
new BukkitRunnable() {
|
||||
int j = 0;
|
||||
final Location loc = stats.getPlayer().getLocation().add(0, .2, 0);
|
||||
|
||||
public void run() {
|
||||
j++;
|
||||
if (target.isDead() || !target.getWorld().equals(loc.getWorld()) || j > 200) {
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
Vector vec = target.getLocation().add(0, .2, 0).subtract(loc).toVector().normalize().multiply(.6);
|
||||
loc.add(vec);
|
||||
|
||||
loc.getWorld().spawnParticle(Particle.LAVA, loc, 2, .2, 0, .2, 0);
|
||||
loc.getWorld().spawnParticle(Particle.FLAME, loc, 2, .2, 0, .2, 0);
|
||||
loc.getWorld().spawnParticle(Particle.SMOKE_NORMAL, loc, 2, .2, 0, .2, 0);
|
||||
loc.getWorld().playSound(loc, VersionSound.BLOCK_NOTE_BLOCK_HAT.toSound(), 1, 1);
|
||||
|
||||
if (target.getLocation().distanceSquared(loc) < 1) {
|
||||
loc.getWorld().playSound(loc, Sound.ENTITY_BLAZE_HURT, 2, 1);
|
||||
target.setFireTicks((int) (target.getFireTicks() + ability.getModifier("ignite") * 20));
|
||||
new AttackResult(ability.getModifier("damage"), DamageType.SKILL, DamageType.MAGIC).damage(stats.getPlayer(), target);
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 1);
|
||||
}
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
package net.Indyuce.mmoitems.ability;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.SimpleAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import io.lumine.mythic.lib.api.AttackResult;
|
||||
import io.lumine.mythic.lib.api.DamageType;
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
|
||||
public class Overload extends Ability {
|
||||
public Overload() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("damage", 6);
|
||||
addModifier("cooldown", 10);
|
||||
addModifier("radius", 6);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) {
|
||||
return new SimpleAbilityResult(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) {
|
||||
double damage = ability.getModifier("damage");
|
||||
double radius = ability.getModifier("radius");
|
||||
|
||||
stats.getPlayer().getWorld().playSound(stats.getPlayer().getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 2, 0);
|
||||
stats.getPlayer().getWorld().playSound(stats.getPlayer().getLocation(), VersionSound.ENTITY_FIREWORK_ROCKET_TWINKLE.toSound(), 2, 0);
|
||||
stats.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 2, 254));
|
||||
|
||||
for (Entity entity : stats.getPlayer().getNearbyEntities(radius, radius, radius))
|
||||
if (MMOUtils.canDamage(stats.getPlayer(), entity))
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.MAGIC).damage(stats.getPlayer(), (LivingEntity) entity);
|
||||
|
||||
double step = 12 + (radius * 2.5);
|
||||
for (double j = 0; j < Math.PI * 2; j += Math.PI / step) {
|
||||
Location loc = stats.getPlayer().getLocation().clone().add(Math.cos(j) * radius, 1, Math.sin(j) * radius);
|
||||
stats.getPlayer().getWorld().spawnParticle(Particle.CLOUD, loc, 4, 0, 0, 0, .05);
|
||||
stats.getPlayer().getWorld().spawnParticle(Particle.FIREWORKS_SPARK, loc, 4, 0, 0, 0, .05);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,107 +0,0 @@
|
||||
package net.Indyuce.mmoitems.ability;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.yaml.snakeyaml.external.biz.base64Coder.Base64Coder;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.SimpleAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.api.util.NoClipItem;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import io.lumine.mythic.lib.api.AttackResult;
|
||||
import io.lumine.mythic.lib.api.DamageType;
|
||||
import io.lumine.mythic.lib.version.VersionMaterial;
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
|
||||
public class Present_Throw extends Ability {
|
||||
private final ItemStack present = VersionMaterial.PLAYER_HEAD.toItem();
|
||||
|
||||
public Present_Throw() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("damage", 6);
|
||||
addModifier("radius", 4);
|
||||
addModifier("force", 1);
|
||||
addModifier("cooldown", 10);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
|
||||
ItemMeta presentMeta = present.getItemMeta();
|
||||
GameProfile profile = new GameProfile(UUID.randomUUID(), null);
|
||||
byte[] encodedData = Base64Coder.encodeLines(String.format("{textures:{SKIN:{url:\"%s\"}}}", "http://textures.minecraft.net/texture/47e55fcc809a2ac1861da2a67f7f31bd7237887d162eca1eda526a7512a64910").getBytes()).getBytes();
|
||||
profile.getProperties().put("textures", new Property("textures", new String(encodedData)));
|
||||
|
||||
try {
|
||||
Field profileField = presentMeta.getClass().getDeclaredField("profile");
|
||||
profileField.setAccessible(true);
|
||||
profileField.set(presentMeta, profile);
|
||||
} catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException e) {
|
||||
MMOItems.plugin.getLogger().log(Level.WARNING, "Could not load the skull texture for the Present Throw item ability.");
|
||||
}
|
||||
|
||||
present.setItemMeta(presentMeta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) {
|
||||
return new SimpleAbilityResult(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) {
|
||||
double damage = ability.getModifier("damage");
|
||||
double radiusSquared = Math.pow(ability.getModifier("radius"), 2);
|
||||
|
||||
final NoClipItem item = new NoClipItem(stats.getPlayer().getLocation().add(0, 1.2, 0), present);
|
||||
item.getEntity().setVelocity(stats.getPlayer().getEyeLocation().getDirection().multiply(1.5 * ability.getModifier("force")));
|
||||
|
||||
/*
|
||||
* when items are moving through the air, they loose a percent of their
|
||||
* velocity proportionally to their coordinates in each axis. this means
|
||||
* that if the trajectory is not affected, the ratio of x/y will always
|
||||
* be the same. check for any change of that ratio to check for a
|
||||
* trajectory change
|
||||
*/
|
||||
final double trajRatio = item.getEntity().getVelocity().getX() / item.getEntity().getVelocity().getZ();
|
||||
stats.getPlayer().getWorld().playSound(stats.getPlayer().getLocation(), Sound.ENTITY_SNOWBALL_THROW, 1, 0);
|
||||
new BukkitRunnable() {
|
||||
double ti = 0;
|
||||
|
||||
public void run() {
|
||||
if (ti++ > 70 || item.getEntity().isDead()) {
|
||||
item.close();
|
||||
cancel();
|
||||
}
|
||||
|
||||
double currentTrajRatio = item.getEntity().getVelocity().getX() / item.getEntity().getVelocity().getZ();
|
||||
item.getEntity().getWorld().spawnParticle(Particle.SPELL_INSTANT, item.getEntity().getLocation().add(0, .1, 0), 0);
|
||||
if (item.getEntity().isOnGround() || Math.abs(trajRatio - currentTrajRatio) > .1) {
|
||||
item.getEntity().getWorld().spawnParticle(Particle.FIREWORKS_SPARK, item.getEntity().getLocation().add(0, .1, 0), 128, 0, 0, 0, .25);
|
||||
item.getEntity().getWorld().playSound(item.getEntity().getLocation(), VersionSound.ENTITY_FIREWORK_ROCKET_TWINKLE.toSound(), 2, 1.5f);
|
||||
for (Entity entity : MMOUtils.getNearbyChunkEntities(item.getEntity().getLocation()))
|
||||
if (entity.getLocation().distanceSquared(item.getEntity().getLocation()) < radiusSquared && MMOUtils.canDamage(stats.getPlayer(), entity))
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.MAGIC, DamageType.PROJECTILE).damage(stats.getPlayer(), (LivingEntity) entity);
|
||||
item.close();
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 1);
|
||||
}
|
||||
}
|
@ -1,81 +0,0 @@
|
||||
|
||||
package net.Indyuce.mmoitems.ability;
|
||||
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import io.lumine.mythic.lib.MythicLib;
|
||||
|
||||
public class Regen_Ally extends Ability {
|
||||
public Regen_Ally() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("heal", 7);
|
||||
addModifier("duration", 3);
|
||||
addModifier("cooldown", 10);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) {
|
||||
return new FriendlyTargetAbilityResult(ability, stats.getPlayer(), target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) {
|
||||
LivingEntity target = ((FriendlyTargetAbilityResult) ability).getTarget();
|
||||
|
||||
new BukkitRunnable() {
|
||||
double ti = 0;
|
||||
double a = 0;
|
||||
final double duration = Math.min(ability.getModifier("duration"), 60) * 20;
|
||||
final double hps = ability.getModifier("heal") / duration * 4;
|
||||
|
||||
public void run() {
|
||||
ti++;
|
||||
if (ti > duration || target.isDead()) {
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
a += Math.PI / 16;
|
||||
target.getWorld().spawnParticle(Particle.HEART, target.getLocation().add(1.3 * Math.cos(a), .3, 1.3 * Math.sin(a)), 0);
|
||||
|
||||
if (ti % 4 == 0)
|
||||
MMOUtils.heal(target, hps);
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* TargetAbilityResult but only targets players
|
||||
*/
|
||||
public static class FriendlyTargetAbilityResult extends AbilityResult {
|
||||
private final LivingEntity target;
|
||||
|
||||
public FriendlyTargetAbilityResult(AbilityData ability, Player caster, LivingEntity target) {
|
||||
super(ability);
|
||||
|
||||
this.target = target != null ? target : MythicLib.plugin.getVersion().getWrapper().rayTrace(caster, 50, entity -> (entity instanceof Player && MMOUtils.canDamage(caster, entity))).getHit();
|
||||
}
|
||||
|
||||
public LivingEntity getTarget() {
|
||||
return target;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSuccessful() {
|
||||
return target != null;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,73 +0,0 @@
|
||||
package net.Indyuce.mmoitems.ability;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.EntityEffect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.SimpleAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
|
||||
public class Shockwave extends Ability {
|
||||
public Shockwave() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK,
|
||||
CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("cooldown", 7.5);
|
||||
addModifier("knock-up", 1);
|
||||
addModifier("length", 5);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) {
|
||||
return new SimpleAbilityResult(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) {
|
||||
double knockUp = ability.getModifier("knock-up");
|
||||
double length = ability.getModifier("length");
|
||||
|
||||
new BukkitRunnable() {
|
||||
final Vector vec = stats.getPlayer().getEyeLocation().getDirection().setY(0);
|
||||
final Location loc = stats.getPlayer().getLocation();
|
||||
int ti = 0;
|
||||
final List<Integer> hit = new ArrayList<>();
|
||||
|
||||
public void run() {
|
||||
ti++;
|
||||
if (ti >= Math.min(20, length))
|
||||
cancel();
|
||||
|
||||
loc.add(vec);
|
||||
|
||||
loc.getWorld().playSound(loc, Sound.BLOCK_GRAVEL_BREAK, 1, 2);
|
||||
loc.getWorld().spawnParticle(Particle.BLOCK_CRACK, loc, 12, .5, 0, .5, 0, Material.DIRT.createBlockData());
|
||||
|
||||
for (Entity ent : MMOUtils.getNearbyChunkEntities(loc))
|
||||
if (ent.getLocation().distance(loc) < 1.1 && ent instanceof LivingEntity && !ent.equals(stats.getPlayer())
|
||||
&& !hit.contains(ent.getEntityId())) {
|
||||
hit.add(ent.getEntityId());
|
||||
ent.playEffect(EntityEffect.HURT);
|
||||
ent.setVelocity(ent.getVelocity().setY(.4 * knockUp));
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 1);
|
||||
}
|
||||
}
|
@ -1,175 +0,0 @@
|
||||
package net.Indyuce.mmoitems.ability;
|
||||
|
||||
import io.lumine.mythic.lib.api.AttackResult;
|
||||
import io.lumine.mythic.lib.api.DamageType;
|
||||
import io.lumine.mythic.lib.api.item.NBTItem;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.VectorAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.interaction.projectile.EntityData;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.ShulkerBullet;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class Shulker_Missile extends Ability implements Listener {
|
||||
public Shulker_Missile() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK,
|
||||
CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("cooldown", 12);
|
||||
addModifier("damage", 5);
|
||||
addModifier("effect-duration", 5);
|
||||
addModifier("duration", 5);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) {
|
||||
return new VectorAbilityResult(ability, stats.getPlayer(), target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) {
|
||||
double duration = ability.getModifier("duration");
|
||||
|
||||
new BukkitRunnable() {
|
||||
double n = 0;
|
||||
|
||||
public void run() {
|
||||
if (n++ > 3) {
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
Vector vec = ((VectorAbilityResult) ability).getTarget();
|
||||
stats.getPlayer().getWorld().playSound(stats.getPlayer().getLocation(), Sound.ENTITY_WITHER_SHOOT, 2, 2);
|
||||
ShulkerBullet shulkerBullet = (ShulkerBullet) stats.getPlayer().getWorld().spawnEntity(stats.getPlayer().getLocation().add(0, 1, 0),
|
||||
EntityType.SHULKER_BULLET);
|
||||
shulkerBullet.setShooter(stats.getPlayer());
|
||||
MMOItems.plugin.getEntities().registerCustomEntity(shulkerBullet, new ShulkerMissileEntityData(
|
||||
new AttackResult(ability.getModifier("damage"), DamageType.SKILL, DamageType.MAGIC, DamageType.PROJECTILE),
|
||||
ability.getModifier("effect-duration")));
|
||||
new BukkitRunnable() {
|
||||
double ti = 0;
|
||||
|
||||
public void run() {
|
||||
if (shulkerBullet.isDead() || ti++ >= duration * 20) {
|
||||
shulkerBullet.remove();
|
||||
cancel();
|
||||
} else
|
||||
shulkerBullet.setVelocity(vec);
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 1);
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 3);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void a(EntityDamageByEntityEvent event) {
|
||||
if (event.getDamager() instanceof ShulkerBullet && event.getEntity() instanceof LivingEntity) {
|
||||
ShulkerBullet damager = (ShulkerBullet) event.getDamager();
|
||||
LivingEntity entity = (LivingEntity) event.getEntity();
|
||||
if (!MMOItems.plugin.getEntities().isCustomEntity(damager))
|
||||
return;
|
||||
|
||||
if (!MMOUtils.canDamage(entity)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
ShulkerMissileEntityData data = (ShulkerMissileEntityData) MMOItems.plugin.getEntities().getEntityData(damager);
|
||||
|
||||
// Void spirit
|
||||
if (data.isWeaponAttack())
|
||||
((ItemAttackResult) data.result).applyEffects(data.stats, data.weapon, entity);
|
||||
|
||||
event.setDamage(data.result.getDamage());
|
||||
|
||||
new BukkitRunnable() {
|
||||
final Location loc = entity.getLocation();
|
||||
double y = 0;
|
||||
|
||||
public void run() {
|
||||
|
||||
// Potion effect should apply right after the damage with a 1 tick delay.
|
||||
if (y == 0) {
|
||||
entity.removePotionEffect(PotionEffectType.LEVITATION);
|
||||
entity.addPotionEffect(new PotionEffect(PotionEffectType.LEVITATION, (int) (data.duration * 20), 0));
|
||||
}
|
||||
|
||||
for (int j1 = 0; j1 < 3; j1++) {
|
||||
y += .04;
|
||||
for (int j = 0; j < 2; j++) {
|
||||
double xz = y * Math.PI * 1.3 + (j * Math.PI);
|
||||
loc.getWorld().spawnParticle(Particle.REDSTONE, loc.clone().add(Math.cos(xz), y, Math.sin(xz)), 1,
|
||||
new Particle.DustOptions(Color.MAROON, 1));
|
||||
}
|
||||
}
|
||||
if (y >= 2)
|
||||
cancel();
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
public static class ShulkerMissileEntityData implements EntityData {
|
||||
private final AttackResult result;
|
||||
private final double duration;
|
||||
|
||||
@Nullable
|
||||
private final CachedStats stats;
|
||||
@Nullable
|
||||
private final NBTItem weapon;
|
||||
|
||||
/**
|
||||
* Used for the Shulker missile ability
|
||||
*
|
||||
* @param result Attack result
|
||||
* @param duration Duration of levitation effect in seconds
|
||||
*/
|
||||
public ShulkerMissileEntityData(AttackResult result, double duration) {
|
||||
this(result, duration, null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Used for the void staff attack spirit (no levitation effect)
|
||||
*
|
||||
* @param result Attack result
|
||||
* @param stats Stats of player attacking
|
||||
* @param weapon Item used for the attack
|
||||
*/
|
||||
public ShulkerMissileEntityData(ItemAttackResult result, CachedStats stats, NBTItem weapon) {
|
||||
this(result, 0, stats, weapon);
|
||||
}
|
||||
|
||||
private ShulkerMissileEntityData(AttackResult result, double duration, CachedStats stats, NBTItem weapon) {
|
||||
this.result = result;
|
||||
this.duration = duration;
|
||||
this.stats = stats;
|
||||
this.weapon = weapon;
|
||||
}
|
||||
|
||||
public boolean isWeaponAttack() {
|
||||
return result instanceof ItemAttackResult;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package net.Indyuce.mmoitems.ability;
|
||||
|
||||
import net.Indyuce.mmoitems.ability.metadata.SimpleAbilityMetadata;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackMetadata;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
||||
public abstract class SimpleAbility extends Ability<SimpleAbilityMetadata> {
|
||||
public SimpleAbility(CastingMode... allowedModes) {
|
||||
super(allowedModes);
|
||||
}
|
||||
|
||||
public SimpleAbility(String id, String name, CastingMode... allowedModes) {
|
||||
super(id, name, allowedModes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SimpleAbilityMetadata canBeCast(ItemAttackMetadata attack, LivingEntity target, AbilityData ability) {
|
||||
return new SimpleAbilityMetadata(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public abstract void whenCast(ItemAttackMetadata attack, SimpleAbilityMetadata ability);
|
||||
}
|
@ -1,56 +0,0 @@
|
||||
package net.Indyuce.mmoitems.ability;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.SimpleAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import io.lumine.mythic.lib.api.AttackResult;
|
||||
import io.lumine.mythic.lib.api.DamageType;
|
||||
|
||||
public class Sky_Smash extends Ability {
|
||||
public Sky_Smash() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("cooldown", 10);
|
||||
addModifier("damage", 3);
|
||||
addModifier("knock-up", 1);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) {
|
||||
return new SimpleAbilityResult(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) {
|
||||
double damage = ability.getModifier("damage");
|
||||
double knockUp = ability.getModifier("knock-up");
|
||||
|
||||
stats.getPlayer().getWorld().playSound(stats.getPlayer().getLocation(), Sound.ENTITY_ZOMBIE_ATTACK_IRON_DOOR, 2, .5f);
|
||||
stats.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 2, 254));
|
||||
Location loc = stats.getPlayer().getEyeLocation().add(stats.getPlayer().getEyeLocation().getDirection().multiply(3));
|
||||
loc.getWorld().spawnParticle(Particle.EXPLOSION_LARGE, loc, 0);
|
||||
loc.getWorld().spawnParticle(Particle.SMOKE_LARGE, loc, 16, 0, 0, 0, .1);
|
||||
|
||||
for (Entity entity : MMOUtils.getNearbyChunkEntities(loc))
|
||||
if (MMOUtils.canDamage(stats.getPlayer(), entity) && entity.getLocation().distanceSquared(loc) < 10) {
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.PHYSICAL).damage(stats.getPlayer(), (LivingEntity) entity);
|
||||
Location loc1 = stats.getPlayer().getEyeLocation().clone();
|
||||
loc1.setPitch(-70);
|
||||
entity.setVelocity(loc1.getDirection().multiply(1.2 * knockUp));
|
||||
}
|
||||
}
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
package net.Indyuce.mmoitems.ability;
|
||||
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.TargetAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import io.lumine.mythic.lib.api.AttackResult;
|
||||
import io.lumine.mythic.lib.api.DamageType;
|
||||
|
||||
public class Smite extends Ability {
|
||||
public Smite() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("cooldown", 10);
|
||||
addModifier("damage", 8);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) {
|
||||
return new TargetAbilityResult(ability, stats.getPlayer(), target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) {
|
||||
LivingEntity target = ((TargetAbilityResult) ability).getTarget();
|
||||
new AttackResult(ability.getModifier("damage"), DamageType.SKILL, DamageType.MAGIC).damage(stats.getPlayer(), target);
|
||||
target.getWorld().strikeLightningEffect(target.getLocation());
|
||||
}
|
||||
}
|
@ -1,110 +0,0 @@
|
||||
package net.Indyuce.mmoitems.ability;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Snowball;
|
||||
import org.bukkit.entity.Snowman;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.LocationAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.api.util.TemporaryListener;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
|
||||
public class Snowman_Turret extends Ability {
|
||||
public Snowman_Turret() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK,
|
||||
CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("duration", 6);
|
||||
addModifier("cooldown", 35);
|
||||
addModifier("damage", 2);
|
||||
addModifier("radius", 20);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) {
|
||||
return new LocationAbilityResult(ability, stats.getPlayer(), target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) {
|
||||
Location loc = ((LocationAbilityResult) ability).getTarget();
|
||||
double duration = Math.min(ability.getModifier("duration") * 20, 300);
|
||||
double radiusSquared = Math.pow(ability.getModifier("radius"), 2);
|
||||
|
||||
loc.getWorld().playSound(loc, VersionSound.ENTITY_ENDERMAN_TELEPORT.toSound(), 2, 1);
|
||||
final Snowman snowman = (Snowman) loc.getWorld().spawnEntity(loc.add(0, 1, 0), EntityType.SNOWMAN);
|
||||
snowman.setInvulnerable(true);
|
||||
snowman.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 100000, 254, true));
|
||||
new BukkitRunnable() {
|
||||
int ti = 0;
|
||||
double j = 0;
|
||||
final TurretHandler turret = new TurretHandler(ability.getModifier("damage"));
|
||||
|
||||
public void run() {
|
||||
if (ti++ > duration || stats.getPlayer().isDead() || snowman == null || snowman.isDead()) {
|
||||
turret.close(3 * 20);
|
||||
snowman.remove();
|
||||
cancel();
|
||||
}
|
||||
|
||||
j += Math.PI / 24 % (2 * Math.PI);
|
||||
for (double k = 0; k < 3; k++)
|
||||
snowman.getWorld().spawnParticle(Particle.SPELL_INSTANT,
|
||||
snowman.getLocation().add(Math.cos(j + k / 3 * 2 * Math.PI) * 1.3, 1, Math.sin(j + k / 3 * 2 * Math.PI) * 1.3), 0);
|
||||
snowman.getWorld().spawnParticle(Particle.SPELL_INSTANT, snowman.getLocation().add(0, 1, 0), 1, 0, 0, 0, .2);
|
||||
|
||||
if (ti % 2 == 0)
|
||||
for (Entity entity : MMOUtils.getNearbyChunkEntities(snowman.getLocation()))
|
||||
if (!entity.equals(snowman) && MMOUtils.canDamage(stats.getPlayer(), entity)
|
||||
&& entity.getLocation().distanceSquared(snowman.getLocation()) < radiusSquared) {
|
||||
snowman.getWorld().playSound(snowman.getLocation(), Sound.ENTITY_SNOWBALL_THROW, 1, 1.3f);
|
||||
Snowball snowball = snowman.launchProjectile(Snowball.class);
|
||||
snowball.setVelocity(entity.getLocation().add(0, entity.getHeight() / 2, 0).toVector()
|
||||
.subtract(snowman.getLocation().add(0, 1, 0).toVector()).normalize().multiply(1.3));
|
||||
turret.entities.add(snowball.getUniqueId());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 1);
|
||||
}
|
||||
|
||||
public static class TurretHandler extends TemporaryListener {
|
||||
private final List<UUID> entities = new ArrayList<>();
|
||||
private final double damage;
|
||||
|
||||
public TurretHandler(double damage) {
|
||||
super(EntityDamageByEntityEvent.getHandlerList());
|
||||
|
||||
this.damage = damage;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void a(EntityDamageByEntityEvent event) {
|
||||
if (entities.contains(event.getDamager().getUniqueId()))
|
||||
event.setDamage(damage);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,62 +0,0 @@
|
||||
package net.Indyuce.mmoitems.ability;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.entity.ArmorStand;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.TargetAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import io.lumine.mythic.lib.api.AttackResult;
|
||||
import io.lumine.mythic.lib.api.DamageType;
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
|
||||
public class Sparkle extends Ability {
|
||||
public Sparkle() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("cooldown", 10);
|
||||
addModifier("damage", 4);
|
||||
addModifier("limit", 5);
|
||||
addModifier("radius", 6);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) {
|
||||
return new TargetAbilityResult(ability, stats.getPlayer(), target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) {
|
||||
LivingEntity target = ((TargetAbilityResult) ability).getTarget();
|
||||
double damage = ability.getModifier("damage");
|
||||
double radius = ability.getModifier("radius");
|
||||
double limit = ability.getModifier("limit");
|
||||
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.MAGIC).damage(stats.getPlayer(), target);
|
||||
target.getWorld().spawnParticle(Particle.EXPLOSION_LARGE, target.getLocation().add(0, 1, 0), 0);
|
||||
target.getWorld().playSound(target.getLocation(), VersionSound.ENTITY_FIREWORK_ROCKET_TWINKLE.toSound(), 2, 2);
|
||||
|
||||
int count = 0;
|
||||
for (Entity entity : target.getNearbyEntities(radius, radius, radius))
|
||||
if (count < limit && entity instanceof LivingEntity && entity != stats.getPlayer() && !(entity instanceof ArmorStand)) {
|
||||
count++;
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.MAGIC).damage(stats.getPlayer(), (LivingEntity) entity);
|
||||
entity.getWorld().playSound(entity.getLocation(), VersionSound.ENTITY_FIREWORK_ROCKET_TWINKLE.toSound(), 2, 2);
|
||||
Location loc_t = target.getLocation().add(0, .75, 0);
|
||||
Location loc_ent = entity.getLocation().add(0, .75, 0);
|
||||
for (double j1 = 0; j1 < 1; j1 += .04) {
|
||||
Vector d = loc_ent.toVector().subtract(loc_t.toVector());
|
||||
target.getWorld().spawnParticle(Particle.FIREWORKS_SPARK, loc_t.clone().add(d.multiply(j1)), 3, .1, .1, .1, .008);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
package net.Indyuce.mmoitems.ability;
|
||||
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.SimpleAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
|
||||
public class Swiftness extends Ability {
|
||||
public Swiftness() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("cooldown", 15);
|
||||
addModifier("duration", 4);
|
||||
addModifier("amplifier", 1);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) {
|
||||
return new SimpleAbilityResult(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) {
|
||||
double duration = ability.getModifier("duration");
|
||||
int amplifier = (int) ability.getModifier("amplifier");
|
||||
|
||||
stats.getPlayer().getWorld().playSound(stats.getPlayer().getLocation(), VersionSound.ENTITY_ZOMBIE_PIGMAN_ANGRY.toSound(), 1, .3f);
|
||||
for (double y = 0; y <= 2; y += .2)
|
||||
for (double j = 0; j < Math.PI * 2; j += Math.PI / 16)
|
||||
if (random.nextDouble() <= .7)
|
||||
stats.getPlayer().getWorld().spawnParticle(Particle.SPELL_INSTANT, stats.getPlayer().getLocation().add(Math.cos(j), y, Math.sin(j)), 0);
|
||||
stats.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.SPEED, (int) (duration * 20), amplifier));
|
||||
stats.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.JUMP, (int) (duration * 20), amplifier));
|
||||
}
|
||||
}
|
@ -1,73 +0,0 @@
|
||||
package net.Indyuce.mmoitems.ability;
|
||||
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.TNTPrimed;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.VectorAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.api.util.TemporaryListener;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
|
||||
public class TNT_Throw extends Ability implements Listener {
|
||||
public TNT_Throw() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK,
|
||||
CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("cooldown", 10);
|
||||
addModifier("force", 1);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) {
|
||||
return new VectorAbilityResult(ability, stats.getPlayer(), target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) {
|
||||
Vector vec = ((VectorAbilityResult) ability).getTarget().multiply(2 * ability.getModifier("force"));
|
||||
TNTPrimed tnt = (TNTPrimed) stats.getPlayer().getWorld().spawnEntity(stats.getPlayer().getLocation().add(0, 1, 0), EntityType.PRIMED_TNT);
|
||||
tnt.setFuseTicks(80);
|
||||
tnt.setVelocity(vec);
|
||||
new CancelTeamDamage(stats.getPlayer(), tnt);
|
||||
stats.getPlayer().getWorld().playSound(stats.getPlayer().getLocation(), Sound.ENTITY_SNOWBALL_THROW, 1, 0);
|
||||
stats.getPlayer().getWorld().spawnParticle(Particle.EXPLOSION_NORMAL, stats.getPlayer().getLocation().add(0, 1, 0), 12, 0, 0, 0, .1);
|
||||
}
|
||||
|
||||
/*
|
||||
* used to cancel team damage and other things
|
||||
*/
|
||||
public static class CancelTeamDamage extends TemporaryListener {
|
||||
private final Player player;
|
||||
private final TNTPrimed tnt;
|
||||
|
||||
public CancelTeamDamage(Player player, TNTPrimed tnt) {
|
||||
super(EntityDamageByEntityEvent.getHandlerList());
|
||||
|
||||
this.player = player;
|
||||
this.tnt = tnt;
|
||||
|
||||
close(100);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void a(EntityDamageByEntityEvent event) {
|
||||
if (event.getDamager().equals(tnt) && !MMOUtils.canDamage(player, event.getEntity()))
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,89 +0,0 @@
|
||||
package net.Indyuce.mmoitems.ability;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.TargetAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import io.lumine.mythic.lib.api.AttackResult;
|
||||
import io.lumine.mythic.lib.api.DamageType;
|
||||
|
||||
public class Tactical_Grenade extends Ability {
|
||||
public Tactical_Grenade() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("cooldown", 10);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
addModifier("knock-up", 1);
|
||||
addModifier("damage", 4);
|
||||
addModifier("radius", 4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) {
|
||||
return new TargetAbilityResult(ability, stats.getPlayer(), target);
|
||||
}
|
||||
@Override
|
||||
public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) {
|
||||
LivingEntity target = ((TargetAbilityResult) ability).getTarget();
|
||||
|
||||
new BukkitRunnable() {
|
||||
int j = 0;
|
||||
final Location loc = stats.getPlayer().getLocation().add(0, .1, 0);
|
||||
final double radius = ability.getModifier("radius");
|
||||
final double knockup = .7 * ability.getModifier("knock-up");
|
||||
final List<Integer> hit = new ArrayList<>();
|
||||
|
||||
public void run() {
|
||||
j++;
|
||||
if (target.isDead() || !target.getWorld().equals(loc.getWorld()) || j > 200) {
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
Vector vec = target.getLocation().add(0, .1, 0).subtract(loc).toVector();
|
||||
vec = vec.length() < 3 ? vec : vec.normalize().multiply(3);
|
||||
loc.add(vec);
|
||||
|
||||
loc.getWorld().spawnParticle(Particle.CLOUD, loc, 32, 1, 0, 1, 0);
|
||||
loc.getWorld().spawnParticle(Particle.EXPLOSION_NORMAL, loc, 16, 1, 0, 1, .05);
|
||||
loc.getWorld().playSound(loc, Sound.BLOCK_ANVIL_LAND, 2, 0);
|
||||
loc.getWorld().playSound(loc, Sound.ENTITY_GENERIC_EXPLODE, 2, 1);
|
||||
|
||||
for (Entity entity : MMOUtils.getNearbyChunkEntities(loc))
|
||||
if (!hit.contains(entity.getEntityId()) && MMOUtils.canDamage(stats.getPlayer(), entity) && entity.getLocation().distanceSquared(loc) < radius * radius) {
|
||||
|
||||
/*
|
||||
* stop the runnable as soon as the grenade finally hits
|
||||
* the initial target.
|
||||
*/
|
||||
hit.add(entity.getEntityId());
|
||||
if (entity.equals(target))
|
||||
cancel();
|
||||
|
||||
new AttackResult(ability.getModifier("damage"), DamageType.SKILL, DamageType.MAGIC).damage(stats.getPlayer(), (LivingEntity) entity);
|
||||
entity.setVelocity(entity.getVelocity().add(offsetVector(knockup)));
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 12);
|
||||
}
|
||||
|
||||
private Vector offsetVector(double y) {
|
||||
return new Vector(2 * (random.nextDouble() - .5), y, 2 * (random.nextDouble() - .5));
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package net.Indyuce.mmoitems.ability;
|
||||
|
||||
import net.Indyuce.mmoitems.ability.metadata.TargetAbilityMetadata;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackMetadata;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
||||
public abstract class TargetAbility extends Ability<TargetAbilityMetadata> {
|
||||
public TargetAbility(CastingMode... allowedModes) {
|
||||
super(allowedModes);
|
||||
}
|
||||
|
||||
public TargetAbility(String id, String name, CastingMode... allowedModes) {
|
||||
super(id, name, allowedModes);
|
||||
}
|
||||
|
||||
public TargetAbilityMetadata canBeCast(ItemAttackMetadata attack, LivingEntity target, AbilityData ability) {
|
||||
return new TargetAbilityMetadata(ability, attack.getDamager(), target);
|
||||
}
|
||||
|
||||
public abstract void whenCast(ItemAttackMetadata attack, TargetAbilityMetadata ability);
|
||||
}
|
@ -1,76 +0,0 @@
|
||||
package net.Indyuce.mmoitems.ability;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.TargetAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import io.lumine.mythic.lib.api.AttackResult;
|
||||
import io.lumine.mythic.lib.api.DamageType;
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
|
||||
public class Targeted_Fireball extends Ability {
|
||||
public Targeted_Fireball() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK,
|
||||
CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("cooldown", 10);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
addModifier("ignite", 4);
|
||||
addModifier("damage", 4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) {
|
||||
return new TargetAbilityResult(ability, stats.getPlayer(), target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) {
|
||||
LivingEntity target = ((TargetAbilityResult) ability).getTarget();
|
||||
|
||||
new BukkitRunnable() {
|
||||
int j = 0;
|
||||
final Location loc = stats.getPlayer().getLocation().add(0, 1.3, 0);
|
||||
|
||||
public void run() {
|
||||
j++;
|
||||
if (target.isDead() || !target.getWorld().equals(loc.getWorld()) || j > 200) {
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
Vector dir = target.getLocation().add(0, target.getHeight() / 2, 0).subtract(loc).toVector().normalize();
|
||||
loc.add(dir.multiply(.6));
|
||||
|
||||
loc.setDirection(dir);
|
||||
for (double a = 0; a < Math.PI * 2; a += Math.PI / 6) {
|
||||
Vector rotated = MMOUtils.rotateFunc(new Vector(Math.cos(a), Math.sin(a), 0), loc);
|
||||
loc.getWorld().spawnParticle(Particle.FLAME, loc, 0, rotated.getX(), rotated.getY(), rotated.getZ(), .06);
|
||||
}
|
||||
|
||||
loc.getWorld().playSound(loc, VersionSound.BLOCK_NOTE_BLOCK_HAT.toSound(), 1, 1);
|
||||
if (target.getLocation().add(0, target.getHeight() / 2, 0).distanceSquared(loc) < 1.3) {
|
||||
loc.getWorld().spawnParticle(Particle.LAVA, loc, 8);
|
||||
loc.getWorld().spawnParticle(Particle.FLAME, loc, 32, 0, 0, 0, .1);
|
||||
loc.getWorld().playSound(loc, Sound.ENTITY_BLAZE_HURT, 2, 1);
|
||||
target.setFireTicks((int) (target.getFireTicks() + ability.getModifier("ignite") * 20));
|
||||
new AttackResult(ability.getModifier("damage"), DamageType.SKILL, DamageType.MAGIC, DamageType.PROJECTILE)
|
||||
.damage(stats.getPlayer(), target);
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 1);
|
||||
}
|
||||
}
|
@ -1,73 +0,0 @@
|
||||
package net.Indyuce.mmoitems.ability;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.SimpleAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.api.util.NoClipItem;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import io.lumine.mythic.lib.api.AttackResult;
|
||||
import io.lumine.mythic.lib.api.DamageType;
|
||||
|
||||
public class Throw_Up extends Ability implements Listener {
|
||||
public Throw_Up() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("duration", 2.5);
|
||||
addModifier("damage", 2);
|
||||
addModifier("cooldown", 10);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) {
|
||||
return new SimpleAbilityResult(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) {
|
||||
double duration = ability.getModifier("duration") * 10;
|
||||
double dps = ability.getModifier("damage") / 2;
|
||||
|
||||
new BukkitRunnable() {
|
||||
int j = 0;
|
||||
|
||||
public void run() {
|
||||
j++;
|
||||
if (j > duration)
|
||||
cancel();
|
||||
|
||||
Location loc = stats.getPlayer().getEyeLocation();
|
||||
loc.setPitch((float) (loc.getPitch() + (random.nextDouble() - .5) * 30));
|
||||
loc.setYaw((float) (loc.getYaw() + (random.nextDouble() - .5) * 30));
|
||||
|
||||
if (j % 5 == 0)
|
||||
for (Entity entity : MMOUtils.getNearbyChunkEntities(loc))
|
||||
if (entity.getLocation().distanceSquared(loc) < 40 && stats.getPlayer().getEyeLocation().getDirection().angle(entity.getLocation().toVector().subtract(stats.getPlayer().getLocation().toVector())) < Math.PI / 6 && MMOUtils.canDamage(stats.getPlayer(), entity))
|
||||
new AttackResult(dps, DamageType.SKILL, DamageType.PHYSICAL, DamageType.PROJECTILE).damage(stats.getPlayer(), (LivingEntity) entity);
|
||||
|
||||
loc.getWorld().playSound(loc, Sound.ENTITY_ZOMBIE_HURT, 1, 1);
|
||||
|
||||
NoClipItem item = new NoClipItem(stats.getPlayer().getLocation().add(0, 1.2, 0), new ItemStack(Material.ROTTEN_FLESH));
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(MMOItems.plugin, item::close, 40);
|
||||
item.getEntity().setVelocity(loc.getDirection().multiply(.8));
|
||||
stats.getPlayer().getWorld().spawnParticle(Particle.SMOKE_LARGE, stats.getPlayer().getLocation().add(0, 1.2, 0), 0, loc.getDirection().getX(), loc.getDirection().getY(), loc.getDirection().getZ(), 1);
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 2);
|
||||
}
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
package net.Indyuce.mmoitems.ability;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.VectorAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import io.lumine.mythic.lib.api.AttackResult;
|
||||
import io.lumine.mythic.lib.api.DamageType;
|
||||
|
||||
public class Thrust extends Ability {
|
||||
public Thrust() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("cooldown", 10);
|
||||
addModifier("damage", 6);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) {
|
||||
return new VectorAbilityResult(ability, stats.getPlayer(), target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) {
|
||||
double damage = ability.getModifier("damage");
|
||||
|
||||
stats.getPlayer().getWorld().playSound(stats.getPlayer().getLocation(), Sound.ENTITY_ZOMBIE_ATTACK_IRON_DOOR, 1, 0);
|
||||
stats.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 2, 3));
|
||||
|
||||
Location loc = stats.getPlayer().getEyeLocation().clone();
|
||||
Vector vec = ((VectorAbilityResult) ability).getTarget().multiply(.5);
|
||||
for (double j = 0; j < 7; j += .5) {
|
||||
loc.add(vec);
|
||||
for (Entity entity : MMOUtils.getNearbyChunkEntities(loc))
|
||||
if (MMOUtils.canDamage(stats.getPlayer(), loc, entity))
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.PHYSICAL).damage(stats.getPlayer(), (LivingEntity) entity);
|
||||
loc.getWorld().spawnParticle(Particle.SMOKE_LARGE, loc, 0);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package net.Indyuce.mmoitems.ability;
|
||||
|
||||
import net.Indyuce.mmoitems.ability.list.vector.Firebolt;
|
||||
import net.Indyuce.mmoitems.ability.metadata.VectorAbilityMetadata;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackMetadata;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
||||
/**
|
||||
* Ability that requires a direction to be cast. For
|
||||
* instance, a projectile like {@link Firebolt}
|
||||
*/
|
||||
public abstract class VectorAbility extends Ability<VectorAbilityMetadata> {
|
||||
public VectorAbility(CastingMode... allowedModes) {
|
||||
super(allowedModes);
|
||||
}
|
||||
|
||||
public VectorAbility(String id, String name, CastingMode... allowedModes) {
|
||||
super(id, name, allowedModes);
|
||||
}
|
||||
|
||||
public VectorAbilityMetadata canBeCast(ItemAttackMetadata attack, LivingEntity target, AbilityData ability) {
|
||||
return new VectorAbilityMetadata(ability, attack.getDamager(), target);
|
||||
}
|
||||
|
||||
public abstract void whenCast(ItemAttackMetadata attack, VectorAbilityMetadata ability);
|
||||
}
|
@ -1,79 +0,0 @@
|
||||
package net.Indyuce.mmoitems.ability.arcane;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.SimpleAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.VectorAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import io.lumine.mythic.lib.api.AttackResult;
|
||||
import io.lumine.mythic.lib.api.DamageType;
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
|
||||
public class Arcane_Rift extends Ability {
|
||||
public Arcane_Rift() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("damage", 5);
|
||||
addModifier("amplifier", 2);
|
||||
addModifier("cooldown", 10);
|
||||
addModifier("speed", 1);
|
||||
addModifier("duration", 1.5);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) {
|
||||
if (!((LivingEntity) stats.getPlayer()).isOnGround())
|
||||
return new SimpleAbilityResult(ability, false);
|
||||
|
||||
return new VectorAbilityResult(ability, stats.getPlayer(), target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) {
|
||||
double damage = ability.getModifier("damage");
|
||||
double slowDuration = ability.getModifier("duration");
|
||||
double slowAmplifier = ability.getModifier("amplifier");
|
||||
|
||||
stats.getPlayer().getWorld().playSound(stats.getPlayer().getLocation(), VersionSound.ENTITY_ENDERMAN_DEATH.toSound(), 2, .5f);
|
||||
new BukkitRunnable() {
|
||||
final Vector vec = ((VectorAbilityResult) ability).getTarget().setY(0).normalize().multiply(.5 * ability.getModifier("speed"));
|
||||
final Location loc = stats.getPlayer().getLocation();
|
||||
int ti = 0;
|
||||
final int duration = (int) (20 * Math.min(ability.getModifier("duration"), 10.));
|
||||
final List<Integer> hit = new ArrayList<>();
|
||||
|
||||
public void run() {
|
||||
if (ti++ > duration)
|
||||
cancel();
|
||||
|
||||
loc.add(vec);
|
||||
loc.getWorld().spawnParticle(Particle.SPELL_WITCH, loc, 5, .5, 0, .5, 0);
|
||||
|
||||
for (Entity entity : MMOUtils.getNearbyChunkEntities(loc))
|
||||
if (MMOUtils.canDamage(stats.getPlayer(), entity) && loc.distanceSquared(entity.getLocation()) < 2 && !hit.contains(entity.getEntityId())) {
|
||||
hit.add(entity.getEntityId());
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.MAGIC).damage(stats.getPlayer(), (LivingEntity) entity);
|
||||
((LivingEntity) entity).addPotionEffect(new PotionEffect(PotionEffectType.SLOW, (int) (slowDuration * 20), (int) slowAmplifier));
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 1);
|
||||
}
|
||||
}
|
@ -1,16 +1,14 @@
|
||||
package net.Indyuce.mmoitems.ability.arcane;
|
||||
package net.Indyuce.mmoitems.ability.list.location;
|
||||
|
||||
import io.lumine.mythic.lib.api.AttackResult;
|
||||
import io.lumine.mythic.lib.api.DamageType;
|
||||
import io.lumine.mythic.lib.damage.AttackMetadata;
|
||||
import io.lumine.mythic.lib.damage.DamageMetadata;
|
||||
import io.lumine.mythic.lib.damage.DamageType;
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.LocationAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.Indyuce.mmoitems.ability.LocationAbility;
|
||||
import net.Indyuce.mmoitems.ability.metadata.LocationAbilityMetadata;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackMetadata;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.entity.Entity;
|
||||
@ -18,7 +16,7 @@ import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class Arcane_Hail extends Ability {
|
||||
public class Arcane_Hail extends LocationAbility {
|
||||
public Arcane_Hail() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
@ -31,13 +29,8 @@ public class Arcane_Hail extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) {
|
||||
return new LocationAbilityResult(ability, stats.getPlayer(), target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) {
|
||||
Location loc = ((LocationAbilityResult) ability).getTarget();
|
||||
public void whenCast(ItemAttackMetadata attack, LocationAbilityMetadata ability) {
|
||||
Location loc = ability.getTarget();
|
||||
|
||||
double damage = ability.getModifier("damage");
|
||||
double duration = ability.getModifier("duration") * 10;
|
||||
@ -56,8 +49,8 @@ public class Arcane_Hail extends Ability {
|
||||
Location loc1 = loc.clone().add(randomCoordMultiplier() * radius, 0, randomCoordMultiplier() * radius);
|
||||
loc1.getWorld().playSound(loc1, VersionSound.ENTITY_ENDERMAN_HURT.toSound(), 1, 0);
|
||||
for (Entity entity : MMOUtils.getNearbyChunkEntities(loc1))
|
||||
if (MMOUtils.canDamage(stats.getPlayer(), entity) && entity.getLocation().distanceSquared(loc1) <= 4)
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.MAGIC).damage(stats.getPlayer(), (LivingEntity) entity);
|
||||
if (MMOUtils.canDamage(attack.getDamager(), entity) && entity.getLocation().distanceSquared(loc1) <= 4)
|
||||
new AttackMetadata(new DamageMetadata(damage, DamageType.SKILL, DamageType.MAGIC), attack.getStats()).damage((LivingEntity) entity);
|
||||
loc1.getWorld().spawnParticle(Particle.SPELL_WITCH, loc1, 12, 0, 0, 0, .1);
|
||||
loc1.getWorld().spawnParticle(Particle.SMOKE_NORMAL, loc1, 6, 0, 0, 0, .1);
|
||||
|
@ -1,23 +1,18 @@
|
||||
package net.Indyuce.mmoitems.ability;
|
||||
package net.Indyuce.mmoitems.ability.list.location;
|
||||
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.ability.LocationAbility;
|
||||
import net.Indyuce.mmoitems.ability.metadata.LocationAbilityMetadata;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackMetadata;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.LocationAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
|
||||
public class Black_Hole extends Ability {
|
||||
public class Black_Hole extends LocationAbility {
|
||||
public Black_Hole() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
@ -29,13 +24,8 @@ public class Black_Hole extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) {
|
||||
return new LocationAbilityResult(ability, stats.getPlayer(), target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) {
|
||||
Location loc = ((LocationAbilityResult) ability).getTarget();
|
||||
public void whenCast(ItemAttackMetadata attack, LocationAbilityMetadata ability) {
|
||||
Location loc = ability.getTarget();
|
||||
|
||||
double duration = ability.getModifier("duration") * 20;
|
||||
double radius = ability.getModifier("radius");
|
||||
@ -62,7 +52,7 @@ public class Black_Hole extends Ability {
|
||||
}
|
||||
|
||||
for (Entity entity : MMOUtils.getNearbyChunkEntities(loc))
|
||||
if (entity.getLocation().distanceSquared(loc) < Math.pow(radius, 2) && MMOUtils.canDamage(stats.getPlayer(), entity))
|
||||
if (entity.getLocation().distanceSquared(loc) < Math.pow(radius, 2) && MMOUtils.canDamage(attack.getDamager(), entity))
|
||||
entity.setVelocity(MMOUtils.normalize(loc.clone().subtract(entity.getLocation()).toVector()).multiply(.5));
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 1);
|
@ -1,5 +1,14 @@
|
||||
package net.Indyuce.mmoitems.ability;
|
||||
package net.Indyuce.mmoitems.ability.list.location;
|
||||
|
||||
import io.lumine.mythic.lib.damage.AttackMetadata;
|
||||
import io.lumine.mythic.lib.damage.DamageMetadata;
|
||||
import io.lumine.mythic.lib.damage.DamageType;
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.ability.LocationAbility;
|
||||
import net.Indyuce.mmoitems.ability.metadata.LocationAbilityMetadata;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackMetadata;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
@ -7,20 +16,7 @@ import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.LocationAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import io.lumine.mythic.lib.MythicLib;
|
||||
import io.lumine.mythic.lib.api.AttackResult;
|
||||
import io.lumine.mythic.lib.api.DamageType;
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
|
||||
public class Contamination extends Ability {
|
||||
public class Contamination extends LocationAbility {
|
||||
public Contamination() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK,
|
||||
CastingMode.SHIFT_RIGHT_CLICK);
|
||||
@ -33,21 +29,16 @@ public class Contamination extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) {
|
||||
return new LocationAbilityResult(ability, stats.getPlayer(), target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) {
|
||||
Location loc = ((LocationAbilityResult) ability).getTarget();
|
||||
public void whenCast(ItemAttackMetadata attack, LocationAbilityMetadata ability) {
|
||||
Location loc = ability.getTarget();
|
||||
|
||||
double duration = Math.min(30, ability.getModifier("duration")) * 20;
|
||||
|
||||
loc.add(0, .1, 0);
|
||||
new BukkitRunnable() {
|
||||
final double dps = ability.getModifier("damage") / 2;
|
||||
double ti = 0;
|
||||
int j = 0;
|
||||
final double dps = ability.getModifier("damage") / 2;
|
||||
|
||||
public void run() {
|
||||
j++;
|
||||
@ -66,9 +57,8 @@ public class Contamination extends Ability {
|
||||
if (j % 10 == 0) {
|
||||
loc.getWorld().playSound(loc, VersionSound.ENTITY_ENDERMAN_HURT.toSound(), 2, 1);
|
||||
for (Entity entity : MMOUtils.getNearbyChunkEntities(loc))
|
||||
if (MMOUtils.canDamage(stats.getPlayer(), entity) && entity.getLocation().distanceSquared(loc) <= 25)
|
||||
MythicLib.plugin.getDamage().damage(stats.getPlayer(), (LivingEntity) entity,
|
||||
new AttackResult(dps, DamageType.SKILL, DamageType.MAGIC), false);
|
||||
if (MMOUtils.canDamage(attack.getDamager(), entity) && entity.getLocation().distanceSquared(loc) <= 25)
|
||||
new AttackMetadata(new DamageMetadata(dps, DamageType.SKILL, DamageType.MAGIC), attack.getStats()).damage((LivingEntity) entity, false);
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 1);
|
@ -1,5 +1,9 @@
|
||||
package net.Indyuce.mmoitems.ability.onhit;
|
||||
package net.Indyuce.mmoitems.ability.list.location;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.ability.LocationAbility;
|
||||
import net.Indyuce.mmoitems.ability.metadata.LocationAbilityMetadata;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackMetadata;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
@ -8,15 +12,7 @@ import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.LocationAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
|
||||
public class Corrosion extends Ability {
|
||||
public class Corrosion extends LocationAbility {
|
||||
public Corrosion() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT);
|
||||
|
||||
@ -29,14 +25,9 @@ public class Corrosion extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) {
|
||||
return new LocationAbilityResult(ability, stats.getPlayer(), target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) {
|
||||
Location loc = ((LocationAbilityResult) ability).getTarget();
|
||||
|
||||
public void whenCast(ItemAttackMetadata attack, LocationAbilityMetadata ability) {
|
||||
Location loc = ability.getTarget();
|
||||
|
||||
int duration = (int) (ability.getModifier("duration") * 20);
|
||||
int amplifier = (int) ability.getModifier("amplifier");
|
||||
double radiusSquared = Math.pow(ability.getModifier("radius"), 2);
|
||||
@ -46,7 +37,7 @@ public class Corrosion extends Ability {
|
||||
loc.getWorld().playSound(loc, Sound.BLOCK_BREWING_STAND_BREW, 2, 0);
|
||||
|
||||
for (Entity entity : MMOUtils.getNearbyChunkEntities(loc))
|
||||
if (entity.getLocation().distanceSquared(loc) < radiusSquared && MMOUtils.canDamage(stats.getPlayer(), entity)) {
|
||||
if (entity.getLocation().distanceSquared(loc) < radiusSquared && MMOUtils.canDamage(attack.getDamager(), entity)) {
|
||||
((LivingEntity) entity).removePotionEffect(PotionEffectType.POISON);
|
||||
((LivingEntity) entity).addPotionEffect(new PotionEffect(PotionEffectType.POISON, duration, amplifier));
|
||||
}
|
@ -1,15 +1,13 @@
|
||||
package net.Indyuce.mmoitems.ability;
|
||||
package net.Indyuce.mmoitems.ability.list.location;
|
||||
|
||||
import io.lumine.mythic.lib.api.AttackResult;
|
||||
import io.lumine.mythic.lib.api.DamageType;
|
||||
import io.lumine.mythic.lib.damage.AttackMetadata;
|
||||
import io.lumine.mythic.lib.damage.DamageMetadata;
|
||||
import io.lumine.mythic.lib.damage.DamageType;
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.LocationAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.Indyuce.mmoitems.ability.LocationAbility;
|
||||
import net.Indyuce.mmoitems.ability.metadata.LocationAbilityMetadata;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackMetadata;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
@ -18,7 +16,7 @@ import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
public class Corrupt extends Ability {
|
||||
public class Corrupt extends LocationAbility {
|
||||
public Corrupt() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK,
|
||||
CastingMode.SHIFT_RIGHT_CLICK);
|
||||
@ -32,13 +30,8 @@ public class Corrupt extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) {
|
||||
return new LocationAbilityResult(ability, stats.getPlayer(), target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) {
|
||||
Location loc = ((LocationAbilityResult) ability).getTarget();
|
||||
public void whenCast(ItemAttackMetadata attack, LocationAbilityMetadata ability) {
|
||||
Location loc = ability.getTarget();
|
||||
|
||||
double damage = ability.getModifier("damage");
|
||||
double duration = ability.getModifier("duration");
|
||||
@ -46,7 +39,7 @@ public class Corrupt extends Ability {
|
||||
double radius = 2.7;
|
||||
|
||||
loc.add(0, -1, 0);
|
||||
stats.getPlayer().getWorld().playSound(stats.getPlayer().getLocation(), VersionSound.ENTITY_ENDERMAN_HURT.toSound(), 1, .5f);
|
||||
attack.getDamager().getWorld().playSound(attack.getDamager().getLocation(), VersionSound.ENTITY_ENDERMAN_HURT.toSound(), 1, .5f);
|
||||
for (double j = 0; j < Math.PI * 2; j += Math.PI / 36) {
|
||||
Location loc1 = loc.clone().add(Math.cos(j) * radius, 1, Math.sin(j) * radius);
|
||||
double y_max = .5 + random.nextDouble();
|
||||
@ -55,8 +48,8 @@ public class Corrupt extends Ability {
|
||||
}
|
||||
|
||||
for (Entity entity : MMOUtils.getNearbyChunkEntities(loc))
|
||||
if (MMOUtils.canDamage(stats.getPlayer(), entity) && entity.getLocation().distanceSquared(loc) <= radius * radius) {
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.MAGIC).damage(stats.getPlayer(), (LivingEntity) entity);
|
||||
if (MMOUtils.canDamage(attack.getDamager(), entity) && entity.getLocation().distanceSquared(loc) <= radius * radius) {
|
||||
new AttackMetadata(new DamageMetadata(damage, DamageType.SKILL, DamageType.MAGIC), attack.getStats()).damage((LivingEntity) entity);
|
||||
((LivingEntity) entity).removePotionEffect(PotionEffectType.WITHER);
|
||||
((LivingEntity) entity).addPotionEffect(new PotionEffect(PotionEffectType.WITHER, (int) (duration * 20), (int) amplifier));
|
||||
}
|
@ -1,5 +1,11 @@
|
||||
package net.Indyuce.mmoitems.ability.onhit;
|
||||
package net.Indyuce.mmoitems.ability.list.location;
|
||||
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.ability.LocationAbility;
|
||||
import net.Indyuce.mmoitems.ability.metadata.LocationAbilityMetadata;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackMetadata;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.entity.Entity;
|
||||
@ -7,16 +13,7 @@ import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.LocationAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
|
||||
public class Freeze extends Ability {
|
||||
public class Freeze extends LocationAbility {
|
||||
public Freeze() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT);
|
||||
|
||||
@ -29,13 +26,13 @@ public class Freeze extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) {
|
||||
return new LocationAbilityResult(ability, stats.getPlayer(), target);
|
||||
public LocationAbilityMetadata canBeCast(ItemAttackMetadata attack, LivingEntity target, AbilityData ability) {
|
||||
return new LocationAbilityMetadata(ability, attack.getDamager(), target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) {
|
||||
Location loc = ((LocationAbilityResult) ability).getTarget();
|
||||
public void whenCast(ItemAttackMetadata attack, LocationAbilityMetadata ability) {
|
||||
Location loc = ability.getTarget();
|
||||
|
||||
int duration = (int) (ability.getModifier("duration") * 20);
|
||||
int amplifier = (int) (ability.getModifier("amplifier") - 1);
|
||||
@ -47,7 +44,7 @@ public class Freeze extends Ability {
|
||||
loc.getWorld().playSound(loc, VersionSound.ENTITY_FIREWORK_ROCKET_LARGE_BLAST.toSound(), 2, 1);
|
||||
|
||||
for (Entity entity : MMOUtils.getNearbyChunkEntities(loc))
|
||||
if (entity.getLocation().distanceSquared(loc) < radiusSquared && MMOUtils.canDamage(stats.getPlayer(), entity)) {
|
||||
if (entity.getLocation().distanceSquared(loc) < radiusSquared && MMOUtils.canDamage(attack.getDamager(), entity)) {
|
||||
((LivingEntity) entity).removePotionEffect(PotionEffectType.SLOW);
|
||||
((LivingEntity) entity).addPotionEffect(new PotionEffect(PotionEffectType.SLOW, duration, amplifier));
|
||||
}
|
@ -1,5 +1,14 @@
|
||||
package net.Indyuce.mmoitems.ability;
|
||||
package net.Indyuce.mmoitems.ability.list.location;
|
||||
|
||||
import io.lumine.mythic.lib.damage.AttackMetadata;
|
||||
import io.lumine.mythic.lib.damage.DamageMetadata;
|
||||
import io.lumine.mythic.lib.damage.DamageType;
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.ability.LocationAbility;
|
||||
import net.Indyuce.mmoitems.ability.metadata.LocationAbilityMetadata;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackMetadata;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
@ -9,19 +18,7 @@ import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.LocationAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import io.lumine.mythic.lib.api.AttackResult;
|
||||
import io.lumine.mythic.lib.api.DamageType;
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
|
||||
public class Freezing_Curse extends Ability {
|
||||
public class Freezing_Curse extends LocationAbility {
|
||||
public Freezing_Curse() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
@ -35,20 +32,11 @@ public class Freezing_Curse extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) {
|
||||
return new LocationAbilityResult(ability, stats.getPlayer(), target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) {
|
||||
Location loc = ((LocationAbilityResult) ability).getTarget();
|
||||
if (loc == null) {
|
||||
result.setSuccessful(false);
|
||||
return;
|
||||
}
|
||||
public void whenCast(ItemAttackMetadata attack, LocationAbilityMetadata ability) {
|
||||
Location loc = ability.getTarget();
|
||||
|
||||
new BukkitRunnable() {
|
||||
final double rads = Math.toRadians(stats.getPlayer().getEyeLocation().getYaw() - 90);
|
||||
final double rads = Math.toRadians(attack.getDamager().getEyeLocation().getYaw() - 90);
|
||||
double ti = rads;
|
||||
int j = 0;
|
||||
|
||||
@ -72,8 +60,8 @@ public class Freezing_Curse extends Ability {
|
||||
double duration = ability.getModifier("duration");
|
||||
double damage = ability.getModifier("damage");
|
||||
for (Entity entity : MMOUtils.getNearbyChunkEntities(loc))
|
||||
if (entity.getLocation().distanceSquared(loc) < radius * radius && MMOUtils.canDamage(stats.getPlayer(), entity)) {
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.MAGIC).damage(stats.getPlayer(), (LivingEntity) entity);
|
||||
if (entity.getLocation().distanceSquared(loc) < radius * radius && MMOUtils.canDamage(attack.getDamager(), entity)) {
|
||||
new AttackMetadata(new DamageMetadata(damage, DamageType.SKILL, DamageType.MAGIC), attack.getStats()).damage((LivingEntity) entity);
|
||||
((LivingEntity) entity).removePotionEffect(PotionEffectType.SLOW);
|
||||
((LivingEntity) entity).addPotionEffect(new PotionEffect(PotionEffectType.SLOW, (int) (duration * 20), (int) amplifier));
|
||||
}
|
@ -1,20 +1,15 @@
|
||||
package net.Indyuce.mmoitems.ability.onhit;
|
||||
package net.Indyuce.mmoitems.ability.list.location;
|
||||
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.ability.LocationAbility;
|
||||
import net.Indyuce.mmoitems.ability.metadata.LocationAbilityMetadata;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackMetadata;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.LocationAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
|
||||
public class Ignite extends Ability {
|
||||
public class Ignite extends LocationAbility {
|
||||
public Ignite() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT);
|
||||
|
||||
@ -27,13 +22,8 @@ public class Ignite extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) {
|
||||
return new LocationAbilityResult(ability, stats.getPlayer(), target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) {
|
||||
Location loc = ((LocationAbilityResult) ability).getTarget();
|
||||
public void whenCast(ItemAttackMetadata attack, LocationAbilityMetadata ability) {
|
||||
Location loc = ability.getTarget();
|
||||
|
||||
int maxIgnite = (int) (ability.getModifier("max-ignite") * 20);
|
||||
int ignite = (int) (ability.getModifier("duration") * 20);
|
||||
@ -45,7 +35,7 @@ public class Ignite extends Ability {
|
||||
loc.getWorld().playSound(loc, VersionSound.ENTITY_FIREWORK_ROCKET_LARGE_BLAST.toSound(), 2, 1);
|
||||
|
||||
for (Entity entity : MMOUtils.getNearbyChunkEntities(loc))
|
||||
if (entity.getLocation().distanceSquared(loc) < radiusSquared && MMOUtils.canDamage(stats.getPlayer(), entity))
|
||||
if (entity.getLocation().distanceSquared(loc) < radiusSquared && MMOUtils.canDamage(attack.getDamager(), entity))
|
||||
entity.setFireTicks(Math.min(entity.getFireTicks() + ignite, maxIgnite));
|
||||
}
|
||||
}
|
@ -1,5 +1,14 @@
|
||||
package net.Indyuce.mmoitems.ability;
|
||||
package net.Indyuce.mmoitems.ability.list.location;
|
||||
|
||||
import io.lumine.mythic.lib.damage.AttackMetadata;
|
||||
import io.lumine.mythic.lib.damage.DamageMetadata;
|
||||
import io.lumine.mythic.lib.damage.DamageType;
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.ability.LocationAbility;
|
||||
import net.Indyuce.mmoitems.ability.metadata.LocationAbilityMetadata;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackMetadata;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
@ -8,19 +17,7 @@ import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.LocationAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import io.lumine.mythic.lib.api.AttackResult;
|
||||
import io.lumine.mythic.lib.api.DamageType;
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
|
||||
public class Life_Ender extends Ability {
|
||||
public class Life_Ender extends LocationAbility {
|
||||
public Life_Ender() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
@ -33,22 +30,17 @@ public class Life_Ender extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) {
|
||||
return new LocationAbilityResult(ability, stats.getPlayer(), target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) {
|
||||
Location loc = ((LocationAbilityResult) ability).getTarget();
|
||||
public void whenCast(ItemAttackMetadata attack, LocationAbilityMetadata ability) {
|
||||
Location loc = ability.getTarget();
|
||||
double damage = ability.getModifier("damage");
|
||||
double knockback = ability.getModifier("knockback");
|
||||
double radius = ability.getModifier("radius");
|
||||
|
||||
stats.getPlayer().getWorld().playSound(stats.getPlayer().getLocation(), VersionSound.ENTITY_ENDERMAN_TELEPORT.toSound(), 2, 1);
|
||||
attack.getDamager().getWorld().playSound(attack.getDamager().getLocation(), VersionSound.ENTITY_ENDERMAN_TELEPORT.toSound(), 2, 1);
|
||||
new BukkitRunnable() {
|
||||
int ti = 0;
|
||||
final Location source = loc.clone().add(5 * Math.cos(random.nextDouble() * 2 * Math.PI), 20, 5 * Math.sin(random.nextDouble() * 2 * Math.PI));
|
||||
final Vector vec = loc.subtract(source).toVector().multiply((double) 1 / 30);
|
||||
int ti = 0;
|
||||
|
||||
public void run() {
|
||||
if (ti == 0)
|
||||
@ -71,8 +63,8 @@ public class Life_Ender extends Ability {
|
||||
source.getWorld().spawnParticle(Particle.SMOKE_LARGE, source, 0, Math.cos(j), 0, Math.sin(j), .5);
|
||||
|
||||
for (Entity entity : MMOUtils.getNearbyChunkEntities(source))
|
||||
if (entity.getLocation().distanceSquared(source) < radius * radius && MMOUtils.canDamage(stats.getPlayer(), entity)) {
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.MAGIC).damage(stats.getPlayer(), (LivingEntity) entity);
|
||||
if (entity.getLocation().distanceSquared(source) < radius * radius && MMOUtils.canDamage(attack.getDamager(), entity)) {
|
||||
new AttackMetadata(new DamageMetadata(damage, DamageType.SKILL, DamageType.MAGIC), attack.getStats()).damage((LivingEntity) entity);
|
||||
entity.setVelocity(entity.getLocation().subtract(source).toVector().setY(.75).normalize().multiply(knockback));
|
||||
}
|
||||
cancel();
|
@ -1,23 +1,20 @@
|
||||
package net.Indyuce.mmoitems.ability;
|
||||
package net.Indyuce.mmoitems.ability.list.location;
|
||||
|
||||
import io.lumine.mythic.lib.damage.AttackMetadata;
|
||||
import io.lumine.mythic.lib.damage.DamageMetadata;
|
||||
import io.lumine.mythic.lib.damage.DamageType;
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.ability.LocationAbility;
|
||||
import net.Indyuce.mmoitems.ability.metadata.LocationAbilityMetadata;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackMetadata;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.LocationAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import io.lumine.mythic.lib.api.AttackResult;
|
||||
import io.lumine.mythic.lib.api.DamageType;
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
|
||||
public class Lightning_Beam extends Ability {
|
||||
public class Lightning_Beam extends LocationAbility {
|
||||
public Lightning_Beam() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
@ -29,21 +26,16 @@ public class Lightning_Beam extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) {
|
||||
return new LocationAbilityResult(ability, stats.getPlayer(), target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) {
|
||||
final Location loc = getFirstNonSolidBlock(((LocationAbilityResult) ability).getTarget());
|
||||
public void whenCast(ItemAttackMetadata attack, LocationAbilityMetadata ability) {
|
||||
final Location loc = getFirstNonSolidBlock(ability.getTarget());
|
||||
double damage = ability.getModifier("damage");
|
||||
double radius = ability.getModifier("radius");
|
||||
|
||||
for (Entity entity : MMOUtils.getNearbyChunkEntities(loc))
|
||||
if (MMOUtils.canDamage(stats.getPlayer(), entity) && entity.getLocation().distanceSquared(loc) <= radius * radius)
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.MAGIC).damage(stats.getPlayer(), (LivingEntity) entity);
|
||||
if (MMOUtils.canDamage(attack.getDamager(), entity) && entity.getLocation().distanceSquared(loc) <= radius * radius)
|
||||
new AttackMetadata(new DamageMetadata(damage, DamageType.SKILL, DamageType.MAGIC), attack.getStats()).damage((LivingEntity) entity);
|
||||
|
||||
stats.getPlayer().getWorld().playSound(stats.getPlayer().getLocation(), VersionSound.ENTITY_FIREWORK_ROCKET_BLAST.toSound(), 1, 0);
|
||||
attack.getDamager().getWorld().playSound(attack.getDamager().getLocation(), VersionSound.ENTITY_FIREWORK_ROCKET_BLAST.toSound(), 1, 0);
|
||||
loc.getWorld().spawnParticle(Particle.FIREWORKS_SPARK, loc, 64, 0, 0, 0, .2);
|
||||
loc.getWorld().spawnParticle(Particle.EXPLOSION_NORMAL, loc, 32, 0, 0, 0, .2);
|
||||
Vector vec = new Vector(0, .3, 0);
|
@ -1,22 +1,19 @@
|
||||
package net.Indyuce.mmoitems.ability.onhit;
|
||||
package net.Indyuce.mmoitems.ability.list.location;
|
||||
|
||||
import io.lumine.mythic.lib.damage.AttackMetadata;
|
||||
import io.lumine.mythic.lib.damage.DamageMetadata;
|
||||
import io.lumine.mythic.lib.damage.DamageType;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.ability.LocationAbility;
|
||||
import net.Indyuce.mmoitems.ability.metadata.LocationAbilityMetadata;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackMetadata;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.LocationAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import io.lumine.mythic.lib.api.AttackResult;
|
||||
import io.lumine.mythic.lib.api.DamageType;
|
||||
|
||||
public class Minor_Explosion extends Ability {
|
||||
public class Minor_Explosion extends LocationAbility {
|
||||
public Minor_Explosion() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT);
|
||||
|
||||
@ -29,13 +26,8 @@ public class Minor_Explosion extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) {
|
||||
return new LocationAbilityResult(ability, stats.getPlayer(), target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) {
|
||||
Location loc = ((LocationAbilityResult) ability).getTarget();
|
||||
public void whenCast(ItemAttackMetadata attack, LocationAbilityMetadata ability) {
|
||||
Location loc = ability.getTarget();
|
||||
|
||||
double damage = ability.getModifier("damage");
|
||||
double radiusSquared = Math.pow(ability.getModifier("radius"), 2);
|
||||
@ -46,8 +38,8 @@ public class Minor_Explosion extends Ability {
|
||||
loc.getWorld().playSound(loc, Sound.ENTITY_GENERIC_EXPLODE, 2, 1);
|
||||
|
||||
for (Entity entity : MMOUtils.getNearbyChunkEntities(loc))
|
||||
if (entity.getLocation().distanceSquared(loc) < radiusSquared && MMOUtils.canDamage(stats.getPlayer(), entity)) {
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.MAGIC).damage(stats.getPlayer(), (LivingEntity) entity);
|
||||
if (entity.getLocation().distanceSquared(loc) < radiusSquared && MMOUtils.canDamage(attack.getDamager(), entity)) {
|
||||
new AttackMetadata(new DamageMetadata(damage, DamageType.SKILL, DamageType.MAGIC), attack.getStats()).damage((LivingEntity) entity);
|
||||
entity.setVelocity(MMOUtils.normalize(entity.getLocation().subtract(loc).toVector().setY(0)).setY(.2).multiply(2 * knockback));
|
||||
}
|
||||
}
|
@ -0,0 +1,100 @@
|
||||
package net.Indyuce.mmoitems.ability.list.location;
|
||||
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.ability.LocationAbility;
|
||||
import net.Indyuce.mmoitems.ability.metadata.LocationAbilityMetadata;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackMetadata;
|
||||
import net.Indyuce.mmoitems.api.util.TemporaryListener;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Snowball;
|
||||
import org.bukkit.entity.Snowman;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class Snowman_Turret extends LocationAbility {
|
||||
public Snowman_Turret() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK,
|
||||
CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("duration", 6);
|
||||
addModifier("cooldown", 35);
|
||||
addModifier("damage", 2);
|
||||
addModifier("radius", 20);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(ItemAttackMetadata attack, LocationAbilityMetadata ability) {
|
||||
Location loc = ability.getTarget();
|
||||
double duration = Math.min(ability.getModifier("duration") * 20, 300);
|
||||
double radiusSquared = Math.pow(ability.getModifier("radius"), 2);
|
||||
|
||||
loc.getWorld().playSound(loc, VersionSound.ENTITY_ENDERMAN_TELEPORT.toSound(), 2, 1);
|
||||
final Snowman snowman = (Snowman) loc.getWorld().spawnEntity(loc.add(0, 1, 0), EntityType.SNOWMAN);
|
||||
snowman.setInvulnerable(true);
|
||||
snowman.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 100000, 254, true));
|
||||
new BukkitRunnable() {
|
||||
int ti = 0;
|
||||
double j = 0;
|
||||
final TurretHandler turret = new TurretHandler(ability.getModifier("damage"));
|
||||
|
||||
public void run() {
|
||||
if (ti++ > duration || attack.getDamager().isDead() || snowman == null || snowman.isDead()) {
|
||||
turret.close(3 * 20);
|
||||
snowman.remove();
|
||||
cancel();
|
||||
}
|
||||
|
||||
j += Math.PI / 24 % (2 * Math.PI);
|
||||
for (double k = 0; k < 3; k++)
|
||||
snowman.getWorld().spawnParticle(Particle.SPELL_INSTANT,
|
||||
snowman.getLocation().add(Math.cos(j + k / 3 * 2 * Math.PI) * 1.3, 1, Math.sin(j + k / 3 * 2 * Math.PI) * 1.3), 0);
|
||||
snowman.getWorld().spawnParticle(Particle.SPELL_INSTANT, snowman.getLocation().add(0, 1, 0), 1, 0, 0, 0, .2);
|
||||
|
||||
if (ti % 2 == 0)
|
||||
for (Entity entity : MMOUtils.getNearbyChunkEntities(snowman.getLocation()))
|
||||
if (!entity.equals(snowman) && MMOUtils.canDamage(attack.getDamager(), entity)
|
||||
&& entity.getLocation().distanceSquared(snowman.getLocation()) < radiusSquared) {
|
||||
snowman.getWorld().playSound(snowman.getLocation(), Sound.ENTITY_SNOWBALL_THROW, 1, 1.3f);
|
||||
Snowball snowball = snowman.launchProjectile(Snowball.class);
|
||||
snowball.setVelocity(entity.getLocation().add(0, entity.getHeight() / 2, 0).toVector()
|
||||
.subtract(snowman.getLocation().add(0, 1, 0).toVector()).normalize().multiply(1.3));
|
||||
turret.entities.add(snowball.getUniqueId());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 1);
|
||||
}
|
||||
|
||||
public static class TurretHandler extends TemporaryListener {
|
||||
private final List<UUID> entities = new ArrayList<>();
|
||||
private final double damage;
|
||||
|
||||
public TurretHandler(double damage) {
|
||||
super(EntityDamageByEntityEvent.getHandlerList());
|
||||
|
||||
this.damage = damage;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void a(EntityDamageByEntityEvent event) {
|
||||
if (entities.contains(event.getDamager().getUniqueId()))
|
||||
event.setDamage(damage);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
package net.Indyuce.mmoitems.ability.list.misc;
|
||||
|
||||
import io.lumine.mythic.lib.damage.AttackMetadata;
|
||||
import io.lumine.mythic.lib.damage.DamageMetadata;
|
||||
import io.lumine.mythic.lib.damage.DamageType;
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.ability.Ability;
|
||||
import net.Indyuce.mmoitems.ability.metadata.VectorAbilityMetadata;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackMetadata;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Arcane_Rift extends Ability<VectorAbilityMetadata> {
|
||||
public Arcane_Rift() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("damage", 5);
|
||||
addModifier("amplifier", 2);
|
||||
addModifier("cooldown", 10);
|
||||
addModifier("speed", 1);
|
||||
addModifier("duration", 1.5);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VectorAbilityMetadata canBeCast(ItemAttackMetadata attack, LivingEntity target, AbilityData ability) {
|
||||
return attack.getDamager().isOnGround() ? new VectorAbilityMetadata(ability, attack.getDamager(), target) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(ItemAttackMetadata attack, VectorAbilityMetadata ability) {
|
||||
double damage = ability.getModifier("damage");
|
||||
double slowDuration = ability.getModifier("duration");
|
||||
double slowAmplifier = ability.getModifier("amplifier");
|
||||
|
||||
attack.getDamager().getWorld().playSound(attack.getDamager().getLocation(), VersionSound.ENTITY_ENDERMAN_DEATH.toSound(), 2, .5f);
|
||||
new BukkitRunnable() {
|
||||
final Vector vec = ability.getTarget().setY(0).normalize().multiply(.5 * ability.getModifier("speed"));
|
||||
final Location loc = attack.getDamager().getLocation();
|
||||
final int duration = (int) (20 * Math.min(ability.getModifier("duration"), 10.));
|
||||
final List<Integer> hit = new ArrayList<>();
|
||||
int ti = 0;
|
||||
|
||||
public void run() {
|
||||
if (ti++ > duration)
|
||||
cancel();
|
||||
|
||||
loc.add(vec);
|
||||
loc.getWorld().spawnParticle(Particle.SPELL_WITCH, loc, 5, .5, 0, .5, 0);
|
||||
|
||||
for (Entity entity : MMOUtils.getNearbyChunkEntities(loc))
|
||||
if (MMOUtils.canDamage(attack.getDamager(), entity) && loc.distanceSquared(entity.getLocation()) < 2 && !hit.contains(entity.getEntityId())) {
|
||||
hit.add(entity.getEntityId());
|
||||
new AttackMetadata(new DamageMetadata(damage, DamageType.SKILL, DamageType.MAGIC), attack.getStats()).damage((LivingEntity) entity);
|
||||
((LivingEntity) entity).addPotionEffect(new PotionEffect(PotionEffectType.SLOW, (int) (slowDuration * 20), (int) slowAmplifier));
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 1);
|
||||
}
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
package net.Indyuce.mmoitems.ability.list.misc;
|
||||
|
||||
import io.lumine.mythic.lib.damage.AttackMetadata;
|
||||
import io.lumine.mythic.lib.damage.DamageMetadata;
|
||||
import io.lumine.mythic.lib.damage.DamageType;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.ability.Ability;
|
||||
import net.Indyuce.mmoitems.ability.metadata.VectorAbilityMetadata;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackMetadata;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Earthquake extends Ability<VectorAbilityMetadata> {
|
||||
public Earthquake() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("damage", 3);
|
||||
addModifier("duration", 2);
|
||||
addModifier("amplifier", 1);
|
||||
addModifier("cooldown", 10);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VectorAbilityMetadata canBeCast(ItemAttackMetadata attack, LivingEntity target, AbilityData ability) {
|
||||
return attack.getDamager().isOnGround() ? new VectorAbilityMetadata(ability, attack.getDamager(), target) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(ItemAttackMetadata attack, VectorAbilityMetadata ability) {
|
||||
double damage = ability.getModifier("damage");
|
||||
double slowDuration = ability.getModifier("duration");
|
||||
double slowAmplifier = ability.getModifier("amplifier");
|
||||
|
||||
new BukkitRunnable() {
|
||||
final Vector vec = ability.getTarget().setY(0);
|
||||
final Location loc = attack.getDamager().getLocation();
|
||||
final List<Integer> hit = new ArrayList<>();
|
||||
int ti = 0;
|
||||
|
||||
public void run() {
|
||||
ti++;
|
||||
if (ti > 20)
|
||||
cancel();
|
||||
|
||||
loc.add(vec);
|
||||
loc.getWorld().spawnParticle(Particle.CLOUD, loc, 5, .5, 0, .5, 0);
|
||||
loc.getWorld().playSound(loc, Sound.BLOCK_GRAVEL_BREAK, 2, 1);
|
||||
|
||||
for (Entity entity : MMOUtils.getNearbyChunkEntities(loc))
|
||||
if (MMOUtils.canDamage(attack.getDamager(), entity) && loc.distanceSquared(entity.getLocation()) < 2 && !hit.contains(entity.getEntityId())) {
|
||||
hit.add(entity.getEntityId());
|
||||
new AttackMetadata(new DamageMetadata(damage, DamageType.SKILL, DamageType.MAGIC), attack.getStats()).damage((LivingEntity) entity);
|
||||
((LivingEntity) entity).addPotionEffect(new PotionEffect(PotionEffectType.SLOW, (int) (slowDuration * 20), (int) slowAmplifier));
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 1);
|
||||
}
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package net.Indyuce.mmoitems.ability.list.misc;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.ability.Ability;
|
||||
import net.Indyuce.mmoitems.ability.metadata.SimpleAbilityMetadata;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackMetadata;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class Hoearthquake extends Ability<SimpleAbilityMetadata> {
|
||||
public Hoearthquake() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("cooldown", 10);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SimpleAbilityMetadata canBeCast(ItemAttackMetadata attack, LivingEntity target, AbilityData ability) {
|
||||
return attack.getDamager().isOnGround() ? new SimpleAbilityMetadata(ability) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(ItemAttackMetadata attack, SimpleAbilityMetadata ability) {
|
||||
new BukkitRunnable() {
|
||||
final Vector vec = attack.getDamager().getEyeLocation().getDirection().setY(0);
|
||||
final Location loc = attack.getDamager().getLocation();
|
||||
int ti = 0;
|
||||
|
||||
public void run() {
|
||||
if (ti++ > 20)
|
||||
cancel();
|
||||
|
||||
loc.add(vec);
|
||||
loc.getWorld().playSound(loc, Sound.BLOCK_GRAVEL_BREAK, 2, 1);
|
||||
loc.getWorld().spawnParticle(Particle.CLOUD, loc, 1, .5, 0, .5, 0);
|
||||
|
||||
for (int x = -1; x < 2; x++)
|
||||
for (int z = -1; z < 2; z++) {
|
||||
Block b = loc.clone().add(x, -1, z).getBlock();
|
||||
if (b.getType() == Material.GRASS || b.getType() == Material.DIRT) {
|
||||
BlockBreakEvent event = new BlockBreakEvent(b, attack.getDamager());
|
||||
event.setDropItems(false);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
if (!event.isCancelled()) b.setType(Material.FARMLAND);
|
||||
}
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 1);
|
||||
}
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
package net.Indyuce.mmoitems.ability.list.misc;
|
||||
|
||||
import io.lumine.mythic.lib.damage.AttackMetadata;
|
||||
import io.lumine.mythic.lib.damage.DamageMetadata;
|
||||
import io.lumine.mythic.lib.damage.DamageType;
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.ability.ItemAbility;
|
||||
import net.Indyuce.mmoitems.ability.metadata.ItemAbilityMetadata;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackMetadata;
|
||||
import net.Indyuce.mmoitems.api.util.NoClipItem;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class Item_Bomb extends ItemAbility implements Listener {
|
||||
public Item_Bomb() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("damage", 7);
|
||||
addModifier("radius", 6);
|
||||
addModifier("slow-duration", 4);
|
||||
addModifier("slow-amplifier", 1);
|
||||
addModifier("cooldown", 15);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(ItemAttackMetadata attack, ItemAbilityMetadata ability) {
|
||||
ItemStack itemStack = ability.getItem();
|
||||
final NoClipItem item = new NoClipItem(attack.getDamager().getLocation().add(0, 1.2, 0), itemStack);
|
||||
item.getEntity().setVelocity(ability.getTarget().multiply(1.3));
|
||||
attack.getDamager().getWorld().playSound(attack.getDamager().getLocation(), Sound.ENTITY_SNOWBALL_THROW, 2, 0);
|
||||
|
||||
new BukkitRunnable() {
|
||||
int j = 0;
|
||||
|
||||
public void run() {
|
||||
if (j++ > 40) {
|
||||
double radius = ability.getModifier("radius");
|
||||
double damage = ability.getModifier("damage");
|
||||
double slowDuration = ability.getModifier("slow-duration");
|
||||
double slowAmplifier = ability.getModifier("slow-amplifier");
|
||||
|
||||
for (Entity entity : item.getEntity().getNearbyEntities(radius, radius, radius))
|
||||
if (MMOUtils.canDamage(attack.getDamager(), entity)) {
|
||||
new AttackMetadata(new DamageMetadata(damage, DamageType.SKILL, DamageType.PHYSICAL), attack.getStats()).damage((LivingEntity) entity);
|
||||
((LivingEntity) entity).removePotionEffect(PotionEffectType.SLOW);
|
||||
((LivingEntity) entity).addPotionEffect(new PotionEffect(PotionEffectType.SLOW, (int) (slowDuration * 20), (int) slowAmplifier));
|
||||
}
|
||||
|
||||
item.getEntity().getWorld().spawnParticle(Particle.EXPLOSION_LARGE, item.getEntity().getLocation(), 24, 2, 2, 2, 0);
|
||||
item.getEntity().getWorld().spawnParticle(Particle.EXPLOSION_NORMAL, item.getEntity().getLocation(), 48, 0, 0, 0, .2);
|
||||
item.getEntity().getWorld().playSound(item.getEntity().getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 3, 0);
|
||||
|
||||
item.close();
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
item.getEntity().getWorld().spawnParticle(Particle.SMOKE_LARGE, item.getEntity().getLocation().add(0, .2, 0), 0);
|
||||
item.getEntity().getWorld().spawnParticle(Particle.FIREWORKS_SPARK, item.getEntity().getLocation().add(0, .2, 0), 1, 0, 0, 0, .1);
|
||||
item.getEntity().getWorld().playSound(item.getEntity().getLocation(), VersionSound.BLOCK_NOTE_BLOCK_HAT.toSound(), 2, (float) (.5 + (j / 40. * 1.5)));
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 1);
|
||||
}
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
package net.Indyuce.mmoitems.ability.list.misc;
|
||||
|
||||
import io.lumine.mythic.lib.damage.AttackMetadata;
|
||||
import io.lumine.mythic.lib.damage.DamageMetadata;
|
||||
import io.lumine.mythic.lib.damage.DamageType;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.ability.ItemAbility;
|
||||
import net.Indyuce.mmoitems.ability.metadata.ItemAbilityMetadata;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackMetadata;
|
||||
import net.Indyuce.mmoitems.api.util.NoClipItem;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class Item_Throw extends ItemAbility implements Listener {
|
||||
public Item_Throw() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("damage", 6);
|
||||
addModifier("force", 1);
|
||||
addModifier("cooldown", 10);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(ItemAttackMetadata attack, ItemAbilityMetadata ability) {
|
||||
ItemStack itemStack = ability.getItem();
|
||||
/*boolean hasAbility = false;
|
||||
|
||||
for (JsonElement entry : MythicLib.plugin.getJson().parse(nbtItem.getString("MMOITEMS_ABILITY"), JsonArray.class)) {
|
||||
if (!entry.isJsonObject())
|
||||
continue;
|
||||
|
||||
JsonObject object = entry.getAsJsonObject();
|
||||
if (object.get("Id").getAsString().equalsIgnoreCase(getID())) {
|
||||
hasAbility = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasAbility)
|
||||
return;*/
|
||||
|
||||
final NoClipItem item = new NoClipItem(attack.getDamager().getLocation().add(0, 1.2, 0), itemStack);
|
||||
item.getEntity().setVelocity(ability.getTarget().multiply(1.5 * ability.getModifier("force")));
|
||||
attack.getDamager().getWorld().playSound(attack.getDamager().getLocation(), Sound.ENTITY_SNOWBALL_THROW, 1, 0);
|
||||
new BukkitRunnable() {
|
||||
double ti = 0;
|
||||
|
||||
public void run() {
|
||||
ti++;
|
||||
if (ti > 20 || item.getEntity().isDead()) {
|
||||
item.close();
|
||||
cancel();
|
||||
}
|
||||
|
||||
item.getEntity().getWorld().spawnParticle(Particle.CRIT, item.getEntity().getLocation(), 0);
|
||||
for (Entity target : item.getEntity().getNearbyEntities(1, 1, 1))
|
||||
if (MMOUtils.canDamage(attack.getDamager(), target)) {
|
||||
new AttackMetadata(new DamageMetadata(ability.getModifier("damage"), DamageType.SKILL, DamageType.PHYSICAL, DamageType.PROJECTILE), attack.getStats()).damage((LivingEntity) target);
|
||||
item.close();
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 1);
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package net.Indyuce.mmoitems.ability.list.misc;
|
||||
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.ability.SimpleAbility;
|
||||
import net.Indyuce.mmoitems.ability.metadata.SimpleAbilityMetadata;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackMetadata;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class Leap extends SimpleAbility {
|
||||
public Leap() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("force", 1);
|
||||
addModifier("cooldown", 10);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SimpleAbilityMetadata canBeCast(ItemAttackMetadata attack, LivingEntity target, AbilityData ability) {
|
||||
return attack.getDamager().isOnGround() ? new SimpleAbilityMetadata(ability) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(ItemAttackMetadata attack, SimpleAbilityMetadata ability) {
|
||||
attack.getDamager().getWorld().playSound(attack.getDamager().getLocation(), VersionSound.ENTITY_ENDER_DRAGON_FLAP.toSound(), 1, 0);
|
||||
attack.getDamager().getWorld().spawnParticle(Particle.EXPLOSION_NORMAL, attack.getDamager().getLocation(), 16, 0, 0, 0.1);
|
||||
Vector vec = attack.getDamager().getEyeLocation().getDirection().multiply(2 * ability.getModifier("force"));
|
||||
vec.setY(vec.getY() / 2);
|
||||
attack.getDamager().setVelocity(vec);
|
||||
new BukkitRunnable() {
|
||||
double ti = 0;
|
||||
|
||||
public void run() {
|
||||
ti++;
|
||||
if (ti > 20)
|
||||
cancel();
|
||||
|
||||
attack.getDamager().getWorld().spawnParticle(Particle.CLOUD, attack.getDamager().getLocation().add(0, 1, 0), 0);
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 1);
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package net.Indyuce.mmoitems.ability.list.misc;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.ability.FriendlyTargetAbility;
|
||||
import net.Indyuce.mmoitems.ability.metadata.FriendlyTargetAbilityMetadata;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackMetadata;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class Regen_Ally extends FriendlyTargetAbility {
|
||||
public Regen_Ally() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("heal", 7);
|
||||
addModifier("duration", 3);
|
||||
addModifier("cooldown", 10);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(ItemAttackMetadata attack, FriendlyTargetAbilityMetadata ability) {
|
||||
LivingEntity target = ability.getTarget();
|
||||
|
||||
new BukkitRunnable() {
|
||||
final double duration = Math.min(ability.getModifier("duration"), 60) * 20;
|
||||
final double hps = ability.getModifier("heal") / duration * 4;
|
||||
double ti = 0;
|
||||
double a = 0;
|
||||
|
||||
public void run() {
|
||||
if (ti++ > duration || target.isDead()) {
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
a += Math.PI / 16;
|
||||
target.getWorld().spawnParticle(Particle.HEART, target.getLocation().add(1.3 * Math.cos(a), .3, 1.3 * Math.sin(a)), 0);
|
||||
|
||||
if (ti % 4 == 0)
|
||||
MMOUtils.heal(target, hps);
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 1);
|
||||
}
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package net.Indyuce.mmoitems.ability.list.simple;
|
||||
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
import net.Indyuce.mmoitems.ability.SimpleAbility;
|
||||
import net.Indyuce.mmoitems.ability.metadata.SimpleAbilityMetadata;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackMetadata;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
|
||||
public class Blink extends SimpleAbility {
|
||||
public Blink() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("range", 8);
|
||||
addModifier("cooldown", 10);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(ItemAttackMetadata attack, SimpleAbilityMetadata ability) {
|
||||
attack.getDamager().getWorld().spawnParticle(Particle.EXPLOSION_LARGE, attack.getDamager().getLocation().add(0, 1, 0), 0);
|
||||
attack.getDamager().getWorld().spawnParticle(Particle.SPELL_INSTANT, attack.getDamager().getLocation().add(0, 1, 0), 32, 0, 0, 0, .1);
|
||||
attack.getDamager().getWorld().playSound(attack.getDamager().getLocation(), VersionSound.ENTITY_ENDERMAN_TELEPORT.toSound(), 1, 1);
|
||||
Location loc = attack.getDamager().getTargetBlock(null, (int) ability.getModifier("range")).getLocation().add(0, 1, 0);
|
||||
loc.setYaw(attack.getDamager().getLocation().getYaw());
|
||||
loc.setPitch(attack.getDamager().getLocation().getPitch());
|
||||
attack.getDamager().teleport(loc);
|
||||
attack.getDamager().getWorld().spawnParticle(Particle.EXPLOSION_LARGE, attack.getDamager().getLocation().add(0, 1, 0), 0);
|
||||
attack.getDamager().getWorld().spawnParticle(Particle.SPELL_INSTANT, attack.getDamager().getLocation().add(0, 1, 0), 32, 0, 0, 0, .1);
|
||||
}
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
package net.Indyuce.mmoitems.ability.list.simple;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.ability.SimpleAbility;
|
||||
import net.Indyuce.mmoitems.ability.metadata.SimpleAbilityMetadata;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackMetadata;
|
||||
import net.Indyuce.mmoitems.api.util.TemporaryListener;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Snowball;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class Blizzard extends SimpleAbility {
|
||||
public Blizzard() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK,
|
||||
CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("duration", 2.5);
|
||||
addModifier("damage", 2);
|
||||
addModifier("inaccuracy", 10);
|
||||
addModifier("force", 1);
|
||||
addModifier("cooldown", 10);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(ItemAttackMetadata attack, SimpleAbilityMetadata ability) {
|
||||
double duration = ability.getModifier("duration") * 10;
|
||||
double force = ability.getModifier("force");
|
||||
double inaccuracy = ability.getModifier("inaccuracy");
|
||||
|
||||
new BukkitRunnable() {
|
||||
final SnowballThrower handler = new SnowballThrower(ability.getModifier("damage"));
|
||||
int j = 0;
|
||||
|
||||
public void run() {
|
||||
if (j++ > duration) {
|
||||
handler.close(5 * 20);
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
Location loc = attack.getDamager().getEyeLocation();
|
||||
loc.setPitch((float) (loc.getPitch() + (random.nextDouble() - .5) * inaccuracy));
|
||||
loc.setYaw((float) (loc.getYaw() + (random.nextDouble() - .5) * inaccuracy));
|
||||
|
||||
loc.getWorld().playSound(loc, Sound.ENTITY_SNOWBALL_THROW, 1, 1);
|
||||
Snowball snowball = attack.getDamager().launchProjectile(Snowball.class);
|
||||
snowball.setVelocity(loc.getDirection().multiply(1.3 * force));
|
||||
handler.entities.add(snowball.getUniqueId());
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 2);
|
||||
}
|
||||
|
||||
public static class SnowballThrower extends TemporaryListener {
|
||||
private final List<UUID> entities = new ArrayList<>();
|
||||
private final double damage;
|
||||
|
||||
public SnowballThrower(double damage) {
|
||||
super(EntityDamageByEntityEvent.getHandlerList());
|
||||
|
||||
this.damage = damage;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void a(EntityDamageByEntityEvent event) {
|
||||
if (entities.contains(event.getDamager().getUniqueId()))
|
||||
event.setDamage(damage);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
package net.Indyuce.mmoitems.ability.list.simple;
|
||||
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.ability.SimpleAbility;
|
||||
import net.Indyuce.mmoitems.ability.metadata.SimpleAbilityMetadata;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackMetadata;
|
||||
import net.Indyuce.mmoitems.api.util.TemporaryListener;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class Bunny_Mode extends SimpleAbility {
|
||||
public Bunny_Mode() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK,
|
||||
CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("duration", 20);
|
||||
addModifier("jump-force", 1);
|
||||
addModifier("cooldown", 50);
|
||||
addModifier("speed", 1);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(ItemAttackMetadata attack, SimpleAbilityMetadata ability) {
|
||||
double duration = ability.getModifier("duration") * 20;
|
||||
double y = ability.getModifier("jump-force");
|
||||
double xz = ability.getModifier("speed");
|
||||
|
||||
new BukkitRunnable() {
|
||||
final BunnyHandler handler = new BunnyHandler(attack.getDamager(), duration);
|
||||
int j = 0;
|
||||
|
||||
public void run() {
|
||||
if (j++ > duration) {
|
||||
handler.close(3 * 20);
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
if (attack.getDamager().getLocation().add(0, -.5, 0).getBlock().getType().isSolid()) {
|
||||
attack.getDamager()
|
||||
.setVelocity(attack.getDamager().getEyeLocation().getDirection().setY(0).normalize().multiply(.8 * xz).setY(0.5 * y / xz));
|
||||
attack.getDamager().getWorld().playSound(attack.getDamager().getLocation(), VersionSound.ENTITY_ENDER_DRAGON_FLAP.toSound(), 2, 1);
|
||||
for (double a = 0; a < Math.PI * 2; a += Math.PI / 12)
|
||||
attack.getDamager().getWorld().spawnParticle(Particle.CLOUD, attack.getDamager().getLocation(), 0, Math.cos(a), 0, Math.sin(a),
|
||||
.2);
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 1);
|
||||
|
||||
}
|
||||
|
||||
public static class BunnyHandler extends TemporaryListener {
|
||||
private final Player player;
|
||||
|
||||
public BunnyHandler(Player player, double duration) {
|
||||
super(EntityDamageEvent.getHandlerList());
|
||||
|
||||
this.player = player;
|
||||
|
||||
Bukkit.getScheduler().runTaskLater(MMOItems.plugin, (Runnable) this::close, (long) (duration * 20));
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void a(EntityDamageEvent event) {
|
||||
if (event.getEntity().equals(player) && event.getCause() == DamageCause.FALL)
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
package net.Indyuce.mmoitems.ability.list.simple;
|
||||
|
||||
import io.lumine.mythic.lib.damage.AttackMetadata;
|
||||
import io.lumine.mythic.lib.damage.DamageMetadata;
|
||||
import io.lumine.mythic.lib.damage.DamageType;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.ability.SimpleAbility;
|
||||
import net.Indyuce.mmoitems.ability.metadata.SimpleAbilityMetadata;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackMetadata;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class Burning_Hands extends SimpleAbility {
|
||||
public Burning_Hands() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK,
|
||||
CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("duration", 3);
|
||||
addModifier("damage", 2);
|
||||
addModifier("cooldown", 10);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(ItemAttackMetadata attack, SimpleAbilityMetadata ability) {
|
||||
double duration = ability.getModifier("duration") * 10;
|
||||
double damage = ability.getModifier("damage") / 2;
|
||||
|
||||
new BukkitRunnable() {
|
||||
int j = 0;
|
||||
|
||||
public void run() {
|
||||
if (j++ > duration)
|
||||
cancel();
|
||||
|
||||
Location loc = attack.getDamager().getLocation().add(0, 1.2, 0);
|
||||
loc.getWorld().playSound(loc, Sound.BLOCK_FIRE_AMBIENT, 1, 1);
|
||||
|
||||
for (double m = -45; m < 45; m += 5) {
|
||||
double a = (m + attack.getDamager().getEyeLocation().getYaw() + 90) * Math.PI / 180;
|
||||
Vector vec = new Vector(Math.cos(a), (random.nextDouble() - .5) * .2, Math.sin(a));
|
||||
Location source = loc.clone().add(vec.clone().setY(0));
|
||||
source.getWorld().spawnParticle(Particle.FLAME, source, 0, vec.getX(), vec.getY(), vec.getZ(), .5);
|
||||
if (j % 2 == 0)
|
||||
source.getWorld().spawnParticle(Particle.SMOKE_NORMAL, source, 0, vec.getX(), vec.getY(), vec.getZ(), .5);
|
||||
}
|
||||
|
||||
if (j % 5 == 0)
|
||||
for (Entity entity : MMOUtils.getNearbyChunkEntities(loc))
|
||||
if (entity.getLocation().distanceSquared(loc) < 60
|
||||
&& attack.getDamager().getEyeLocation().getDirection()
|
||||
.angle(entity.getLocation().toVector().subtract(attack.getDamager().getLocation().toVector())) < Math.PI / 6
|
||||
&& MMOUtils.canDamage(attack.getDamager(), entity))
|
||||
new AttackMetadata(new DamageMetadata(damage, DamageType.SKILL, DamageType.MAGIC), attack.getStats()).damage((LivingEntity) entity);
|
||||
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 2);
|
||||
}
|
||||
}
|
@ -0,0 +1,87 @@
|
||||
package net.Indyuce.mmoitems.ability.list.simple;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.ability.SimpleAbility;
|
||||
import net.Indyuce.mmoitems.ability.metadata.SimpleAbilityMetadata;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackMetadata;
|
||||
import net.Indyuce.mmoitems.api.util.TemporaryListener;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Egg;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.player.PlayerEggThrowEvent;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Chicken_Wraith extends SimpleAbility {
|
||||
public Chicken_Wraith() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK,
|
||||
CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("duration", 2.5);
|
||||
addModifier("damage", 2);
|
||||
addModifier("inaccuracy", 10);
|
||||
addModifier("force", 1);
|
||||
addModifier("cooldown", 10);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(ItemAttackMetadata attack, SimpleAbilityMetadata ability) {
|
||||
double duration = ability.getModifier("duration") * 10;
|
||||
double force = ability.getModifier("force");
|
||||
double inaccuracy = ability.getModifier("inaccuracy");
|
||||
|
||||
new BukkitRunnable() {
|
||||
final EggHandler handler = new EggHandler(ability.getModifier("damage"));
|
||||
int j = 0;
|
||||
|
||||
public void run() {
|
||||
if (j++ > duration) {
|
||||
handler.close(5 * 20);
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
Location loc = attack.getDamager().getEyeLocation();
|
||||
loc.setPitch((float) (loc.getPitch() + (random.nextDouble() - .5) * inaccuracy));
|
||||
loc.setYaw((float) (loc.getYaw() + (random.nextDouble() - .5) * inaccuracy));
|
||||
|
||||
loc.getWorld().playSound(loc, Sound.ENTITY_CHICKEN_EGG, 1, 1);
|
||||
Egg egg = attack.getDamager().launchProjectile(Egg.class);
|
||||
egg.setVelocity(loc.getDirection().multiply(1.3 * force));
|
||||
|
||||
handler.entities.add(egg.getEntityId());
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 2);
|
||||
}
|
||||
|
||||
public static class EggHandler extends TemporaryListener {
|
||||
private final List<Integer> entities = new ArrayList<>();
|
||||
private final double damage;
|
||||
|
||||
public EggHandler(double damage) {
|
||||
super(EntityDamageByEntityEvent.getHandlerList());
|
||||
|
||||
this.damage = damage;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void a(PlayerEggThrowEvent event) {
|
||||
if (entities.contains(event.getEgg().getEntityId())) {
|
||||
event.setHatching(false);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void b(EntityDamageByEntityEvent event) {
|
||||
if (entities.contains(event.getDamager().getEntityId()))
|
||||
event.setDamage(damage);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package net.Indyuce.mmoitems.ability.list.simple;
|
||||
|
||||
import io.lumine.mythic.lib.damage.AttackMetadata;
|
||||
import io.lumine.mythic.lib.damage.DamageMetadata;
|
||||
import io.lumine.mythic.lib.damage.DamageType;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.ability.SimpleAbility;
|
||||
import net.Indyuce.mmoitems.ability.metadata.SimpleAbilityMetadata;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackMetadata;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class Circular_Slash extends SimpleAbility {
|
||||
public Circular_Slash() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("damage", 6);
|
||||
addModifier("radius", 3);
|
||||
addModifier("knockback", 1);
|
||||
addModifier("cooldown", 10);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(ItemAttackMetadata attack, SimpleAbilityMetadata ability) {
|
||||
double damage = ability.getModifier("damage");
|
||||
double radius = ability.getModifier("radius");
|
||||
double knockback = ability.getModifier("knockback");
|
||||
|
||||
attack.getDamager().getWorld().playSound(attack.getDamager().getLocation(), Sound.ENTITY_ZOMBIE_ATTACK_IRON_DOOR, 2, .5f);
|
||||
attack.getDamager().addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 2, 254));
|
||||
for (Entity entity : attack.getDamager().getNearbyEntities(radius, radius, radius)) {
|
||||
if (MMOUtils.canDamage(attack.getDamager(), entity)) {
|
||||
new AttackMetadata(new DamageMetadata(damage, DamageType.SKILL, DamageType.PHYSICAL), attack.getStats()).damage((LivingEntity) entity);
|
||||
Vector v1 = entity.getLocation().toVector();
|
||||
Vector v2 = attack.getDamager().getLocation().toVector();
|
||||
double y = .5;
|
||||
Vector v3 = v1.subtract(v2).multiply(.5 * knockback).setY(knockback == 0 ? 0 : y);
|
||||
entity.setVelocity(v3);
|
||||
}
|
||||
}
|
||||
double step = 12 + (radius * 2.5);
|
||||
for (double j = 0; j < Math.PI * 2; j += Math.PI / step) {
|
||||
Location loc = attack.getDamager().getLocation().clone();
|
||||
loc.add(Math.cos(j) * radius, .75, Math.sin(j) * radius);
|
||||
loc.getWorld().spawnParticle(Particle.SMOKE_LARGE, loc, 0);
|
||||
}
|
||||
attack.getDamager().getWorld().spawnParticle(Particle.EXPLOSION_LARGE, attack.getDamager().getLocation().add(0, 1, 0), 0);
|
||||
}
|
||||
}
|
@ -0,0 +1,85 @@
|
||||
package net.Indyuce.mmoitems.ability.list.simple;
|
||||
|
||||
import io.lumine.mythic.lib.damage.AttackMetadata;
|
||||
import io.lumine.mythic.lib.damage.DamageMetadata;
|
||||
import io.lumine.mythic.lib.damage.DamageType;
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.ability.SimpleAbility;
|
||||
import net.Indyuce.mmoitems.ability.metadata.SimpleAbilityMetadata;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackMetadata;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class Firefly extends SimpleAbility {
|
||||
public Firefly() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("damage", 6);
|
||||
addModifier("duration", 2.5);
|
||||
addModifier("knockback", 1);
|
||||
addModifier("cooldown", 10);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(ItemAttackMetadata attack, SimpleAbilityMetadata ability) {
|
||||
double duration = ability.getModifier("duration") * 20;
|
||||
|
||||
new BukkitRunnable() {
|
||||
int j = 0;
|
||||
|
||||
public void run() {
|
||||
if (j++ > duration)
|
||||
cancel();
|
||||
|
||||
if (attack.getDamager().getLocation().getBlock().getType() == Material.WATER) {
|
||||
attack.getDamager().setVelocity(attack.getDamager().getVelocity().multiply(3).setY(1.8));
|
||||
attack.getDamager().getWorld().playSound(attack.getDamager().getLocation(), Sound.BLOCK_FIRE_EXTINGUISH, 1, .5f);
|
||||
attack.getDamager().getWorld().spawnParticle(Particle.EXPLOSION_NORMAL, attack.getDamager().getLocation().add(0, 1, 0), 32, 0, 0, 0, .2);
|
||||
attack.getDamager().getWorld().spawnParticle(Particle.CLOUD, attack.getDamager().getLocation().add(0, 1, 0), 32, 0, 0, 0, .2);
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
for (Entity entity : attack.getDamager().getNearbyEntities(1, 1, 1))
|
||||
if (MMOUtils.canDamage(attack.getDamager(), entity)) {
|
||||
double damage = ability.getModifier("damage");
|
||||
double knockback = ability.getModifier("knockback");
|
||||
|
||||
attack.getDamager().getWorld().playSound(attack.getDamager().getLocation(), Sound.ENTITY_ZOMBIE_ATTACK_IRON_DOOR, 1, .5f);
|
||||
attack.getDamager().getWorld().spawnParticle(Particle.LAVA, attack.getDamager().getLocation().add(0, 1, 0), 32);
|
||||
attack.getDamager().getWorld().spawnParticle(Particle.SMOKE_LARGE, attack.getDamager().getLocation().add(0, 1, 0), 24, 0, 0, 0, .3);
|
||||
attack.getDamager().getWorld().spawnParticle(Particle.FLAME, attack.getDamager().getLocation().add(0, 1, 0), 24, 0, 0, 0, .3);
|
||||
entity.setVelocity(attack.getDamager().getVelocity().setY(0.3).multiply(1.7 * knockback));
|
||||
attack.getDamager().setVelocity(attack.getDamager().getEyeLocation().getDirection().multiply(-3).setY(.5));
|
||||
new AttackMetadata(new DamageMetadata(damage, DamageType.SKILL, DamageType.MAGIC), attack.getStats()).damage((LivingEntity) entity);
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
Location loc = attack.getDamager().getLocation().add(0, 1, 0);
|
||||
for (double a = 0; a < Math.PI * 2; a += Math.PI / 9) {
|
||||
Vector vec = new Vector(.6 * Math.cos(a), .6 * Math.sin(a), 0);
|
||||
vec = MMOUtils.rotateFunc(vec, loc);
|
||||
loc.add(vec);
|
||||
attack.getDamager().getWorld().spawnParticle(Particle.SMOKE_NORMAL, loc, 0);
|
||||
if (random.nextDouble() < .3)
|
||||
attack.getDamager().getWorld().spawnParticle(Particle.FLAME, loc, 0);
|
||||
loc.add(vec.multiply(-1));
|
||||
}
|
||||
|
||||
attack.getDamager().setVelocity(attack.getDamager().getEyeLocation().getDirection());
|
||||
attack.getDamager().getWorld().playSound(attack.getDamager().getLocation(), VersionSound.ENTITY_FIREWORK_ROCKET_BLAST.toSound(), 1, 1);
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 1);
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package net.Indyuce.mmoitems.ability.list.simple;
|
||||
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.ability.SimpleAbility;
|
||||
import net.Indyuce.mmoitems.ability.metadata.SimpleAbilityMetadata;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackMetadata;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class Frog_Mode extends SimpleAbility implements Listener {
|
||||
public Frog_Mode() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("duration", 20);
|
||||
addModifier("jump-force", 1);
|
||||
addModifier("speed", 1);
|
||||
addModifier("cooldown", 50);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(ItemAttackMetadata attack, SimpleAbilityMetadata ability) {
|
||||
double duration = ability.getModifier("duration") * 20;
|
||||
double y = ability.getModifier("jump-force");
|
||||
double xz = ability.getModifier("speed");
|
||||
|
||||
new BukkitRunnable() {
|
||||
int j = 0;
|
||||
|
||||
public void run() {
|
||||
j++;
|
||||
if (j > duration)
|
||||
cancel();
|
||||
|
||||
if (attack.getDamager().getLocation().getBlock().getType() == Material.WATER) {
|
||||
attack.getDamager().setVelocity(attack.getDamager().getEyeLocation().getDirection().setY(0).normalize().multiply(.8 * xz).setY(0.5 / xz * y));
|
||||
attack.getDamager().getWorld().playSound(attack.getDamager().getLocation(), VersionSound.ENTITY_ENDER_DRAGON_FLAP.toSound(), 2, 1);
|
||||
for (double a = 0; a < Math.PI * 2; a += Math.PI / 12)
|
||||
attack.getDamager().getWorld().spawnParticle(Particle.CLOUD, attack.getDamager().getLocation(), 0, Math.cos(a), 0, Math.sin(a), .2);
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 1);
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
package net.Indyuce.mmoitems.ability.list.simple;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.ability.SimpleAbility;
|
||||
import net.Indyuce.mmoitems.ability.metadata.SimpleAbilityMetadata;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackMetadata;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class Frozen_Aura extends SimpleAbility implements Listener {
|
||||
public Frozen_Aura() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("duration", 6);
|
||||
addModifier("amplifier", 1);
|
||||
addModifier("radius", 10);
|
||||
addModifier("cooldown", 10);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(ItemAttackMetadata attack, SimpleAbilityMetadata ability) {
|
||||
double duration = ability.getModifier("duration") * 20;
|
||||
double radiusSquared = Math.pow(ability.getModifier("radius"), 2);
|
||||
double amplifier = ability.getModifier("amplifier") - 1;
|
||||
|
||||
new BukkitRunnable() {
|
||||
double j = 0;
|
||||
int ti = 0;
|
||||
|
||||
public void run() {
|
||||
if (ti++ > duration)
|
||||
cancel();
|
||||
|
||||
j += Math.PI / 60;
|
||||
for (double k = 0; k < Math.PI * 2; k += Math.PI / 2)
|
||||
attack.getDamager().getWorld().spawnParticle(Particle.SPELL_INSTANT, attack.getDamager().getLocation().add(Math.cos(k + j) * 2, 1 + Math.sin(k + j * 7) / 3, Math.sin(k + j) * 2), 0);
|
||||
|
||||
if (ti % 2 == 0)
|
||||
attack.getDamager().getWorld().playSound(attack.getDamager().getLocation(), Sound.BLOCK_SNOW_BREAK, 1, 1);
|
||||
|
||||
if (ti % 7 == 0)
|
||||
for (Entity entity : MMOUtils.getNearbyChunkEntities(attack.getDamager().getLocation()))
|
||||
if (entity.getLocation().distanceSquared(attack.getDamager().getLocation()) < radiusSquared && MMOUtils.canDamage(attack.getDamager(), entity)) {
|
||||
((LivingEntity) entity).removePotionEffect(PotionEffectType.SLOW);
|
||||
((LivingEntity) entity).addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 40, (int) amplifier));
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 1);
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package net.Indyuce.mmoitems.ability.list.simple;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.ability.SimpleAbility;
|
||||
import net.Indyuce.mmoitems.ability.metadata.SimpleAbilityMetadata;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackMetadata;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Grand_Heal extends SimpleAbility {
|
||||
public Grand_Heal() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("heal", 5);
|
||||
addModifier("radius", 5);
|
||||
addModifier("cooldown", 15);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(ItemAttackMetadata attack, SimpleAbilityMetadata ability) {
|
||||
double heal = ability.getModifier("heal");
|
||||
double radius = ability.getModifier("radius");
|
||||
|
||||
MMOUtils.heal(attack.getDamager(), heal);
|
||||
attack.getDamager().getWorld().playSound(attack.getDamager().getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1, 2);
|
||||
attack.getDamager().getWorld().spawnParticle(Particle.HEART, attack.getDamager().getLocation().add(0, .75, 0), 16, 1, 1, 1, 0);
|
||||
attack.getDamager().getWorld().spawnParticle(Particle.VILLAGER_HAPPY, attack.getDamager().getLocation().add(0, .75, 0), 16, 1, 1, 1, 0);
|
||||
for (Entity entity : attack.getDamager().getNearbyEntities(radius, radius, radius))
|
||||
if (entity instanceof Player)
|
||||
MMOUtils.heal((Player) entity, heal);
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package net.Indyuce.mmoitems.ability.list.simple;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.ability.SimpleAbility;
|
||||
import net.Indyuce.mmoitems.ability.metadata.SimpleAbilityMetadata;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackMetadata;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
|
||||
public class Heal extends SimpleAbility {
|
||||
public Heal() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("heal", 4);
|
||||
addModifier("cooldown", 10);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(ItemAttackMetadata attack, SimpleAbilityMetadata ability) {
|
||||
attack.getDamager().getWorld().playSound(attack.getDamager().getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1, 2);
|
||||
attack.getDamager().getWorld().spawnParticle(Particle.HEART, attack.getDamager().getLocation().add(0, .75, 0), 16, 1, 1, 1, 0);
|
||||
attack.getDamager().getWorld().spawnParticle(Particle.VILLAGER_HAPPY, attack.getDamager().getLocation().add(0, .75, 0), 16, 1, 1, 1, 0);
|
||||
MMOUtils.heal(attack.getDamager(), ability.getModifier("heal"));
|
||||
}
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package net.Indyuce.mmoitems.ability.list.simple;
|
||||
|
||||
import io.lumine.mythic.lib.damage.AttackMetadata;
|
||||
import io.lumine.mythic.lib.damage.DamageMetadata;
|
||||
import io.lumine.mythic.lib.damage.DamageType;
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.ability.SimpleAbility;
|
||||
import net.Indyuce.mmoitems.ability.metadata.SimpleAbilityMetadata;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackMetadata;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Light_Dash extends SimpleAbility {
|
||||
public Light_Dash() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("damage", 3);
|
||||
addModifier("cooldown", 10);
|
||||
addModifier("length", 1);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(ItemAttackMetadata attack, SimpleAbilityMetadata ability) {
|
||||
double damage = ability.getModifier("damage");
|
||||
double length = ability.getModifier("length");
|
||||
|
||||
new BukkitRunnable() {
|
||||
final Vector vec = attack.getDamager().getEyeLocation().getDirection();
|
||||
final List<Integer> hit = new ArrayList<>();
|
||||
int j = 0;
|
||||
|
||||
public void run() {
|
||||
if (j++ > 10 * Math.min(10, length))
|
||||
cancel();
|
||||
|
||||
attack.getDamager().setVelocity(vec);
|
||||
attack.getDamager().getWorld().spawnParticle(Particle.SMOKE_LARGE, attack.getDamager().getLocation().add(0, 1, 0), 0);
|
||||
attack.getDamager().getWorld().playSound(attack.getDamager().getLocation(), VersionSound.ENTITY_ENDER_DRAGON_FLAP.toSound(), 1, 2);
|
||||
for (Entity entity : attack.getDamager().getNearbyEntities(1, 1, 1))
|
||||
if (!hit.contains(entity.getEntityId()) && MMOUtils.canDamage(attack.getDamager(), entity)) {
|
||||
hit.add(entity.getEntityId());
|
||||
new AttackMetadata(new DamageMetadata(damage, DamageType.SKILL, DamageType.PHYSICAL), attack.getStats()).damage((LivingEntity) entity);
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 2);
|
||||
}
|
||||
}
|
@ -1,8 +1,12 @@
|
||||
package net.Indyuce.mmoitems.ability;
|
||||
package net.Indyuce.mmoitems.ability.list.simple;
|
||||
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.ability.SimpleAbility;
|
||||
import net.Indyuce.mmoitems.ability.metadata.SimpleAbilityMetadata;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackMetadata;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@ -13,39 +17,25 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.SimpleAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
public class Magical_Path extends SimpleAbility {
|
||||
public Magical_Path() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
public class Magical_Path extends Ability {
|
||||
public Magical_Path() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
addModifier("duration", 3);
|
||||
addModifier("cooldown", 15);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
addModifier("duration", 3);
|
||||
addModifier("cooldown", 15);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
@Override
|
||||
public void whenCast(ItemAttackMetadata attack, SimpleAbilityMetadata ability) {
|
||||
attack.getDamager().setAllowFlight(true);
|
||||
attack.getDamager().setFlying(true);
|
||||
attack.getDamager().setVelocity(attack.getDamager().getVelocity().setY(.5));
|
||||
attack.getDamager().getWorld().playSound(attack.getDamager().getLocation(), VersionSound.ENTITY_ENDERMAN_TELEPORT.toSound(), 1, 1);
|
||||
|
||||
@Override
|
||||
public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) {
|
||||
return new SimpleAbilityResult(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) {
|
||||
stats.getPlayer().setAllowFlight(true);
|
||||
stats.getPlayer().setFlying(true);
|
||||
stats.getPlayer().setVelocity(stats.getPlayer().getVelocity().setY(.5));
|
||||
stats.getPlayer().getWorld().playSound(stats.getPlayer().getLocation(), VersionSound.ENTITY_ENDERMAN_TELEPORT.toSound(), 1, 1);
|
||||
|
||||
new MagicalPathHandler(stats.getPlayer(), ability.getModifier("duration"));
|
||||
}
|
||||
new MagicalPathHandler(attack.getDamager(), ability.getModifier("duration"));
|
||||
}
|
||||
|
||||
public static class MagicalPathHandler extends BukkitRunnable implements Listener {
|
||||
private final Player player;
|
@ -1,5 +1,11 @@
|
||||
package net.Indyuce.mmoitems.ability;
|
||||
package net.Indyuce.mmoitems.ability.list.simple;
|
||||
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.ability.SimpleAbility;
|
||||
import net.Indyuce.mmoitems.ability.metadata.SimpleAbilityMetadata;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackMetadata;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Location;
|
||||
@ -12,42 +18,33 @@ import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.SimpleAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
public class Magical_Shield extends SimpleAbility {
|
||||
public Magical_Shield() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK,
|
||||
CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
public class Magical_Shield extends Ability {
|
||||
public Magical_Shield() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK,
|
||||
CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("power", 40);
|
||||
addModifier("radius", 5);
|
||||
addModifier("duration", 5);
|
||||
addModifier("cooldown", 35);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
addModifier("power", 40);
|
||||
addModifier("radius", 5);
|
||||
addModifier("duration", 5);
|
||||
addModifier("cooldown", 35);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) {
|
||||
return new SimpleAbilityResult(ability, ((LivingEntity) stats.getPlayer()).isOnGround());
|
||||
}
|
||||
@Override
|
||||
public SimpleAbilityMetadata canBeCast(ItemAttackMetadata attack, LivingEntity target, AbilityData ability) {
|
||||
return attack.getDamager().isOnGround() ? new SimpleAbilityMetadata(ability) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) {
|
||||
double duration = ability.getModifier("duration");
|
||||
double radiusSquared = Math.pow(ability.getModifier("radius"), 2);
|
||||
double power = ability.getModifier("power") / 100;
|
||||
@Override
|
||||
public void whenCast(ItemAttackMetadata attack, SimpleAbilityMetadata ability) {
|
||||
double duration = ability.getModifier("duration");
|
||||
double radiusSquared = Math.pow(ability.getModifier("radius"), 2);
|
||||
double power = ability.getModifier("power") / 100;
|
||||
|
||||
stats.getPlayer().getWorld().playSound(stats.getPlayer().getLocation(), VersionSound.ENTITY_ENDERMAN_TELEPORT.toSound(), 3, 0);
|
||||
new MagicalShield(stats.getPlayer().getLocation().clone(), duration, radiusSquared, power);
|
||||
}
|
||||
attack.getDamager().getWorld().playSound(attack.getDamager().getLocation(), VersionSound.ENTITY_ENDERMAN_TELEPORT.toSound(), 3, 0);
|
||||
new MagicalShield(attack.getDamager().getLocation().clone(), duration, radiusSquared, power);
|
||||
}
|
||||
|
||||
public static class MagicalShield extends BukkitRunnable implements Listener {
|
||||
private final Location loc;
|
@ -0,0 +1,50 @@
|
||||
package net.Indyuce.mmoitems.ability.list.simple;
|
||||
|
||||
import io.lumine.mythic.lib.damage.AttackMetadata;
|
||||
import io.lumine.mythic.lib.damage.DamageMetadata;
|
||||
import io.lumine.mythic.lib.damage.DamageType;
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.ability.SimpleAbility;
|
||||
import net.Indyuce.mmoitems.ability.metadata.SimpleAbilityMetadata;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackMetadata;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
public class Overload extends SimpleAbility {
|
||||
public Overload() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("damage", 6);
|
||||
addModifier("cooldown", 10);
|
||||
addModifier("radius", 6);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(ItemAttackMetadata attack, SimpleAbilityMetadata ability) {
|
||||
double damage = ability.getModifier("damage");
|
||||
double radius = ability.getModifier("radius");
|
||||
|
||||
attack.getDamager().getWorld().playSound(attack.getDamager().getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 2, 0);
|
||||
attack.getDamager().getWorld().playSound(attack.getDamager().getLocation(), VersionSound.ENTITY_FIREWORK_ROCKET_TWINKLE.toSound(), 2, 0);
|
||||
attack.getDamager().addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 2, 254));
|
||||
|
||||
for (Entity entity : attack.getDamager().getNearbyEntities(radius, radius, radius))
|
||||
if (MMOUtils.canDamage(attack.getDamager(), entity))
|
||||
new AttackMetadata(new DamageMetadata(damage, DamageType.SKILL, DamageType.MAGIC), attack.getStats()).damage((LivingEntity) entity);
|
||||
|
||||
double step = 12 + (radius * 2.5);
|
||||
for (double j = 0; j < Math.PI * 2; j += Math.PI / step) {
|
||||
Location loc = attack.getDamager().getLocation().clone().add(Math.cos(j) * radius, 1, Math.sin(j) * radius);
|
||||
attack.getDamager().getWorld().spawnParticle(Particle.CLOUD, loc, 4, 0, 0, 0, .05);
|
||||
attack.getDamager().getWorld().spawnParticle(Particle.FIREWORKS_SPARK, loc, 4, 0, 0, 0, .05);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,98 @@
|
||||
package net.Indyuce.mmoitems.ability.list.simple;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import io.lumine.mythic.lib.damage.AttackMetadata;
|
||||
import io.lumine.mythic.lib.damage.DamageMetadata;
|
||||
import io.lumine.mythic.lib.damage.DamageType;
|
||||
import io.lumine.mythic.lib.version.VersionMaterial;
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.ability.SimpleAbility;
|
||||
import net.Indyuce.mmoitems.ability.metadata.SimpleAbilityMetadata;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackMetadata;
|
||||
import net.Indyuce.mmoitems.api.util.NoClipItem;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.yaml.snakeyaml.external.biz.base64Coder.Base64Coder;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class Present_Throw extends SimpleAbility {
|
||||
private final ItemStack present = VersionMaterial.PLAYER_HEAD.toItem();
|
||||
|
||||
public Present_Throw() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("damage", 6);
|
||||
addModifier("radius", 4);
|
||||
addModifier("force", 1);
|
||||
addModifier("cooldown", 10);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
|
||||
ItemMeta presentMeta = present.getItemMeta();
|
||||
GameProfile profile = new GameProfile(UUID.randomUUID(), null);
|
||||
byte[] encodedData = Base64Coder.encodeLines(String.format("{textures:{SKIN:{url:\"%s\"}}}", "http://textures.minecraft.net/texture/47e55fcc809a2ac1861da2a67f7f31bd7237887d162eca1eda526a7512a64910").getBytes()).getBytes();
|
||||
profile.getProperties().put("textures", new Property("textures", new String(encodedData)));
|
||||
|
||||
try {
|
||||
Field profileField = presentMeta.getClass().getDeclaredField("profile");
|
||||
profileField.setAccessible(true);
|
||||
profileField.set(presentMeta, profile);
|
||||
} catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException e) {
|
||||
MMOItems.plugin.getLogger().log(Level.WARNING, "Could not load the skull texture for the Present Throw item ability.");
|
||||
}
|
||||
|
||||
present.setItemMeta(presentMeta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(ItemAttackMetadata attack, SimpleAbilityMetadata ability) {
|
||||
double damage = ability.getModifier("damage");
|
||||
double radiusSquared = Math.pow(ability.getModifier("radius"), 2);
|
||||
|
||||
final NoClipItem item = new NoClipItem(attack.getDamager().getLocation().add(0, 1.2, 0), present);
|
||||
item.getEntity().setVelocity(attack.getDamager().getEyeLocation().getDirection().multiply(1.5 * ability.getModifier("force")));
|
||||
|
||||
/*
|
||||
* when items are moving through the air, they loose a percent of their
|
||||
* velocity proportionally to their coordinates in each axis. this means
|
||||
* that if the trajectory is not affected, the ratio of x/y will always
|
||||
* be the same. check for any change of that ratio to check for a
|
||||
* trajectory change
|
||||
*/
|
||||
final double trajRatio = item.getEntity().getVelocity().getX() / item.getEntity().getVelocity().getZ();
|
||||
attack.getDamager().getWorld().playSound(attack.getDamager().getLocation(), Sound.ENTITY_SNOWBALL_THROW, 1, 0);
|
||||
new BukkitRunnable() {
|
||||
double ti = 0;
|
||||
|
||||
public void run() {
|
||||
if (ti++ > 70 || item.getEntity().isDead()) {
|
||||
item.close();
|
||||
cancel();
|
||||
}
|
||||
|
||||
double currentTrajRatio = item.getEntity().getVelocity().getX() / item.getEntity().getVelocity().getZ();
|
||||
item.getEntity().getWorld().spawnParticle(Particle.SPELL_INSTANT, item.getEntity().getLocation().add(0, .1, 0), 0);
|
||||
if (item.getEntity().isOnGround() || Math.abs(trajRatio - currentTrajRatio) > .1) {
|
||||
item.getEntity().getWorld().spawnParticle(Particle.FIREWORKS_SPARK, item.getEntity().getLocation().add(0, .1, 0), 128, 0, 0, 0, .25);
|
||||
item.getEntity().getWorld().playSound(item.getEntity().getLocation(), VersionSound.ENTITY_FIREWORK_ROCKET_TWINKLE.toSound(), 2, 1.5f);
|
||||
for (Entity entity : MMOUtils.getNearbyChunkEntities(item.getEntity().getLocation()))
|
||||
if (entity.getLocation().distanceSquared(item.getEntity().getLocation()) < radiusSquared && MMOUtils.canDamage(attack.getDamager(), entity))
|
||||
new AttackMetadata(new DamageMetadata(damage, DamageType.SKILL, DamageType.MAGIC, DamageType.PROJECTILE), attack.getStats()).damage((LivingEntity) entity);
|
||||
item.close();
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 1);
|
||||
}
|
||||
}
|
@ -1,18 +1,14 @@
|
||||
package net.Indyuce.mmoitems.ability;
|
||||
package net.Indyuce.mmoitems.ability.list.simple;
|
||||
|
||||
import io.lumine.mythic.lib.api.util.ui.SilentNumbers;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.SimpleAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.ability.SimpleAbility;
|
||||
import net.Indyuce.mmoitems.ability.metadata.SimpleAbilityMetadata;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackMetadata;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Mob;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -21,41 +17,36 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityTargetEvent;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class Shadow_Veil extends Ability implements Listener {
|
||||
public Shadow_Veil() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK,
|
||||
CastingMode.SHIFT_RIGHT_CLICK);
|
||||
public class Shadow_Veil extends SimpleAbility implements Listener {
|
||||
public Shadow_Veil() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK,
|
||||
CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("cooldown", 35);
|
||||
addModifier("duration", 5);
|
||||
addModifier("deception", 1);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
addModifier("cooldown", 35);
|
||||
addModifier("duration", 5);
|
||||
addModifier("deception", 1);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) {
|
||||
return new SimpleAbilityResult(ability);
|
||||
}
|
||||
@Override
|
||||
public void whenCast(ItemAttackMetadata attack, SimpleAbilityMetadata ability) {
|
||||
double duration = ability.getModifier("duration");
|
||||
|
||||
@Override
|
||||
public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) {
|
||||
double duration = ability.getModifier("duration");
|
||||
attack.getDamager().getWorld().playSound(attack.getDamager().getLocation(), VersionSound.ENTITY_ENDERMAN_TELEPORT.toSound(), 3, 0);
|
||||
for (Player online : Bukkit.getOnlinePlayers())
|
||||
online.hidePlayer(MMOItems.plugin, attack.getDamager());
|
||||
|
||||
stats.getPlayer().getWorld().playSound(stats.getPlayer().getLocation(), VersionSound.ENTITY_ENDERMAN_TELEPORT.toSound(), 3, 0);
|
||||
for (Player online : Bukkit.getOnlinePlayers())
|
||||
online.hidePlayer(MMOItems.plugin, stats.getPlayer());
|
||||
/*
|
||||
* clears the target of any entity around the player
|
||||
*/
|
||||
for (Mob serverEntities : attack.getDamager().getWorld().getEntitiesByClass(Mob.class))
|
||||
if (serverEntities.getTarget() != null && serverEntities.getTarget().equals(attack.getDamager()))
|
||||
serverEntities.setTarget(null);
|
||||
|
||||
/*
|
||||
* clears the target of any entity around the player
|
||||
*/
|
||||
for (Mob serverEntities : stats.getPlayer().getWorld().getEntitiesByClass(Mob.class))
|
||||
if (serverEntities.getTarget() != null && serverEntities.getTarget().equals(stats.getPlayer()))
|
||||
serverEntities.setTarget(null);
|
||||
|
||||
ShadowVeilHandler svh = new ShadowVeilHandler(stats.getPlayer(), duration);
|
||||
svh.setDeceptions(SilentNumbers.floor(ability.getModifier("deception")));
|
||||
}
|
||||
ShadowVeilHandler svh = new ShadowVeilHandler(attack.getDamager(), duration);
|
||||
svh.setDeceptions(SilentNumbers.floor(ability.getModifier("deception")));
|
||||
}
|
||||
|
||||
public static class ShadowVeilHandler extends BukkitRunnable implements Listener {
|
||||
private final Player player;
|
@ -0,0 +1,60 @@
|
||||
package net.Indyuce.mmoitems.ability.list.simple;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.ability.SimpleAbility;
|
||||
import net.Indyuce.mmoitems.ability.metadata.SimpleAbilityMetadata;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackMetadata;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Shockwave extends SimpleAbility {
|
||||
public Shockwave() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK,
|
||||
CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("cooldown", 7.5);
|
||||
addModifier("knock-up", 1);
|
||||
addModifier("length", 5);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(ItemAttackMetadata attack, SimpleAbilityMetadata ability) {
|
||||
double knockUp = ability.getModifier("knock-up");
|
||||
double length = ability.getModifier("length");
|
||||
|
||||
new BukkitRunnable() {
|
||||
final Vector vec = attack.getDamager().getEyeLocation().getDirection().setY(0);
|
||||
final Location loc = attack.getDamager().getLocation();
|
||||
final List<Integer> hit = new ArrayList<>();
|
||||
int ti = 0;
|
||||
|
||||
public void run() {
|
||||
ti++;
|
||||
if (ti >= Math.min(20, length))
|
||||
cancel();
|
||||
|
||||
loc.add(vec);
|
||||
|
||||
loc.getWorld().playSound(loc, Sound.BLOCK_GRAVEL_BREAK, 1, 2);
|
||||
loc.getWorld().spawnParticle(Particle.BLOCK_CRACK, loc, 12, .5, 0, .5, 0, Material.DIRT.createBlockData());
|
||||
|
||||
for (Entity ent : MMOUtils.getNearbyChunkEntities(loc))
|
||||
if (ent.getLocation().distance(loc) < 1.1 && ent instanceof LivingEntity && !ent.equals(attack.getDamager())
|
||||
&& !hit.contains(ent.getEntityId())) {
|
||||
hit.add(ent.getEntityId());
|
||||
ent.playEffect(EntityEffect.HURT);
|
||||
ent.setVelocity(ent.getVelocity().setY(.4 * knockUp));
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 1);
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package net.Indyuce.mmoitems.ability.list.simple;
|
||||
|
||||
import io.lumine.mythic.lib.damage.AttackMetadata;
|
||||
import io.lumine.mythic.lib.damage.DamageMetadata;
|
||||
import io.lumine.mythic.lib.damage.DamageType;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.ability.SimpleAbility;
|
||||
import net.Indyuce.mmoitems.ability.metadata.SimpleAbilityMetadata;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackMetadata;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
public class Sky_Smash extends SimpleAbility {
|
||||
public Sky_Smash() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("cooldown", 10);
|
||||
addModifier("damage", 3);
|
||||
addModifier("knock-up", 1);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(ItemAttackMetadata attack, SimpleAbilityMetadata ability) {
|
||||
double damage = ability.getModifier("damage");
|
||||
double knockUp = ability.getModifier("knock-up");
|
||||
|
||||
attack.getDamager().getWorld().playSound(attack.getDamager().getLocation(), Sound.ENTITY_ZOMBIE_ATTACK_IRON_DOOR, 2, .5f);
|
||||
attack.getDamager().addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 2, 254));
|
||||
Location loc = attack.getDamager().getEyeLocation().add(attack.getDamager().getEyeLocation().getDirection().multiply(3));
|
||||
loc.getWorld().spawnParticle(Particle.EXPLOSION_LARGE, loc, 0);
|
||||
loc.getWorld().spawnParticle(Particle.SMOKE_LARGE, loc, 16, 0, 0, 0, .1);
|
||||
|
||||
for (Entity entity : MMOUtils.getNearbyChunkEntities(loc))
|
||||
if (MMOUtils.canDamage(attack.getDamager(), entity) && entity.getLocation().distanceSquared(loc) < 10) {
|
||||
new AttackMetadata(new DamageMetadata(damage, DamageType.SKILL, DamageType.PHYSICAL), attack.getStats()).damage((LivingEntity) entity);
|
||||
Location loc1 = attack.getDamager().getEyeLocation().clone();
|
||||
loc1.setPitch(-70);
|
||||
entity.setVelocity(loc1.getDirection().multiply(1.2 * knockUp));
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package net.Indyuce.mmoitems.ability.list.simple;
|
||||
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
import net.Indyuce.mmoitems.ability.SimpleAbility;
|
||||
import net.Indyuce.mmoitems.ability.metadata.SimpleAbilityMetadata;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackMetadata;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
public class Swiftness extends SimpleAbility {
|
||||
public Swiftness() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("cooldown", 15);
|
||||
addModifier("duration", 4);
|
||||
addModifier("amplifier", 1);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(ItemAttackMetadata attack, SimpleAbilityMetadata ability) {
|
||||
double duration = ability.getModifier("duration");
|
||||
int amplifier = (int) ability.getModifier("amplifier");
|
||||
|
||||
attack.getDamager().getWorld().playSound(attack.getDamager().getLocation(), VersionSound.ENTITY_ZOMBIE_PIGMAN_ANGRY.toSound(), 1, .3f);
|
||||
for (double y = 0; y <= 2; y += .2)
|
||||
for (double j = 0; j < Math.PI * 2; j += Math.PI / 16)
|
||||
if (random.nextDouble() <= .7)
|
||||
attack.getDamager().getWorld().spawnParticle(Particle.SPELL_INSTANT, attack.getDamager().getLocation().add(Math.cos(j), y, Math.sin(j)), 0);
|
||||
attack.getDamager().addPotionEffect(new PotionEffect(PotionEffectType.SPEED, (int) (duration * 20), amplifier));
|
||||
attack.getDamager().addPotionEffect(new PotionEffect(PotionEffectType.JUMP, (int) (duration * 20), amplifier));
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package net.Indyuce.mmoitems.ability.list.simple;
|
||||
|
||||
import io.lumine.mythic.lib.damage.AttackMetadata;
|
||||
import io.lumine.mythic.lib.damage.DamageMetadata;
|
||||
import io.lumine.mythic.lib.damage.DamageType;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.ability.SimpleAbility;
|
||||
import net.Indyuce.mmoitems.ability.metadata.SimpleAbilityMetadata;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackMetadata;
|
||||
import net.Indyuce.mmoitems.api.util.NoClipItem;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class Throw_Up extends SimpleAbility implements Listener {
|
||||
public Throw_Up() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("duration", 2.5);
|
||||
addModifier("damage", 2);
|
||||
addModifier("cooldown", 10);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(ItemAttackMetadata attack, SimpleAbilityMetadata ability) {
|
||||
double duration = ability.getModifier("duration") * 10;
|
||||
double dps = ability.getModifier("damage") / 2;
|
||||
|
||||
new BukkitRunnable() {
|
||||
int j = 0;
|
||||
|
||||
public void run() {
|
||||
j++;
|
||||
if (j > duration)
|
||||
cancel();
|
||||
|
||||
Location loc = attack.getDamager().getEyeLocation();
|
||||
loc.setPitch((float) (loc.getPitch() + (random.nextDouble() - .5) * 30));
|
||||
loc.setYaw((float) (loc.getYaw() + (random.nextDouble() - .5) * 30));
|
||||
|
||||
if (j % 5 == 0)
|
||||
for (Entity entity : MMOUtils.getNearbyChunkEntities(loc))
|
||||
if (entity.getLocation().distanceSquared(loc) < 40 && attack.getDamager().getEyeLocation().getDirection().angle(entity.getLocation().toVector().subtract(attack.getDamager().getLocation().toVector())) < Math.PI / 6 && MMOUtils.canDamage(attack.getDamager(), entity))
|
||||
new AttackMetadata(new DamageMetadata(dps, DamageType.SKILL, DamageType.PHYSICAL, DamageType.PROJECTILE), attack.getStats()).damage((LivingEntity) entity);
|
||||
|
||||
loc.getWorld().playSound(loc, Sound.ENTITY_ZOMBIE_HURT, 1, 1);
|
||||
|
||||
NoClipItem item = new NoClipItem(attack.getDamager().getLocation().add(0, 1.2, 0), new ItemStack(Material.ROTTEN_FLESH));
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(MMOItems.plugin, item::close, 40);
|
||||
item.getEntity().setVelocity(loc.getDirection().multiply(.8));
|
||||
attack.getDamager().getWorld().spawnParticle(Particle.SMOKE_LARGE, attack.getDamager().getLocation().add(0, 1.2, 0), 0, loc.getDirection().getX(), loc.getDirection().getY(), loc.getDirection().getZ(), 1);
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 2);
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package net.Indyuce.mmoitems.ability.list.target;
|
||||
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.ability.TargetAbility;
|
||||
import net.Indyuce.mmoitems.ability.metadata.TargetAbilityMetadata;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackMetadata;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class Blind extends TargetAbility {
|
||||
public Blind() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK,
|
||||
CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("duration", 5);
|
||||
addModifier("cooldown", 9);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(ItemAttackMetadata attack, TargetAbilityMetadata ability) {
|
||||
LivingEntity target = ability.getTarget();
|
||||
|
||||
target.getWorld().playSound(target.getLocation(), VersionSound.ENTITY_ENDERMAN_HURT.toSound(), 1, 2);
|
||||
for (double i = 0; i < Math.PI * 2; i += Math.PI / 24)
|
||||
for (double j = 0; j < 2; j++) {
|
||||
Location loc = target.getLocation();
|
||||
Vector vec = MMOUtils.rotateFunc(new Vector(Math.cos(i), 1 + Math.cos(i + (Math.PI * j)) * .5, Math.sin(i)),
|
||||
attack.getDamager().getLocation());
|
||||
loc.getWorld().spawnParticle(Particle.REDSTONE, loc.add(vec), 1, new Particle.DustOptions(Color.BLACK, 1));
|
||||
}
|
||||
target.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, (int) (ability.getModifier("duration") * 20), 0));
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package net.Indyuce.mmoitems.ability.list.target;
|
||||
|
||||
import net.Indyuce.mmoitems.ability.TargetAbility;
|
||||
import net.Indyuce.mmoitems.ability.metadata.TargetAbilityMetadata;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackMetadata;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
||||
public class Bloodbath extends TargetAbility {
|
||||
public Bloodbath() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("amount", 2);
|
||||
addModifier("cooldown", 8);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(ItemAttackMetadata attack, TargetAbilityMetadata ability) {
|
||||
LivingEntity target = ability.getTarget();
|
||||
|
||||
target.getWorld().playSound(target.getLocation(), Sound.ENTITY_COW_HURT, 1, 2);
|
||||
target.getWorld().playEffect(target.getLocation().add(0, 1, 0), Effect.STEP_SOUND, 152);
|
||||
attack.getDamager().setFoodLevel((int) Math.min(20, attack.getDamager().getFoodLevel() + ability.getModifier("amount")));
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package net.Indyuce.mmoitems.ability.list.target;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.ability.TargetAbility;
|
||||
import net.Indyuce.mmoitems.ability.metadata.TargetAbilityMetadata;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackMetadata;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class Burn extends TargetAbility {
|
||||
public Burn() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("duration", 3);
|
||||
addModifier("cooldown", 8);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(ItemAttackMetadata attack, TargetAbilityMetadata ability) {
|
||||
LivingEntity target = ability.getTarget();
|
||||
|
||||
new BukkitRunnable() {
|
||||
final Location loc = target.getLocation();
|
||||
double y = 0;
|
||||
|
||||
public void run() {
|
||||
for (int j1 = 0; j1 < 3; j1++) {
|
||||
y += .04;
|
||||
for (int j = 0; j < 2; j++) {
|
||||
double xz = y * Math.PI * 1.3 + (j * Math.PI);
|
||||
Location loc1 = loc.clone().add(Math.cos(xz), y, Math.sin(xz));
|
||||
loc.getWorld().spawnParticle(Particle.FLAME, loc1, 0);
|
||||
}
|
||||
}
|
||||
if (y >= 1.7)
|
||||
cancel();
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 1);
|
||||
target.getWorld().playSound(target.getLocation(), Sound.ENTITY_BLAZE_HURT, 1, 2);
|
||||
target.setFireTicks((int) (target.getFireTicks() + ability.getModifier("duration") * 20));
|
||||
}
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package net.Indyuce.mmoitems.ability.list.target;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.ability.TargetAbility;
|
||||
import net.Indyuce.mmoitems.ability.metadata.TargetAbilityMetadata;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackMetadata;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class Confuse extends TargetAbility {
|
||||
public Confuse() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("cooldown", 7);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(ItemAttackMetadata attack, TargetAbilityMetadata ability) {
|
||||
LivingEntity target = ability.getTarget();
|
||||
|
||||
target.getWorld().playSound(target.getLocation(), Sound.ENTITY_SHEEP_DEATH, 1, 2);
|
||||
new BukkitRunnable() {
|
||||
final Location loc = target.getLocation();
|
||||
final double rads = Math.toRadians(attack.getDamager().getEyeLocation().getYaw() - 90);
|
||||
double ti = rads;
|
||||
|
||||
public void run() {
|
||||
for (int j1 = 0; j1 < 3; j1++) {
|
||||
ti += Math.PI / 15;
|
||||
Location loc1 = loc.clone().add(Math.cos(ti), 1, Math.sin(ti));
|
||||
loc.getWorld().spawnParticle(Particle.SPELL_WITCH, loc1, 0);
|
||||
}
|
||||
if (ti >= Math.PI * 2 + rads)
|
||||
cancel();
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 1);
|
||||
Location loc = target.getLocation().clone();
|
||||
loc.setYaw(target.getLocation().getYaw() - 180);
|
||||
target.teleport(loc);
|
||||
}
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package net.Indyuce.mmoitems.ability.list.target;
|
||||
|
||||
import io.lumine.mythic.lib.damage.AttackMetadata;
|
||||
import io.lumine.mythic.lib.damage.DamageMetadata;
|
||||
import io.lumine.mythic.lib.damage.DamageType;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.ability.TargetAbility;
|
||||
import net.Indyuce.mmoitems.ability.metadata.TargetAbilityMetadata;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackMetadata;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class Death_Mark extends TargetAbility {
|
||||
public Death_Mark() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("cooldown", 7);
|
||||
addModifier("damage", 5);
|
||||
addModifier("duration", 3);
|
||||
addModifier("amplifier", 1);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(ItemAttackMetadata attack, TargetAbilityMetadata ability) {
|
||||
LivingEntity target = ability.getTarget();
|
||||
|
||||
double duration = ability.getModifier("duration") * 20;
|
||||
double dps = ability.getModifier("damage") / duration * 20;
|
||||
|
||||
new BukkitRunnable() {
|
||||
double ti = 0;
|
||||
|
||||
public void run() {
|
||||
ti++;
|
||||
if (ti > duration || target == null || target.isDead()) {
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
target.getWorld().spawnParticle(Particle.SPELL_MOB, target.getLocation(), 4, .2, 0, .2, 0);
|
||||
|
||||
if (ti % 20 == 0)
|
||||
new AttackMetadata(new DamageMetadata(dps, DamageType.SKILL, DamageType.MAGIC), attack.getStats()).damage(target);
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 1);
|
||||
target.getWorld().playSound(target.getLocation(), Sound.ENTITY_BLAZE_HURT, 1, 2);
|
||||
target.removePotionEffect(PotionEffectType.SLOW);
|
||||
target.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, (int) duration, (int) ability.getModifier("amplifier")));
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package net.Indyuce.mmoitems.ability.list.target;
|
||||
|
||||
import io.lumine.mythic.lib.damage.AttackMetadata;
|
||||
import io.lumine.mythic.lib.damage.DamageMetadata;
|
||||
import io.lumine.mythic.lib.damage.DamageType;
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.ability.TargetAbility;
|
||||
import net.Indyuce.mmoitems.ability.metadata.TargetAbilityMetadata;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackMetadata;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class Magma_Fissure extends TargetAbility {
|
||||
public Magma_Fissure() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("cooldown", 10);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
addModifier("ignite", 4);
|
||||
addModifier("damage", 4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(ItemAttackMetadata attack, TargetAbilityMetadata ability) {
|
||||
LivingEntity target = ability.getTarget();
|
||||
|
||||
new BukkitRunnable() {
|
||||
final Location loc = attack.getDamager().getLocation().add(0, .2, 0);
|
||||
int j = 0;
|
||||
|
||||
public void run() {
|
||||
j++;
|
||||
if (target.isDead() || !target.getWorld().equals(loc.getWorld()) || j > 200) {
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
Vector vec = target.getLocation().add(0, .2, 0).subtract(loc).toVector().normalize().multiply(.6);
|
||||
loc.add(vec);
|
||||
|
||||
loc.getWorld().spawnParticle(Particle.LAVA, loc, 2, .2, 0, .2, 0);
|
||||
loc.getWorld().spawnParticle(Particle.FLAME, loc, 2, .2, 0, .2, 0);
|
||||
loc.getWorld().spawnParticle(Particle.SMOKE_NORMAL, loc, 2, .2, 0, .2, 0);
|
||||
loc.getWorld().playSound(loc, VersionSound.BLOCK_NOTE_BLOCK_HAT.toSound(), 1, 1);
|
||||
|
||||
if (target.getLocation().distanceSquared(loc) < 1) {
|
||||
loc.getWorld().playSound(loc, Sound.ENTITY_BLAZE_HURT, 2, 1);
|
||||
target.setFireTicks((int) (target.getFireTicks() + ability.getModifier("ignite") * 20));
|
||||
new AttackMetadata(new DamageMetadata(ability.getModifier("damage"), DamageType.SKILL, DamageType.MAGIC), attack.getStats()).damage(target);
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 1);
|
||||
}
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package net.Indyuce.mmoitems.ability.list.target;
|
||||
|
||||
import net.Indyuce.mmoitems.ability.TargetAbility;
|
||||
import net.Indyuce.mmoitems.ability.metadata.TargetAbilityMetadata;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackMetadata;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
public class Poison extends TargetAbility {
|
||||
public Poison() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("duration", 4);
|
||||
addModifier("cooldown", 10);
|
||||
addModifier("amplifier", 1);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(ItemAttackMetadata attack, TargetAbilityMetadata ability) {
|
||||
LivingEntity target = ability.getTarget();
|
||||
|
||||
target.getWorld().spawnParticle(Particle.SLIME, target.getLocation().add(0, 1, 0), 32, 1, 1, 1, 0);
|
||||
target.getWorld().spawnParticle(Particle.VILLAGER_HAPPY, target.getLocation().add(0, 1, 0), 24, 1, 1, 1, 0);
|
||||
target.getWorld().playSound(target.getLocation(), Sound.BLOCK_BREWING_STAND_BREW, 1.5f, 2);
|
||||
target.addPotionEffect(new PotionEffect(PotionEffectType.POISON, (int) (ability.getModifier("duration") * 20), (int) ability.getModifier("amplifier")));
|
||||
}
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package net.Indyuce.mmoitems.ability.list.target;
|
||||
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.ability.TargetAbility;
|
||||
import net.Indyuce.mmoitems.ability.metadata.TargetAbilityMetadata;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackMetadata;
|
||||
import org.bukkit.EntityEffect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class Shock extends TargetAbility {
|
||||
public Shock() {
|
||||
super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
|
||||
addModifier("duration", 2);
|
||||
addModifier("cooldown", 8);
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(ItemAttackMetadata attack, TargetAbilityMetadata ability) {
|
||||
LivingEntity target = ability.getTarget();
|
||||
|
||||
double duration = ability.getModifier("duration");
|
||||
|
||||
target.getWorld().playSound(target.getLocation(), VersionSound.ENTITY_ZOMBIE_PIGMAN_ANGRY.toSound(), 1, 2);
|
||||
new BukkitRunnable() {
|
||||
final Location loc = target.getLocation();
|
||||
final double rads = Math.toRadians(attack.getDamager().getEyeLocation().getYaw() - 90);
|
||||
double ti = rads;
|
||||
|
||||
public void run() {
|
||||
for (int j = 0; j < 3; j++) {
|
||||
ti += Math.PI / 15;
|
||||
target.getWorld().spawnParticle(Particle.SMOKE_LARGE, loc.clone().add(Math.cos(ti), 1, Math.sin(ti)), 0);
|
||||
}
|
||||
if (ti >= Math.PI * 2 + rads)
|
||||
cancel();
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 1);
|
||||
|
||||
new BukkitRunnable() {
|
||||
int ti;
|
||||
|
||||
public void run() {
|
||||
if (ti++ > (duration > 300 ? 300 : duration * 10) || target.isDead())
|
||||
cancel();
|
||||
else
|
||||
target.playEffect(EntityEffect.HURT);
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 2);
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user