mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2025-02-01 11:11:21 +01:00
!Moved skill damage modifiers to MMOLib
This commit is contained in:
parent
245356b517
commit
77edbaf992
@ -14,6 +14,7 @@ import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.api.AttackResult;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
|
||||
public class Bouncy_Fireball extends Ability {
|
||||
@ -74,7 +75,7 @@ public class Bouncy_Fireball extends Ability {
|
||||
for (Entity entity : MMOUtils.getNearbyChunkEntities(loc))
|
||||
if (entity.getLocation().distanceSquared(loc) < radius * radius)
|
||||
if (MMOUtils.canDamage(stats.getPlayer(), entity)) {
|
||||
new ItemAttackResult(damage, DamageType.SKILL, DamageType.MAGICAL, DamageType.PROJECTILE).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.MAGICAL, DamageType.PROJECTILE).damage(stats.getPlayer(), (LivingEntity) entity);
|
||||
((LivingEntity) entity).setFireTicks((int) (ignite * 20));
|
||||
}
|
||||
|
||||
|
@ -15,6 +15,7 @@ import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.api.AttackResult;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
|
||||
public class Burning_Hands extends Ability implements Listener {
|
||||
@ -55,10 +56,8 @@ public class Burning_Hands extends Ability implements Listener {
|
||||
|
||||
if (j % 5 == 0)
|
||||
for (Entity entity : MMOUtils.getNearbyChunkEntities(loc))
|
||||
if (entity.getLocation().distanceSquared(loc) < 60)
|
||||
if (stats.getPlayer().getEyeLocation().getDirection().angle(entity.getLocation().toVector().subtract(stats.getPlayer().getLocation().toVector())) < Math.PI / 6)
|
||||
if (MMOUtils.canDamage(stats.getPlayer(), entity))
|
||||
new ItemAttackResult(damage, DamageType.SKILL, DamageType.MAGICAL).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
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.MAGICAL).damage(stats.getPlayer(), (LivingEntity) entity);
|
||||
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 2);
|
||||
|
@ -14,6 +14,7 @@ import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.api.AttackResult;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
|
||||
public class Circular_Slash extends Ability {
|
||||
@ -38,7 +39,7 @@ public class Circular_Slash extends Ability {
|
||||
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 ItemAttackResult(damage, DamageType.SKILL, DamageType.PHYSICAL).applyEffectsAndDamage(stats, null, (LivingEntity) 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;
|
||||
|
@ -14,6 +14,7 @@ import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.api.AttackResult;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
import net.mmogroup.mmolib.version.VersionSound;
|
||||
|
||||
@ -61,7 +62,7 @@ public class Contamination extends Ability {
|
||||
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)
|
||||
MMOLib.plugin.getDamage().damage(stats.getPlayer(), (LivingEntity) entity, new ItemAttackResult(dps, DamageType.SKILL, DamageType.MAGICAL), false);
|
||||
MMOLib.plugin.getDamage().damage(stats.getPlayer(), (LivingEntity) entity, new AttackResult(dps, DamageType.SKILL, DamageType.MAGICAL), false);
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 1);
|
||||
|
@ -14,6 +14,7 @@ import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.api.AttackResult;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
import net.mmogroup.mmolib.version.VersionSound;
|
||||
|
||||
@ -53,7 +54,7 @@ public class Corrupt extends Ability {
|
||||
|
||||
for (Entity entity : MMOUtils.getNearbyChunkEntities(loc))
|
||||
if (MMOUtils.canDamage(stats.getPlayer(), entity) && entity.getLocation().distanceSquared(loc) <= radius * radius) {
|
||||
new ItemAttackResult(damage, DamageType.SKILL, DamageType.MAGICAL).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.MAGICAL).damage(stats.getPlayer(), (LivingEntity) entity);
|
||||
((LivingEntity) entity).removePotionEffect(PotionEffectType.WITHER);
|
||||
((LivingEntity) entity).addPotionEffect(new PotionEffect(PotionEffectType.WITHER, (int) (duration * 20), (int) amplifier));
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.api.AttackResult;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
|
||||
public class Corrupted_Fangs extends Ability implements Listener {
|
||||
@ -63,7 +64,7 @@ public class Corrupted_Fangs extends Ability implements Listener {
|
||||
Object[] data = MMOItems.plugin.getEntities().getEntityData(damager);
|
||||
CachedStats stats = (CachedStats) data[0];
|
||||
if (MMOUtils.canDamage(stats.getPlayer(), event.getEntity()))
|
||||
new ItemAttackResult((double) data[1], DamageType.SKILL, DamageType.MAGICAL).applyEffectsAndDamage(stats, null, (LivingEntity) event.getEntity());
|
||||
new AttackResult((double) data[1], DamageType.SKILL, DamageType.MAGICAL).damage(stats.getPlayer(), (LivingEntity) event.getEntity());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.api.AttackResult;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
import net.mmogroup.mmolib.version.VersionSound;
|
||||
|
||||
@ -66,7 +67,7 @@ public class Cursed_Beam extends Ability {
|
||||
|
||||
for (Entity entity : entities)
|
||||
if (MMOUtils.canDamage(stats.getPlayer(), entity) && loc.distanceSquared(entity.getLocation().add(0, 1, 0)) < 9) {
|
||||
new ItemAttackResult(damage, DamageType.SKILL, DamageType.MAGICAL, DamageType.PROJECTILE).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.MAGICAL, DamageType.PROJECTILE).damage(stats.getPlayer(), (LivingEntity) entity);
|
||||
((LivingEntity) entity).addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, (int) (duration * 20), 0));
|
||||
}
|
||||
cancel();
|
||||
|
@ -19,6 +19,7 @@ import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.api.AttackResult;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
|
||||
public class Earthquake extends Ability {
|
||||
@ -62,7 +63,7 @@ public class Earthquake extends Ability {
|
||||
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 ItemAttackResult(damage, DamageType.SKILL, DamageType.MAGICAL).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.MAGICAL).damage(stats.getPlayer(), (LivingEntity) entity);
|
||||
((LivingEntity) entity).addPotionEffect(new PotionEffect(PotionEffectType.SLOW, (int) (slowDuration * 20), (int) slowAmplifier));
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.api.AttackResult;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
|
||||
public class Explosive_Turkey extends Ability implements Listener {
|
||||
@ -88,7 +89,7 @@ public class Explosive_Turkey extends Ability implements Listener {
|
||||
chicken.getWorld().playSound(chicken.getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 2, 1.5f);
|
||||
for (Entity entity : MMOUtils.getNearbyChunkEntities(chicken.getLocation()))
|
||||
if (!entity.isDead() && entity.getLocation().distanceSquared(chicken.getLocation()) < radiusSquared && MMOUtils.canDamage(stats.getPlayer(), entity)) {
|
||||
new ItemAttackResult(damage, DamageType.SKILL, DamageType.MAGICAL, DamageType.PROJECTILE).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.MAGICAL, DamageType.PROJECTILE).damage(stats.getPlayer(), (LivingEntity) entity);
|
||||
entity.setVelocity(entity.getLocation().toVector().subtract(chicken.getLocation().toVector()).multiply(.1 * knockback).setY(.4 * knockback));
|
||||
}
|
||||
cancel();
|
||||
|
@ -15,6 +15,7 @@ import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.api.AttackResult;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
import net.mmogroup.mmolib.version.VersionSound;
|
||||
|
||||
@ -57,7 +58,7 @@ public class Fire_Meteor extends Ability {
|
||||
double radius = data.getModifier("radius");
|
||||
for (Entity entity : loc.getWorld().getEntitiesByClass(LivingEntity.class))
|
||||
if (MMOUtils.canDamage(stats.getPlayer(), entity) && entity.getLocation().distanceSquared(loc) < radius * radius) {
|
||||
new ItemAttackResult(damage, DamageType.SKILL, DamageType.MAGICAL, DamageType.PROJECTILE).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.MAGICAL, DamageType.PROJECTILE).damage(stats.getPlayer(), (LivingEntity) entity);
|
||||
entity.setVelocity(entity.getLocation().toVector().subtract(loc.toVector()).multiply(.1 * knockback).setY(.4 * knockback));
|
||||
}
|
||||
cancel();
|
||||
|
@ -16,6 +16,7 @@ import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.api.AttackResult;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
import net.mmogroup.mmolib.version.VersionSound;
|
||||
|
||||
@ -59,7 +60,7 @@ public class Firebolt extends Ability {
|
||||
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 ItemAttackResult(data.getModifier("damage"), DamageType.SKILL, DamageType.MAGICAL, DamageType.PROJECTILE).applyEffectsAndDamage(stats, null, (LivingEntity) target);
|
||||
new AttackResult(data.getModifier("damage"), DamageType.SKILL, DamageType.MAGICAL, DamageType.PROJECTILE).damage(stats.getPlayer(), (LivingEntity) target);
|
||||
target.setFireTicks((int) data.getModifier("ignite") * 20);
|
||||
cancel();
|
||||
return;
|
||||
|
@ -15,6 +15,7 @@ import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.api.AttackResult;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
import net.mmogroup.mmolib.version.VersionSound;
|
||||
|
||||
@ -62,7 +63,7 @@ public class Firefly extends Ability {
|
||||
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 ItemAttackResult(damage, DamageType.SKILL, DamageType.MAGICAL).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.MAGICAL).damage(stats.getPlayer(), (LivingEntity) entity);
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.api.AttackResult;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
import net.mmogroup.mmolib.version.VersionSound;
|
||||
|
||||
@ -65,7 +66,7 @@ public class Freezing_Curse extends Ability {
|
||||
double damage = data.getModifier("damage");
|
||||
for (Entity entity : MMOUtils.getNearbyChunkEntities(loc))
|
||||
if (entity.getLocation().distanceSquared(loc) < radius * radius && MMOUtils.canDamage(stats.getPlayer(), entity)) {
|
||||
new ItemAttackResult(damage, DamageType.SKILL, DamageType.MAGICAL).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.MAGICAL).damage(stats.getPlayer(), (LivingEntity) entity);
|
||||
((LivingEntity) entity).removePotionEffect(PotionEffectType.SLOW);
|
||||
((LivingEntity) entity).addPotionEffect(new PotionEffect(PotionEffectType.SLOW, (int) (duration * 20), (int) amplifier));
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.api.AttackResult;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
|
||||
public class Heavy_Charge extends Ability {
|
||||
@ -50,7 +51,7 @@ public class Heavy_Charge extends Ability {
|
||||
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 ItemAttackResult(data.getModifier("damage"), DamageType.SKILL, DamageType.PHYSICAL).applyEffectsAndDamage(stats, null, (LivingEntity) target);
|
||||
new AttackResult(data.getModifier("damage"), DamageType.SKILL, DamageType.PHYSICAL).damage(stats.getPlayer(), (LivingEntity) target);
|
||||
cancel();
|
||||
break;
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.api.AttackResult;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
import net.mmogroup.mmolib.version.VersionSound;
|
||||
|
||||
@ -63,7 +64,7 @@ public class Holy_Missile extends Ability {
|
||||
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 ItemAttackResult(damage, DamageType.SKILL, DamageType.MAGICAL, DamageType.PROJECTILE).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.MAGICAL, DamageType.PROJECTILE).damage(stats.getPlayer(), (LivingEntity) entity);
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.api.AttackResult;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
import net.mmogroup.mmolib.version.VersionSound;
|
||||
|
||||
@ -73,7 +74,7 @@ public class Ice_Crystal extends Ability {
|
||||
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 ItemAttackResult(data.getModifier("damage"), DamageType.SKILL, DamageType.MAGICAL, DamageType.PROJECTILE).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
new AttackResult(data.getModifier("damage"), DamageType.SKILL, DamageType.MAGICAL, DamageType.PROJECTILE).damage(stats.getPlayer(), (LivingEntity) entity);
|
||||
((LivingEntity) entity).addPotionEffect(new PotionEffect(PotionEffectType.SLOW, (int) (data.getModifier("duration") * 20), (int) data.getModifier("amplifier")));
|
||||
cancel();
|
||||
return;
|
||||
|
@ -18,6 +18,7 @@ import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.api.util.NoInteractItemEntity;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.api.AttackResult;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
import net.mmogroup.mmolib.version.VersionSound;
|
||||
|
||||
@ -58,7 +59,7 @@ public class Item_Bomb extends Ability implements Listener {
|
||||
|
||||
for (Entity entity : item.getEntity().getNearbyEntities(radius, radius, radius))
|
||||
if (MMOUtils.canDamage(stats.getPlayer(), entity)) {
|
||||
new ItemAttackResult(damage, DamageType.SKILL, DamageType.PHYSICAL).applyEffectsAndDamage(stats, null, (LivingEntity) 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));
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.api.util.NoInteractItemEntity;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.api.AttackResult;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
|
||||
public class Item_Throw extends Ability implements Listener {
|
||||
@ -53,7 +54,7 @@ public class Item_Throw extends Ability implements Listener {
|
||||
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 ItemAttackResult(data.getModifier("damage"), DamageType.SKILL, DamageType.PHYSICAL, DamageType.PROJECTILE).applyEffectsAndDamage(stats, null, (LivingEntity) target);
|
||||
new AttackResult(data.getModifier("damage"), DamageType.SKILL, DamageType.PHYSICAL, DamageType.PROJECTILE).damage(stats.getPlayer(), (LivingEntity) target);
|
||||
item.close();
|
||||
cancel();
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.api.AttackResult;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
import net.mmogroup.mmolib.version.VersionSound;
|
||||
|
||||
@ -69,7 +70,7 @@ public class Life_Ender extends Ability {
|
||||
|
||||
for (Entity entity : MMOUtils.getNearbyChunkEntities(source))
|
||||
if (entity.getLocation().distanceSquared(source) < radius * radius && MMOUtils.canDamage(stats.getPlayer(), entity)) {
|
||||
new ItemAttackResult(damage, DamageType.SKILL, DamageType.MAGICAL).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.MAGICAL).damage(stats.getPlayer(), (LivingEntity) entity);
|
||||
entity.setVelocity(entity.getLocation().subtract(source).toVector().setY(.75).normalize().multiply(knockback));
|
||||
}
|
||||
cancel();
|
||||
|
@ -15,6 +15,7 @@ import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.api.AttackResult;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
import net.mmogroup.mmolib.version.VersionSound;
|
||||
|
||||
@ -49,7 +50,7 @@ public class Light_Dash extends Ability {
|
||||
for (Entity entity : stats.getPlayer().getNearbyEntities(1, 1, 1))
|
||||
if (!hit.contains(entity.getEntityId()) && MMOUtils.canDamage(stats.getPlayer(), entity)) {
|
||||
hit.add(entity.getEntityId());
|
||||
new ItemAttackResult(damage, DamageType.SKILL, DamageType.PHYSICAL).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.PHYSICAL).damage(stats.getPlayer(), (LivingEntity) entity);
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 2);
|
||||
|
@ -11,6 +11,7 @@ import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.api.AttackResult;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
import net.mmogroup.mmolib.version.VersionSound;
|
||||
|
||||
@ -40,7 +41,7 @@ public class Lightning_Beam extends Ability {
|
||||
|
||||
for (Entity entity : MMOUtils.getNearbyChunkEntities(loc))
|
||||
if (MMOUtils.canDamage(stats.getPlayer(), entity) && entity.getLocation().distanceSquared(loc) <= radius * radius)
|
||||
new ItemAttackResult(damage, DamageType.SKILL, DamageType.MAGICAL).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.MAGICAL).damage(stats.getPlayer(), (LivingEntity) entity);
|
||||
|
||||
stats.getPlayer().getWorld().playSound(stats.getPlayer().getLocation(), VersionSound.ENTITY_FIREWORK_ROCKET_BLAST.toSound(), 1, 0);
|
||||
loc.getWorld().spawnParticle(Particle.FIREWORKS_SPARK, loc, 64, 0, 0, 0, .2);
|
||||
|
@ -14,6 +14,7 @@ import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.api.AttackResult;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
import net.mmogroup.mmolib.version.VersionSound;
|
||||
|
||||
@ -58,7 +59,7 @@ public class Magma_Fissure extends Ability {
|
||||
if (target.getLocation().distanceSquared(loc) < 1) {
|
||||
loc.getWorld().playSound(loc, Sound.ENTITY_BLAZE_HURT, 2, 1);
|
||||
target.setFireTicks((int) (target.getFireTicks() + data.getModifier("ignite") * 20));
|
||||
new ItemAttackResult(data.getModifier("damage"), DamageType.SKILL, DamageType.MAGICAL).applyEffectsAndDamage(stats, null, target);
|
||||
new AttackResult(data.getModifier("damage"), DamageType.SKILL, DamageType.MAGICAL).damage(stats.getPlayer(), target);
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.api.AttackResult;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
import net.mmogroup.mmolib.version.VersionSound;
|
||||
|
||||
@ -38,7 +39,7 @@ public class Overload extends Ability {
|
||||
|
||||
for (Entity entity : stats.getPlayer().getNearbyEntities(radius, radius, radius))
|
||||
if (MMOUtils.canDamage(stats.getPlayer(), entity))
|
||||
new ItemAttackResult(damage, DamageType.SKILL, DamageType.MAGICAL).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.MAGICAL).damage(stats.getPlayer(), (LivingEntity) entity);
|
||||
|
||||
double step = 12 + (radius * 2.5);
|
||||
for (double j = 0; j < Math.PI * 2; j += Math.PI / step) {
|
||||
|
@ -23,6 +23,7 @@ import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.api.util.NoInteractItemEntity;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.api.AttackResult;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
import net.mmogroup.mmolib.version.VersionMaterial;
|
||||
import net.mmogroup.mmolib.version.VersionSound;
|
||||
@ -89,7 +90,7 @@ public class Present_Throw extends Ability {
|
||||
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 ItemAttackResult(damage, DamageType.SKILL, DamageType.MAGICAL, DamageType.PROJECTILE).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.MAGICAL, DamageType.PROJECTILE).damage(stats.getPlayer(), (LivingEntity) entity);
|
||||
item.close();
|
||||
cancel();
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.api.AttackResult;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
import net.mmogroup.mmolib.api.item.NBTItem;
|
||||
|
||||
@ -54,7 +55,7 @@ public class Shulker_Missile extends Ability implements Listener {
|
||||
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 ItemAttackResult(data.getModifier("damage"), DamageType.SKILL, DamageType.MAGICAL, DamageType.PROJECTILE), data.getModifier("effect-duration"));
|
||||
MMOItems.plugin.getEntities().registerCustomEntity(shulkerBullet, new AttackResult(data.getModifier("damage"), DamageType.SKILL, DamageType.MAGICAL, DamageType.PROJECTILE), data.getModifier("effect-duration"));
|
||||
new BukkitRunnable() {
|
||||
double ti = 0;
|
||||
|
||||
@ -84,12 +85,12 @@ public class Shulker_Missile extends Ability implements Listener {
|
||||
}
|
||||
|
||||
Object[] data = MMOItems.plugin.getEntities().getEntityData(damager);
|
||||
ItemAttackResult result = (ItemAttackResult) data[0];
|
||||
AttackResult result = (AttackResult) data[0];
|
||||
double duration = (double) data[1] * 20;
|
||||
|
||||
// void spirit
|
||||
if (data.length > 2)
|
||||
result.applyEffects((CachedStats) data[2], (NBTItem) data[3], entity);
|
||||
((ItemAttackResult) result).applyEffects((CachedStats) data[2], (NBTItem) data[3], entity);
|
||||
|
||||
event.setDamage(result.getDamage());
|
||||
|
||||
|
@ -13,6 +13,7 @@ import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.api.AttackResult;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
|
||||
public class Sky_Smash extends Ability {
|
||||
@ -39,7 +40,7 @@ public class Sky_Smash extends Ability {
|
||||
|
||||
for (Entity entity : MMOUtils.getNearbyChunkEntities(loc))
|
||||
if (MMOUtils.canDamage(stats.getPlayer(), entity) && entity.getLocation().distanceSquared(loc) < 10) {
|
||||
new ItemAttackResult(damage, DamageType.SKILL, DamageType.PHYSICAL).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.PHYSICAL).damage(stats.getPlayer(), (LivingEntity) entity);
|
||||
Location loc1 = stats.getPlayer().getEyeLocation().clone();
|
||||
loc1.setPitch(-70);
|
||||
((LivingEntity) entity).setVelocity(loc1.getDirection().multiply(1.2 * knockUp));
|
||||
|
@ -8,6 +8,7 @@ import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.api.AttackResult;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
|
||||
public class Smite extends Ability {
|
||||
@ -28,7 +29,7 @@ public class Smite extends Ability {
|
||||
return;
|
||||
}
|
||||
|
||||
new ItemAttackResult(data.getModifier("damage"), DamageType.SKILL, DamageType.MAGICAL).applyEffectsAndDamage(stats, null, target);
|
||||
new AttackResult(data.getModifier("damage"), DamageType.SKILL, DamageType.MAGICAL).damage(stats.getPlayer(), target);
|
||||
target.getWorld().strikeLightningEffect(target.getLocation());
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.api.AttackResult;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
import net.mmogroup.mmolib.version.VersionSound;
|
||||
|
||||
@ -40,7 +41,7 @@ public class Sparkle extends Ability {
|
||||
double radius = data.getModifier("radius");
|
||||
double limit = data.getModifier("limit");
|
||||
|
||||
new ItemAttackResult(damage, DamageType.SKILL, DamageType.MAGICAL).applyEffectsAndDamage(stats, null, target);
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.MAGICAL).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);
|
||||
|
||||
@ -48,7 +49,7 @@ public class Sparkle extends Ability {
|
||||
for (Entity entity : target.getNearbyEntities(radius, radius, radius))
|
||||
if (count < limit && entity instanceof LivingEntity && entity != stats.getPlayer() && !(entity instanceof ArmorStand)) {
|
||||
count++;
|
||||
new ItemAttackResult(damage, DamageType.SKILL, DamageType.MAGICAL).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.MAGICAL).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);
|
||||
|
@ -18,6 +18,7 @@ import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.api.AttackResult;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
|
||||
public class Tactical_Grenade extends Ability {
|
||||
@ -74,7 +75,7 @@ public class Tactical_Grenade extends Ability {
|
||||
if (entity.equals(target))
|
||||
cancel();
|
||||
|
||||
new ItemAttackResult(data.getModifier("damage"), DamageType.SKILL, DamageType.MAGICAL).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
new AttackResult(data.getModifier("damage"), DamageType.SKILL, DamageType.MAGICAL).damage(stats.getPlayer(), (LivingEntity) entity);
|
||||
entity.setVelocity(entity.getVelocity().add(offsetVector(knockup)));
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.api.AttackResult;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
import net.mmogroup.mmolib.version.VersionSound;
|
||||
|
||||
@ -57,7 +58,7 @@ public class Targeted_Fireball extends Ability {
|
||||
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() + data.getModifier("ignite") * 20));
|
||||
new ItemAttackResult(data.getModifier("damage"), DamageType.SKILL, DamageType.MAGICAL, DamageType.PROJECTILE).applyEffectsAndDamage(stats, null, target);
|
||||
new AttackResult(data.getModifier("damage"), DamageType.SKILL, DamageType.MAGICAL, DamageType.PROJECTILE).damage(stats.getPlayer(), target);
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.api.util.NoInteractItemEntity;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.api.AttackResult;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
import net.mmogroup.mmolib.api.item.ItemTag;
|
||||
|
||||
@ -53,7 +54,7 @@ public class Throw_Up extends Ability implements Listener {
|
||||
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 ItemAttackResult(dps, DamageType.SKILL, DamageType.PHYSICAL, DamageType.PROJECTILE).applyEffectsAndDamage(stats, null, (LivingEntity) 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);
|
||||
|
||||
|
@ -14,6 +14,7 @@ import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.api.AttackResult;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
|
||||
public class Thrust extends Ability {
|
||||
@ -39,7 +40,7 @@ public class Thrust extends Ability {
|
||||
loc.add(vec);
|
||||
for (Entity entity : MMOUtils.getNearbyChunkEntities(loc))
|
||||
if (MMOUtils.canDamage(stats.getPlayer(), loc, entity))
|
||||
new ItemAttackResult(damage, DamageType.SKILL, DamageType.PHYSICAL).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.PHYSICAL).damage(stats.getPlayer(), (LivingEntity) entity);
|
||||
loc.getWorld().spawnParticle(Particle.SMOKE_LARGE, loc, 0);
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.api.AttackResult;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
import net.mmogroup.mmolib.version.VersionSound;
|
||||
|
||||
@ -54,7 +55,7 @@ public class Arcane_Hail extends Ability {
|
||||
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 ItemAttackResult(damage, DamageType.SKILL, DamageType.MAGICAL).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.MAGICAL).damage(stats.getPlayer(), (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);
|
||||
|
||||
|
@ -18,6 +18,7 @@ import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.api.AttackResult;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
import net.mmogroup.mmolib.version.VersionSound;
|
||||
|
||||
@ -62,7 +63,7 @@ public class Arcane_Rift extends Ability {
|
||||
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 ItemAttackResult(damage, DamageType.SKILL, DamageType.MAGICAL).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.MAGICAL).damage(stats.getPlayer(), (LivingEntity) entity);
|
||||
((LivingEntity) entity).addPotionEffect(new PotionEffect(PotionEffectType.SLOW, (int) (slowDuration * 20), (int) slowAmplifier));
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.api.AttackResult;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
|
||||
public class Death_Mark extends Ability {
|
||||
@ -52,7 +53,7 @@ public class Death_Mark extends Ability {
|
||||
target.getWorld().spawnParticle(Particle.SPELL_MOB, target.getLocation(), 4, .2, 0, .2, 0);
|
||||
|
||||
if (ti % 20 == 0)
|
||||
MMOLib.plugin.getDamage().damage(stats.getPlayer(), target, new ItemAttackResult(dps, DamageType.SKILL, DamageType.MAGICAL), false);
|
||||
MMOLib.plugin.getDamage().damage(stats.getPlayer(), target, new AttackResult(dps, DamageType.SKILL, DamageType.MAGICAL), false);
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 1);
|
||||
target.getWorld().playSound(target.getLocation(), Sound.ENTITY_BLAZE_HURT, 1, 2);
|
||||
|
@ -11,6 +11,7 @@ import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.api.AttackResult;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
|
||||
public class Minor_Explosion extends Ability {
|
||||
@ -43,7 +44,7 @@ public class Minor_Explosion extends Ability {
|
||||
|
||||
for (Entity entity : MMOUtils.getNearbyChunkEntities(loc))
|
||||
if (entity.getLocation().distanceSquared(loc) < radiusSquared && MMOUtils.canDamage(stats.getPlayer(), entity)) {
|
||||
new ItemAttackResult(damage, DamageType.SKILL, DamageType.MAGICAL).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.MAGICAL).damage(stats.getPlayer(), (LivingEntity) entity);
|
||||
entity.setVelocity(MMOUtils.normalize(entity.getLocation().subtract(loc).toVector().setY(0)).setY(.2).multiply(2 * knockback));
|
||||
}
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ public enum Element {
|
||||
target.getWorld().playSound(target.getLocation(), VersionSound.ENTITY_FIREWORK_ROCKET_LARGE_BLAST.toSound(), 2, 0);
|
||||
for (Entity entity : target.getNearbyEntities(3, 2, 3))
|
||||
if (MMOUtils.canDamage(stats.getPlayer(), entity))
|
||||
new ItemAttackResult(result.getDamage() * attack / 100, DamageType.WEAPON).damage(stats, (LivingEntity) entity);
|
||||
new ItemAttackResult(result.getDamage() * attack / 100, DamageType.WEAPON).damage(stats.getPlayer(), (LivingEntity) entity);
|
||||
|
||||
result.addDamage(absolute);
|
||||
for (double k = 0; k < Math.PI * 2; k += Math.PI / 16)
|
||||
|
@ -2,24 +2,17 @@ package net.Indyuce.mmoitems.api;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.Ability.CastingMode;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.type.ItemStat;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.api.AttackResult;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
import net.mmogroup.mmolib.api.item.NBTItem;
|
||||
|
||||
public class ItemAttackResult extends AttackResult {
|
||||
private static final Random random = new Random();
|
||||
|
||||
public ItemAttackResult(boolean successful, DamageType... types) {
|
||||
this(successful, 0, types);
|
||||
}
|
||||
@ -55,10 +48,6 @@ public class ItemAttackResult extends AttackResult {
|
||||
return (ItemAttackResult) super.multiplyDamage(coef);
|
||||
}
|
||||
|
||||
public void damage(CachedStats stats, LivingEntity target) {
|
||||
MMOLib.plugin.getDamage().damage(stats.getPlayer(), target, this);
|
||||
}
|
||||
|
||||
public void applyEffectsAndDamage(CachedStats stats, NBTItem item, LivingEntity target) {
|
||||
MMOLib.plugin.getDamage().damage(stats.getPlayer(), target, applyEffects(stats, item, target));
|
||||
}
|
||||
@ -85,18 +74,7 @@ public class ItemAttackResult extends AttackResult {
|
||||
* non-weapon specific effects like critical strikes and extra stat damage
|
||||
*/
|
||||
public ItemAttackResult applyOnHitEffects(CachedStats stats, LivingEntity target) {
|
||||
|
||||
// abilities
|
||||
stats.getPlayerData().castAbilities(stats, target, this, CastingMode.ON_HIT);
|
||||
|
||||
// critical strikes
|
||||
if (random.nextDouble() <= stats.getStat(ItemStat.CRITICAL_STRIKE_CHANCE) / 100) {
|
||||
multiplyDamage(MMOItems.plugin.getConfig().getDouble("crit-coefficient") + stats.getStat(ItemStat.CRITICAL_STRIKE_POWER) / 100);
|
||||
target.getWorld().playSound(target.getLocation(), Sound.ENTITY_PLAYER_ATTACK_CRIT, 1, 1);
|
||||
target.getWorld().spawnParticle(Particle.FIREWORKS_SPARK, target.getLocation().add(0, 1, 0), 16, 0, 0, 0, .1);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -83,7 +83,6 @@ public class Weapon extends UseItem {
|
||||
if (!hasEnoughResources(attackSpeed, CooldownType.ATTACK, true))
|
||||
return result.setSuccessful(false);
|
||||
|
||||
result.applyElementalEffects(stats, getNBTItem(), target);
|
||||
if (!getNBTItem().getBoolean("MMOITEMS_DISABLE_ATTACK_PASSIVE"))
|
||||
getMMOItem().getType().getItemSet().applyAttackEffect(stats, target, this, result);
|
||||
|
||||
|
@ -82,7 +82,7 @@ public class RealDualWieldHook implements Listener {
|
||||
/*
|
||||
* cast on-hit abilities and add the extra damage to the damage event
|
||||
*/
|
||||
result.applyOnHitEffects(stats == null ? stats = playerData.getStats().newTemporary() : stats, target);
|
||||
result.applyEffects(stats == null ? stats = playerData.getStats().newTemporary() : stats, item, target);
|
||||
|
||||
event.setDamage(result.getDamage());
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ public class ItemUse implements Listener {
|
||||
/*
|
||||
* cast on-hit abilities and add the extra damage to the damage event
|
||||
*/
|
||||
result.applyOnHitEffects(stats == null ? stats = playerData.getStats().newTemporary() : stats, target);
|
||||
result.applyEffects(stats == null ? stats = playerData.getStats().newTemporary() : stats, item, target);
|
||||
|
||||
event.setDamage(result.getDamage());
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ public class EntityManager implements Listener {
|
||||
|
||||
if (data.getSourceItem().getItem().hasItemMeta())
|
||||
if (data.getSourceItem().getItem().getItemMeta().getEnchants().containsKey(Enchantment.ARROW_DAMAGE))
|
||||
result.addRelativeDamage(.25 + (.25 * data.getSourceItem().getItem().getItemMeta().getEnchantLevel(Enchantment.ARROW_DAMAGE)));
|
||||
result.multiplyDamage(1.25 + (.25 * data.getSourceItem().getItem().getItemMeta().getEnchantLevel(Enchantment.ARROW_DAMAGE)));
|
||||
}
|
||||
|
||||
event.setDamage(result.getDamage());
|
||||
|
@ -38,17 +38,6 @@ disable-abilities-in-offhand: false
|
||||
# 10 ticks which corresponds to 2 inventory updates a second.
|
||||
inventory-update-delay: 10
|
||||
|
||||
# Default: 1.0 ; critical strikes deal 1.0x EXTRA damage.
|
||||
#
|
||||
# Example:
|
||||
# If a sword has 10 attack damage and 50% critical power and the
|
||||
# weapon hits the critical chance it'll deal 15 attack damage (50% Extra).
|
||||
# If the below value was 2.0 for example it'll deal
|
||||
# 10 (Base damage) + 10 critical damage! (100% Extra)
|
||||
#
|
||||
# Can be increased by 'Critical Strike Power'
|
||||
crit-coefficient: 1.0
|
||||
|
||||
# Changes the default value for some stats.
|
||||
default:
|
||||
attack-speed: 0.67
|
||||
|
Loading…
Reference in New Issue
Block a user