wyvern.kernel.monsters
Class InvGenerator

java.lang.Object
  extended bywyvern.kernel.monsters.InvGenerator
Direct Known Subclasses:
BatInv, DemonInv, DiamondInv, DragonInv, ElfInv, EyeInv, GiantInv, GuardInv, ImpInv, KoboldInv, LeprechaunInv, LichInv, MinotaurInv, NymphInv, OgreInv, OgreMagiInv, OrcInv, PirateInv, PuddingInv, RockMoleInv, SatyrInv, SaurianInv, ShamblerInv, SkeletonInv, SoldierInv, TitanInv, TrogInv, UnicornInv, ZombieInv

public abstract class InvGenerator
extends java.lang.Object

Base class for monster inventory-generators. Has utility functions for generating and cloning objects.

Version:
1.0, Jun 10, 2001
Author:
Steve Yegge

Constructor Summary
InvGenerator()
           
 
Method Summary
 void addItem(Inventory inv, Archetype arch)
          Adds an object of the passed archetype.
 void addItem(Inventory inv, java.lang.String name)
          Creates and adds an item of the exact archetype specified in the name property, e.g.
 GameObject clone(java.lang.String name, int level)
          Instantiates an object of the passed arch and level.
 GameObject cloneItem(java.lang.String name)
          Clones a random item generated from a list, rather than using the RandomItem stuff, so the level doesn't matter.
abstract  void generate(Monster mon)
          Time to generate the inventory.
 void randomItem(Inventory inv, java.lang.String name, int level)
          Generates a random item of the passed type and level, and adds it to the inventory.
 int roll()
          Rolls a percentage (just calls Range.percent()).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InvGenerator

public InvGenerator()
Method Detail

roll

public int roll()
Rolls a percentage (just calls Range.percent()).


cloneItem

public GameObject cloneItem(java.lang.String name)
Clones a random item generated from a list, rather than using the RandomItem stuff, so the level doesn't matter.


clone

public GameObject clone(java.lang.String name,
                        int level)
Instantiates an object of the passed arch and level. If the item is damageable, gives it random wear & tear.

Parameters:
name - the archetype, e.g. "random/weapon"
level - level of item to clone

addItem

public void addItem(Inventory inv,
                    Archetype arch)
Adds an object of the passed archetype. If the item is damageable, gives it random wear & tear.

Parameters:
arch - the archetype

addItem

public void addItem(Inventory inv,
                    java.lang.String name)
Creates and adds an item of the exact archetype specified in the name property, e.g. "weapons/battle_axe".


randomItem

public void randomItem(Inventory inv,
                       java.lang.String name,
                       int level)
Generates a random item of the passed type and level, and adds it to the inventory. Can fail to add anything if the object can't be instantiated, or it's too heavy, or whatever. The level doesn't matter if the item isn't a random object (or if it's a random object generated from a list, sometimes)


generate

public abstract void generate(Monster mon)
Time to generate the inventory.