mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01: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:
parent
2aec202e6d
commit
5b862a4cee
@ -17,6 +17,7 @@ Version 1.4.00-dev
|
||||
+ Added '/ptp toggle' command, to disable party teleportation.
|
||||
+ Added '/ptp accept' and '/ptp acceptall' commands
|
||||
+ Added timeout on party teleport requests
|
||||
+ Added XP bonus for Archery based on distance from shooter to target
|
||||
= Fixed Spout config files loading / generating when they shouldn't have
|
||||
= Fixed mod config files loading / generating when they shouldn't have
|
||||
= Fixed bug where Green Terra could activate on crops that weren't fully grown.
|
||||
|
@ -311,6 +311,7 @@ public final class Combat {
|
||||
}
|
||||
|
||||
if (target != shooter) {
|
||||
archeryManager.distanceXpBonus(target);
|
||||
startGainXp(shooter, archeryManager.getProfile(), target, SkillType.ARCHERY);
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ public class Archery {
|
||||
public static boolean pvpEnabled = Config.getInstance().getArcheryPVP();
|
||||
public static boolean pveEnabled = Config.getInstance().getArcheryPVE();
|
||||
|
||||
public static double distanceXpModifer = 0.1;
|
||||
protected static void incrementTrackerValue(LivingEntity livingEntity) {
|
||||
for (TrackedEntity trackedEntity : trackedEntities) {
|
||||
if (trackedEntity.getLivingEntity().getEntityId() == livingEntity.getEntityId()) {
|
||||
|
@ -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.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user