From f40433fc9921a772e5423ac56809011630541e39 Mon Sep 17 00:00:00 2001 From: GJ Date: Tue, 15 Jan 2013 16:16:46 -0500 Subject: [PATCH 1/5] Axe restructuring. --- .../nossr50/commands/skills/AxesCommand.java | 25 ++-- .../gmail/nossr50/skills/axes/AxeManager.java | 23 ++++ .../com/gmail/nossr50/skills/axes/Axes.java | 122 +----------------- .../skills/axes/ImpactEventHandler.java | 104 +++++++++++++++ .../mining/SuperBreakerEventHandler.java | 2 +- .../java/com/gmail/nossr50/util/Combat.java | 6 +- .../java/com/gmail/nossr50/util/Misc.java | 22 +++- 7 files changed, 164 insertions(+), 140 deletions(-) create mode 100644 src/main/java/com/gmail/nossr50/skills/axes/ImpactEventHandler.java diff --git a/src/main/java/com/gmail/nossr50/commands/skills/AxesCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/AxesCommand.java index 7bc3b9109..ee7060950 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/AxesCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/AxesCommand.java @@ -6,6 +6,7 @@ import com.gmail.nossr50.commands.SkillCommand; import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.locale.LocaleLoader; +import com.gmail.nossr50.skills.axes.Axes; import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Permissions; @@ -20,14 +21,6 @@ public class AxesCommand extends SkillCommand { private String skullSplitterLength; private String skullSplitterLengthEndurance; - private int bonusDamageAxesBonusMax = advancedConfig.getBonusDamageAxesBonusMax(); - private int bonusDamageAxesMaxBonusLevel = advancedConfig.getBonusDamageAxesMaxBonusLevel(); - private double critMaxChance = advancedConfig.getAxesCriticalChance(); - private int critMaxBonusLevel = advancedConfig.getAxesCriticalMaxBonusLevel(); - private int greaterImpactIncreaseLevel = advancedConfig.getArmorImpactIncreaseLevel(); - private double greaterImpactBonusDamage = advancedConfig.getGreaterImpactBonusDamage(); - private int abilityLengthIncreaseLevel = advancedConfig.getAbilityLength(); - private boolean canSkullSplitter; private boolean canCritical; private boolean canBonusDamage; @@ -43,12 +36,12 @@ public class AxesCommand extends SkillCommand { @Override protected void dataCalculations() { float critChanceF; - int skillCheck = Misc.skillCheck((int)skillValue, critMaxBonusLevel); + int skillCheck = Misc.skillCheck((int) skillValue, Axes.criticalHitMaxBonusLevel); //Armor Impact - impactDamage = String.valueOf(1 + ((double) skillValue / (double) greaterImpactIncreaseLevel)); + impactDamage = String.valueOf(1 + ((double) skillValue / (double) Axes.impactIncreaseLevel)); //Skull Splitter - int length = 2 + (int) ((double) skillValue / (double) abilityLengthIncreaseLevel); + int length = 2 + (int) ((double) skillValue / (double) Misc.abilityLengthIncreaseLevel); skullSplitterLength = String.valueOf(length); if (Permissions.activationTwelve(player)) { @@ -67,16 +60,16 @@ public class AxesCommand extends SkillCommand { skullSplitterLengthEndurance = String.valueOf(length); //Greater Impact - greaterImpactDamage = String.valueOf(greaterImpactBonusDamage); + greaterImpactDamage = String.valueOf(Axes.greaterImpactBonusDamage); //Critical Strikes - if (skillValue >= critMaxBonusLevel) critChanceF = (float) critMaxChance; - else critChanceF = (float) ((critMaxChance / critMaxBonusLevel) * skillCheck); + if (skillValue >= Axes.criticalHitMaxBonusLevel) critChanceF = (float) Axes.criticalHitMaxChance; + else critChanceF = (float) ((Axes.criticalHitMaxChance / Axes.criticalHitMaxBonusLevel) * skillCheck); critChance = percent.format(critChanceF / 100D); if (critChanceF * 1.3333D >= 100D) critChanceLucky = percent.format(1D); else critChanceLucky = percent.format(critChanceF * 1.3333D / 100D); //Axe Mastery - if (skillValue >= bonusDamageAxesMaxBonusLevel) bonusDamage = String.valueOf(bonusDamageAxesBonusMax); - else bonusDamage = String.valueOf(skillValue / ((double) bonusDamageAxesMaxBonusLevel / (double) bonusDamageAxesBonusMax)); + if (skillValue >= Axes.bonusDamageMaxBonusLevel) bonusDamage = String.valueOf(Axes.bonusDamageMaxBonus); + else bonusDamage = String.valueOf(skillValue / ((double) Axes.bonusDamageMaxBonusLevel / (double) Axes.bonusDamageMaxBonus)); } @Override diff --git a/src/main/java/com/gmail/nossr50/skills/axes/AxeManager.java b/src/main/java/com/gmail/nossr50/skills/axes/AxeManager.java index b9ef45c3c..23e9ceaa7 100644 --- a/src/main/java/com/gmail/nossr50/skills/axes/AxeManager.java +++ b/src/main/java/com/gmail/nossr50/skills/axes/AxeManager.java @@ -59,4 +59,27 @@ public class AxeManager extends SkillManager { } } + /** + * Check for Impact ability. + * + * @param event The event to modify + */ + public void impact(EntityDamageByEntityEvent event) { + if (Misc.isNPC(player) || !Permissions.impact(player)) { + return; + } + + ImpactEventHandler eventHandler = new ImpactEventHandler(this, event); + + if (eventHandler.livingDefender == null) { + return; + } + + if (!Misc.hasArmor(eventHandler.livingDefender)) { + eventHandler.damageArmor(); + } + else { + eventHandler.applyGreaterImpact(); + } + } } diff --git a/src/main/java/com/gmail/nossr50/skills/axes/Axes.java b/src/main/java/com/gmail/nossr50/skills/axes/Axes.java index d77f16874..5b9daad9e 100644 --- a/src/main/java/com/gmail/nossr50/skills/axes/Axes.java +++ b/src/main/java/com/gmail/nossr50/skills/axes/Axes.java @@ -1,18 +1,6 @@ package com.gmail.nossr50.skills.axes; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.PlayerInventory; - import com.gmail.nossr50.config.AdvancedConfig; -import com.gmail.nossr50.datatypes.SkillType; -import com.gmail.nossr50.locale.LocaleLoader; -import com.gmail.nossr50.util.Misc; -import com.gmail.nossr50.util.Permissions; -import com.gmail.nossr50.util.Users; public class Axes { public static int bonusDamageMaxBonus = AdvancedConfig.getInstance().getBonusDamageAxesBonusMax(); @@ -23,110 +11,10 @@ public class Axes { public static double criticalHitPVPModifier = AdvancedConfig.getInstance().getAxesCriticalPVPModifier(); public static double criticalHitPVEModifier = AdvancedConfig.getInstance().getAxesCriticalPVEModifier(); - static AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); + public static int impactIncreaseLevel = AdvancedConfig.getInstance().getArmorImpactIncreaseLevel(); + public static double impactMaxDurabilityDamageModifier = AdvancedConfig.getInstance().getArmorImpactMaxDurabilityDamage() / 100D; - /** - * Check for Impact ability. - * - * @param attacker The attacking player - * @param target The defending entity - * @param event The event to modify - */ - public static void impact(Player attacker, LivingEntity target, EntityDamageByEntityEvent event) { - if (attacker == null) - return; - - /* - * TODO: Finish this skill. The idea is you will greatly damage an opponents armor. - * When they are unarmored, you have a proc that will stun them and deal additional damage. - */ - if (target instanceof Player) { - Player targetPlayer = (Player) target; - short durabilityDamage = 1; //Start with 1 durability damage - - /* Every 50 Skill Levels you gain 1 durability damage (default values) */ - int impactIncreaseLevel = advancedConfig.getArmorImpactIncreaseLevel(); - double impactMaxDamage = advancedConfig.getArmorImpactMaxDurabilityDamage() / 100F; - short maxDurability; - durabilityDamage += (int) ((double) Users.getProfile(attacker).getSkillLevel(SkillType.AXES) / (double) impactIncreaseLevel); - - if (!hasArmor(targetPlayer)) { - applyGreaterImpact(attacker, target, event); - } - else { - for (ItemStack armor : targetPlayer.getInventory().getArmorContents()) { - if (Math.random() * 100 > 75) { - int lowerdamage = 0; - for (int i = 0; i <= durabilityDamage; i ++) { - if (armor.containsEnchantment(Enchantment.DURABILITY)) { - int level = armor.getEnchantmentLevel(Enchantment.DURABILITY); - if (Misc.getRandom().nextInt(level + 1) > 0) { - lowerdamage++; - } - } - } - int newDurabilityDamage = durabilityDamage - lowerdamage; - maxDurability = (short) (armor.getType().getMaxDurability() * impactMaxDamage); - if (newDurabilityDamage > maxDurability) newDurabilityDamage = maxDurability; - armor.setDurability((short) (armor.getDurability() + newDurabilityDamage)); //Damage armor piece - } - } - targetPlayer.updateInventory(); - } - } - else { - applyGreaterImpact(attacker, target, event); //Since mobs are technically unarmored, this will always trigger - } - } - - /** - * Apply Greater Impact ability. - * - * @param attacker The attacking player - * @param target The defending entity - * @param event The event to modify - */ - private static void applyGreaterImpact(Player attacker, LivingEntity target, EntityDamageByEntityEvent event) { - if (attacker == null) - return; - - final double GREATER_IMPACT_CHANCE = advancedConfig.getGreaterImpactChance(); - final double GREATER_IMPACT_MULTIPLIER = advancedConfig.getGreaterImpactModifier(); - final int GREATER_IMPACT_DAMAGE = advancedConfig.getGreaterImpactBonusDamage(); - - if (!Permissions.greaterImpact(attacker)) { - return; - } - - int randomChance = 100; - - if (Permissions.luckyAxes(attacker)) { - randomChance = (int) (randomChance * 0.75); - } - - if (Misc.getRandom().nextInt(randomChance) <= GREATER_IMPACT_CHANCE) { - event.setDamage(event.getDamage() + GREATER_IMPACT_DAMAGE); - target.setVelocity(attacker.getLocation().getDirection().normalize().multiply(GREATER_IMPACT_MULTIPLIER)); - attacker.sendMessage(LocaleLoader.getString("Axes.Combat.GI.Proc")); - } - } - - /** - * Check if a player has armor. - * - * @param player Player whose armor to check - * @return true if the player has armor, false otherwise - */ - private static boolean hasArmor(Player player) { - if (player == null) - return false; - - PlayerInventory inventory = player.getInventory(); - - if (inventory.getBoots() != null || inventory.getChestplate() != null || inventory.getHelmet() != null || inventory.getLeggings() != null) { - return true; - } - - return false; - } + public static double greaterImpactChance = AdvancedConfig.getInstance().getGreaterImpactChance(); + public static double greaterImpactKnockbackMultiplier = AdvancedConfig.getInstance().getGreaterImpactModifier(); + public static int greaterImpactBonusDamage = AdvancedConfig.getInstance().getGreaterImpactBonusDamage(); } diff --git a/src/main/java/com/gmail/nossr50/skills/axes/ImpactEventHandler.java b/src/main/java/com/gmail/nossr50/skills/axes/ImpactEventHandler.java new file mode 100644 index 000000000..694a64b54 --- /dev/null +++ b/src/main/java/com/gmail/nossr50/skills/axes/ImpactEventHandler.java @@ -0,0 +1,104 @@ +package com.gmail.nossr50.skills.axes; + +import org.bukkit.enchantments.Enchantment; +import org.bukkit.entity.Entity; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.inventory.EntityEquipment; +import org.bukkit.inventory.ItemStack; + +import com.gmail.nossr50.locale.LocaleLoader; +import com.gmail.nossr50.util.Misc; +import com.gmail.nossr50.util.Permissions; + +public class ImpactEventHandler { + private AxeManager manager; + private Player player; + private EntityDamageByEntityEvent event; + private short durabilityDamage = 1; + private EntityEquipment equipment; + private ItemStack[] armorContents; + + protected Entity defender; + protected LivingEntity livingDefender; + + public ImpactEventHandler(AxeManager manager, EntityDamageByEntityEvent event) { + this.manager = manager; + this.player = manager.getPlayer(); + this.event = event; + this.defender = event.getEntity(); + + if (defender instanceof LivingEntity) { + this.livingDefender = (LivingEntity) defender; + this.equipment = livingDefender.getEquipment(); + this.armorContents = equipment.getArmorContents(); + } + } + + protected void damageArmor() { + /* Every 50 Skill Levels you gain 1 durability damage (default values) */ + durabilityDamage += (short) (manager.getSkillLevel() / Axes.impactIncreaseLevel); + + for (ItemStack armor : armorContents) { + if (Misc.getRandom().nextInt(100) > 75) { + + for (int i = 0; i <= durabilityDamage; i++) { + if (armor.containsEnchantment(Enchantment.DURABILITY)) { + handleDurabilityEnchantment(armor); + } + } + + damageValidation(armor); + armor.setDurability((short) (armor.getDurability() + durabilityDamage)); + } + } + + equipment.setArmorContents(armorContents); + } + + protected void applyGreaterImpact() { + if (!Permissions.greaterImpact(player)) { + return; + } + + int randomChance = 100; + if (Permissions.luckyAxes(player)) { + randomChance = (int) (randomChance * 0.75); + } + + if (Misc.getRandom().nextInt(randomChance) <= Axes.greaterImpactChance) { + handleGreaterImpactEffect(); + sendAbilityMessge(); + } + } + + private void handleGreaterImpactEffect() { + event.setDamage(event.getDamage() + Axes.greaterImpactBonusDamage); + livingDefender.setVelocity(player.getLocation().getDirection().normalize().multiply(Axes.greaterImpactKnockbackMultiplier)); + } + + private void sendAbilityMessge() { + player.sendMessage(LocaleLoader.getString("Axes.Combat.GI.Proc")); + + if (livingDefender instanceof Player) { + ((Player) livingDefender).sendMessage(LocaleLoader.getString("Axes.Combat.GI.Struck")); + } + } + + private void handleDurabilityEnchantment(ItemStack armor) { + int enchantmentLevel = armor.getEnchantmentLevel(Enchantment.DURABILITY); + + if (Misc.getRandom().nextInt(enchantmentLevel + 1) > 0) { + durabilityDamage--; + } + } + + private void damageValidation(ItemStack armor) { + short maxDurability = (short) (armor.getType().getMaxDurability() * Axes.impactMaxDurabilityDamageModifier); + + if (durabilityDamage > maxDurability) { + durabilityDamage = maxDurability; + } + } +} diff --git a/src/main/java/com/gmail/nossr50/skills/mining/SuperBreakerEventHandler.java b/src/main/java/com/gmail/nossr50/skills/mining/SuperBreakerEventHandler.java index c00229ae6..da498a375 100644 --- a/src/main/java/com/gmail/nossr50/skills/mining/SuperBreakerEventHandler.java +++ b/src/main/java/com/gmail/nossr50/skills/mining/SuperBreakerEventHandler.java @@ -115,7 +115,7 @@ public class SuperBreakerEventHandler { } private void calculateDurabilityLoss() { - this.durabilityLoss = Misc.TOOL_DURABILITY_LOSS; + this.durabilityLoss = Misc.toolDurabilityLoss; if (blockType.equals(Material.OBSIDIAN)) { durabilityLoss = durabilityLoss * 5; diff --git a/src/main/java/com/gmail/nossr50/util/Combat.java b/src/main/java/com/gmail/nossr50/util/Combat.java index 7f83c488a..90bf7e1ec 100644 --- a/src/main/java/com/gmail/nossr50/util/Combat.java +++ b/src/main/java/com/gmail/nossr50/util/Combat.java @@ -33,7 +33,6 @@ import com.gmail.nossr50.runnables.GainXp; import com.gmail.nossr50.skills.acrobatics.AcrobaticsManager; import com.gmail.nossr50.skills.archery.ArcheryManager; import com.gmail.nossr50.skills.axes.AxeManager; -import com.gmail.nossr50.skills.axes.Axes; import com.gmail.nossr50.skills.swords.Swords; import com.gmail.nossr50.skills.swords.SwordsManager; import com.gmail.nossr50.skills.taming.TamingManager; @@ -101,10 +100,7 @@ public class Combat { axeManager.bonusDamage(event); axeManager.criticalHitCheck(event); - - if (Permissions.impact(attacker)) { - Axes.impact(attacker, target, event); - } + axeManager.impact(event); if (attackerProfile.getAbilityMode(AbilityType.SKULL_SPLIITER) && Permissions.skullSplitter(attacker)) { applyAbilityAoE(attacker, target, event.getDamage() / 2, SkillType.AXES); diff --git a/src/main/java/com/gmail/nossr50/util/Misc.java b/src/main/java/com/gmail/nossr50/util/Misc.java index 1c0fa2fcb..4135cebdd 100644 --- a/src/main/java/com/gmail/nossr50/util/Misc.java +++ b/src/main/java/com/gmail/nossr50/util/Misc.java @@ -11,10 +11,12 @@ import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.entity.Tameable; import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.inventory.EntityEquipment; import org.bukkit.inventory.ItemStack; import org.bukkit.plugin.PluginManager; import com.gmail.nossr50.mcMMO; +import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.Config; import com.gmail.nossr50.events.fake.FakeBlockBreakEvent; import com.gmail.nossr50.events.fake.FakeBlockDamageEvent; @@ -25,11 +27,29 @@ import com.gmail.nossr50.party.PartyManager; public class Misc { private static Random random = new Random(); - public static final int TOOL_DURABILITY_LOSS = Config.getInstance().getAbilityToolDamage(); + public static int toolDurabilityLoss = Config.getInstance().getAbilityToolDamage(); + public static int abilityLengthIncreaseLevel = AdvancedConfig.getInstance().getAbilityLength(); + public static final int PLAYER_RESPAWN_COOLDOWN_SECONDS = 5; public static final int TIME_CONVERSION_FACTOR = 1000; public static final double SKILL_MESSAGE_MAX_SENDING_DISTANCE = 10.0; + /** + * Check if a player has armor. + * + * @param player Player whose armor to check + * @return true if the player has armor, false otherwise + */ + public static boolean hasArmor(LivingEntity entity) { + EntityEquipment equipment = entity.getEquipment(); + + if (equipment.getBoots() != null || equipment.getChestplate() != null || equipment.getHelmet() != null || equipment.getLeggings() != null) { + return true; + } + + return false; + } + public static boolean isFriendlyPet(Player attacker, Tameable pet) { if (pet.isTamed()) { AnimalTamer tamer = pet.getOwner(); From 105f0885769594e179e8a6553202ddfc706ca43a Mon Sep 17 00:00:00 2001 From: GJ Date: Tue, 15 Jan 2013 16:36:39 -0500 Subject: [PATCH 2/5] Remove unused variable. --- src/main/java/com/gmail/nossr50/commands/mc/McremoveCommand.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/com/gmail/nossr50/commands/mc/McremoveCommand.java b/src/main/java/com/gmail/nossr50/commands/mc/McremoveCommand.java index 785abcb3b..1f3117a07 100644 --- a/src/main/java/com/gmail/nossr50/commands/mc/McremoveCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/mc/McremoveCommand.java @@ -17,7 +17,6 @@ import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.util.Database; public class McremoveCommand implements CommandExecutor { - private Database database = mcMMO.getPlayerDatabase(); private final String location; private final mcMMO plugin; From 5bdf4b5dccb48f415c7e6b86e6318b10e00abd16 Mon Sep 17 00:00:00 2001 From: GJ Date: Tue, 15 Jan 2013 16:38:44 -0500 Subject: [PATCH 3/5] Finish Axe restructuring, modify a little bit of Swords stuff as well. --- .../gmail/nossr50/skills/axes/AxeManager.java | 14 +++++++++++ .../axes/SkullSplitterEventHandler.java | 24 +++++++++++++++++++ .../swords/SerratedStrikesEventHandler.java | 3 --- .../nossr50/skills/swords/SwordsManager.java | 5 +--- .../java/com/gmail/nossr50/util/Combat.java | 3 ++- 5 files changed, 41 insertions(+), 8 deletions(-) create mode 100644 src/main/java/com/gmail/nossr50/skills/axes/SkullSplitterEventHandler.java diff --git a/src/main/java/com/gmail/nossr50/skills/axes/AxeManager.java b/src/main/java/com/gmail/nossr50/skills/axes/AxeManager.java index 23e9ceaa7..a4da044a7 100644 --- a/src/main/java/com/gmail/nossr50/skills/axes/AxeManager.java +++ b/src/main/java/com/gmail/nossr50/skills/axes/AxeManager.java @@ -82,4 +82,18 @@ public class AxeManager extends SkillManager { eventHandler.applyGreaterImpact(); } } + + /** + * Check for Skull Splitter ability. + * + * @param event The event to process + */ + public void skullSplitter(EntityDamageByEntityEvent event) { + if (Misc.isNPC(player) || !Permissions.skullSplitter(player)) { + return; + } + + SkullSplitterEventHandler eventHandler = new SkullSplitterEventHandler(this, event); + eventHandler.applyAbilityEffects(); + } } diff --git a/src/main/java/com/gmail/nossr50/skills/axes/SkullSplitterEventHandler.java b/src/main/java/com/gmail/nossr50/skills/axes/SkullSplitterEventHandler.java new file mode 100644 index 000000000..30b6b3a1e --- /dev/null +++ b/src/main/java/com/gmail/nossr50/skills/axes/SkullSplitterEventHandler.java @@ -0,0 +1,24 @@ +package com.gmail.nossr50.skills.axes; + +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.entity.EntityDamageByEntityEvent; + +import com.gmail.nossr50.datatypes.SkillType; +import com.gmail.nossr50.util.Combat; + +public class SkullSplitterEventHandler { + private Player player; + private LivingEntity target; + private int damage; + + protected SkullSplitterEventHandler(AxeManager manager, EntityDamageByEntityEvent event) { + this.player = manager.getPlayer(); + this.target = (LivingEntity) event.getEntity(); + this.damage = event.getDamage(); + } + + protected void applyAbilityEffects() { + Combat.applyAbilityAoE(player, target, damage / 2, SkillType.AXES); + } +} diff --git a/src/main/java/com/gmail/nossr50/skills/swords/SerratedStrikesEventHandler.java b/src/main/java/com/gmail/nossr50/skills/swords/SerratedStrikesEventHandler.java index a2ede56ae..c2ba02ebd 100644 --- a/src/main/java/com/gmail/nossr50/skills/swords/SerratedStrikesEventHandler.java +++ b/src/main/java/com/gmail/nossr50/skills/swords/SerratedStrikesEventHandler.java @@ -19,9 +19,6 @@ public class SerratedStrikesEventHandler { } protected void applyAbilityEffects() { - if (player == null) - return; - Combat.applyAbilityAoE(player, target, damage / Swords.SERRATED_STRIKES_MODIFIER, SkillType.SWORDS); BleedTimer.add(target, Swords.SERRATED_STRIKES_BLEED_TICKS); } diff --git a/src/main/java/com/gmail/nossr50/skills/swords/SwordsManager.java b/src/main/java/com/gmail/nossr50/skills/swords/SwordsManager.java index 6057bc637..185812225 100644 --- a/src/main/java/com/gmail/nossr50/skills/swords/SwordsManager.java +++ b/src/main/java/com/gmail/nossr50/skills/swords/SwordsManager.java @@ -76,10 +76,7 @@ public class SwordsManager extends SkillManager { } public void serratedStrikes(LivingEntity target, int damage) { - if (player == null) - return; - - if (!Permissions.serratedStrikes(player)) { + if (Misc.isNPC(player) || !Permissions.serratedStrikes(player)) { return; } diff --git a/src/main/java/com/gmail/nossr50/util/Combat.java b/src/main/java/com/gmail/nossr50/util/Combat.java index 90bf7e1ec..38591b0d0 100644 --- a/src/main/java/com/gmail/nossr50/util/Combat.java +++ b/src/main/java/com/gmail/nossr50/util/Combat.java @@ -102,7 +102,8 @@ public class Combat { axeManager.criticalHitCheck(event); axeManager.impact(event); - if (attackerProfile.getAbilityMode(AbilityType.SKULL_SPLIITER) && Permissions.skullSplitter(attacker)) { + if (attackerProfile.getAbilityMode(AbilityType.SKULL_SPLIITER)) { + axeManager.skullSplitter(event); applyAbilityAoE(attacker, target, event.getDamage() / 2, SkillType.AXES); } From 7203a0fcadfc55c4c3700ab08738db81dca2ff13 Mon Sep 17 00:00:00 2001 From: GJ Date: Tue, 15 Jan 2013 16:42:20 -0500 Subject: [PATCH 4/5] Changelog update. --- Changelog.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Changelog.txt b/Changelog.txt index af13c1bf5..2d1fa22d3 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -21,6 +21,7 @@ Version 1.3.13-dev + Added wooden button to the list of items that shouldn't trigger abilities + Added a new feature to fishing. Players will have +10% chance of finding enchanted items when fishing while it's raining + Added displaying bonus perks on skill commands + = Impact now works with mobs wearing armor = Fixed issue with Tree Feller dropping player-placed blocks = Fixed issue with missing default cases from several switch/case statements = Fixed issue with Mining using actual skill level rather than max skill level From 9204b23d5107c27138dec22185f12aa64b4c71a3 Mon Sep 17 00:00:00 2001 From: GJ Date: Tue, 15 Jan 2013 17:00:56 -0500 Subject: [PATCH 5/5] Allow configuration of Skull Splitter damage modifier. --- src/main/java/com/gmail/nossr50/config/AdvancedConfig.java | 2 ++ src/main/java/com/gmail/nossr50/skills/axes/Axes.java | 2 ++ .../gmail/nossr50/skills/axes/SkullSplitterEventHandler.java | 2 +- src/main/resources/advanced.yml | 3 +++ 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java b/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java index 3ffbb37cc..c405437de 100644 --- a/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java +++ b/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java @@ -63,6 +63,8 @@ public class AdvancedConfig extends ConfigLoader { public int getArmorImpactIncreaseLevel() { return config.getInt("Skills.Axes.ArmorImpact_IncreaseLevel", 50); } public double getArmorImpactMaxDurabilityDamage() { return config.getDouble("Skills.Axes.ArmorImpact_MaxPercentageDurabilityDamage", 20.0D); } + public int getSkullSplitterModifier() { return config.getInt("Skills.Axes.SkullSplitter_DamagerModifier", 2); } + /* EXCAVATION */ //Nothing to configure, everything is already configurable in config.yml diff --git a/src/main/java/com/gmail/nossr50/skills/axes/Axes.java b/src/main/java/com/gmail/nossr50/skills/axes/Axes.java index 5b9daad9e..0fd7d60a5 100644 --- a/src/main/java/com/gmail/nossr50/skills/axes/Axes.java +++ b/src/main/java/com/gmail/nossr50/skills/axes/Axes.java @@ -17,4 +17,6 @@ public class Axes { public static double greaterImpactChance = AdvancedConfig.getInstance().getGreaterImpactChance(); public static double greaterImpactKnockbackMultiplier = AdvancedConfig.getInstance().getGreaterImpactModifier(); public static int greaterImpactBonusDamage = AdvancedConfig.getInstance().getGreaterImpactBonusDamage(); + + public static int skullSplitterModifier = AdvancedConfig.getInstance().getSkullSplitterModifier(); } diff --git a/src/main/java/com/gmail/nossr50/skills/axes/SkullSplitterEventHandler.java b/src/main/java/com/gmail/nossr50/skills/axes/SkullSplitterEventHandler.java index 30b6b3a1e..66d4c1a0a 100644 --- a/src/main/java/com/gmail/nossr50/skills/axes/SkullSplitterEventHandler.java +++ b/src/main/java/com/gmail/nossr50/skills/axes/SkullSplitterEventHandler.java @@ -19,6 +19,6 @@ public class SkullSplitterEventHandler { } protected void applyAbilityEffects() { - Combat.applyAbilityAoE(player, target, damage / 2, SkillType.AXES); + Combat.applyAbilityAoE(player, target, damage / Axes.skullSplitterModifier, SkillType.AXES); } } diff --git a/src/main/resources/advanced.yml b/src/main/resources/advanced.yml index debb78c66..8c4d6fa6b 100644 --- a/src/main/resources/advanced.yml +++ b/src/main/resources/advanced.yml @@ -90,6 +90,9 @@ Skills: # ArmorImpact_MaxPercentageDurabilityDamage: Durability damage cap for ArmorImpact, 20% means that you can never destroy a piece of armor in less than 5 hits ArmorImpact_IncreaseLevel: 50 ArmorImpact_MaxPercentageDurabilityDamage: 20.0 + + # SkullSplitter_DamageModifier: Damage will get divided by this modifier + SkullSplitter_DamageModifier: 2 # # Settings for Fishing ###