mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-07-01 13:14:44 +02:00
Added XP bonus for Archery based on distance from shooter to target. The
farther you are from your target, the more bonus XP you'll earn.
This commit is contained in:
@ -1,10 +1,12 @@
|
||||
package com.gmail.nossr50.skills.archery;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.skills.SkillTools;
|
||||
import com.gmail.nossr50.skills.SkillType;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
@ -14,6 +16,15 @@ public class ArcheryManager extends SkillManager {
|
||||
super(player, SkillType.ARCHERY);
|
||||
}
|
||||
|
||||
public void distanceXpBonus(LivingEntity target) {
|
||||
Location shooterLocation = player.getEyeLocation();
|
||||
Location targetLocation = target.getLocation();
|
||||
double distance = shooterLocation.distance(targetLocation);
|
||||
|
||||
int bonusXp = (int) (distance * Archery.distanceXpModifer);
|
||||
SkillTools.xpProcessing(player, profile, SkillType.ARCHERY, bonusXp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Track arrows fired for later retrieval.
|
||||
*
|
||||
|
Reference in New Issue
Block a user