Add bow force multiplier to Archery XP.

This commit is contained in:
GJ 2013-05-15 01:19:14 -04:00
parent 9ec376a228
commit 8d5696507a
6 changed files with 26 additions and 3 deletions

View File

@ -24,6 +24,7 @@ Version 1.4.06-dev
+ Added McMMOAbilityActivateEvent and McMMOAbilityDeactivateEvent
+ Added config options to toggle the size of fireworks
+ Added config option to multiply xp gains from mob spawner mobs
+ Added multiplier to Archery XP based on bow force
= Fixed bug where players were able to join the same party multiple times
= Fixed displaying partial names when trying to use /ptp
= Fixed wolves from Call of the Wild only having 8 health

View File

@ -52,6 +52,8 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
public double getRetrieveChanceMax() { return config.getDouble("Skills.Archery.Retrieve_MaxBonus", 100.0D); }
public int getRetrieveMaxBonusLevel() { return config.getInt("Skills.Archery.Retrieve_MaxBonusLevel", 1000); }
public double getForceMultiplier() { return config.getDouble("Skills.Archery.Force_Multiplier", 2.0D); }
/* AXES */
public int getBonusDamageAxesBonusMax() { return config.getInt("Skills.Axes.DamageIncrease_MaxBonus", 4); }
public int getBonusDamageAxesMaxBonusLevel() { return config.getInt("Skills.Axes.DamageIncrease_MaxBonusLevel", 200); }

View File

@ -4,6 +4,7 @@ import org.bukkit.OfflinePlayer;
import org.bukkit.block.Block;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.AnimalTamer;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity;
import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.LivingEntity;
@ -28,8 +29,10 @@ import org.bukkit.event.entity.EntityTargetEvent;
import org.bukkit.event.entity.ExplosionPrimeEvent;
import org.bukkit.event.entity.FoodLevelChangeEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.metadata.FixedMetadataValue;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.events.fake.FakeEntityDamageByEntityEvent;
import com.gmail.nossr50.events.fake.FakeEntityDamageEvent;
@ -59,7 +62,12 @@ public class EntityListener implements Listener {
ItemStack bow = event.getBow();
if (bow != null && bow.containsEnchantment(Enchantment.ARROW_INFINITE)) {
event.getProjectile().setMetadata(mcMMO.infiniteArrowKey, mcMMO.metadataValue);
Entity projectile = event.getProjectile();
if (projectile instanceof Arrow) {
projectile.setMetadata(mcMMO.infiniteArrowKey, mcMMO.metadataValue);
projectile.setMetadata(mcMMO.bowForceKey, new FixedMetadataValue(plugin, Math.min(event.getForce() * AdvancedConfig.getInstance().getForceMultiplier(), 1.0)));
}
}
}

View File

@ -95,6 +95,7 @@ public class mcMMO extends JavaPlugin {
public final static String customVisibleKey = "mcMMO: Name Visibility";
public final static String droppedItemKey = "mcMMO: Tracked Item";
public final static String infiniteArrowKey = "mcMMO: Infinite Arrow";
public final static String bowForceKey = "mcMMO: Bow Force";
public static FixedMetadataValue metadataValue;

View File

@ -250,7 +250,9 @@ public final class CombatUtils {
}
archeryManager.distanceXpBonus(target);
startGainXp(mcMMOPlayer, target, SkillType.ARCHERY);
double forceMultiplier = damager.hasMetadata(mcMMO.bowForceKey) ? damager.getMetadata(mcMMO.bowForceKey).get(0).asDouble() : 1.0;
startGainXp(mcMMOPlayer, target, SkillType.ARCHERY, forceMultiplier);
}
break;
@ -424,6 +426,10 @@ public final class CombatUtils {
}
}
public static void startGainXp(McMMOPlayer mcMMOPlayer, LivingEntity target, SkillType skillType) {
startGainXp(mcMMOPlayer, target, skillType, 1.0);
}
/**
* Start the task that gives combat XP.
*
@ -431,7 +437,7 @@ public final class CombatUtils {
* @param target The defending entity
* @param skillType The skill being used
*/
public static void startGainXp(McMMOPlayer mcMMOPlayer, LivingEntity target, SkillType skillType) {
public static void startGainXp(McMMOPlayer mcMMOPlayer, LivingEntity target, SkillType skillType, double multiplier) {
double baseXP = 0;
if (target instanceof Player) {
@ -514,6 +520,8 @@ public final class CombatUtils {
baseXP *= 10;
}
baseXP *= multiplier;
if (baseXP != 0) {
new AwardCombatXpTask(mcMMOPlayer, skillType, baseXP, target).runTaskLater(mcMMO.p, 0);
}

View File

@ -71,6 +71,9 @@ Skills:
# Retrieve_MaxBonusLevel: Maximum bonus level for Arrow retrieval, at this level the chance of retrieving arrows from mobs is Retrieve_MaxBonus
Retrieve_MaxChance: 100.0
Retrieve_MaxBonusLevel: 1000
#Force_Multiplier: Multiply the force of the bow by this for an XP boost.
Force_Multiplier: 2.0
#
# Settings for Axes
###