|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object wyvern.lib.classes.random.RandomItem
Class to generate random items of various types. Reads all the generatable archetypes in when the game starts up. Knows how to generate items of different levels, including adding enchantments.
Constructor Summary | |
RandomItem()
|
Method Summary | |
static void |
main(java.lang.String[] args)
Tests the item generator. |
static GameObject |
randomItem(int level)
Generates a random item of the passed level, with the default chance of the item being cursed. |
static GameObject |
randomItem(int level,
int curseChance)
Generates a random item of the passed level. |
static GameObject |
randomItem(int level,
java.lang.String stype)
Generates a random item of the passed level, with the default chance of generating a cursed item. |
static GameObject |
randomItem(int level,
java.lang.String stype,
int curseChance)
Generates a random item of the passed level. |
static Archetype |
randomItemOfLevelAndType(int level,
java.lang.String type)
Returns an archetype chosen from a specific list, given the type and level. |
static Archetype |
randomItemOfLevelAndType(int level,
java.lang.String stype,
boolean useMagic)
Returns an archetype chosen from a specific list, given the type and level. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public RandomItem()
Method Detail |
public static GameObject randomItem(int level)
level
- the level of item to generate (1-20)public static GameObject randomItem(int level, int curseChance)
level
- the level of item to generatecurseChance
- the chance the item should be cursed, -1 to
use the default.
public static GameObject randomItem(int level, java.lang.String stype, int curseChance)
level
- the level of item to generatestype
- the type of item, from the following list:
"weapon", "armor", "misc", "treasure",
"spellbook", "ring", "wand", "potion", "scroll". "ring"
generates rings and amulets, and "wand" generates wands,
rods and magical staves.curseChance
- the percentage chance in 100 that
the item should be cursed, -1 to use the default chance.
public static GameObject randomItem(int level, java.lang.String stype)
level
- the level of item to generatestype
- the type of item, from the following list:
"weapon", "armor", "misc", "treasure",
"spellbook", "ring", "wand", "potion", "scroll". "ring"
generates rings and amulets, and "wand" generates wands,
rods and magical staves.
public static Archetype randomItemOfLevelAndType(int level, java.lang.String type)
level
- the level of item to choose (after random adjustment).
Doesn't work for "treasure" - call RandomTreasure.randomTreasure()
for that.type
- the item type/categorypublic static Archetype randomItemOfLevelAndType(int level, java.lang.String stype, boolean useMagic)
level
- the level of item to choose (after random adjustment).
Doesn't work for "treasure" - call RandomTreasure.randomTreasure()
for that.stype
- the item type/categoryuseMagic
- true to have a chance of generating a magically
enchanted item by using a nonmagic item as a base. If false,
it will only return archetypes it finds in the list.public static void main(java.lang.String[] args) throws java.lang.Exception
java.lang.Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |