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:
GJ 2013-01-29 01:58:03 -05:00
parent 2aec202e6d
commit 5b862a4cee
4 changed files with 14 additions and 0 deletions

View File

@ -17,6 +17,7 @@ Version 1.4.00-dev
+ Added '/ptp toggle' command, to disable party teleportation. + Added '/ptp toggle' command, to disable party teleportation.
+ Added '/ptp accept' and '/ptp acceptall' commands + Added '/ptp accept' and '/ptp acceptall' commands
+ Added timeout on party teleport requests + 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 Spout config files loading / generating when they shouldn't have
= Fixed mod 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. = Fixed bug where Green Terra could activate on crops that weren't fully grown.

View File

@ -311,6 +311,7 @@ public final class Combat {
} }
if (target != shooter) { if (target != shooter) {
archeryManager.distanceXpBonus(target);
startGainXp(shooter, archeryManager.getProfile(), target, SkillType.ARCHERY); startGainXp(shooter, archeryManager.getProfile(), target, SkillType.ARCHERY);
} }
} }

View File

@ -29,6 +29,7 @@ public class Archery {
public static boolean pvpEnabled = Config.getInstance().getArcheryPVP(); public static boolean pvpEnabled = Config.getInstance().getArcheryPVP();
public static boolean pveEnabled = Config.getInstance().getArcheryPVE(); public static boolean pveEnabled = Config.getInstance().getArcheryPVE();
public static double distanceXpModifer = 0.1;
protected static void incrementTrackerValue(LivingEntity livingEntity) { protected static void incrementTrackerValue(LivingEntity livingEntity) {
for (TrackedEntity trackedEntity : trackedEntities) { for (TrackedEntity trackedEntity : trackedEntities) {
if (trackedEntity.getLivingEntity().getEntityId() == livingEntity.getEntityId()) { if (trackedEntity.getLivingEntity().getEntityId() == livingEntity.getEntityId()) {

View File

@ -1,10 +1,12 @@
package com.gmail.nossr50.skills.archery; package com.gmail.nossr50.skills.archery;
import org.bukkit.Location;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent;
import com.gmail.nossr50.skills.SkillManager; import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.skills.SkillTools;
import com.gmail.nossr50.skills.SkillType; import com.gmail.nossr50.skills.SkillType;
import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
@ -14,6 +16,15 @@ public class ArcheryManager extends SkillManager {
super(player, SkillType.ARCHERY); 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. * Track arrows fired for later retrieval.
* *