@Override public SkillResult use(Hero paramHero, String[] paramArrayOfString) { final Player localPlayer = paramHero.getPlayer(); Location localLocation1 = localPlayer.getLocation(); int distance = (int) (SkillConfigManager.getUseSetting( paramHero, this, SkillSetting.MAX_DISTANCE.node(), 15, false) + (SkillConfigManager.getUseSetting( paramHero, this, SkillSetting.MAX_DISTANCE_INCREASE.node(), 0.0, false) * paramHero.getSkillLevel(this))); distance = distance > 0 ? distance : 0; Location localLocation2 = null; try { localLocation2 = localPlayer.getTargetBlock(null, distance).getLocation(); } catch (IllegalArgumentException iae) { return SkillResult.INVALID_TARGET_NO_MSG; } double d1 = localLocation2.getX() - localLocation1.getX(); double d2 = localLocation2.getZ() - localLocation1.getZ(); double d3 = Math.sqrt(d1 * d1 + d2 * d2); double d4 = 0; try { d4 = localLocation2.distance(localLocation1) / 8.0D; } catch (IllegalArgumentException iae) { return SkillResult.INVALID_TARGET_NO_MSG; } d1 = d1 / d3 * d4; d2 = d2 / d3 * d4; localPlayer.setVelocity(new Vector(d1, 1.0D, d2)); this.chargingPlayers.put(localPlayer, localLocation1); this.plugin .getServer() .getScheduler() .scheduleSyncDelayedTask( this.plugin, new Runnable() { @Override public void run() { localPlayer.setFallDistance(8.0F); } }, 1L); broadcastExecuteText(paramHero); return SkillResult.NORMAL; }
@Override public ConfigurationSection getDefaultConfig() { ConfigurationSection localConfigurationSection = super.getDefaultConfig(); localConfigurationSection.set("stun-duration", 5000); localConfigurationSection.set("slow-duration", 0); localConfigurationSection.set("root-duration", 0); localConfigurationSection.set("silence-duration", 0); localConfigurationSection.set("invuln-duration", 0); localConfigurationSection.set("duration-increase", 0); localConfigurationSection.set(SkillSetting.DAMAGE.node(), 0); localConfigurationSection.set("damage-increase", 0); localConfigurationSection.set(SkillSetting.RADIUS.node(), 2); localConfigurationSection.set(SkillSetting.RADIUS_INCREASE.node(), 0); localConfigurationSection.set(SkillSetting.MAX_DISTANCE.node(), 15); localConfigurationSection.set(SkillSetting.MAX_DISTANCE_INCREASE.node(), 0); localConfigurationSection.set(SkillSetting.USE_TEXT.node(), "%hero% used %skill%!"); localConfigurationSection.set("damage-per-block-traveled", 0.1); localConfigurationSection.set("mana-per-block-traveled", 0.5); return localConfigurationSection; }
@Override public String getDescription(Hero hero) { long stunDuration = (long) SkillConfigManager.getUseSetting(hero, this, "stun-duration", 10000, false); if (stunDuration > 0) { stunDuration = (long) (stunDuration + (SkillConfigManager.getUseSetting( hero, this, "duration-increase", 0.0, false) * hero.getSkillLevel(this))) / 1000; stunDuration = stunDuration > 0 ? stunDuration : 0; } long slowDuration = (long) SkillConfigManager.getUseSetting(hero, this, "slow-duration", 0, false); if (slowDuration > 0) { slowDuration = (long) (slowDuration + (SkillConfigManager.getUseSetting( hero, this, "duration-increase", 0.0, false) * hero.getSkillLevel(this))) / 1000; slowDuration = slowDuration > 0 ? slowDuration : 0; } long rootDuration = (long) SkillConfigManager.getUseSetting(hero, this, "root-duration", 0, false); if (rootDuration > 0) { rootDuration = (long) (rootDuration + (SkillConfigManager.getUseSetting( hero, this, "duration-increase", 0.0, false) * hero.getSkillLevel(this))) / 1000; rootDuration = rootDuration > 0 ? rootDuration : 0; } long silenceDuration = (long) SkillConfigManager.getUseSetting(hero, this, "silence-duration", 0, false); if (silenceDuration > 0) { silenceDuration = (long) (silenceDuration + (SkillConfigManager.getUseSetting( hero, this, "duration-increase", 0.0, false) * hero.getSkillLevel(this))) / 1000; silenceDuration = silenceDuration > 0 ? silenceDuration : 0; } long invulnDuration = (long) SkillConfigManager.getUseSetting(hero, this, "invuln-duration", 0, false); if (invulnDuration > 0) { invulnDuration = (long) (invulnDuration + (SkillConfigManager.getUseSetting( hero, this, "duration-increase", 0.0, false) * hero.getSkillLevel(this))) / 1000; invulnDuration = invulnDuration > 0 ? invulnDuration : 0; } int damage = (int) (SkillConfigManager.getUseSetting(hero, this, SkillSetting.DAMAGE.node(), 0, false) + (SkillConfigManager.getUseSetting(hero, this, "damage-increase", 0.0, false) * hero.getSkillLevel(this))); damage = damage > 0 ? damage : 0; int radius = (int) (SkillConfigManager.getUseSetting(hero, this, SkillSetting.RADIUS.node(), 2, false) + (SkillConfigManager.getUseSetting( hero, this, SkillSetting.RADIUS_INCREASE.node(), 0.0, false) * hero.getSkillLevel(this))); radius = radius > 0 ? radius : 0; int distance = (int) (SkillConfigManager.getUseSetting( hero, this, SkillSetting.MAX_DISTANCE.node(), 15, false) + (SkillConfigManager.getUseSetting( hero, this, SkillSetting.MAX_DISTANCE_INCREASE.node(), 0.0, false) * hero.getSkillLevel(this))); distance = distance > 0 ? distance : 0; String description = getDescription() .replace("$1", damage + "") .replace("$2", radius + "") .replace("$3", distance + ""); if (stunDuration > 0) { description += " Stun:" + stunDuration + "s"; } if (slowDuration > 0) { description += " Slow:" + slowDuration + "s"; } if (rootDuration > 0) { description += " Root:" + rootDuration + "s"; } if (silenceDuration > 0) { description += " Silence:" + silenceDuration + "s"; } if (invulnDuration > 0) { description += " Invuln:" + invulnDuration + "s"; } // COOLDOWN int cooldown = (SkillConfigManager.getUseSetting(hero, this, SkillSetting.COOLDOWN.node(), 0, false) - SkillConfigManager.getUseSetting( hero, this, SkillSetting.COOLDOWN_REDUCE.node(), 0, false) * hero.getSkillLevel(this)) / 1000; if (cooldown > 0) { description += " CD:" + cooldown + "s"; } // MANA int mana = SkillConfigManager.getUseSetting(hero, this, SkillSetting.MANA.node(), 10, false) - (SkillConfigManager.getUseSetting( hero, this, SkillSetting.MANA_REDUCE.node(), 0, false) * hero.getSkillLevel(this)); if (mana > 0) { description += " M:" + mana; } // HEALTH_COST int healthCost = SkillConfigManager.getUseSetting(hero, this, SkillSetting.HEALTH_COST, 0, false) - (SkillConfigManager.getUseSetting( hero, this, SkillSetting.HEALTH_COST_REDUCE, mana, true) * hero.getSkillLevel(this)); if (healthCost > 0) { description += " HP:" + healthCost; } // STAMINA int staminaCost = SkillConfigManager.getUseSetting(hero, this, SkillSetting.STAMINA.node(), 0, false) - (SkillConfigManager.getUseSetting( hero, this, SkillSetting.STAMINA_REDUCE.node(), 0, false) * hero.getSkillLevel(this)); if (staminaCost > 0) { description += " FP:" + staminaCost; } // DELAY int delay = SkillConfigManager.getUseSetting(hero, this, SkillSetting.DELAY.node(), 0, false) / 1000; if (delay > 0) { description += " W:" + delay + "s"; } // EXP int exp = SkillConfigManager.getUseSetting(hero, this, SkillSetting.EXP.node(), 0, false); if (exp > 0) { description += " XP:" + exp; } return description; }