wyvern.kernel.monsters
Class Wallet

java.lang.Object
  extended bywyvern.kernel.monsters.Wallet

public final class Wallet
extends java.lang.Object

This class has utility methods for adding and removing coins from a monster or player's "wallet". The wallet consists of coins in their top-level inventory and coins in any coin purse(s) they may be carrying.

Version:
1.0, Oct 30, 2000
Author:
Steve Yegge

Constructor Summary
Wallet()
           
 
Method Summary
static void adjustTotal(Monster m, long amount)
          Adjusts the total number of coins for the monster by the specified amount.
static long getTotal(Monster m)
          Returns the total, converted to silver coins, that the monster is carrying in top-level inventory.
static void main(java.lang.String[] args)
          Tests the make-change algorithm.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Wallet

public Wallet()
Method Detail

getTotal

public static long getTotal(Monster m)
Returns the total, converted to silver coins, that the monster is carrying in top-level inventory.


adjustTotal

public static void adjustTotal(Monster m,
                               long amount)
Adjusts the total number of coins for the monster by the specified amount. Positive adds coins. Negative deducts coins. If the negative value is greater than the total, throws an IllegalStateException.

Parameters:
m - the monster to do this to
amount - the amount to add (or deduct, if the value is negative). If deducting, takes from silver first, then gold, then platinum.

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Tests the make-change algorithm.

Throws:
java.lang.Exception