use of com.ebicep.warlords.effects.circle.CircumferenceEffect in project Warlords by ebicep.
the class Consecrate method onActivate.
@Override
public boolean onActivate(WarlordsPlayer wp, Player player) {
wp.subtractEnergy(energyCost);
Utils.playGlobalSound(player.getLocation(), "paladin.consecrate.activation", 2, 1);
Location location = player.getLocation().clone();
ArmorStand consecrate = player.getLocation().getWorld().spawn(player.getLocation().clone().add(0, -2, 0), ArmorStand.class);
consecrate.setMetadata("Consecrate - " + player.getName(), new FixedMetadataValue(Warlords.getInstance(), true));
consecrate.setGravity(false);
consecrate.setVisible(false);
consecrate.setMarker(true);
CircleEffect circleEffect = new CircleEffect(wp.getGame(), wp.getTeam(), location, radius, new CircumferenceEffect(ParticleEffect.VILLAGER_HAPPY, ParticleEffect.REDSTONE), new DoubleLineEffect(ParticleEffect.SPELL));
BukkitTask task = Bukkit.getScheduler().runTaskTimer(Warlords.getInstance(), circleEffect::playEffects, 0, 1);
new GameRunnable(wp.getGame()) {
int timeLeft = 5;
@Override
public void run() {
timeLeft--;
PlayerFilter.entitiesAround(location, radius, 6, radius).aliveEnemiesOf(wp).forEach(warlordsPlayer -> {
warlordsPlayer.addDamageInstance(wp, name, minDamageHeal, maxDamageHeal, critChance, critMultiplier, false);
});
if (timeLeft == 0) {
consecrate.remove();
this.cancel();
task.cancel();
}
}
}.runTaskTimer(0, 20);
return true;
}
use of com.ebicep.warlords.effects.circle.CircumferenceEffect in project Warlords by ebicep.
the class DeathsDebt method onActivation.
@Override
protected void onActivation(WarlordsPlayer wp, Player player, ArmorStand totemStand) {
final int ticksLeft = (4 + (2 * (int) Math.round((double) wp.getHealth() / wp.getMaxHealth()))) * 20;
DeathsDebt tempDeathsDebt = new DeathsDebt();
CircleEffect circle = new CircleEffect(wp, totemStand.getLocation().clone().add(0, 1.25, 0), respiteRadius);
circle.addEffect(new CircumferenceEffect(ParticleEffect.SPELL));
circle.addEffect(new DoubleLineEffect(ParticleEffect.REDSTONE));
BukkitTask particles = Bukkit.getScheduler().runTaskTimer(Warlords.getInstance(), circle::playEffects, 0, 1);
AtomicReference<RegularCooldown<DeathsDebt>> deathsDebtCooldown = new AtomicReference<>();
RegularCooldown<DeathsDebt> spiritRespiteCooldown = new RegularCooldown<DeathsDebt>("Spirits Respite", "RESP", DeathsDebt.class, tempDeathsDebt, wp, CooldownTypes.ABILITY, cooldownManagerRespite -> {
tempDeathsDebt.setInDebt(true);
// beginning debt
deathsDebtCooldown.set(new RegularCooldown<>(name, "DEBT", DeathsDebt.class, tempDeathsDebt, wp, CooldownTypes.ABILITY, cooldownManagerDebt -> {
// final damage tick
wp.getWorld().spigot().strikeLightningEffect(totemStand.getLocation(), false);
// Enemy damage
PlayerFilter.entitiesAround(totemStand, debtRadius, debtRadius - 1, debtRadius).aliveEnemiesOf(wp).forEach((nearPlayer) -> {
nearPlayer.addDamageInstance(wp, name, tempDeathsDebt.getDelayedDamage() * .15f, tempDeathsDebt.getDelayedDamage() * .15f, critChance, critMultiplier, false);
});
// 6 damage waves, stop the function
totemStand.remove();
particles.cancel();
}, 6 * 20));
wp.getCooldownManager().addCooldown(deathsDebtCooldown.get());
if (!tempDeathsDebt.playerInRadius) {
wp.sendMessage("§7You walked outside your §dDeath's Debt §7radius");
} else {
wp.sendMessage("§c\u00AB §2Spirit's Respite §7delayed §c" + Math.round(tempDeathsDebt.getDelayedDamage()) + " §7damage. §dYour debt must now be paid.");
}
circle.replaceEffects(e -> e instanceof DoubleLineEffect, new DoubleLineEffect(ParticleEffect.SPELL_WITCH));
circle.setRadius(debtRadius);
// blue to purple totem
totemStand.setHelmet(new ItemStack(Material.DARK_OAK_FENCE_GATE));
}, ticksLeft) {
@Override
public void onDamageFromSelf(WarlordsDamageHealingEvent event, float currentDamageValue, boolean isCrit) {
tempDeathsDebt.addDelayedDamage(currentDamageValue);
}
};
wp.getCooldownManager().addCooldown(spiritRespiteCooldown);
new GameRunnable(wp.getGame()) {
int counter = 0;
@Override
public void run() {
if (wp.isDead()) {
totemStand.remove();
particles.cancel();
this.cancel();
} else {
if (wp.getWorld() != totemStand.getWorld()) {
totemStand.remove();
particles.cancel();
this.cancel();
return;
}
boolean isPlayerInRadius = wp.getLocation().distanceSquared(totemStand.getLocation()) < respiteRadius * respiteRadius;
if (!isPlayerInRadius && wp.getCooldownManager().hasCooldown(tempDeathsDebt) && !tempDeathsDebt.isInDebt()) {
tempDeathsDebt.setInDebt(true);
tempDeathsDebt.setPlayerInRadius(false);
spiritRespiteCooldown.setTicksLeft(0);
}
// every second
if (counter % 20 == 0) {
if (!tempDeathsDebt.isInDebt()) {
// respite
Utils.playGlobalSound(totemStand.getLocation(), "shaman.earthlivingweapon.impact", 2, 1.5F);
wp.sendMessage(ChatColor.GREEN + "\u00BB §2Spirit's Respite §7delayed §c" + Math.round(tempDeathsDebt.getDelayedDamage()) + " §7damage. §6" + Math.round(spiritRespiteCooldown.getTicksLeft() / 20f) + " §7seconds left.");
} else {
// during debt
onDebtTick(wp, totemStand, tempDeathsDebt);
}
}
counter++;
if (deathsDebtCooldown.get() == null) {
return;
}
if (!wp.getCooldownManager().hasCooldown(deathsDebtCooldown.get())) {
totemStand.remove();
particles.cancel();
this.cancel();
}
}
}
}.runTaskTimer(2, 0);
}
use of com.ebicep.warlords.effects.circle.CircumferenceEffect in project Warlords by ebicep.
the class HealingRain method onActivate.
@Override
public boolean onActivate(WarlordsPlayer wp, Player player) {
if (player.getTargetBlock((Set<Material>) null, 25).getType() == Material.AIR)
return false;
Location location = player.getTargetBlock((Set<Material>) null, 25).getLocation().clone();
wp.subtractEnergy(energyCost);
wp.getCooldownManager().addRegularCooldown(name, "RAIN", HealingRain.class, new HealingRain(), wp, CooldownTypes.ABILITY, cooldownManager -> {
}, duration * 20);
wp.getSpec().getOrange().setCurrentCooldown((float) (cooldown * wp.getCooldownModifier()));
Utils.playGlobalSound(location, "mage.healingrain.impact", 2, 1);
CircleEffect circleEffect = new CircleEffect(wp.getGame(), wp.getTeam(), location, radius, new CircumferenceEffect(ParticleEffect.VILLAGER_HAPPY, ParticleEffect.REDSTONE), new AreaEffect(5, ParticleEffect.CLOUD).particlesPerSurface(0.025), new AreaEffect(5, ParticleEffect.DRIP_WATER).particlesPerSurface(0.025));
BukkitTask task = wp.getGame().registerGameTask(circleEffect::playEffects, 0, 1);
location.add(0, 1, 0);
BukkitTask rainSneakAbility = new GameRunnable(wp.getGame()) {
boolean wasSneaking = false;
@Override
public void run() {
if (wp.isAlive() && wp.isSneaking() && !wasSneaking) {
wp.playSound(wp.getLocation(), "mage.timewarp.teleport", 2, 1.35f);
wp.sendMessage(WarlordsPlayer.RECEIVE_ARROW + " §7You moved your §aHealing Rain §7to your current location.");
location.setX(wp.getLocation().getX());
location.setY(wp.getLocation().getY());
location.setZ(wp.getLocation().getZ());
}
wasSneaking = wp.isSneaking();
}
}.runTaskTimer(0, 0);
new GameRunnable(wp.getGame()) {
int counter = 0;
int timeLeft = duration;
@Override
public void run() {
if (counter % 10 == 0) {
for (WarlordsPlayer teammateInRain : PlayerFilter.entitiesAround(location, radius, radius, radius).aliveTeammatesOf(wp)) {
teammateInRain.addHealingInstance(wp, name, minDamageHeal, maxDamageHeal, critChance, critMultiplier, false, false);
if (teammateInRain != wp) {
teammateInRain.getCooldownManager().removeCooldown(Overheal.OVERHEAL_MARKER);
teammateInRain.getCooldownManager().addRegularCooldown("Overheal", "OVERHEAL", Overheal.class, Overheal.OVERHEAL_MARKER, wp, CooldownTypes.BUFF, cooldownManager -> {
}, Overheal.OVERHEAL_DURATION * 20);
}
}
if (timeLeft < 0) {
this.cancel();
task.cancel();
rainSneakAbility.cancel();
}
}
if (counter % 20 == 0) {
timeLeft--;
}
counter--;
}
}.runTaskTimer(0, 0);
return true;
}
use of com.ebicep.warlords.effects.circle.CircumferenceEffect in project Warlords by ebicep.
the class HealingTotem method onActivation.
@Override
protected void onActivation(WarlordsPlayer wp, Player player, ArmorStand totemStand) {
wp.getCooldownManager().addRegularCooldown(name, "TOTEM", HealingTotem.class, new HealingTotem(), wp, CooldownTypes.ABILITY, cooldownManager -> {
}, duration * 20);
new GameRunnable(wp.getGame()) {
int timeLeft = 5;
@Override
public void run() {
if (timeLeft != 0) {
Location initParticleLoc = totemStand.getLocation().clone().add(0, 1.6, 0);
ParticleEffect.VILLAGER_HAPPY.display(0.4F, 0.2F, 0.4F, 0.05F, 5, initParticleLoc, 500);
for (Player player1 : wp.getWorld().getPlayers()) {
player1.playSound(totemStand.getLocation(), "shaman.earthlivingweapon.impact", 2, 0.9f);
}
Location totemLoc = totemStand.getLocation();
totemLoc.add(0, 2, 0);
Location particleLoc = totemLoc.clone();
for (int i = 0; i < 1; i++) {
for (int j = 0; j < 12; j++) {
double angle = j / 10D * Math.PI * 2;
double width = radius;
particleLoc.setX(totemLoc.getX() + Math.sin(angle) * width);
particleLoc.setY(totemLoc.getY() + i / 2D);
particleLoc.setZ(totemLoc.getZ() + Math.cos(angle) * width);
ParticleEffect.FIREWORKS_SPARK.display(0, 0, 0, 0, 1, particleLoc, 500);
}
}
CircleEffect circle = new CircleEffect(wp.getGame(), wp.getTeam(), totemStand.getLocation().add(0, 1, 0), radius);
circle.addEffect(new CircumferenceEffect(ParticleEffect.VILLAGER_HAPPY, ParticleEffect.REDSTONE).particlesPerCircumference(1.5));
circle.playEffects();
// 1
// 1.35
// 1.7
// 2.05
// 2.4
// 2.85
float healMultiplier = 1 + (.35f * (5 - timeLeft));
PlayerFilter.entitiesAround(totemStand, radius, radius, radius).aliveTeammatesOf(wp).forEach((nearPlayer) -> {
nearPlayer.addHealingInstance(wp, name, minDamageHeal * healMultiplier, maxDamageHeal * healMultiplier, critChance, critMultiplier, false, false);
});
} else {
PlayerFilter.entitiesAround(totemStand, radius, radius, radius).aliveTeammatesOf(wp).forEach((nearPlayer) -> {
nearPlayer.addHealingInstance(wp, name, minDamageHeal * 3.1f, maxDamageHeal * 3.1f, critChance, critMultiplier, false, false);
});
Utils.playGlobalSound(totemStand.getLocation(), Sound.BLAZE_DEATH, 1.2f, 0.7f);
Utils.playGlobalSound(totemStand.getLocation(), "shaman.heal.impact", 2, 1);
new FallingBlockWaveEffect(totemStand.getLocation().clone().add(0, 1, 0), 3, 0.8, Material.SAPLING, (byte) 1).play();
totemStand.remove();
this.cancel();
}
timeLeft--;
}
}.runTaskTimer(0, 20);
new GameRunnable(wp.getGame()) {
int counter = 0;
@Override
public void run() {
if (wp.isDead() || counter >= 20 * duration) {
this.cancel();
} else if (wp.isSneaking()) {
PlayerFilter.entitiesAround(totemStand.getLocation(), radius, radius, radius).aliveEnemiesOf(wp).forEach((p) -> {
wp.sendMessage(WarlordsPlayer.RECEIVE_ARROW + ChatColor.GRAY + " Your Healing Totem has crippled " + ChatColor.YELLOW + p.getName() + ChatColor.GRAY + "!");
p.getCooldownManager().addCooldown(new RegularCooldown<HealingTotem>("Totem Crippling", "CRIP", HealingTotem.class, new HealingTotem(), wp, CooldownTypes.DEBUFF, cooldownManager -> {
}, crippleDuration * 20) {
@Override
public float modifyDamageBeforeInterveneFromAttacker(WarlordsDamageHealingEvent event, float currentDamageValue) {
return currentDamageValue * .75f;
}
});
});
Utils.playGlobalSound(totemStand.getLocation(), "paladin.hammeroflight.impact", 1.5f, 0.2f);
new FallingBlockWaveEffect(totemStand.getLocation().add(0, 1, 0), 7, 2, Material.SAPLING, (byte) 1).play();
this.cancel();
}
counter++;
}
}.runTaskTimer(0, 0);
}
use of com.ebicep.warlords.effects.circle.CircumferenceEffect in project Warlords by ebicep.
the class InterceptionPointOption method updateArmorstandsAndEffect.
private void updateArmorstandsAndEffect(ScoreboardHandler handler) {
Location clone = this.location.clone();
clone.add(0, -1.7, 0);
for (int i = middle.length - 1; i >= 0; i--) {
clone.add(0, this.captureProgress * 1 + 0.25, 0);
middle[i].teleport(clone);
ItemStack item = getItem(i == 0 ? this.inConflict ? null : this.teamAttacking : this.teamOwning);
if (!item.equals(middle[i].getHelmet())) {
middle[i].setHelmet(item);
}
}
double computedCurrentRadius = this.computeCurrentRadius();
if (this.effectPlayer == null || this.effectPlayer.getTeam() != teamOwning) {
this.effectPlayer = new CircleEffect(game, teamOwning, location, computedCurrentRadius);
this.effectPlayer.addEffect(new CircumferenceEffect(ParticleEffect.CRIT).particles(20));
}
if (this.effectPlayer.getRadius() != computedCurrentRadius) {
this.effectPlayer.setRadius(computedCurrentRadius);
}
}
Aggregations