浏览代码

Clean up some stuff with our DATS.

GJ 12 年之前
父节点
当前提交
965dbda101

+ 1 - 4
src/main/java/com/gmail/nossr50/skills/mining/MiningManager.java

@@ -284,10 +284,7 @@ public class MiningManager extends SkillManager {
     private boolean blastMiningCooldownOver() {
     private boolean blastMiningCooldownOver() {
         Player player = getPlayer();
         Player player = getPlayer();
         PlayerProfile profile = getProfile();
         PlayerProfile profile = getProfile();
-
-        long oldTime = profile.getSkillDATS(AbilityType.BLAST_MINING) * Misc.TIME_CONVERSION_FACTOR;
-        int cooldown = AbilityType.BLAST_MINING.getCooldown();
-        int timeRemaining = SkillUtils.calculateTimeLeft(oldTime, cooldown, player);
+        int timeRemaining = SkillUtils.calculateTimeLeft(profile.getSkillDATS(AbilityType.BLAST_MINING) * Misc.TIME_CONVERSION_FACTOR, AbilityType.BLAST_MINING.getCooldown(), player);
 
 
         if (timeRemaining > 0) {
         if (timeRemaining > 0) {
             player.sendMessage(LocaleLoader.getString("Skills.TooTired", timeRemaining));
             player.sendMessage(LocaleLoader.getString("Skills.TooTired", timeRemaining));

+ 2 - 11
src/main/java/com/gmail/nossr50/util/skills/SkillUtils.java

@@ -392,14 +392,8 @@ public class SkillUtils {
             }
             }
 
 
             McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
             McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
-            int ticks = 0;
-
-            if (mcMMOPlayer.getAbilityMode(AbilityType.SUPER_BREAKER)) {
-                ticks = ((int) (mcMMOPlayer.getProfile().getSkillDATS(AbilityType.SUPER_BREAKER) - (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR))) * 20;
-            }
-            else if (mcMMOPlayer.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER)) {
-                ticks = ((int) (mcMMOPlayer.getProfile().getSkillDATS(AbilityType.GIGA_DRILL_BREAKER) - (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR))) * 20;
-            }
+            SkillType skill = mcMMOPlayer.getAbilityMode(AbilityType.SUPER_BREAKER) ? SkillType.MINING : SkillType.EXCAVATION;
+            int ticks = PerksUtils.handleActivationPerks(player, 2 + (mcMMOPlayer.getProfile().getSkillLevel(skill) / AdvancedConfig.getInstance().getAbilityLength()), skill.getAbility().getMaxTicks()) * 20;
 
 
             PotionEffect abilityBuff = new PotionEffect(PotionEffectType.FAST_DIGGING, duration + ticks, amplifier + 10);
             PotionEffect abilityBuff = new PotionEffect(PotionEffectType.FAST_DIGGING, duration + ticks, amplifier + 10);
             player.addPotionEffect(abilityBuff, true);
             player.addPotionEffect(abilityBuff, true);
@@ -415,9 +409,6 @@ public class SkillUtils {
                 playerInventory.setItem(i, removeAbilityBuff(item));
                 playerInventory.setItem(i, removeAbilityBuff(item));
             }
             }
         }
         }
-        else {
-            player.removePotionEffect(PotionEffectType.FAST_DIGGING);
-        }
     }
     }
 
 
     public static ItemStack removeAbilityBuff(ItemStack item) {
     public static ItemStack removeAbilityBuff(ItemStack item) {