wyvern.kernel.player
Class Races

java.lang.Object
  extended bywyvern.kernel.player.Races

public final class Races
extends java.lang.Object

This class encapsulates information about the various player races. It provides static access methods for convenience. It's also the single least object-oriented, least polymorphic piece of code in the game. I'm terribly ashamed of it, and we'll migrate to using classes for each race as soon as possible.

Version:
1.0, Mar 14, 1999
Author:
Steve Yegge

Field Summary
static int HALL_OF_FAME_LEVEL
           
static int WARN_POINTS_PER_LEVEL
           
 
Method Summary
static void advanceLevel(Player player, int new_level)
          Pushes the player up to another level.
static java.lang.String getAdjective(java.lang.String race)
          Returns an adjective (e.g.
static void inductToHOF(Player player)
          The player has won - put them in the Hall of Fame.
static boolean isSupported(java.lang.String race)
          Returns true if the passed race is one of the supported races.
static int levelForXP(int xp)
          Tells you what level the player should be given his/her current XP.
static int xpForLevel(int level)
          Returns the minimum number of XP needed for the passed level.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HALL_OF_FAME_LEVEL

public static final int HALL_OF_FAME_LEVEL
See Also:
Constant Field Values

WARN_POINTS_PER_LEVEL

public static final int WARN_POINTS_PER_LEVEL
See Also:
Constant Field Values
Method Detail

isSupported

public static boolean isSupported(java.lang.String race)
Returns true if the passed race is one of the supported races. Performs a case-insensitive comparison.

Parameters:
race - the race to check - can have any case
Returns:
true if it's a supported player race

getAdjective

public static java.lang.String getAdjective(java.lang.String race)
Returns an adjective (e.g. "elven") for the given race.


levelForXP

public static int levelForXP(int xp)
Tells you what level the player should be given his/her current XP. Currently not race-dependent, but we may eventually opt to add in a race parameter.

Parameters:
xp - the current XP for the player
Returns:
level the player's level

xpForLevel

public static int xpForLevel(int level)
Returns the minimum number of XP needed for the passed level.

Parameters:
level - the desired level
Returns:
xp the XP needed for that level

advanceLevel

public static void advanceLevel(Player player,
                                int new_level)
Pushes the player up to another level. Runs a method-hook called "level-up" with no data.

Parameters:
player - the player to advance
new_level - the player's new level

inductToHOF

public static void inductToHOF(Player player)
The player has won - put them in the Hall of Fame.