mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-29 16:46:46 +01:00
Only have 1 xp gain instance for archery.
This commit is contained in:
parent
a2f9ab70aa
commit
cb89a80fd8
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user