forked from SkyeStarfall/BaseMod
-
Notifications
You must be signed in to change notification settings - Fork 118
Dynamic Variables
Reina edited this page Jan 1, 2019
·
5 revisions
In the base game, cards use values such as !D! or !M! to display numbers on cards. If you find yourself wanting to put a number onto your card, but none of the base game dynamic variables (!D!, !M!, !B!) work for you or are already in use, then you can create your own dynamic variable.
public class MyVariable extends DynamicVariable
{
@Override
public String key()
{
return "myKey";
// What you put in your localization file between ! to show your value. Eg, !myKey!.
}
@Override
public boolean isModified(AbstractCard card)
{
return myBoolean;
// Set to true if the value is modified from the base value.
}
@Override
public int value(AbstractCard card)
{
return myInt;
// What the dynamic variable will be set to on your card. Usually uses some kind of int you store on your card.
}
@Override
public int baseValue(AbstractCard card)
{
return myInt
// Should generally just be the above.
}
@Override
public boolean upgraded(AbstractCard card)
{
return myBoolean;
// Set to true if this value is changed on upgrade
}
This is then registered in receiveEditCards
.
BaseMod.addDynamicVariable(new MyVariable());