Only have 1 xp gain instance for archery.

This commit is contained in:
t00thpick1 2019-01-31 19:55:09 -05:00
parent a2f9ab70aa
commit cb89a80fd8
2 changed files with 5 additions and 5 deletions

View File

@ -52,15 +52,15 @@ public class ArcheryManager extends SkillManager {
* @param target The {@link LivingEntity} damaged by the arrow
* @param damager The {@link Entity} who shot the arrow
*/
public void distanceXpBonus(LivingEntity target, Entity damager) {
public double distanceXpBonusMultiplier(LivingEntity target, Entity damager) {
Location firedLocation = (Location) damager.getMetadata(mcMMO.arrowDistanceKey).get(0).value();
Location targetLocation = target.getLocation();
if (firedLocation.getWorld() != targetLocation.getWorld()) {
return;
return 1;
}
applyXpGain((int) (Math.min(firedLocation.distanceSquared(targetLocation), 2500) * Archery.DISTANCE_XP_MULTIPLIER), getXPGainReason(target, damager));
return 1 + Math.min(firedLocation.distance(targetLocation), 50) * Archery.DISTANCE_XP_MULTIPLIER;
}
/**

View File

@ -194,10 +194,10 @@ public final class CombatUtils {
archeryManager.retrieveArrows(target);
}
archeryManager.distanceXpBonus(target, arrow);
double distanceMultiplier = archeryManager.distanceXpBonusMultiplier(target, arrow);
applyScaledModifiers(initialDamage, finalDamage, event);
startGainXp(mcMMOPlayer, target, PrimarySkillType.ARCHERY, arrow.getMetadata(mcMMO.bowForceKey).get(0).asDouble());
startGainXp(mcMMOPlayer, target, PrimarySkillType.ARCHERY, arrow.getMetadata(mcMMO.bowForceKey).get(0).asDouble() * distanceMultiplier);
}
/**