forked from Upstream/mmocore
Fix cooldown reduction
This commit is contained in:
parent
3418a02ffa
commit
270a552abc
@ -393,8 +393,7 @@ public class PlayerData {
|
||||
}
|
||||
|
||||
public void heal(double heal) {
|
||||
getPlayer().setHealth(Math.max(0,
|
||||
Math.min(player.getHealth() + heal, player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue())));
|
||||
getPlayer().setHealth(Math.max(0, Math.min(player.getHealth() + heal, player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue())));
|
||||
}
|
||||
|
||||
public void addFriend(UUID uuid) {
|
||||
@ -521,7 +520,8 @@ public class PlayerData {
|
||||
|
||||
public void giveMana(double amount) {
|
||||
if (mana != (mana = Math.max(0, Math.min(getStats().getStat(StatType.MAX_MANA), mana + amount))))
|
||||
if(MMOCore.plugin.getConfig().getBoolean("display.mana")) displayMana();
|
||||
if (MMOCore.plugin.getConfig().getBoolean("display.mana"))
|
||||
displayMana();
|
||||
}
|
||||
|
||||
public void giveStamina(double amount) {
|
||||
@ -590,10 +590,9 @@ public class PlayerData {
|
||||
public void displayMana() {
|
||||
if (System.currentTimeMillis() > lastActionbarUpdate + 1200)
|
||||
MMOCore.plugin.pauseDefaultActionBar(uuid, 60);
|
||||
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(getProfess().getManaDisplay().generateBar(getMana(), getStats().getStat(StatType.MAX_MANA))));
|
||||
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(getProfess().getManaDisplay().generateBar(getMana(), getStats().getStat(StatType.MAX_MANA))));
|
||||
}
|
||||
|
||||
|
||||
public void setAttributes(PlayerAttribute attribute, int value) {
|
||||
setAttributes(attribute.getId(), value);
|
||||
}
|
||||
@ -756,7 +755,13 @@ public class PlayerData {
|
||||
}
|
||||
|
||||
if (!nocd) {
|
||||
skillData.setLastCast(cast.getSkill(), System.currentTimeMillis() + (long) (getStats().getStat(StatType.COOLDOWN_REDUCTION) * cast.getCooldown() * 10));
|
||||
|
||||
// calculate skill cooldown reduction only if stat is higher than 0
|
||||
// to save performance
|
||||
double red = getStats().getStat(StatType.COOLDOWN_REDUCTION) * 10;
|
||||
red *= red > 0 ? skill.getModifier("cooldown", getSkillLevel(skill.getSkill())) : 0;
|
||||
|
||||
skillData.setLastCast(cast.getSkill(), System.currentTimeMillis() - (long) red);
|
||||
giveMana(-cast.getManaCost());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user