use of com.ebicep.warlords.events.WarlordsDamageHealingEvent in project Warlords by ebicep.
the class Berserk method onActivate.
@Override
public boolean onActivate(WarlordsPlayer wp, Player player) {
Berserk tempBerserk = new Berserk();
wp.subtractEnergy(energyCost);
Runnable cancelSpeed = wp.getSpeed().addSpeedModifier(name, speedBuff, duration * 20, "BASE");
wp.getCooldownManager().addCooldown(new RegularCooldown<Berserk>(name, "BERS", Berserk.class, tempBerserk, wp, CooldownTypes.ABILITY, cooldownManager -> {
}, duration * 20) {
@Override
public float modifyDamageBeforeInterveneFromSelf(WarlordsDamageHealingEvent event, float currentDamageValue) {
return currentDamageValue * (1 + damageTakenIncrease / 100);
}
@Override
public float modifyDamageBeforeInterveneFromAttacker(WarlordsDamageHealingEvent event, float currentDamageValue) {
return currentDamageValue * (1 + damageIncrease / 100);
}
});
Utils.playGlobalSound(player.getLocation(), "warrior.berserk.activation", 2, 1);
new GameRunnable(wp.getGame()) {
@Override
public void run() {
if (wp.getCooldownManager().hasCooldown(tempBerserk)) {
Location location = wp.getLocation();
location.add(0, 2.1, 0);
ParticleEffect.VILLAGER_ANGRY.display(0, 0, 0, 0.1F, 1, location, 500);
} else {
cancelSpeed.run();
this.cancel();
}
}
}.runTaskTimer(0, 3);
return true;
}
use of com.ebicep.warlords.events.WarlordsDamageHealingEvent 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;
}
use of com.ebicep.warlords.events.WarlordsDamageHealingEvent in project Warlords by ebicep.
the class OrderOfEviscerate method onActivate.
@Override
public boolean onActivate(@Nonnull WarlordsPlayer wp, @Nonnull Player player) {
wp.subtractEnergy(energyCost);
wp.getCooldownManager().removeCooldown(OrderOfEviscerate.class);
wp.getCooldownManager().addCooldown(new RegularCooldown<OrderOfEviscerate>("Order of Eviscerate", "ORDER", OrderOfEviscerate.class, new OrderOfEviscerate(), wp, CooldownTypes.ABILITY, cooldownManager -> {
}, duration * 20) {
@Override
public void doBeforeReductionFromSelf(WarlordsDamageHealingEvent event) {
OrderOfEviscerate.removeCloak(wp, false);
}
@Override
public void doBeforeReductionFromAttacker(WarlordsDamageHealingEvent event) {
// mark message here so it displays before damage
WarlordsPlayer victim = event.getPlayer();
if (!Objects.equals(this.getCooldownObject().getMarkedPlayer(), victim)) {
wp.sendMessage(WarlordsPlayer.RECEIVE_ARROW + ChatColor.GRAY + " You have marked §e" + victim.getName());
}
this.getCooldownObject().setMarkedPlayer(victim);
}
@Override
public float modifyDamageBeforeInterveneFromAttacker(WarlordsDamageHealingEvent event, float currentDamageValue) {
if (this.getCooldownObject().getMarkedPlayer().equals(event.getPlayer()) && !Utils.isLineOfSightAssassin(event.getPlayer().getEntity(), event.getAttacker().getEntity())) {
return currentDamageValue * 1.25f;
}
return currentDamageValue;
}
@Override
public void onDeathFromEnemies(WarlordsDamageHealingEvent event, float currentDamageValue, boolean isCrit, boolean isKiller) {
wp.getCooldownManager().removeCooldown(OrderOfEviscerate.class);
wp.getCooldownManager().removeCooldownByName("Cloaked");
if (isKiller) {
wp.sendMessage(WarlordsPlayer.RECEIVE_ARROW + ChatColor.GRAY + " You killed your mark," + ChatColor.YELLOW + " your cooldowns have been reset" + ChatColor.GRAY + "!");
new GameRunnable(wp.getGame()) {
@Override
public void run() {
wp.getSpec().getPurple().setCurrentCooldown(0);
wp.getSpec().getOrange().setCurrentCooldown(0);
wp.updatePurpleItem();
wp.updateOrangeItem();
wp.subtractEnergy(-wp.getSpec().getOrange().getEnergyCost());
}
}.runTaskLater(2);
} else {
new GameRunnable(wp.getGame()) {
@Override
public void run() {
wp.sendMessage(WarlordsPlayer.RECEIVE_ARROW + ChatColor.GRAY + " You assisted in killing your mark," + ChatColor.YELLOW + " your cooldowns have been reduced by half" + ChatColor.GRAY + "!");
wp.getSpec().getPurple().setCurrentCooldown(wp.getSpec().getPurple().getCurrentCooldown() / 2);
wp.getSpec().getOrange().setCurrentCooldown(wp.getSpec().getOrange().getCurrentCooldown() / 2);
wp.updatePurpleItem();
wp.updateOrangeItem();
wp.subtractEnergy(-wp.getSpec().getOrange().getEnergyCost() / 2);
}
}.runTaskLater(2);
}
if (wp.getEntity() instanceof Player) {
((Player) wp.getEntity()).playSound(wp.getLocation(), Sound.AMBIENCE_THUNDER, 1, 2);
}
}
});
if (!FlagHolder.isPlayerHolderFlag(wp)) {
wp.getCooldownManager().removeCooldownByName("Cloaked");
wp.getCooldownManager().addRegularCooldown("Cloaked", "INVIS", OrderOfEviscerate.class, new OrderOfEviscerate(), wp, CooldownTypes.BUFF, cooldownManager -> {
}, duration * 20);
player.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, duration * 20, 0, true, false), true);
wp.updateArmor();
PlayerFilter.playingGame(wp.getGame()).enemiesOf(wp).forEach(warlordsPlayer -> {
LivingEntity livingEntity = warlordsPlayer.getEntity();
if (livingEntity instanceof Player) {
((Player) livingEntity).hidePlayer(player);
}
});
}
Runnable cancelSpeed = wp.getSpeed().addSpeedModifier("Order of Eviscerate", 40, duration * 20, "BASE");
Utils.playGlobalSound(player.getLocation(), Sound.GHAST_FIREBALL, 2, 0.7f);
new GameRunnable(wp.getGame()) {
@Override
public void run() {
if (!wp.getCooldownManager().hasCooldown(OrderOfEviscerate.class)) {
this.cancel();
// wp.setMarkedTarget(null);
cancelSpeed.run();
removeCloak(wp, true);
} else {
ParticleEffect.SMOKE_NORMAL.display(0.01f, 0.28f, 0.01f, 0.05f, 6, wp.getLocation(), 500);
Utils.playGlobalSound(wp.getLocation(), Sound.AMBIENCE_CAVE, 0.08f, 2);
}
}
}.runTaskTimer(0, 1);
return true;
}
use of com.ebicep.warlords.events.WarlordsDamageHealingEvent in project Warlords by ebicep.
the class PrismGuard method onActivate.
@Override
public boolean onActivate(@Nonnull WarlordsPlayer wp, @Nonnull Player player) {
wp.subtractEnergy(energyCost);
PrismGuard tempWideGuard = new PrismGuard();
Set<WarlordsPlayer> isInsideBubble = new HashSet<>();
wp.getCooldownManager().addCooldown(new RegularCooldown<PrismGuard>("Prism Guard", "GUARD", PrismGuard.class, tempWideGuard, wp, CooldownTypes.ABILITY, cooldownManager -> {
}, duration * 20) {
@Override
public float modifyDamageAfterInterveneFromSelf(WarlordsDamageHealingEvent event, float currentDamageValue) {
String ability = event.getAbility();
if (ability.equals("Fireball") || ability.equals("Frostbolt") || ability.equals("Water Bolt") || ability.equals("Lightning Bolt") || ability.equals("Flame Burst") || ability.equals("Fallen Souls")) {
if (isInsideBubble.contains(event.getAttacker())) {
return currentDamageValue;
} else {
return currentDamageValue * .4f;
}
} else {
return currentDamageValue * .75f;
}
}
});
Utils.playGlobalSound(wp.getLocation(), "mage.timewarp.teleport", 2, 2);
Utils.playGlobalSound(player.getLocation(), "warrior.intervene.impact", 2, 0.1f);
// First Particle Sphere
playSphereAnimation(wp.getLocation(), bubbleRadius + 2.5, 68, 176, 176);
// Second Particle Sphere
new GameRunnable(wp.getGame()) {
@Override
public void run() {
playSphereAnimation(wp.getLocation(), bubbleRadius + 1, 65, 185, 185);
Utils.playGlobalSound(wp.getLocation(), "warrior.intervene.impact", 2, 0.2f);
}
}.runTaskLater(3);
HashMap<WarlordsPlayer, Integer> timeInBubble = new HashMap<>();
// Third Particle Sphere
new GameRunnable(wp.getGame()) {
@Override
public void run() {
if (wp.getCooldownManager().hasCooldown(tempWideGuard)) {
playSphereAnimation(wp.getLocation(), bubbleRadius, 190, 190, 190);
Utils.playGlobalSound(wp.getLocation(), Sound.CREEPER_DEATH, 2, 2);
timeInBubble.compute(wp, (k, v) -> v == null ? 1 : v + 1);
isInsideBubble.clear();
for (WarlordsPlayer enemyInsideBubble : PlayerFilter.entitiesAround(wp, bubbleRadius, bubbleRadius, bubbleRadius).aliveEnemiesOf(wp)) {
isInsideBubble.add(enemyInsideBubble);
}
for (WarlordsPlayer bubblePlayer : PlayerFilter.entitiesAround(wp, bubbleRadius, bubbleRadius, bubbleRadius).aliveTeammatesOfExcludingSelf(wp)) {
bubblePlayer.getCooldownManager().removeCooldown(PrismGuard.class);
bubblePlayer.getCooldownManager().addCooldown(new RegularCooldown<PrismGuard>("Prism Guard", "GUARD", PrismGuard.class, tempWideGuard, wp, CooldownTypes.ABILITY, cooldownManager -> {
}, 20) {
@Override
public float modifyDamageAfterInterveneFromSelf(WarlordsDamageHealingEvent event, float currentDamageValue) {
String ability = event.getAbility();
if (ability.equals("Fireball") || ability.equals("Frostbolt") || ability.equals("Water Bolt") || ability.equals("Lightning Bolt") || ability.equals("Flame Burst") || ability.equals("Fallen Souls")) {
if (isInsideBubble.contains(event.getAttacker())) {
return currentDamageValue;
} else {
return currentDamageValue * .4f;
}
} else {
return currentDamageValue * .75f;
}
}
});
timeInBubble.compute(bubblePlayer, (k, v) -> v == null ? 1 : v + 1);
}
} else {
this.cancel();
Utils.playGlobalSound(wp.getLocation(), "paladin.holyradiance.activation", 2, 1.4f);
Utils.playGlobalSound(wp.getLocation(), Sound.AMBIENCE_THUNDER, 2, 1.5f);
for (Map.Entry<WarlordsPlayer, Integer> entry : timeInBubble.entrySet()) {
// 5% missing health * 4
float healingValue = 150 + (entry.getKey().getMaxHealth() - entry.getKey().getHealth()) * 0.05f;
int timeInSeconds = entry.getValue() * 4 / 20;
float totalHealing = (timeInSeconds * healingValue);
entry.getKey().addHealingInstance(wp, name, totalHealing, totalHealing, -1, 100, false, false);
}
CircleEffect circle = new CircleEffect(wp.getGame(), wp.getTeam(), wp.getLocation(), bubbleRadius);
circle.addEffect(new CircumferenceEffect(ParticleEffect.SPELL).particlesPerCircumference(2));
circle.playEffects();
}
}
}.runTaskTimer(5, 4);
return true;
}
use of com.ebicep.warlords.events.WarlordsDamageHealingEvent in project Warlords by ebicep.
the class Repentance method onActivate.
@Override
public boolean onActivate(WarlordsPlayer wp, Player player) {
wp.subtractEnergy(energyCost);
WarlordsPlayer warlordsPlayer = Warlords.getPlayer(player);
pool += 2000;
assert warlordsPlayer != null;
warlordsPlayer.getCooldownManager().addCooldown(new RegularCooldown<Repentance>(name, "REPE", Repentance.class, new Repentance(), warlordsPlayer, CooldownTypes.ABILITY, cooldownManager -> {
}, duration * 20) {
@Override
public boolean distinct() {
return true;
}
@Override
public void onDamageFromAttacker(WarlordsDamageHealingEvent event, float currentDamageValue, boolean isCrit) {
WarlordsPlayer attacker = event.getAttacker();
if (attacker.getSpec() instanceof Spiritguard) {
Repentance repentance = (Repentance) attacker.getSpec().getBlue();
int healthToAdd = (int) (repentance.getPool() * (repentance.getDamageConvertPercent() / 100f)) + 10;
attacker.addHealingInstance(attacker, "Repentance", healthToAdd, healthToAdd, -1, 100, false, false);
repentance.setPool(repentance.getPool() * .5f);
attacker.addEnergy(attacker, "Repentance", (float) (healthToAdd * .035));
}
}
});
Utils.playGlobalSound(player.getLocation(), "paladin.barrieroflight.impact", 2, 1.35f);
EffectUtils.playCylinderAnimation(player, 1, 255, 255, 255);
return true;
}
Aggregations