public abstract class TreasureObj
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
static int |
UNSET
Unset values.
|
Modifier | Constructor and Description |
---|---|
protected |
TreasureObj(@NotNull java.lang.String name,
boolean isTreasureList,
boolean isRealChild)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
protected abstract void |
appendToString(@NotNull java.lang.StringBuilder sb)
Appends a description of this treasure object to a
StringBuilder . |
abstract void |
copyListType(@NotNull TreasureObj treasureObj)
Copes the list type of a treasureone list.
|
void |
correctChance(double corrector)
Updates the chance attribute by a corrector factor.
|
int |
getChance()
Returns the chance attribute.
|
int |
getMagic()
Returns the magic attribute.
|
@NotNull java.lang.String |
getName()
Returns the name of this treasure object.
|
boolean |
hasLoop()
Returns whether this treasure object contains itself.
|
int |
initChance()
Initializes the chance attribute.
|
boolean |
isRealChild()
Returns whether this node is no a yes or no node.
|
boolean |
isTreasureList()
Returns whether this treasure object is a "treasure" or "treasureone"
object.
|
void |
setChance(int value)
Sets the chance attribute.
|
void |
setHasLoop(boolean hasLoop)
Sets whether this treasure object contains itself.
|
void |
setMagic(int magic)
Sets the magic attribute.
|
void |
setNrof(int nrof)
Sets the maximum number of generated items.
|
@NotNull java.lang.String |
toString() |
abstract void |
visit(@NotNull TreasureObjVisitor visitor)
Calls the
TreasureObjVisitor callback function appropriate for
this instance. |
public static final int UNSET
protected TreasureObj(@NotNull @NotNull java.lang.String name, boolean isTreasureList, boolean isRealChild)
name
- the name of this treasure objectisTreasureList
- set for treasure or treasureoneisRealChild
- set for all except yes or no nodes@NotNull public @NotNull java.lang.String toString()
toString
in class java.lang.Object
protected abstract void appendToString(@NotNull @NotNull java.lang.StringBuilder sb)
StringBuilder
.sb
- the string builderpublic void setChance(int value)
value
- the chance attributepublic int getChance()
public int initChance()
public void correctChance(double corrector)
corrector
- the corrector factorpublic void setMagic(int magic)
magic
- the magic attributepublic int getMagic()
public void setNrof(int nrof)
nrof
- the maximum numberpublic boolean hasLoop()
public void setHasLoop(boolean hasLoop)
hasLoop
- whether this treasure object contains itselfpublic boolean isTreasureList()
public boolean isRealChild()
@NotNull public @NotNull java.lang.String getName()
public abstract void visit(@NotNull @NotNull TreasureObjVisitor visitor)
TreasureObjVisitor
callback function appropriate for
this instance.visitor
- the visitor to callpublic abstract void copyListType(@NotNull @NotNull TreasureObj treasureObj)
treasureObj
- the node to copy from