wyvern.kernel.combat
Class XPAwards

java.lang.Object
  extended bywyvern.kernel.combat.XPAwards

public final class XPAwards
extends java.lang.Object

Handles computation of individual and group XP for a kill.

Version:
1.0, Jan 02, 2004
Author:
Steve Yegge

Field Summary
static java.lang.String MYCLASS
           
 
Method Summary
static int adjustXPByLevel(int xp, int level1, int level2)
          Does an adjustment of the XP award based on the relative levels of the attacker and defender.
static java.util.List awardExperience(Player attacker, Attackable target)
          Awards the experience for the kill to the attacker (and any group members present, if applicable).
static java.util.List awardGroupXP(PlayerGroups.Group g, Attackable target, int xp, DamageEvent event)
          Awards XP to an entire group.
static void awardGuildXP(Player member, DamageEvent event)
          Awards guild experience for the kill.
static void awardIndividualXP(Attackable target, Player attacker, DamageEvent event, int xp)
          Awards XP to a non-grouped individual.
static void awardXPForPlayer(Player winner, Damageable target)
          Figures out if a player who killed something should get all the XP, or share it with other group members.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MYCLASS

public static final java.lang.String MYCLASS
See Also:
Constant Field Values
Method Detail

awardXPForPlayer

public static void awardXPForPlayer(Player winner,
                                    Damageable target)
Figures out if a player who killed something should get all the XP, or share it with other group members. Calls the appropriate xp-awarding function. Also adjusts alignments of all players who shared in the XP.

Parameters:
winner - the player who killed the thing
target - the thing that got killed/destroyed

awardExperience

public static java.util.List awardExperience(Player attacker,
                                             Attackable target)
Awards the experience for the kill to the attacker (and any group members present, if applicable).

Parameters:
attacker - the one who dealt the final blow
target - the thing that got destroyed. It has the damage event stored in a "fatal-event" property (a DamageEvent produced by DamageCommand). If the target was killed instantly, e.g. by a death ray or fear, the "fatal-event" property is a DeathEvent.
Returns:
a list of the attackers who shared the experience. Null if no experience was awarded, or only one player got all of it.

awardIndividualXP

public static void awardIndividualXP(Attackable target,
                                     Player attacker,
                                     DamageEvent event,
                                     int xp)
Awards XP to a non-grouped individual.

Returns:
the list of people who shared in the XP, or null if only one person got it

awardGroupXP

public static java.util.List awardGroupXP(PlayerGroups.Group g,
                                          Attackable target,
                                          int xp,
                                          DamageEvent event)
Awards XP to an entire group. Called by awardExperience if the attacker is in a group.

Parameters:
g - the group the attacker is in
target - the target that was killed

adjustXPByLevel

public static int adjustXPByLevel(int xp,
                                  int level1,
                                  int level2)
Does an adjustment of the XP award based on the relative levels of the attacker and defender.

Parameters:
xp - the proposed amount of xp to award
level1 - attacker's level
level2 - defender's level
Returns:
the actual amount of xp to award (can be zero)

awardGuildXP

public static void awardGuildXP(Player member,
                                DamageEvent event)
Awards guild experience for the kill.

Parameters:
member - a group member who's getting some experience - could be the player who actually killed the monster, or not.
event - the DamageEvent - see comments in wyvern.lib.properties.GuildSkills.awardXP() for details on the properties set in the event.