mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-29 16:46:46 +01:00
Fix SkillShot display
This commit is contained in:
parent
c22a1a0dd2
commit
f4cab35a46
@ -5,6 +5,7 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
|||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.skills.archery.Archery;
|
import com.gmail.nossr50.skills.archery.Archery;
|
||||||
import com.gmail.nossr50.util.TextComponentFactory;
|
import com.gmail.nossr50.util.TextComponentFactory;
|
||||||
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||||
import net.md_5.bungee.api.chat.TextComponent;
|
import net.md_5.bungee.api.chat.TextComponent;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -45,8 +46,7 @@ public class ArcheryCommand extends SkillCommand {
|
|||||||
|
|
||||||
// SKILL SHOT
|
// SKILL SHOT
|
||||||
if (canSkillShot) {
|
if (canSkillShot) {
|
||||||
double bonus = (skillValue / Archery.skillShotIncreaseLevel) * Archery.skillShotIncreasePercentage;
|
skillShotBonus = percent.format(Archery.getDamageBonusPercent(player));
|
||||||
skillShotBonus = percent.format(Archery.getSkillShotBonusDamage(player, 0));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -881,7 +881,6 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
|||||||
//public int getConcoctionsTierLevel(Alchemy.Tier tier) { return config.getInt("Skills.Alchemy.Rank_Levels.Rank_" + rank); }
|
//public int getConcoctionsTierLevel(Alchemy.Tier tier) { return config.getInt("Skills.Alchemy.Rank_Levels.Rank_" + rank); }
|
||||||
|
|
||||||
/* ARCHERY */
|
/* 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 getSkillShotRankDamageMultiplier() { return config.getDouble("Skills.Archery.SkillShot.RankDamageMultiplier", 10.0D); }
|
||||||
public double getSkillShotDamageMax() { return config.getDouble("Skills.Archery.SkillShot.MaxDamage", 9.0D); }
|
public double getSkillShotDamageMax() { return config.getDouble("Skills.Archery.SkillShot.MaxDamage", 9.0D); }
|
||||||
|
|
||||||
|
@ -17,8 +17,6 @@ import java.util.List;
|
|||||||
public class Archery {
|
public class Archery {
|
||||||
private static List<TrackedEntity> trackedEntities = new ArrayList<TrackedEntity>();
|
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 skillShotMaxBonusDamage = AdvancedConfig.getInstance().getSkillShotDamageMax();
|
||||||
|
|
||||||
public static double dazeBonusDamage = AdvancedConfig.getInstance().getDazeBonusDamage();
|
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)
|
public static double getSkillShotBonusDamage(Player player, double oldDamage)
|
||||||
{
|
{
|
||||||
double damageBonusPercent = ((RankUtils.getRank(player, SubSkillType.ARCHERY_SKILL_SHOT)) * Archery.skillShotIncreasePercentage) / 100.0D;
|
double damageBonusPercent = getDamageBonusPercent(player);
|
||||||
return Math.min(oldDamage * damageBonusPercent, Archery.skillShotMaxBonusDamage);
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ public class ArcheryManager extends SkillManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean canSkillShot() {
|
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() {
|
public boolean canRetrieveArrows() {
|
||||||
|
Loading…
Reference in New Issue
Block a user