Interface VariableAmount

    • Method Detail

      • fixed

        static VariableAmount fixed​(double value)
        Creates a new 'fixed' variable amount, calls to amount(java.util.Random) will always return the fixed value.
        Parameters:
        value - The fixed value
        Returns:
        A variable amount representation
      • range

        static VariableAmount range​(double min,
                                    double max)
        Creates a new variable amount which return values between the given min (inclusive) and max (exclusive).
        Parameters:
        min - The minimum of the range (inclusive)
        max - The maximum of the range (exclusive)
        Returns:
        A variable amount representation
      • baseWithVariance

        static VariableAmount baseWithVariance​(double base,
                                               double variance)
        Creates a new variable about which has a base and variance. The final amount will be the base amount plus or minus a random amount between zero (inclusive) and the variance (exclusive).
        Parameters:
        base - The base value
        variance - The variance
        Returns:
        A variable amount representation
      • baseWithVariance

        static VariableAmount baseWithVariance​(double base,
                                               VariableAmount variance)
        Creates a new variable about which has a base and variance. The final amount will be the base amount plus or minus a random amount between zero (inclusive) and the variance (exclusive).
        Parameters:
        base - The base value
        variance - The variance
        Returns:
        A variable amount representation
      • baseWithRandomAddition

        static VariableAmount baseWithRandomAddition​(double base,
                                                     double addition)
        Creates a new variable amount which has a base and an additional amount. The final amount will be the base amount plus a random amount between zero (inclusive) and the additional amount (exclusive).
        Parameters:
        base - The base value
        addition - The additional amount
        Returns:
        A variable amount representation
      • baseWithRandomAddition

        static VariableAmount baseWithRandomAddition​(double base,
                                                     VariableAmount addition)
        Creates a new variable amount which has a base and an additional amount. The final amount will be the base amount plus a random amount between zero (inclusive) and the additional amount (exclusive).
        Parameters:
        base - The base value
        addition - The additional amount
        Returns:
        A variable amount representation
      • baseWithOptionalVariance

        static VariableAmount baseWithOptionalVariance​(double base,
                                                       double variance,
                                                       double chance)
        Creates a new variable about which has a base and a chance to apply a random variance. The chance should be between zero and one with a chance of one signifying that the variance will always be applied. If the chance succeeds then the final amount will be the base amount plus or minus a random amount between zero (inclusive) and the variance (exclusive). If the chance fails then the final amount will just be the base value.
        Parameters:
        base - The base value
        variance - The variance
        chance - The chance to apply the variance
        Returns:
        A variable amount representation
      • baseWithOptionalVariance

        static VariableAmount baseWithOptionalVariance​(double base,
                                                       VariableAmount variance,
                                                       double chance)
        Creates a new variable about which has a base and a chance to apply a random variance. The chance should be between zero and one with a chance of one signifying that the variance will always be applied. If the chance succeeds then the final amount will be the base amount plus or minus a random amount between zero (inclusive) and the variance (exclusive). If the chance fails then the final amount will just be the base value.
        Parameters:
        base - The base value
        variance - The variance
        chance - The chance to apply the variance
        Returns:
        A variable amount representation
      • baseWithOptionalAddition

        static VariableAmount baseWithOptionalAddition​(double base,
                                                       double addition,
                                                       double chance)
        Creates a new variable about which has a base and a chance to apply a random additional amount. The chance should be between zero and one with a chance of one signifying that the additional amount will always be applied. If the chance succeeds then the final amount will be the base amount plus a random amount between zero (inclusive) and the additional amount (exclusive). If the chance fails then the final amount will just be the base value.
        Parameters:
        base - The base value
        addition - The additional amount
        chance - The chance to apply the additional amount
        Returns:
        A variable amount representation
      • baseWithOptionalAddition

        static VariableAmount baseWithOptionalAddition​(double base,
                                                       VariableAmount addition,
                                                       double chance)
        Creates a new variable about which has a base and a chance to apply a random additional amount. The chance should be between zero and one with a chance of one signifying that the additional amount will always be applied. If the chance succeeds then the final amount will be the base amount plus a random amount between zero (inclusive) and the additional amount (exclusive). If the chance fails then the final amount will just be the base value.
        Parameters:
        base - The base value
        addition - The additional amount
        chance - The chance to apply the additional amount
        Returns:
        A variable amount representation
      • amount

        double amount​(Random rand)
        Gets an instance of the variable amount depending on the given random object.
        Parameters:
        rand - The random object
        Returns:
        The amount
      • flooredAmount

        default int flooredAmount​(Random rand)
        Gets the amount as if from amount(Random) but floored to the nearest integer equivalent.
        Parameters:
        rand - The random object
        Returns:
        The floored amount