com.planet_ink.coffee_mud.Libraries.interfaces
Interface CombatLibrary

All Superinterfaces:
java.lang.Cloneable, CMLibrary, CMObject, java.lang.Comparable<CMObject>
All Known Implementing Classes:
MUDFight

public interface CombatLibrary
extends CMLibrary

Fighting, healing, determining combatants, death, attacking, damaging, and formations. These are all the things handled by the combat library. But I'm betting you already knew that.


Nested Class Summary
static class CombatLibrary.CombatSystem
          An enumeration of the several combat systems.
 
Field Summary
static int TICKS_PER_SHIP_COMBAT
          Number of normal 4-second ticks per ship combat round
 
Method Summary
 int adjustedArmor(int armorValue)
          Returns the given armor value, after adjusting for hunger, thirst, fatigue, position, and dexterity.
 int adjustedArmor(MOB mob)
          Returns the given mobs armor, after adjusting for hunger, thirst, fatigue, position, and dexterity.
 int adjustedAttackBonus(int baseAttack)
          Returns the given attack bonus, after adjusting for hunger, thirst, fatigue, position, and strength.
 int adjustedAttackBonus(MOB mob, MOB target)
          Returns the given mobs attack bonus, after adjusting for hunger, thirst, fatigue, position, and strength.
 int adjustedDamage(int baseDamage, int level, boolean biasHigh)
          Returns the given unarmed damage bonus, after adjusting for hunger, thirst, fatigue, position, and strength, from the proper damage formula, which assumes a standard unarmed mob with average stats.
 int adjustedDamage(MOB mob, Weapon weapon, MOB target, int bonusDamage, boolean allowCrits, boolean biasHigh)
          Returns the given mob (or weapons, if provided) damage bonus, after adjusting for hunger, thirst, fatigue, position, and strength, from the proper damage formula, which depends on the weapon and the target.
 java.util.Set<MOB> allCombatants(MOB mob)
          If the given mob is not in combat, this returns null.
 java.util.Set<MOB> allPossibleCombatants(MOB mob, boolean includePlayers)
          Returns all the mobs in the same room as the given mob, which that aren't in the mobs group.
 java.lang.String armorStr(MOB mob)
          Returns the friendly armor string for the given mob, describing how well armored they are.
 boolean checkDamageSaves(MOB mob, CMMsg msg)
          Checks to see if the given message gets a saving throw for the given mob damage and, if so, adjusts it
 boolean checkSavingThrows(MOB mob, CMMsg msg)
          Checks to see if the given message gets a saving throw for the given mob and, if so, applies it.
 java.lang.String damageProwessStr(MOB mob)
          Returns the friendly damage prowess string for the given mob, describing how well damagy they are.
 void dispenseExperience(java.util.Set<MOB> killers, java.util.Set<MOB> dividers, MOB killed)
          For a valid set of killers who are benefitting from having killed the given killed mob, this method will make repeated postExperience calls after having calculated their exp bounty for the kill.
 void doDeathPostProcessing(CMMsg msg)
          When a death occurs, there are certain record keeping processes that need to happen.
 boolean doTurnBasedCombat(MOB mob, Room R, Area A)
          The heart of the alternative turn-based combat engine, this method is called every tick to determine if it is the given mobs turn to fight.
 void establishRange(MOB source, MOB target, Environmental tool)
          Given an attacking source and a defending target and the sources weapon or skill, this method will set the distance between the source and target from each other.
 void expendEnergy(MOB mob, boolean expendMovement)
          Every tick, THIS method is called to make the given mob a little more hungry and thirsty.
 java.lang.String fightingProwessStr(MOB mob)
          Returns the friendly attack string for the given mob, describing how well attacky they are.
 void forcePeaceAllFightingAgainst(MOB mob, java.util.Set<MOB> exceptionSet)
          Forces all the mobs in the same room to stop fighting the given mob, with possible exceptions.
 java.util.Set<MOB> getAllFightingAgainst(MOB mob, java.util.Set<MOB> set)
          Returns all the mobs in the same room as the given mob who are attacking the given mob, and puts them in the given set.
 MOB getBreatheKiller(MOB victim)
          When a mob can't breathe, it actually takes some work to figure out if anyone is to blame.
 java.util.Set<MOB> getCombatBeneficiaries(MOB killer, MOB killed, CharClass combatCharClass)
          Returns all the mobs set to benefit from the death of the given killed mob by the given killer.
 java.util.Set<MOB> getCombatDividers(MOB killer, MOB killed, CharClass combatCharClass)
          Returns all the mobs for whom experience awards must be divided before awarding.
 CharClass getCombatDominantClass(MOB killer, MOB killed)
          Returns the character class of the given killer, or their leader if they are following someone who is not a mob.
 MOB getFollowedLeader(MOB mob)
          Returns the front of the follower line for this mob.
 java.util.List<MOB>[] getFormation(MOB mob)
          Returns this mobs combat formation an an array of string lists, where each entry is a "row" in the formation, and the lists contain the mobs at that row.
 int getFormationAbsOrder(MOB mob)
          Returns the numeric position of the given mob in his or her combat formation.
 java.util.List<MOB> getFormationFollowed(MOB mob)
          Returns the list of mobs behind the given mob in their respective formation order.
 int getShipHullPoints(BoardableShip ship)
          Returns the number of base hull points that the given ship has.
 void handleBeingAssaulted(CMMsg msg)
          When an attack message targeting a given mob is received, this method is called to react to the attack.
 void handleBeingDamaged(CMMsg msg)
          When a damaging message targeting a given mob is received, this method is called to actually do the damaging.
 void handleBeingGravitied(MOB mob, CMMsg msg)
          Handles the effects of extreme gravity and other acceleration as from a ship.
 void handleBeingHealed(CMMsg msg)
          When a healing message targeting a given mob is received, this method is called to actually do the healing.
 boolean handleCombatLossConsequences(MOB deadM, MOB killerM, java.lang.String[] consequences, int[] lostExperience, java.lang.String message)
          When a player dies or flees, the system coffeemud.ini file defines the consequences of losing the fight.
 boolean handleDamageSpam(MOB observerM, Physical target, int amount)
          When a player has nobattlespam, this method is called when damage is observed to add to the totals.
 void handleDamageSpamSummary(MOB mob)
          When a player has nobattlespam, this method is called when damage is observed to report the totals from the last combat round.
 void handleDeath(CMMsg msg)
          When a death message is received by a mob and the message has the mob as a source, this method is called to kill the source of the message off.
 void handleObserveDeath(MOB observer, MOB fighting, CMMsg msg)
          When an observer observes a death, this method is called is called to have the observer react.
 boolean isAShipSiegeWeapon(Item I)
          Returns whether the given item is classified as a ammunition firing siege weapon, as used on a sailing ship.
 boolean isKnockedOutUponDeath(MOB deadM, MOB killerM)
          Returns whether the system properties specify that, when the given dead mob does by the hand of the given killer mob, that the dead mob won't actually die, but just be knocked out.
 void makeFollowersFight(MOB observerM, MOB defenderM, MOB attackerM)
          When the given observerM witnesses the given attacker mob attacking the given defender mob, this method checks to see if the observer has a dog in the fight, and if they do, causes them to start fighting either the attacker or the defender.
 void makePeaceInGroup(MOB mob)
          This strange method makes sure that none of the mobs in the given mobs group are fighting each other.
 boolean mayIAttackThisVessel(MOB mob, PhysicalAgent defender)
          Returns whether the given attacking mob, on the given attacker ship, may attack the people and property of the given defending ship.
 boolean postAttack(MOB attacker, MOB target, Item weapon)
          This method causes a mundane attack to occur by the given attack to the given target using the given weapon.
 void postDamage(MOB attacker, MOB target, Environmental weapon, int damage, int messageCode, int damageType, java.lang.String allDisplayMessage)
          The official way to post damage that is happening.
 void postDeath(MOB killerM, MOB deadM, CMMsg addHere)
          This method will create an official death message for the given deadM mob, by the given killerM mob.
 boolean postHealing(MOB healer, MOB target, Ability tool, int healing, int messageCode, java.lang.String allDisplayMessage)
          Posts a message of healing from the given healer to the given target using the given optional Ability tool.
 void postItemDamage(MOB mob, Item I, Environmental tool, int damageAmount, int messageType, java.lang.String message)
          This method handles an item taking damage.
 void postPanic(MOB mob, CMMsg addHere)
          When a mobs hit points fall below the wimp level, they panic, which often causes the mob to flee.
 boolean postRevengeAttack(MOB attacker, MOB defender)
          If an NPC attacker comes under the sudden effect of a spell, and knows who is responsible, but are not presently in combat, this method will start combat with them.
 boolean postShipAttack(MOB attacker, PhysicalAgent attackingShip, PhysicalAgent target, Weapon weapon, boolean wasAHit)
          This method causes a mundane attack by the given attacking mob (which may be a fake factory mob) on the given attacking ship against the given target ship with the given siege weapon.
 void postShipWeaponAttackResult(MOB source, PhysicalAgent attacker, PhysicalAgent defender, Weapon weapon, boolean success)
          This method handles both a hit or a miss with a weapon between two ships in combat.
 CMMsg postWeaponAttackResult(MOB source, MOB target, Item item, boolean success)
          This method handles both a hit or a miss with a weapon.
 CMMsg postWeaponDamage(MOB source, MOB target, Item item, int damageInt)
          An alternative to postWeaponAttackResult(MOB, MOB, Item, boolean).
 java.util.Set<MOB> properTargets(Ability A, MOB caster, boolean includePlayers)
          Returns all the potential targets for the given ability, in the same room as the given mob.
 void recoverTick(MOB mob)
          Every tick, this method is called.
 java.lang.String replaceDamageTag(java.lang.String str, int damage, int damageType, CMMsg.View sourceTargetSTO)
          Because damage messages are basically always modified in message preview (okMessage), there is no point in putting the amount of damage into the message string.
 void resistanceMsgs(MOB source, MOB target, CMMsg msg)
          When the source does something to the target that the target resists, and the given message has a targetminor containing the type of damage that's being resisted, this message will generate and tack on a new message with the resistance of the target, and flag the given message as having been resisted.
 boolean rollToHit(int attack, int defence, int adjustment)
          Given the exact attack score, against the given defense score, and the given percentage adjustment.
 boolean rollToHit(MOB attacker, MOB defender)
          Gathers the given attackers adjusted attack and the given defenders adjusted armor, applies a fudge factor, and makes a to-hit roll.
 java.lang.String standardHitString(int weaponDamageType, int weaponClass, int damageAmount, java.lang.String weaponName)
          Given the weapon type and classification and name, this method returns either the fullly filled out weapon hit/damage string from the lists.ini file that matches.
 java.lang.String standardHitWord(int type, double pct)
          Given the weapon type and percent of damage 0 to 1, this method returns the hit/damage string from the lists.ini file that matches.
 java.lang.String standardHitWord(int type, int damage)
          Given the weapon type and amount of damage, this method returns the hit/damage string from the lists.ini file that matches.
 java.lang.String standardMissString(int weaponDamageType, int weaponClassification, java.lang.String weaponName, boolean useExtendedMissString)
          Given the weapon type and classification and name, this method returns either the fullly filled out weapon miss string, or generic non-extended non-weapon miss string from the lists.ini file that matches.
 java.lang.String standardMobCondition(MOB viewer, MOB mob)
          When a particular race does not provide its own override health condition message, this method provides the base message from the list.ini file.
 void tickCombat(MOB fighter)
          This is the heart of the main combat engine.
 
Methods inherited from interface com.planet_ink.coffee_mud.Libraries.interfaces.CMLibrary
activate, getServiceClient, L, propertiesLoaded, shutdown
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.CMObject
copyOf, ID, initializeClass, name, newInstance
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Field Detail

TICKS_PER_SHIP_COMBAT

static final int TICKS_PER_SHIP_COMBAT
Number of normal 4-second ticks per ship combat round

See Also:
Constant Field Values
Method Detail

allPossibleCombatants

java.util.Set<MOB> allPossibleCombatants(MOB mob,
                                         boolean includePlayers)
Returns all the mobs in the same room as the given mob, which that aren't in the mobs group. It doesn't check combatability, and as such, is pretty loose.

Parameters:
mob - the mob to check
includePlayers - true to include players, false not
Returns:
the set of mobs who might be a future combatant
See Also:
allCombatants(MOB), properTargets(Ability, MOB, boolean)

properTargets

java.util.Set<MOB> properTargets(Ability A,
                                 MOB caster,
                                 boolean includePlayers)
Returns all the potential targets for the given ability, in the same room as the given mob. If the skill is non-malicious, it returns the mobs groups members, if the mob is in combat, it returns the mobs in combat with him/her, and if the skill is malicious, it returns all potential combatants.

Parameters:
A - the skill you want targets for
caster - the user of the skill
includePlayers - true to include players, false otherwise
Returns:
the proper targets for the given skill
See Also:
allCombatants(MOB), allPossibleCombatants(MOB, boolean)

allCombatants

java.util.Set<MOB> allCombatants(MOB mob)
If the given mob is not in combat, this returns null. Otherwise, it returns all the mobs in the same room that are fighting the mob, or a follower.

Parameters:
mob - the fighting mob
Returns:
the set of combatants.
See Also:
allPossibleCombatants(MOB, boolean), properTargets(Ability, MOB, boolean)

makePeaceInGroup

void makePeaceInGroup(MOB mob)
This strange method makes sure that none of the mobs in the given mobs group are fighting each other.

Parameters:
mob - the mob whose group needs peace.

adjustedArmor

int adjustedArmor(MOB mob)
Returns the given mobs armor, after adjusting for hunger, thirst, fatigue, position, and dexterity.

Parameters:
mob - the mob whose armor needs adjusting
Returns:
the given mobs adjusted armor value
See Also:
PhyStats.armor()

adjustedArmor

int adjustedArmor(int armorValue)
Returns the given armor value, after adjusting for hunger, thirst, fatigue, position, and dexterity. Assumes an average random mob.

Parameters:
armorValue - the base armor value to start from
Returns:
the given adjusted armor value
See Also:
PhyStats.armor()

adjustedAttackBonus

int adjustedAttackBonus(MOB mob,
                        MOB target)
Returns the given mobs attack bonus, after adjusting for hunger, thirst, fatigue, position, and strength.

Parameters:
mob - the mob whose attack bonus needs adjusting
target - i guess this is who they are fighting
Returns:
the given mobs adjusted attack bonus
See Also:
PhyStats.armor()

adjustedAttackBonus

int adjustedAttackBonus(int baseAttack)
Returns the given attack bonus, after adjusting for hunger, thirst, fatigue, position, and strength. Assumes an average mob otherwise.

Parameters:
baseAttack - the base attack bonus to work from.
Returns:
the given adjusted attack bonus
See Also:
PhyStats.armor()

adjustedDamage

int adjustedDamage(MOB mob,
                   Weapon weapon,
                   MOB target,
                   int bonusDamage,
                   boolean allowCrits,
                   boolean biasHigh)
Returns the given mob (or weapons, if provided) damage bonus, after adjusting for hunger, thirst, fatigue, position, and strength, from the proper damage formula, which depends on the weapon and the target.

Parameters:
mob - the mob who wants adjusted damage
weapon - the weapon used by the mob against target, or null
target - the target being hit, or null
bonusDamage - any bonus to base damage
allowCrits - true to apply crit if crit damage occurs
biasHigh - random numbers are always biased high
Returns:
the total adjusted damage

adjustedDamage

int adjustedDamage(int baseDamage,
                   int level,
                   boolean biasHigh)
Returns the given unarmed damage bonus, after adjusting for hunger, thirst, fatigue, position, and strength, from the proper damage formula, which assumes a standard unarmed mob with average stats.

Parameters:
baseDamage - base damage
level - the level of the mob
biasHigh - random numbers are always biased high
Returns:
the total adjusted damage

rollToHit

boolean rollToHit(MOB attacker,
                  MOB defender)
Gathers the given attackers adjusted attack and the given defenders adjusted armor, applies a fudge factor, and makes a to-hit roll.

Parameters:
attacker - the attacking mob
defender - the mob being attacked
Returns:
true if the hit roll succeeded, false if it failed
See Also:
rollToHit(int, int, int)

rollToHit

boolean rollToHit(int attack,
                  int defence,
                  int adjustment)
Given the exact attack score, against the given defense score, and the given percentage adjustment.

Parameters:
attack - the attack score
defence - the armor score
adjustment - the percentage adjustment
Returns:
true if the attack roll succeeds, false if it fails.
See Also:
rollToHit(MOB, MOB)

forcePeaceAllFightingAgainst

void forcePeaceAllFightingAgainst(MOB mob,
                                  java.util.Set<MOB> exceptionSet)
Forces all the mobs in the same room to stop fighting the given mob, with possible exceptions.

Parameters:
mob - the mob who needs peace
exceptionSet - null, or a set of mobs not to apply this to.

getAllFightingAgainst

java.util.Set<MOB> getAllFightingAgainst(MOB mob,
                                         java.util.Set<MOB> set)
Returns all the mobs in the same room as the given mob who are attacking the given mob, and puts them in the given set.

Parameters:
mob - the mob who is in combat
set - the set to put combatants in, or null to make one
Returns:
the same set sent in

postPanic

void postPanic(MOB mob,
               CMMsg addHere)
When a mobs hit points fall below the wimp level, they panic, which often causes the mob to flee. This method will initiate that process by causing a combat panic, and either posting it to the room, or adding it as a trailer to the given msg. Generates a CMMsg message and sends it to the mobs room.

Parameters:
mob - the mob who is panicing
addHere - null, or the message to add the panic to
See Also:
postDeath(MOB, MOB, CMMsg)

postDeath

void postDeath(MOB killerM,
               MOB deadM,
               CMMsg addHere)
This method will create an official death message for the given deadM mob, by the given killerM mob. It will then either post it, or add it as a trailer to the given msg Generates a CMMsg message and sends it to the target room.

Parameters:
killerM - the killer mob
deadM - the dead mob
addHere - null, or the message to add this one to.
See Also:
postPanic(MOB, CMMsg)

postAttack

boolean postAttack(MOB attacker,
                   MOB target,
                   Item weapon)
This method causes a mundane attack to occur by the given attack to the given target using the given weapon. If no weapon is given, it might attempt a draw first. Generates a CMMsg message and sends it to the target room.

Parameters:
attacker - the attacker mob
target - the target mob
weapon - the weapon used by the attacker, or null
Returns:
true if the attack succeeded, false if it failed.

postShipAttack

boolean postShipAttack(MOB attacker,
                       PhysicalAgent attackingShip,
                       PhysicalAgent target,
                       Weapon weapon,
                       boolean wasAHit)
This method causes a mundane attack by the given attacking mob (which may be a fake factory mob) on the given attacking ship against the given target ship with the given siege weapon.

Parameters:
attacker - the attacking agent mob
attackingShip - the ship the attacker is on
target - the target ship
weapon - the siege weapon used
wasAHit - true to register a hit, false to register an attack
Returns:
true if the attack succeeded, false if it failed

mayIAttackThisVessel

boolean mayIAttackThisVessel(MOB mob,
                             PhysicalAgent defender)
Returns whether the given attacking mob, on the given attacker ship, may attack the people and property of the given defending ship.

Parameters:
mob - the agent attacker
defender - the attacked ship
Returns:
true if an attack is authorized, false otherwise

postHealing

boolean postHealing(MOB healer,
                    MOB target,
                    Ability tool,
                    int healing,
                    int messageCode,
                    java.lang.String allDisplayMessage)
Posts a message of healing from the given healer to the given target using the given optional Ability tool. There are no optional parameters here, except the msg of course Generates a CMMsg message and sends it to the target room.

Parameters:
healer - the healer mob
target - the target mob being healed
tool - the skill doing the healing, or null
healing - the amount of healing to do
messageCode - msg code for the source and others code
allDisplayMessage - the string to show everyone
Returns:
true if the healing post worked, false otherwise

replaceDamageTag

java.lang.String replaceDamageTag(java.lang.String str,
                                  int damage,
                                  int damageType,
                                  CMMsg.View sourceTargetSTO)
Because damage messages are basically always modified in message preview (okMessage), there is no point in putting the amount of damage into the message string. Because of this the string <DAMAGE> or <DAMAGES> is put as a placeholder, and then this method is called to replace those tags with actual damage words based on the given final amount and the given weapon type, and a clue as to who would see the message

Parameters:
str - the original string with the appropriate tag
damage - the final amount of damage
damageType - the weapon type code Weapon.TYPE_BASHING
sourceTargetSTO - the view of the message
Returns:
the final modified string
See Also:
CMMsg.View, postDamage(MOB, MOB, Environmental, int, int, int, String)

postDamage

void postDamage(MOB attacker,
                MOB target,
                Environmental weapon,
                int damage,
                int messageCode,
                int damageType,
                java.lang.String allDisplayMessage)
The official way to post damage that is happening. It generates a message and sends it to the target room. Handles MXP tagging, fight coloring, and other details on the string message. replaceDataTag is called to ensure a proper damage word.

Parameters:
attacker - the attacking mob
target - the target mob being healed
weapon - the item weapon, ability skill, or null tool used to damage
damage - the initial amount of damage
messageCode - msg code for the source and others code
damageType - the weapon type code Weapon.TYPE_BASHING
allDisplayMessage - the message to send
See Also:
replaceDamageTag(String, int, int, CMMsg.View)

postWeaponDamage

CMMsg postWeaponDamage(MOB source,
                       MOB target,
                       Item item,
                       int damageInt)
An alternative to postWeaponAttackResult(MOB, MOB, Item, boolean). This method handles only a hit with a weapon, which will post damage. Generates a CMMsg message and sends it to the SOURCE room. Call this instead of postAttackResult when the amount of damage done is custom instead of random.

Parameters:
source - the attacker
target - the target
item - the weapon used
damageInt - the amount of damage done by the weapon
Returns:
the message sent to the source room, or null
See Also:
replaceDamageTag(String, int, int, CMMsg.View)

postWeaponAttackResult

CMMsg postWeaponAttackResult(MOB source,
                             MOB target,
                             Item item,
                             boolean success)
This method handles both a hit or a miss with a weapon. The hit, obviously, posts damage, while the miss, posts a miss. replaceDataTag is called to ensure a proper damage word. Generates a CMMsg message and sends it to the SOURCE room.

Parameters:
source - the attacker
target - the target
item - the weapon used
success - true if it was a hit with damage, false if it was a miss
Returns:
the message sent to the source room, or null
See Also:
replaceDamageTag(String, int, int, CMMsg.View)

postShipWeaponAttackResult

void postShipWeaponAttackResult(MOB source,
                                PhysicalAgent attacker,
                                PhysicalAgent defender,
                                Weapon weapon,
                                boolean success)
This method handles both a hit or a miss with a weapon between two ships in combat. The hit, obviously, posts damage, while the miss, posts a miss. replaceDataTag is called to ensure a proper damage word. Generates a CMMsg message and sends it to the common room.

Parameters:
source - the agent of the attack
attacker - the attacker
defender - the target
weapon - the weapon used
success - true if it was a hit with damage, false if it was a miss
See Also:
replaceDamageTag(String, int, int, CMMsg.View)

postItemDamage

void postItemDamage(MOB mob,
                    Item I,
                    Environmental tool,
                    int damageAmount,
                    int messageType,
                    java.lang.String message)
This method handles an item taking damage. If the item is subject to wear and tear, it will take the amount of specific damage given until it gets below 0, after which it is destroyed. If the item is not subject to wear and tear, any positive damage destroys the item.

Parameters:
mob - the mob doing damage to an item
I - the item being damaged
tool - the weapon or skill used to do the damage
damageAmount - the amount of damage done (0-100)
messageType - the CMMsg message code for source and others
message - the message string

getFollowedLeader

MOB getFollowedLeader(MOB mob)
Returns the front of the follower line for this mob. If this mob is following someone, it returns the MOB being ultimately followed, otherwise it just returns the mob

Parameters:
mob - the mob who might be following someone
Returns:
the leader mob

getFormation

java.util.List<MOB>[] getFormation(MOB mob)
Returns this mobs combat formation an an array of string lists, where each entry is a "row" in the formation, and the lists contain the mobs at that row. Only the leaders formation settings matter, so any mob can be sent, because the leader will be teased out and used.

Parameters:
mob - a member of a group with a formation.
Returns:
the formation.
See Also:
getFormationFollowed(MOB), getFormationAbsOrder(MOB)

getFormationFollowed

java.util.List<MOB> getFormationFollowed(MOB mob)
Returns the list of mobs behind the given mob in their respective formation order.

Parameters:
mob - the mob in the formation
Returns:
the list of mobs behind the given one
See Also:
getFormation(MOB), getFormationAbsOrder(MOB)

getFormationAbsOrder

int getFormationAbsOrder(MOB mob)
Returns the numeric position of the given mob in his or her combat formation.

Parameters:
mob - the mob in formation
Returns:
the numeric order, with 0 being front.
See Also:
getFormationFollowed(MOB), getFormation(MOB)

getCombatDominantClass

CharClass getCombatDominantClass(MOB killer,
                                 MOB killed)
Returns the character class of the given killer, or their leader if they are following someone who is not a mob.

Parameters:
killer - the killer
killed - the killed
Returns:
the leaders char class
See Also:
getCombatDividers(MOB, MOB, CharClass), getCombatBeneficiaries(MOB, MOB, CharClass)

getCombatDividers

java.util.Set<MOB> getCombatDividers(MOB killer,
                                     MOB killed,
                                     CharClass combatCharClass)
Returns all the mobs for whom experience awards must be divided before awarding. This does not mean the others do not get experience, just that they aren't counted for the purposes of decreasing the experience each member wil get. This is usually used to exclude the mob followers of certain classes.

Parameters:
killer - the killer
killed - the killed the killer killed
combatCharClass - the charclass of the leader (usually)
Returns:
the set of mobs who must decrease experience through division.
See Also:
getCombatBeneficiaries(MOB, MOB, CharClass), getCombatDominantClass(MOB, MOB)

getCombatBeneficiaries

java.util.Set<MOB> getCombatBeneficiaries(MOB killer,
                                          MOB killed,
                                          CharClass combatCharClass)
Returns all the mobs set to benefit from the death of the given killed mob by the given killer. This means going through the followers, and asking the classes if they are allowed to benefit from xp.\

Parameters:
killer - the killer of the killed
killed - the killed one
combatCharClass - the charclass of the killer
Returns:
the set of mobs who get xp from the kill
See Also:
getCombatDividers(MOB, MOB, CharClass), getCombatDominantClass(MOB, MOB)

armorStr

java.lang.String armorStr(MOB mob)
Returns the friendly armor string for the given mob, describing how well armored they are.

Parameters:
mob - the mob who has armor
Returns:
the displayable armor string
See Also:
fightingProwessStr(MOB)

fightingProwessStr

java.lang.String fightingProwessStr(MOB mob)
Returns the friendly attack string for the given mob, describing how well attacky they are.

Parameters:
mob - the mob who has attack
Returns:
the displayable attack string
See Also:
armorStr(MOB)

damageProwessStr

java.lang.String damageProwessStr(MOB mob)
Returns the friendly damage prowess string for the given mob, describing how well damagy they are.

Parameters:
mob - the mob who damages
Returns:
the displayable damage string

standardHitWord

java.lang.String standardHitWord(int type,
                                 int damage)
Given the weapon type and amount of damage, this method returns the hit/damage string from the lists.ini file that matches.

Parameters:
type - the weapon type
damage - the amount of damage
Returns:
the hit/damage word
See Also:
Weapon.TYPE_BASHING

standardHitWord

java.lang.String standardHitWord(int type,
                                 double pct)
Given the weapon type and percent of damage 0 to 1, this method returns the hit/damage string from the lists.ini file that matches.

Parameters:
type - the weapon type
pct - the percent of damage from 0.0 to 1.0
Returns:
the hit/damage word
See Also:
Weapon.TYPE_BASHING

standardMissString

java.lang.String standardMissString(int weaponDamageType,
                                    int weaponClassification,
                                    java.lang.String weaponName,
                                    boolean useExtendedMissString)
Given the weapon type and classification and name, this method returns either the fullly filled out weapon miss string, or generic non-extended non-weapon miss string from the lists.ini file that matches.

Parameters:
weaponDamageType - the weapon type
weaponClassification - the weapon classification
weaponName - the name of the weapon
useExtendedMissString - true to include the weapon name, false for a shorter message
Returns:
the fully formed swing and miss string
See Also:
Weapon.TYPE_DESCS, Weapon.CLASS_DESCS

standardHitString

java.lang.String standardHitString(int weaponDamageType,
                                   int weaponClass,
                                   int damageAmount,
                                   java.lang.String weaponName)
Given the weapon type and classification and name, this method returns either the fullly filled out weapon hit/damage string from the lists.ini file that matches.

Parameters:
weaponDamageType - the weapon type
weaponClass - the weapon classification
damageAmount - the amount of damage done
weaponName - the name of the weapon
Returns:
the fully formed hit and damage string
See Also:
Weapon.TYPE_DESCS, Weapon.CLASS_DESCS

standardMobCondition

java.lang.String standardMobCondition(MOB viewer,
                                      MOB mob)
When a particular race does not provide its own override health condition message, this method provides the base message from the list.ini file. It returns the condition of the given mob as seen by the given viewer.

Parameters:
viewer - the viewer of the mob
mob - the mob who has a health condition
Returns:
the condition of the health of the mob

resistanceMsgs

void resistanceMsgs(MOB source,
                    MOB target,
                    CMMsg msg)
When the source does something to the target that the target resists, and the given message has a targetminor containing the type of damage that's being resisted, this message will generate and tack on a new message with the resistance of the target, and flag the given message as having been resisted.

Parameters:
source - the attacker
target - the defender who is resisting
msg - the message to flag as being resisted and tack on resistance msg
See Also:
CMMsg.addTrailerMsg(CMMsg)

establishRange

void establishRange(MOB source,
                    MOB target,
                    Environmental tool)
Given an attacking source and a defending target and the sources weapon or skill, this method will set the distance between the source and target from each other.

Parameters:
source - the attacker
target - the target
tool - the sources weapon
See Also:
Combatant.setRangeToTarget(int)

makeFollowersFight

void makeFollowersFight(MOB observerM,
                        MOB defenderM,
                        MOB attackerM)
When the given observerM witnesses the given attacker mob attacking the given defender mob, this method checks to see if the observer has a dog in the fight, and if they do, causes them to start fighting either the attacker or the defender.

Parameters:
observerM - the observer mob who might be a follower
defenderM - the defender mob who is being attacked
attackerM - the attacker mob who is attacking the defender

handleBeingHealed

void handleBeingHealed(CMMsg msg)
When a healing message targeting a given mob is received, this method is called to actually do the healing.

Parameters:
msg - the healing message

handleBeingDamaged

void handleBeingDamaged(CMMsg msg)
When a damaging message targeting a given mob is received, this method is called to actually do the damaging.

Parameters:
msg - the damaging message

handleBeingAssaulted

void handleBeingAssaulted(CMMsg msg)
When an attack message targeting a given mob is received, this method is called to react to the attack. If the target is not in combat, range is established and the target is pissed off (has their victim set). An attack roll is then made for the source and the results used to alter the message. The target will also be made to stand. The message has a source attacker, target, and the tool is a weapon.

Parameters:
msg - the attack message

handleDamageSpam

boolean handleDamageSpam(MOB observerM,
                         Physical target,
                         int amount)
When a player has nobattlespam, this method is called when damage is observed to add to the totals.

Parameters:
observerM - the observer of the combat
target - the damaged thing.
amount - the amount of damage.
Returns:
true if it was counted

handleDamageSpamSummary

void handleDamageSpamSummary(MOB mob)
When a player has nobattlespam, this method is called when damage is observed to report the totals from the last combat round.

Parameters:
mob - the no spam observer.

handleDeath

void handleDeath(CMMsg msg)
When a death message is received by a mob and the message has the mob as a source, this method is called to kill the source of the message off. The message has a source as dead person, the target is null, and the tool is the killer.

Parameters:
msg - the death message

handleObserveDeath

void handleObserveDeath(MOB observer,
                        MOB fighting,
                        CMMsg msg)
When an observer observes a death, this method is called is called to have the observer react.

Parameters:
observer - the one observing the death
fighting - the dead mob
msg - the death message

doDeathPostProcessing

void doDeathPostProcessing(CMMsg msg)
When a death occurs, there are certain record keeping processes that need to happen. This method does nothing but make sure those records are kept. The message has a source as dead person, the target is null, and the tool is the killer.

Parameters:
msg - the death message

isKnockedOutUponDeath

boolean isKnockedOutUponDeath(MOB deadM,
                              MOB killerM)
Returns whether the system properties specify that, when the given dead mob does by the hand of the given killer mob, that the dead mob won't actually die, but just be knocked out.

Parameters:
deadM - the dead mob
killerM - the killer mob
Returns:
true if there's no death, but only being knocked out

handleCombatLossConsequences

boolean handleCombatLossConsequences(MOB deadM,
                                     MOB killerM,
                                     java.lang.String[] consequences,
                                     int[] lostExperience,
                                     java.lang.String message)
When a player dies or flees, the system coffeemud.ini file defines the consequences of losing the fight.

Parameters:
deadM - the mob who died or is fleeing
killerM - the killer or attacker of the given mob
consequences - the list of consequence strings from the ini file
lostExperience - a one dimensional array containing the base experience to lose
message - the xp loss message, sometimes localized, sometimes not.. you got me!
Returns:
false if the mob is obliterated, true otherwise

tickCombat

void tickCombat(MOB fighter)
This is the heart of the main combat engine. Every tick that a mob is in combat, and is permitted to use auto attacks, this method is called. It figures out how many weapon attacks to dish out, and dishes them.

Parameters:
fighter - the attacker

postRevengeAttack

boolean postRevengeAttack(MOB attacker,
                          MOB defender)
If an NPC attacker comes under the sudden effect of a spell, and knows who is responsible, but are not presently in combat, this method will start combat with them.

Parameters:
attacker - the wronged npc party
defender - the defender who wronged the attacker
Returns:
true if an attack was tried, false if not.

recoverTick

void recoverTick(MOB mob)
Every tick, this method is called. If the given mob is not in combat, it will help the mob recover some of their hit points, mana, movement, etc.

Parameters:
mob - the mob who is recovering

doTurnBasedCombat

boolean doTurnBasedCombat(MOB mob,
                          Room R,
                          Area A)
The heart of the alternative turn-based combat engine, this method is called every tick to determine if it is the given mobs turn to fight. If it is not the method returns false, and if it is, true

Parameters:
mob - the mob who wants to fight
R - the room the mob is in
A - the area the room is in
Returns:
true if its time to fight, false otherwise

expendEnergy

void expendEnergy(MOB mob,
                  boolean expendMovement)
Every tick, THIS method is called to make the given mob a little more hungry and thirsty. It might even expend movement if they are walking around.

Parameters:
mob - the mob who needs to get hungry
expendMovement - true to also expend the rooms movement amt, false otherwise

dispenseExperience

void dispenseExperience(java.util.Set<MOB> killers,
                        java.util.Set<MOB> dividers,
                        MOB killed)
For a valid set of killers who are benefitting from having killed the given killed mob, this method will make repeated postExperience calls after having calculated their exp bounty for the kill.

Parameters:
killers - a set of mobs to benefit from the kill
dividers - a set of mobs who must divide the xp.. usually subset of killers
killed - the mob killed
See Also:
ExpLevelLibrary.postExperience(MOB, MOB, String, int, boolean)

getBreatheKiller

MOB getBreatheKiller(MOB victim)
When a mob can't breathe, it actually takes some work to figure out if anyone is to blame. This method attempts to place the blame anywhere but on the victim him or herself.

Parameters:
victim - the one who can't breathe
Returns:
the mob to blame

isAShipSiegeWeapon

boolean isAShipSiegeWeapon(Item I)
Returns whether the given item is classified as a ammunition firing siege weapon, as used on a sailing ship.

Parameters:
I - the item to check
Returns:
true if its a siege weapon, false otherwise

getShipHullPoints

int getShipHullPoints(BoardableShip ship)
Returns the number of base hull points that the given ship has.

Parameters:
ship - the ship to get points for
Returns:
the base hull points of the ship

checkSavingThrows

boolean checkSavingThrows(MOB mob,
                          CMMsg msg)
Checks to see if the given message gets a saving throw for the given mob and, if so, applies it.

Parameters:
mob - the mob to save
msg - the message that might apply
Returns:
true if the message na or save only, false to cancel

checkDamageSaves

boolean checkDamageSaves(MOB mob,
                         CMMsg msg)
Checks to see if the given message gets a saving throw for the given mob damage and, if so, adjusts it

Parameters:
mob - the mob to save
msg - the message that might apply
Returns:
true if the message na or save only, false to cancel

handleBeingGravitied

void handleBeingGravitied(MOB mob,
                          CMMsg msg)
Handles the effects of extreme gravity and other acceleration as from a ship.

Parameters:
mob - the mob feeling the effect
msg - the message doing the effect