public interface Currency extends MagicProvider
| Modifier and Type | Method and Description |
|---|---|
void |
deduct(Mage mage,
CasterProperties caster,
double amount)
Deduct some currency from the specified Mage
|
default void |
deduct(Mage mage,
double amount) |
String |
formatAmount(double amount,
Messages messages)
Get a human-readable description of an amount of this currency.
|
default double |
getBalance(Mage mage) |
double |
getBalance(Mage mage,
CasterProperties caster)
Get the amount of this currency type a Mage has.
|
double |
getDefaultValue()
Get the default value for this currency.
|
MaterialAndData |
getIcon()
Get an icon to use to represent this currency as a physical item.
|
String |
getKey()
Each currency must have a unique key name, used to register.
|
double |
getMaxValue()
Get the maximum value for this currency.
|
default double |
getMinValue()
Get the minimum value for this currency.
|
String |
getName(Messages messages)
Get a human-readable description of this currency.
|
default String |
getShortName(Messages messages) |
default String |
getSingularName(Messages messages) |
double |
getWorth()
Get the relative worth of this currency.
|
boolean |
give(Mage mage,
CasterProperties caster,
double amount)
Give some currency to the specified Mage
|
default boolean |
give(Mage mage,
double amount) |
boolean |
has(Mage mage,
CasterProperties caster,
double amount)
Whether or not a mage has at least a certain amount of this currency.
|
default boolean |
has(Mage mage,
double amount) |
boolean |
hasMaxValue()
Check to see if this currency has an upper limit for player balances.
|
default boolean |
hasMinValue()
Check to see if this currency has a lower limit for player balances.
|
boolean |
isValid()
Check to see if this currency is valid.
|
@Nonnull String getKey()
double getBalance(Mage mage, CasterProperties caster)
mage - The mage to checkcaster - A optional caster, to be used for wand or class-specific costs (such as mana)default double getBalance(Mage mage)
boolean has(Mage mage, CasterProperties caster, double amount)
mage - The mage to check for costscaster - A optional wand or mage class, to be used for mana or other specific currenciesamount - The amount of currency required.default boolean has(Mage mage, double amount)
void deduct(Mage mage, CasterProperties caster, double amount)
mage - The mage to check for costscaster - A optional caster, to be used for mana costsamount - The amount of currency to deduct.default void deduct(Mage mage, double amount)
boolean give(Mage mage, CasterProperties caster, double amount)
mage - The mage to give these costs tocaster - A optional caster, to be used for mana costsamount - The amount of currency to give.default boolean give(Mage mage, double amount)
double getDefaultValue()
boolean hasMaxValue()
double getMaxValue()
default boolean hasMinValue()
default double getMinValue()
@Nullable MaterialAndData getIcon()
double getWorth()
@Nonnull String getName(Messages messages)
This does not include the amount, and only the label - e.g. "Bread" or "Mana" or "XP".
messages - The Messages class for looking up localizations@Nonnull String formatAmount(double amount, Messages messages)
This includes the amount as well as the label - e.g. "2 Bread" or "30 Mana" or "50 XP".
amount - The amountmessages - The Messages class for looking up localizationsboolean isValid()
This can be used if disabling currency, or providing a currency that may rely on some other dependency.
Copyright © 2021 elMakers. All rights reserved.