|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface CombatLibrary
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 |
---|
static final int TICKS_PER_SHIP_COMBAT
Method Detail |
---|
java.util.Set<MOB> allPossibleCombatants(MOB mob, boolean includePlayers)
mob
- the mob to checkincludePlayers
- true to include players, false not
allCombatants(MOB)
,
properTargets(Ability, MOB, boolean)
java.util.Set<MOB> properTargets(Ability A, MOB caster, boolean includePlayers)
A
- the skill you want targets forcaster
- the user of the skillincludePlayers
- true to include players, false otherwise
allCombatants(MOB)
,
allPossibleCombatants(MOB, boolean)
java.util.Set<MOB> allCombatants(MOB mob)
mob
- the fighting mob
allPossibleCombatants(MOB, boolean)
,
properTargets(Ability, MOB, boolean)
void makePeaceInGroup(MOB mob)
mob
- the mob whose group needs peace.int adjustedArmor(MOB mob)
mob
- the mob whose armor needs adjusting
PhyStats.armor()
int adjustedArmor(int armorValue)
armorValue
- the base armor value to start from
PhyStats.armor()
int adjustedAttackBonus(MOB mob, MOB target)
mob
- the mob whose attack bonus needs adjustingtarget
- i guess this is who they are fighting
PhyStats.armor()
int adjustedAttackBonus(int baseAttack)
baseAttack
- the base attack bonus to work from.
PhyStats.armor()
int adjustedDamage(MOB mob, Weapon weapon, MOB target, int bonusDamage, boolean allowCrits, boolean biasHigh)
mob
- the mob who wants adjusted damageweapon
- the weapon used by the mob against target, or nulltarget
- the target being hit, or nullbonusDamage
- any bonus to base damageallowCrits
- true to apply crit if crit damage occursbiasHigh
- random numbers are always biased high
int adjustedDamage(int baseDamage, int level, boolean biasHigh)
baseDamage
- base damagelevel
- the level of the mobbiasHigh
- random numbers are always biased high
boolean rollToHit(MOB attacker, MOB defender)
attacker
- the attacking mobdefender
- the mob being attacked
rollToHit(int, int, int)
boolean rollToHit(int attack, int defence, int adjustment)
attack
- the attack scoredefence
- the armor scoreadjustment
- the percentage adjustment
rollToHit(MOB, MOB)
void forcePeaceAllFightingAgainst(MOB mob, java.util.Set<MOB> exceptionSet)
mob
- the mob who needs peaceexceptionSet
- null, or a set of mobs not to apply this to.java.util.Set<MOB> getAllFightingAgainst(MOB mob, java.util.Set<MOB> set)
mob
- the mob who is in combatset
- the set to put combatants in, or null to make one
void postPanic(MOB mob, CMMsg addHere)
mob
- the mob who is panicingaddHere
- null, or the message to add the panic topostDeath(MOB, MOB, CMMsg)
void postDeath(MOB killerM, MOB deadM, CMMsg addHere)
killerM
- the killer mobdeadM
- the dead mobaddHere
- null, or the message to add this one to.postPanic(MOB, CMMsg)
boolean postAttack(MOB attacker, MOB target, Item weapon)
attacker
- the attacker mobtarget
- the target mobweapon
- the weapon used by the attacker, or null
boolean postShipAttack(MOB attacker, PhysicalAgent attackingShip, PhysicalAgent target, Weapon weapon, boolean wasAHit)
attacker
- the attacking agent mobattackingShip
- the ship the attacker is ontarget
- the target shipweapon
- the siege weapon usedwasAHit
- true to register a hit, false to register an attack
boolean mayIAttackThisVessel(MOB mob, PhysicalAgent defender)
mob
- the agent attackerdefender
- the attacked ship
boolean postHealing(MOB healer, MOB target, Ability tool, int healing, int messageCode, java.lang.String allDisplayMessage)
healer
- the healer mobtarget
- the target mob being healedtool
- the skill doing the healing, or nullhealing
- the amount of healing to domessageCode
- msg code for the source and others codeallDisplayMessage
- the string to show everyone
java.lang.String replaceDamageTag(java.lang.String str, int damage, int damageType, CMMsg.View sourceTargetSTO)
str
- the original string with the appropriate tagdamage
- the final amount of damagedamageType
- the weapon type code Weapon.TYPE_BASHING
sourceTargetSTO
- the view of the message
CMMsg.View
,
postDamage(MOB, MOB, Environmental, int, int, int, String)
void postDamage(MOB attacker, MOB target, Environmental weapon, int damage, int messageCode, int damageType, java.lang.String allDisplayMessage)
attacker
- the attacking mobtarget
- the target mob being healedweapon
- the item weapon, ability skill, or null tool used to damagedamage
- the initial amount of damagemessageCode
- msg code for the source and others codedamageType
- the weapon type code Weapon.TYPE_BASHING
allDisplayMessage
- the message to sendreplaceDamageTag(String, int, int, CMMsg.View)
CMMsg postWeaponDamage(MOB source, MOB target, Item item, int damageInt)
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.
source
- the attackertarget
- the targetitem
- the weapon useddamageInt
- the amount of damage done by the weapon
replaceDamageTag(String, int, int, CMMsg.View)
CMMsg postWeaponAttackResult(MOB source, MOB target, Item item, boolean success)
source
- the attackertarget
- the targetitem
- the weapon usedsuccess
- true if it was a hit with damage, false if it was a miss
replaceDamageTag(String, int, int, CMMsg.View)
void postShipWeaponAttackResult(MOB source, PhysicalAgent attacker, PhysicalAgent defender, Weapon weapon, boolean success)
source
- the agent of the attackattacker
- the attackerdefender
- the targetweapon
- the weapon usedsuccess
- true if it was a hit with damage, false if it was a missreplaceDamageTag(String, int, int, CMMsg.View)
void postItemDamage(MOB mob, Item I, Environmental tool, int damageAmount, int messageType, java.lang.String message)
mob
- the mob doing damage to an itemI
- the item being damagedtool
- the weapon or skill used to do the damagedamageAmount
- the amount of damage done (0-100)messageType
- the CMMsg message code for source and othersmessage
- the message stringMOB getFollowedLeader(MOB mob)
mob
- the mob who might be following someone
java.util.List<MOB>[] getFormation(MOB mob)
mob
- a member of a group with a formation.
getFormationFollowed(MOB)
,
getFormationAbsOrder(MOB)
java.util.List<MOB> getFormationFollowed(MOB mob)
mob
- the mob in the formation
getFormation(MOB)
,
getFormationAbsOrder(MOB)
int getFormationAbsOrder(MOB mob)
mob
- the mob in formation
getFormationFollowed(MOB)
,
getFormation(MOB)
CharClass getCombatDominantClass(MOB killer, MOB killed)
killer
- the killerkilled
- the killed
getCombatDividers(MOB, MOB, CharClass)
,
getCombatBeneficiaries(MOB, MOB, CharClass)
java.util.Set<MOB> getCombatDividers(MOB killer, MOB killed, CharClass combatCharClass)
killer
- the killerkilled
- the killed the killer killedcombatCharClass
- the charclass of the leader (usually)
getCombatBeneficiaries(MOB, MOB, CharClass)
,
getCombatDominantClass(MOB, MOB)
java.util.Set<MOB> getCombatBeneficiaries(MOB killer, MOB killed, CharClass combatCharClass)
killer
- the killer of the killedkilled
- the killed onecombatCharClass
- the charclass of the killer
getCombatDividers(MOB, MOB, CharClass)
,
getCombatDominantClass(MOB, MOB)
java.lang.String armorStr(MOB mob)
mob
- the mob who has armor
fightingProwessStr(MOB)
java.lang.String fightingProwessStr(MOB mob)
mob
- the mob who has attack
armorStr(MOB)
java.lang.String damageProwessStr(MOB mob)
mob
- the mob who damages
java.lang.String standardHitWord(int type, int damage)
type
- the weapon typedamage
- the amount of damage
Weapon.TYPE_BASHING
java.lang.String standardHitWord(int type, double pct)
type
- the weapon typepct
- the percent of damage from 0.0 to 1.0
Weapon.TYPE_BASHING
java.lang.String standardMissString(int weaponDamageType, int weaponClassification, java.lang.String weaponName, boolean useExtendedMissString)
weaponDamageType
- the weapon typeweaponClassification
- the weapon classificationweaponName
- the name of the weaponuseExtendedMissString
- true to include the weapon name, false for a shorter message
Weapon.TYPE_DESCS
,
Weapon.CLASS_DESCS
java.lang.String standardHitString(int weaponDamageType, int weaponClass, int damageAmount, java.lang.String weaponName)
weaponDamageType
- the weapon typeweaponClass
- the weapon classificationdamageAmount
- the amount of damage doneweaponName
- the name of the weapon
Weapon.TYPE_DESCS
,
Weapon.CLASS_DESCS
java.lang.String standardMobCondition(MOB viewer, MOB mob)
viewer
- the viewer of the mobmob
- the mob who has a health condition
void resistanceMsgs(MOB source, MOB target, CMMsg msg)
source
- the attackertarget
- the defender who is resistingmsg
- the message to flag as being resisted and tack on resistance msgCMMsg.addTrailerMsg(CMMsg)
void establishRange(MOB source, MOB target, Environmental tool)
source
- the attackertarget
- the targettool
- the sources weaponCombatant.setRangeToTarget(int)
void makeFollowersFight(MOB observerM, MOB defenderM, MOB attackerM)
observerM
- the observer mob who might be a followerdefenderM
- the defender mob who is being attackedattackerM
- the attacker mob who is attacking the defendervoid handleBeingHealed(CMMsg msg)
msg
- the healing messagevoid handleBeingDamaged(CMMsg msg)
msg
- the damaging messagevoid handleBeingAssaulted(CMMsg msg)
msg
- the attack messageboolean handleDamageSpam(MOB observerM, Physical target, int amount)
observerM
- the observer of the combattarget
- the damaged thing.amount
- the amount of damage.
void handleDamageSpamSummary(MOB mob)
mob
- the no spam observer.void handleDeath(CMMsg msg)
msg
- the death messagevoid handleObserveDeath(MOB observer, MOB fighting, CMMsg msg)
observer
- the one observing the deathfighting
- the dead mobmsg
- the death messagevoid doDeathPostProcessing(CMMsg msg)
msg
- the death messageboolean isKnockedOutUponDeath(MOB deadM, MOB killerM)
deadM
- the dead mobkillerM
- the killer mob
boolean handleCombatLossConsequences(MOB deadM, MOB killerM, java.lang.String[] consequences, int[] lostExperience, java.lang.String message)
deadM
- the mob who died or is fleeingkillerM
- the killer or attacker of the given mobconsequences
- the list of consequence strings from the ini filelostExperience
- a one dimensional array containing the base experience to losemessage
- the xp loss message, sometimes localized, sometimes not.. you got me!
void tickCombat(MOB fighter)
fighter
- the attackerboolean postRevengeAttack(MOB attacker, MOB defender)
attacker
- the wronged npc partydefender
- the defender who wronged the attacker
void recoverTick(MOB mob)
mob
- the mob who is recoveringboolean doTurnBasedCombat(MOB mob, Room R, Area A)
mob
- the mob who wants to fightR
- the room the mob is inA
- the area the room is in
void expendEnergy(MOB mob, boolean expendMovement)
mob
- the mob who needs to get hungryexpendMovement
- true to also expend the rooms movement amt, false otherwisevoid dispenseExperience(java.util.Set<MOB> killers, java.util.Set<MOB> dividers, MOB killed)
killers
- a set of mobs to benefit from the killdividers
- a set of mobs who must divide the xp.. usually subset of killerskilled
- the mob killedExpLevelLibrary.postExperience(MOB, MOB, String, int, boolean)
MOB getBreatheKiller(MOB victim)
victim
- the one who can't breathe
boolean isAShipSiegeWeapon(Item I)
I
- the item to check
int getShipHullPoints(BoardableShip ship)
ship
- the ship to get points for
boolean checkSavingThrows(MOB mob, CMMsg msg)
mob
- the mob to savemsg
- the message that might apply
boolean checkDamageSaves(MOB mob, CMMsg msg)
mob
- the mob to savemsg
- the message that might apply
void handleBeingGravitied(MOB mob, CMMsg msg)
mob
- the mob feeling the effectmsg
- the message doing the effect
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |