More cleanup

This commit is contained in:
Indyuce 2020-08-09 10:10:01 +02:00
parent 4cceb06ed6
commit c29fe0bc87
4 changed files with 18 additions and 12 deletions

View File

@ -13,9 +13,19 @@ public abstract class AbilityResult {
return ability;
}
/**
* @param path
* Path of ability modifier
* @return Calculates a new value for a given ability modifier
*/
public double getModifier(String path) {
return ability.getModifier(path);
}
/**
* @return If the ability is cast successfully. This method is used to apply
* extra ability conditions (player must be on the ground, must aim
* at an entity..)
*/
public abstract boolean isSuccessful();
}

View File

@ -110,7 +110,7 @@ public class PlayerData {
public MMOPlayerData getMMOPlayerData() {
return mmoData;
}
public UUID getUniqueId() {
return mmoData.getUniqueId();
}
@ -417,15 +417,11 @@ public class PlayerData {
* target, removes resources needed from the player
*/
if (ability.hasModifier("mana"))
rpgPlayer.giveMana(-ability.getModifier("mana"));
rpgPlayer.giveMana(-abilityResult.getModifier("mana"));
if (ability.hasModifier("stamina"))
rpgPlayer.giveStamina(-ability.getModifier("stamina"));
double cooldown = ability.getModifier("cooldown");
// apply cooldown reduction
cooldown *= 1 - Math.min(.8, stats.getStat(ItemStat.COOLDOWN_REDUCTION) / 100);
rpgPlayer.giveStamina(-abilityResult.getModifier("stamina"));
double cooldown = abilityResult.getModifier("cooldown") * (1 - Math.min(.8, stats.getStat(ItemStat.COOLDOWN_REDUCTION) / 100));
if (cooldown > 0)
applyAbilityCooldown(ability.getAbility(), cooldown);

View File

@ -8,10 +8,10 @@ import net.Indyuce.mmoitems.stat.data.type.Mergeable;
import net.Indyuce.mmoitems.stat.data.type.StatData;
public class DoubleData implements StatData, Mergeable {
private static final Random random = new Random();
private double min, max;
private static final Random random = new Random();
public DoubleData(Object object) {
if (object instanceof Number) {
min = Double.valueOf(object.toString());

View File

@ -14,8 +14,8 @@ import net.Indyuce.mmoitems.stat.data.type.StatData;
public abstract class InternalStat extends ItemStat {
/*
* internal stats can be used to store specific item data and cannot be
/**
* Internal stats can be used to store specific item data and cannot be
* edited in the item edition GUI since they only exist once the item is
* physically generated.
*/