wyvern.lib.classes.random
Class RandomRing

java.lang.Object
  extended bywyvern.kernel.properties.PList
      extended bywyvern.kernel.maps.MapObject
          extended bywyvern.lib.classes.random.RandomObject
              extended bywyvern.lib.classes.random.RandomRing
All Implemented Interfaces:
Broadcaster, GameObject, MethodHookable, PropertyList

public class RandomRing
extends RandomObject

Generates random rings for dungeons and such. The more powerful the ring, the more rare it is. Some rings are generated with curses, with more nastier being more likely to be cursed.

Version:
1.0, Jan 15, 2001
Author:
Steve Yegge

Field Summary
 
Fields inherited from class wyvern.lib.classes.random.RandomObject
DEFAULT_BAG_CHANCE
 
Fields inherited from class wyvern.kernel.maps.MapObject
IN_MAP_EDITOR, listenerList_
 
Fields inherited from class wyvern.kernel.properties.PList
readOnly_
 
Fields inherited from interface wyvern.lib.PropertyList
PROPERTY_PACKAGE
 
Constructor Summary
RandomRing()
           
 
Method Summary
 GameObject generate()
          Produces a random ring.
 void generateMixed(GameObject ring)
          Adds more or less equally-weighted properties to the ring, one good one and one bad one.
 void generateMixedResistance(GameObject ring)
          Generates one resistance and one vulnerability.
 void generateMixedStats(GameObject ring)
          Generates one positive stat and one negative stat, each level 1.
 void generatePlusMinus(GameObject ring, int level)
          Adds one good OR one bad property to the ring (50/50).
 void generateStat(GameObject obj, int level)
          Puts a positive or negative (50/50) adjustment on a random stat or skill.
static void main(java.lang.String[] args)
          Tests the class.
 void transform(GameMap map, int x, int y)
          Generates a ring and sets it in the map.
 
Methods inherited from class wyvern.lib.classes.random.RandomObject
addChanceProperty, addObjProperty, addRandomProperty, createBag, generateFromList, getBagChance, getCurseChance, getLevel, getListName, setContainer, setDangerLevelFromMap, setMap, transferProperties, usingList, usingSingleArch
 
Methods inherited from class wyvern.kernel.maps.MapObject
addContainerChangeListener, addDefaultProperty, addMapChangeListener, addMapMotionListener, addMethodHook, addMotionTracker, addObjectTracker, addPrefix, addSuffix, addToMap, bless, broadcast, broadcast, broadcast, broadcast, broadcast, canEnter, canEnterBlockedBy, canMove, canMove, canMoveBlockedBy, canMoveBlockedBy, canMoveTo, canMoveToBlockedBy, checkDrop, curse, cycleFrame, destroy, ensureListenerList, ensureWeight, externalize, fireContainerEntered, fireContainerExited, fireEnteredMap, fireExitedMap, fireMovedInMap, getAlpha, getAppearance, getArchetype, getBaseName, getBaseWeight, getBitmap, getBounds, getCanonicalClassName, getCategory, getContainer, getCreator, getDamagedDescription, getDescription, getDirection, getGenderPossessive, getGenderPronoun, getImage, getImageDescriptor, getImageDescriptors, getLayer, getLocations, getMap, getMapLink, getMaterial, getMaterialDescription, getMover, getOwningPlayer, getParentMap, getPrefixes, getQuantity, getReferenceLoc, getRelativeLocs, getShortDesc, getSuffixes, getTile, getTile, getValue, getWeight, groupString, inContainer, initialize, initLocs, inMapEditor, invalidate, invalidateImage, invalidateParent, invalidateText, isAnimated, isAttackable, isBlessed, isCommandable, isCursed, isDamned, isGroupable, isIdentified, isMonster, isMonsterOrPlayer, isPlayer, isTerrain, isUncursed, isUnpaid, isWizard, makeClone, markPaid, markUnpaid, move, occupies, positionAt, positionAtMap, remove, removeContainerChangeListener, removeFromMap, removeMapChangeListener, removeMapMotionListener, removeMethodHook, removeMotionTracker, removeObjectTracker, removePrefix, removeSuffix, runMethodHook, setAlpha, setAnimated, setBitmap, setCategory, setDefaultBitmap, setDefaultCategory, setDefaultDesc, setDefaultImage, setDefaultIntProperty, setDefaultLayer, setDefaultMaterial, setDefaultProperty, setDefaultShortDesc, setDirection, setImage, setImage, setLayer, setLocations, setMapLink, setQuantity, setShape, setSize, setTransientSize, setWeight, setWeight, teleport, toString, updateMapLocation
 
Methods inherited from class wyvern.kernel.properties.PList
addProperty, addTransientProperty, adjustDoubleProperty, adjustIntProperty, adjustLongProperty, adjustTransientDoubleProperty, adjustTransientIntProperty, adjustTransientLongProperty, countLocalProperties, debugProperties, dismantlePropertyList, getDoubleProperty, getInheritedProperty, getInteger, getIntProperty, getLocalProperties, getLocalProperty, getLongProperty, getParent, getPersistentDoubleProperty, getPersistentIntProperty, getPersistentLocalProperties, getPersistentLongProperty, getPersistentProperty, getProfilingInfo, getProperties, getProperties, getPropertiesIncludingTransients, getPropertiesIncludingTransients, getProperty, getSerializableProperties, getSerializableProperty, getStringProperty, getTransientDoubleProperty, getTransientIntProperty, getTransientLongProperty, getTransientProperties, getTransientProperty, hasLocalProperty, hasPersistentProperty, hasProperty, hasTransientProperty, inheritProperty, isReadOnly, isRemoved, isTransientlyRemoved, printLocalProperties, printProperties, printProperties, printTransientProperties, removeProperty, removeTransientProperty, setDoubleProperty, setIntProperty, setLongProperty, setParent, setProperty, setReadOnly, setTransientDoubleProperty, setTransientIntProperty, setTransientLongProperty, setTransientProperty, toString, transientlyRemoveProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface wyvern.lib.PropertyList
addProperty, addTransientProperty, adjustDoubleProperty, adjustIntProperty, adjustLongProperty, adjustTransientDoubleProperty, adjustTransientIntProperty, adjustTransientLongProperty, countLocalProperties, getDoubleProperty, getInheritedProperty, getIntProperty, getLocalProperties, getLocalProperty, getLongProperty, getParent, getPersistentDoubleProperty, getPersistentIntProperty, getPersistentLocalProperties, getPersistentLongProperty, getPersistentProperty, getProperties, getProperties, getPropertiesIncludingTransients, getPropertiesIncludingTransients, getProperty, getSerializableProperties, getSerializableProperty, getStringProperty, getTransientDoubleProperty, getTransientIntProperty, getTransientLongProperty, getTransientProperties, getTransientProperty, hasLocalProperty, hasPersistentProperty, hasProperty, hasTransientProperty, inheritProperty, isReadOnly, isRemoved, isTransientlyRemoved, printLocalProperties, printProperties, printProperties, printTransientProperties, removeProperty, removeTransientProperty, setDoubleProperty, setIntProperty, setLongProperty, setParent, setProperty, setReadOnly, setTransientDoubleProperty, setTransientIntProperty, setTransientLongProperty, setTransientProperty, toString, transientlyRemoveProperty
 

Constructor Detail

RandomRing

public RandomRing()
Method Detail

transform

public void transform(GameMap map,
                      int x,
                      int y)
Generates a ring and sets it in the map. If the RandomRing object is in the map, removes it before generating the ring. If the RandomRing is NOT in a map, it still generates a ring - this way you can use a RandomRing class to generate a random ring on the fly, although you might as well just the generate() method directly if you want to do that. Sets a property on the RandomRing called "generated", whose value is the item that was generated (null if none).

Overrides:
transform in class RandomObject
Parameters:
map - the map to put the generated ring in.
x - x location
y - y location

generate

public GameObject generate()
Produces a random ring.

Overrides:
generate in class RandomObject
Returns:
a randomly-generated ring

generateMixed

public void generateMixed(GameObject ring)
Adds more or less equally-weighted properties to the ring, one good one and one bad one. Example: resist fire, vuln cold. Puts a curse on the ring 50% of the time.

Parameters:
ring - the same object, with extra properties added to it. The object's identified-description and shop value will be updated appropriately.

generateMixedResistance

public void generateMixedResistance(GameObject ring)
Generates one resistance and one vulnerability.


generateMixedStats

public void generateMixedStats(GameObject ring)
Generates one positive stat and one negative stat, each level 1.


generatePlusMinus

public void generatePlusMinus(GameObject ring,
                              int level)
Adds one good OR one bad property to the ring (50/50). Puts a curse on the ring 50% of the time, more often if it's a negative enchantment.

Parameters:
level - 1 for +/-1, 2 for +/-2, etc.
ring - the same object, with extra properties added to it. The object's identified-description and shop value will be updated appropriately.

generateStat

public void generateStat(GameObject obj,
                         int level)
Puts a positive or negative (50/50) adjustment on a random stat or skill. Doesn't add curses.

Parameters:
obj - the object to add it to
level - the int adjustment to add

main

public static void main(java.lang.String[] args)
Tests the class.