Search in sources :

Example 6 with WarlordsPlayer

use of com.ebicep.warlords.player.WarlordsPlayer in project Warlords by ebicep.

the class HeartToHeart method onActivate.

@Override
public boolean onActivate(@Nonnull WarlordsPlayer wp, @Nonnull Player player) {
    if (wp.getCarriedFlag() != null) {
        radius = 7;
        verticalRadius = 3;
    } else {
        radius = 15;
        verticalRadius = 15;
    }
    for (WarlordsPlayer heartTarget : PlayerFilter.entitiesAround(wp, radius, verticalRadius, radius).aliveTeammatesOfExcludingSelf(wp).requireLineOfSight(wp).lookingAtFirst(wp).limit(1)) {
        Utils.playGlobalSound(player.getLocation(), "rogue.hearttoheart.activation", 2, 1);
        Utils.playGlobalSound(player.getLocation(), "rogue.hearttoheart.activation.alt", 2, 1.2f);
        HeartToHeart tempHeartToHeart = new HeartToHeart();
        wp.subtractEnergy(energyCost);
        // remove other instances of vindicate buff to override
        heartTarget.getCooldownManager().removeCooldownByName("Vindicate Debuff Immunity");
        heartTarget.getCooldownManager().addRegularCooldown("Vindicate Debuff Immunity", "VIND", HeartToHeart.class, tempHeartToHeart, wp, CooldownTypes.BUFF, cooldownManager -> {
        }, vindDuration * 20);
        wp.getCooldownManager().removeCooldownByName("Vindicate Debuff Immunity");
        wp.getCooldownManager().addRegularCooldown("Vindicate Debuff Immunity", "VIND", HeartToHeart.class, tempHeartToHeart, wp, CooldownTypes.BUFF, cooldownManager -> {
        }, vindDuration * 20);
        new BukkitRunnable() {

            final Location playerLoc = wp.getLocation();

            int timer = 0;

            @Override
            public void run() {
                timer++;
                if (timer >= 8 || (heartTarget.isDead() || wp.isDead())) {
                    this.cancel();
                }
                double target = timer / 8D;
                Location targetLoc = heartTarget.getLocation();
                Location newLocation = new Location(playerLoc.getWorld(), Utils.lerp(playerLoc.getX(), targetLoc.getX(), target), Utils.lerp(playerLoc.getY(), targetLoc.getY(), target), Utils.lerp(playerLoc.getZ(), targetLoc.getZ(), target), targetLoc.getYaw(), targetLoc.getPitch());
                EffectUtils.playChainAnimation(wp, heartTarget, new ItemStack(Material.LEAVES, 1, (short) 1), timer);
                wp.teleportLocationOnly(newLocation);
                player.setFallDistance(-5);
                newLocation.add(0, 1, 0);
                Matrix4d center = new Matrix4d(newLocation);
                for (float i = 0; i < 6; i++) {
                    double angle = Math.toRadians(i * 90) + timer * 0.6;
                    double width = 1.5D;
                    ParticleEffect.SPELL_WITCH.display(0, 0, 0, 0, 1, center.translateVector(playerLoc.getWorld(), 0, Math.sin(angle) * width, Math.cos(angle) * width), 500);
                }
                if (timer >= 8) {
                    wp.setVelocity(playerLoc.getDirection().multiply(0.4).setY(0.2));
                    wp.addHealingInstance(wp, name, 400, 400, -1, 100, false, false);
                }
            }
        }.runTaskTimer(Warlords.getInstance(), 0, 1);
        return true;
    }
    return false;
}
Also used : Matrix4d(com.ebicep.warlords.util.bukkit.Matrix4d) WarlordsPlayer(com.ebicep.warlords.player.WarlordsPlayer) BukkitRunnable(org.bukkit.scheduler.BukkitRunnable) ItemStack(org.bukkit.inventory.ItemStack) Location(org.bukkit.Location)

Example 7 with WarlordsPlayer

use of com.ebicep.warlords.player.WarlordsPlayer in project Warlords by ebicep.

the class HolyRadianceCrusader method chain.

@Override
public void chain(WarlordsPlayer wp, Player player) {
    for (WarlordsPlayer markTarget : PlayerFilter.entitiesAround(player, markRadius, markRadius, markRadius).aliveTeammatesOfExcludingSelf(wp).lookingAtFirst(wp).limit(1)) {
        if (Utils.isLookingAtMark(player, markTarget.getEntity()) && Utils.hasLineOfSight(player, markTarget.getEntity())) {
            wp.subtractEnergy(energyCost);
            Utils.playGlobalSound(player.getLocation(), "paladin.consecrate.activation", 2, 0.65f);
            PacketPlayOutAnimation playOutAnimation = new PacketPlayOutAnimation(((CraftPlayer) player).getHandle(), 0);
            ((CraftPlayer) player).getHandle().playerConnection.sendPacket(playOutAnimation);
            // chain particles
            EffectUtils.playParticleLinkAnimation(player.getLocation(), markTarget.getLocation(), 255, 170, 0, 1);
            EffectUtils.playChainAnimation(wp, markTarget, new ItemStack(Material.PUMPKIN), 20);
            HolyRadianceCrusader tempMark = new HolyRadianceCrusader(minDamageHeal, maxDamageHeal, cooldown, energyCost, critChance, critMultiplier);
            markTarget.getCooldownManager().addRegularCooldown(name, "CRUS MARK", HolyRadianceCrusader.class, tempMark, wp, CooldownTypes.BUFF, cooldownManager -> {
            }, markDuration * 20);
            markTarget.getSpeed().addSpeedModifier("Crusader Mark Speed", 25, 20 * markDuration, "BASE");
            player.sendMessage(WarlordsPlayer.RECEIVE_ARROW + ChatColor.GRAY + " You have marked " + ChatColor.YELLOW + markTarget.getName() + ChatColor.GRAY + "!");
            markTarget.sendMessage(WarlordsPlayer.RECEIVE_ARROW + ChatColor.GRAY + " You have been granted " + ChatColor.YELLOW + "Crusader's Mark" + ChatColor.GRAY + " by " + wp.getName() + "!");
            new GameRunnable(wp.getGame()) {

                @Override
                public void run() {
                    if (markTarget.getCooldownManager().hasCooldown(tempMark)) {
                        Location playerLoc = markTarget.getLocation();
                        Location particleLoc = playerLoc.clone();
                        for (int i = 0; i < 4; i++) {
                            for (int j = 0; j < 10; j++) {
                                double angle = j / 8D * Math.PI * 2;
                                double width = 1;
                                particleLoc.setX(playerLoc.getX() + Math.sin(angle) * width);
                                particleLoc.setY(playerLoc.getY() + i / 6D);
                                particleLoc.setZ(playerLoc.getZ() + Math.cos(angle) * width);
                                ParticleEffect.REDSTONE.display(new ParticleEffect.OrdinaryColor(255, 170, 0), particleLoc, 500);
                            }
                        }
                    } else {
                        this.cancel();
                    }
                }
            }.runTaskTimer(0, 10);
        } else {
            player.sendMessage("§cYour mark was out of range or you did not target a player!");
        }
    }
}
Also used : WarlordsPlayer(com.ebicep.warlords.player.WarlordsPlayer) GameRunnable(com.ebicep.warlords.util.warlords.GameRunnable) CraftPlayer(org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer) ItemStack(org.bukkit.inventory.ItemStack) PacketPlayOutAnimation(net.minecraft.server.v1_8_R3.PacketPlayOutAnimation) Location(org.bukkit.Location)

Example 8 with WarlordsPlayer

use of com.ebicep.warlords.player.WarlordsPlayer in project Warlords by ebicep.

the class IncendiaryCurse method onActivate.

@Override
public boolean onActivate(WarlordsPlayer wp, Player player) {
    wp.subtractEnergy(energyCost);
    Location location = player.getLocation();
    Vector speed = player.getLocation().getDirection().multiply(SPEED);
    ArmorStand stand = (ArmorStand) location.getWorld().spawnEntity(location, EntityType.ARMOR_STAND);
    stand.setHelmet(new ItemStack(Material.FIREBALL));
    stand.setGravity(false);
    stand.setVisible(false);
    new GameRunnable(wp.getGame()) {

        @Override
        public void run() {
            quarterStep(false);
            quarterStep(false);
            quarterStep(false);
            quarterStep(false);
            quarterStep(false);
            quarterStep(false);
            quarterStep(true);
        }

        private void quarterStep(boolean last) {
            if (!stand.isValid()) {
                this.cancel();
                return;
            }
            speed.add(new Vector(0, GRAVITY * SPEED, 0));
            Location newLoc = stand.getLocation();
            newLoc.add(speed);
            stand.teleport(newLoc);
            newLoc.add(0, 1.75, 0);
            stand.setHeadPose(new EulerAngle(-speed.getY() * 3, 0, 0));
            boolean shouldExplode;
            if (last) {
                ParticleEffect.FIREWORKS_SPARK.display(0.1f, 0.1f, 0.1f, 0.1f, 4, newLoc.clone().add(0, -1, 0), 500);
            }
            WarlordsPlayer directHit;
            if (!newLoc.getBlock().isEmpty() && newLoc.getBlock().getType() != Material.GRASS && newLoc.getBlock().getType() != Material.BARRIER && newLoc.getBlock().getType() != Material.VINE) {
                // Explode based on collision
                shouldExplode = true;
            } else {
                directHit = PlayerFilter.entitiesAroundRectangle(newLoc, 1, 2, 1).aliveEnemiesOf(wp).findFirstOrNull();
                shouldExplode = directHit != null;
            }
            if (shouldExplode) {
                stand.remove();
                Utils.playGlobalSound(newLoc, Sound.FIRE_IGNITE, 2, 0.1f);
                FireWorkEffectPlayer.playFirework(newLoc, FireworkEffect.builder().withColor(Color.ORANGE).withColor(Color.RED).with(FireworkEffect.Type.BURST).build());
                ParticleEffect.SMOKE_NORMAL.display(0.4f, 0.05f, 0.4f, 0.2f, 100, newLoc, 500);
                for (WarlordsPlayer nearEntity : PlayerFilter.entitiesAround(newLoc, HITBOX, HITBOX, HITBOX).aliveEnemiesOf(wp)) {
                    nearEntity.addDamageInstance(wp, name, minDamageHeal, maxDamageHeal, critChance, critMultiplier, false);
                    nearEntity.getEntity().addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, blindDurationInTicks, 0, true, false), true);
                    nearEntity.getEntity().addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, blindDurationInTicks, 0, true, false), true);
                }
                this.cancel();
            }
        }
    }.runTaskTimer(0, 1);
    Utils.playGlobalSound(player.getLocation(), "mage.frostbolt.activation", 2, 0.7f);
    return true;
}
Also used : ArmorStand(org.bukkit.entity.ArmorStand) GameRunnable(com.ebicep.warlords.util.warlords.GameRunnable) WarlordsPlayer(com.ebicep.warlords.player.WarlordsPlayer) PotionEffect(org.bukkit.potion.PotionEffect) ItemStack(org.bukkit.inventory.ItemStack) EulerAngle(org.bukkit.util.EulerAngle) Vector(org.bukkit.util.Vector)

Example 9 with WarlordsPlayer

use of com.ebicep.warlords.player.WarlordsPlayer in project Warlords by ebicep.

the class Inferno method onActivate.

@Override
public boolean onActivate(WarlordsPlayer wp, Player player) {
    Inferno tempInferno = new Inferno();
    wp.getCooldownManager().addCooldown(new RegularCooldown<Inferno>(name, "INFR", Inferno.class, tempInferno, wp, CooldownTypes.ABILITY, cooldownManager -> {
    }, duration * 20) {

        @Override
        public boolean distinct() {
            return true;
        }

        @Override
        public int addCritChanceFromAttacker(WarlordsDamageHealingEvent event, int currentCritChance) {
            if (event.getAbility().isEmpty() || event.getAbility().equals("Time Warp"))
                return currentCritChance;
            return currentCritChance + critChanceIncrease;
        }

        @Override
        public int addCritMultiplierFromAttacker(WarlordsDamageHealingEvent event, int currentCritMultiplier) {
            if (event.getAbility().isEmpty() || event.getAbility().equals("Time Warp"))
                return currentCritMultiplier;
            return currentCritMultiplier + critMultiplierIncrease;
        }
    });
    Utils.playGlobalSound(player.getLocation(), "mage.inferno.activation", 2, 1);
    new GameRunnable(wp.getGame()) {

        @Override
        public void run() {
            if (wp.getCooldownManager().hasCooldown(tempInferno)) {
                Location location = wp.getLocation();
                location.add(0, 1.2, 0);
                ParticleEffect.DRIP_LAVA.display(0.5F, 0.3F, 0.5F, 0.4F, 1, location, 500);
                ParticleEffect.FLAME.display(0.5F, 0.3F, 0.5F, 0.0001F, 1, location, 500);
                ParticleEffect.CRIT.display(0.5F, 0.3F, 0.5F, 0.0001F, 1, location, 500);
            } else {
                this.cancel();
            }
        }
    }.runTaskTimer(0, 3);
    return true;
}
Also used : Utils(com.ebicep.warlords.util.warlords.Utils) GameRunnable(com.ebicep.warlords.util.warlords.GameRunnable) RegularCooldown(com.ebicep.warlords.player.cooldowns.cooldowns.RegularCooldown) Location(org.bukkit.Location) WarlordsPlayer(com.ebicep.warlords.player.WarlordsPlayer) CooldownTypes(com.ebicep.warlords.player.cooldowns.CooldownTypes) Player(org.bukkit.entity.Player) AbstractAbility(com.ebicep.warlords.classes.AbstractAbility) WarlordsDamageHealingEvent(com.ebicep.warlords.events.WarlordsDamageHealingEvent) ParticleEffect(com.ebicep.warlords.effects.ParticleEffect) GameRunnable(com.ebicep.warlords.util.warlords.GameRunnable) WarlordsDamageHealingEvent(com.ebicep.warlords.events.WarlordsDamageHealingEvent) Location(org.bukkit.Location)

Example 10 with WarlordsPlayer

use of com.ebicep.warlords.player.WarlordsPlayer in project Warlords by ebicep.

the class LightningBolt method onHit.

@Override
protected void onHit(InternalProjectile projectile, WarlordsPlayer hit) {
    final Location currentLocation = projectile.getCurrentLocation();
    ParticleEffect.EXPLOSION_LARGE.display(0, 0, 0, 0.0F, 1, currentLocation, 500);
    Utils.playGlobalSound(currentLocation, "shaman.lightningbolt.impact", 2, 1);
    WarlordsPlayer wp = projectile.getShooter();
    for (WarlordsPlayer warlordsPlayer : PlayerFilter.entitiesAround(currentLocation, 3, 3, 3).aliveEnemiesOf(wp).excluding(projectile.getHit())) {
        // hitting player
        warlordsPlayer.addDamageInstance(wp, name, minDamageHeal, maxDamageHeal, critChance, critMultiplier, false);
        Utils.playGlobalSound(warlordsPlayer.getLocation(), "shaman.lightningbolt.impact", 2, 1);
        // reducing chain cooldown
        wp.getSpec().getRed().subtractCooldown(2);
        if (wp.getEntity() instanceof Player) {
            wp.updateRedItem((Player) wp.getEntity());
        }
    }
}
Also used : Player(org.bukkit.entity.Player) WarlordsPlayer(com.ebicep.warlords.player.WarlordsPlayer) WarlordsPlayer(com.ebicep.warlords.player.WarlordsPlayer) Location(org.bukkit.Location)

Aggregations

WarlordsPlayer (com.ebicep.warlords.player.WarlordsPlayer)80 GameRunnable (com.ebicep.warlords.util.warlords.GameRunnable)43 Location (org.bukkit.Location)37 Player (org.bukkit.entity.Player)36 Utils (com.ebicep.warlords.util.warlords.Utils)26 RegularCooldown (com.ebicep.warlords.player.cooldowns.cooldowns.RegularCooldown)21 PlayerFilter (com.ebicep.warlords.util.warlords.PlayerFilter)21 AbstractAbility (com.ebicep.warlords.classes.AbstractAbility)20 ParticleEffect (com.ebicep.warlords.effects.ParticleEffect)20 CooldownTypes (com.ebicep.warlords.player.cooldowns.CooldownTypes)20 WarlordsDamageHealingEvent (com.ebicep.warlords.events.WarlordsDamageHealingEvent)17 ItemStack (org.bukkit.inventory.ItemStack)16 ChatColor (org.bukkit.ChatColor)15 Nonnull (javax.annotation.Nonnull)14 Warlords (com.ebicep.warlords.Warlords)13 Nullable (javax.annotation.Nullable)13 Material (org.bukkit.Material)13 Vector (org.bukkit.util.Vector)13 List (java.util.List)11 CircleEffect (com.ebicep.warlords.effects.circle.CircleEffect)10