Browse Source

Fix SkillShot display

nossr50 6 years ago
parent
commit
f4cab35a46

+ 2 - 2
src/main/java/com/gmail/nossr50/commands/skills/ArcheryCommand.java

@@ -5,6 +5,7 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType;
 import com.gmail.nossr50.locale.LocaleLoader;
 import com.gmail.nossr50.skills.archery.Archery;
 import com.gmail.nossr50.util.TextComponentFactory;
+import com.gmail.nossr50.util.player.UserManager;
 import com.gmail.nossr50.util.skills.SkillActivationType;
 import net.md_5.bungee.api.chat.TextComponent;
 import org.bukkit.entity.Player;
@@ -45,8 +46,7 @@ public class ArcheryCommand extends SkillCommand {
         
         // SKILL SHOT
         if (canSkillShot) {
-            double bonus = (skillValue / Archery.skillShotIncreaseLevel) * Archery.skillShotIncreasePercentage;
-            skillShotBonus = percent.format(Archery.getSkillShotBonusDamage(player, 0));
+            skillShotBonus = percent.format(Archery.getDamageBonusPercent(player));
         }
     }
 

+ 0 - 1
src/main/java/com/gmail/nossr50/config/AdvancedConfig.java

@@ -881,7 +881,6 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
     //public int getConcoctionsTierLevel(Alchemy.Tier tier) { return config.getInt("Skills.Alchemy.Rank_Levels.Rank_" + rank); }
 
     /* ARCHERY */
-    public int getSkillShotIncreaseLevel() { return config.getInt("Skills.Archery.SkillShot.IncreaseLevel", 50); }
     public double getSkillShotRankDamageMultiplier() { return config.getDouble("Skills.Archery.SkillShot.RankDamageMultiplier", 10.0D); }
     public double getSkillShotDamageMax() { return config.getDouble("Skills.Archery.SkillShot.MaxDamage", 9.0D); }
 

+ 7 - 13
src/main/java/com/gmail/nossr50/skills/archery/Archery.java

@@ -17,8 +17,6 @@ import java.util.List;
 public class Archery {
     private static List<TrackedEntity> trackedEntities = new ArrayList<TrackedEntity>();
 
-    public static int    skillShotIncreaseLevel      = AdvancedConfig.getInstance().getSkillShotIncreaseLevel();
-    public static double skillShotIncreasePercentage = AdvancedConfig.getInstance().getSkillShotRankDamageMultiplier();
     public static double skillShotMaxBonusDamage     = AdvancedConfig.getInstance().getSkillShotDamageMax();
 
     public static double dazeBonusDamage = AdvancedConfig.getInstance().getDazeBonusDamage();
@@ -64,18 +62,14 @@ public class Archery {
         }
     }
 
-    /**
-     * Every rank we increase Skill Shot's bonus damage % by the IncreaseDamage percentage value from advanced.yml
-     * Divide end result by 100.0D to get proper scale
-     * Damage is capped in advanced.yml by Archery.SkillShot.MaxDamage
-     *
-     * @param player The target player
-     * @param oldDamage The raw damage of the arrow before we add bonus damage
-     * @return The damage that the arrow will deal after we've added bonus damage, damage is capped by Archery.SkillShot.MaxDamage
-     */
     public static double getSkillShotBonusDamage(Player player, double oldDamage)
     {
-        double damageBonusPercent = ((RankUtils.getRank(player, SubSkillType.ARCHERY_SKILL_SHOT)) * Archery.skillShotIncreasePercentage) / 100.0D;
-        return Math.min(oldDamage * damageBonusPercent, Archery.skillShotMaxBonusDamage);
+        double damageBonusPercent = getDamageBonusPercent(player);
+        double newDamage = oldDamage + (oldDamage * damageBonusPercent);
+        return Math.min(newDamage, Archery.skillShotMaxBonusDamage);
+    }
+
+    public static double getDamageBonusPercent(Player player) {
+        return ((RankUtils.getRank(player, SubSkillType.ARCHERY_SKILL_SHOT)) * AdvancedConfig.getInstance().getSkillShotRankDamageMultiplier()) / 100.0D;
     }
 }

+ 1 - 1
src/main/java/com/gmail/nossr50/skills/archery/ArcheryManager.java

@@ -29,7 +29,7 @@ public class ArcheryManager extends SkillManager {
     }
 
     public boolean canSkillShot() {
-        return getSkillLevel() >= Archery.skillShotIncreaseLevel && Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.ARCHERY_SKILL_SHOT);
+        return Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.ARCHERY_SKILL_SHOT);
     }
 
     public boolean canRetrieveArrows() {