com.planet_ink.coffee_mud.core.interfaces
Interface Combatant

All Superinterfaces:
Affectable, Behavable, java.lang.Cloneable, CMObject, java.lang.Comparable<CMObject>, Contingent, Environmental, Modifiable, MsgListener, Physical, PhysicalAgent, StatsAffecting, Tickable
All Known Subinterfaces:
Deity, MOB, SailingShip
All Known Implementing Classes:
Alligator, AngryCitizen, Ape, Assassin, Beaver, Bee, BlackBear, BlackDragon, BlueDragon, BrassDragon, BronzeDragon, BrownBear, BrownSnake, Buck, Buffalo, Bugbear, Bull, Cat, Centaur, Centipede, Cheetah, Chicken, Chimp, Citizen, Cobra, CommonBat, CopperDragon, Cougar, Cow, Coyote, Crocodile, Deer, DireWolf, Doe, Dog, Dolphin, Doppleganger, Dragon, DrowElf, DrowPriestess, DrowWarrior, DrowWizard, Duck, Elephant, Falcon, FireGiant, FlyingInsect, Fox, Frog, FrostGiant, GardenSnake, GenAuctioneer, GenBanker, GenCow, GenDeity, GenHorse, GenLibrarian, GenMob, GenPostman, GenRideable, GenSailingShip, GenShopkeeper, GenUndead, GiantBat, GiantScorpion, Gnoll, Goat, GoatDoe, Goblin, GoldDragon, Gorilla, GreenDragon, Hawk, HeavenlyServent, HillGiant, Hornet, Horse, InvisibleStalker, Jaguar, Kitten, LargeBat, Lion, Lizard, LizardMan, LizardManShaman, Minotaur, Monkey, MountainLion, Mouse, Naga, Ogre, Orc, Owl, Panther, Parakeet, Pegasus, PegasusGreater, Penguin, Pig, Puppy, Python, Rabbit, Rat, Rattlesnake, Raven, RedDragon, Scorpion, Seal, Shark, Sheep, SilverDragon, Skeleton, Snake, Spider, Squirrel, StdAuctioneer, StdBanker, StdDeity, StdFactoryMOB, StdLibrarian, StdMOB, StdPostman, StdRideable, StdShopKeeper, StoneGiant, StoneGolem, Swordfish, Teacher, Tiger, Toad, Troll, Turtle, UmberHulk, Undead, Vulture, Walrus, Whale, WhiteBear, WhiteDragon, WildEagle, Wolf, Wolverine, Worm, Wyvern, Zombie

public interface Combatant
extends PhysicalAgent

A physical object in the world that is capable of engaging in combat with others.


Field Summary
 
Fields inherited from interface com.planet_ink.coffee_mud.core.interfaces.Tickable
STATUS_AFFECT, STATUS_ALIVE, STATUS_BEHAVIOR, STATUS_CLASS, STATUS_DEAD, STATUS_END, STATUS_FIGHT, STATUS_MISC, STATUS_MISC2, STATUS_MISC3, STATUS_MISC4, STATUS_MISC5, STATUS_MISC6, STATUS_MISC7, STATUS_NOT, STATUS_OTHER, STATUS_RACE, STATUS_REBIRTH, STATUS_SCRIPT, STATUS_START, STATUS_WEATHER, TICKID_AREA, TICKID_BEAMWEAPON, TICKID_CLAN, TICKID_CLANITEM, TICKID_DEADBODY_DECAY, TICKID_ELECTRONICS, TICKID_EMAIL, TICKID_EXIT_BEHAVIOR, TICKID_EXIT_REOPEN, TICKID_ITEM_BEHAVIOR, TICKID_ITEM_BOUNCEBACK, TICKID_LIGHT_FLICKERS, TICKID_LIVEAUCTION, TICKID_LONGERMASK, TICKID_MISCELLANEOUS, TICKID_MOB, TICKID_PROPERTY_SPECIAL, TICKID_QUEST, TICKID_READYTOSTOP, TICKID_ROOM_BEHAVIOR, TICKID_ROOM_ITEM_REJUV, TICKID_SOLITARYMASK, TICKID_SPECIALCOMBAT, TICKID_SPECIALMANEUVER, TICKID_SPELL_AFFECT, TICKID_SUPPORT, TICKID_TIMEAUCTION, TICKID_TRAP_DESTRUCTION, TICKID_TRAP_RESET
 
Method Summary
 PhysicalAgent getCombatant()
          If this mob is in combat, this returns the mob that this mob is targeting.
 int getDirectionToTarget()
          Gets the compass direction between this combatant and the current combat victim.
 boolean isInCombat()
          Returns whether this combatant is in an active combat state
 void makePeace(boolean includePlayerFollowers)
          Clears the combat state between this combatant and their target, clears the targets combat state, as well as that of any followers of this combatant.
 boolean mayIFight(PhysicalAgent victim)
          Returns whether this combatant is both permitted to attack the given combatant, and that both this combatant and the potential target are alive.
 boolean mayPhysicallyAttack(PhysicalAgent victim)
          Returns whether this combatant is permitted to attack the given combatant, both this combatant and the potential target are alive, both the combatant and the target are confirmed to be the same place.
 int rangeToTarget()
          Gets the distance between this combatant and the current combat victim.
 void setCombatant(PhysicalAgent other)
          Sets the mob that this mob is targeting for combat, which either puts them into, or clears their combat state.
 void setRangeToTarget(int newRange)
          Sets the distance between this combatant and the current combat victim.
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.Physical
description, displayText, name
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.Environmental
description, displayText, expirationDate, image, isGeneric, L, maxRange, minRange, miscTextFormat, Name, rawImage, sameAs, setDescription, setDisplayText, setExpirationDate, setImage, setMiscText, setName, text
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.Tickable
getTickStatus, name, tick
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.StatsAffecting
affectCharState, affectCharStats, affectPhyStats
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.MsgListener
executeMsg, okMessage
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.Contingent
amDestroyed, destroy, isSavable, setSavable
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.CMObject
copyOf, ID, initializeClass, newInstance
 
Methods inherited from interface java.lang.Comparable
compareTo
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.Modifiable
getSaveStatIndex, getStat, getStatCodes, isStat, setStat
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.Affectable
addEffect, addNonUninvokableEffect, basePhyStats, delAllEffects, delEffect, eachEffect, effects, fetchEffect, fetchEffect, numEffects, phyStats, recoverPhyStats, setBasePhyStats
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.Behavable
addBehavior, addScript, behaviors, delAllBehaviors, delAllScripts, delBehavior, delScript, eachBehavior, eachScript, fetchBehavior, fetchBehavior, fetchScript, numBehaviors, numScripts, scripts
 

Method Detail

isInCombat

boolean isInCombat()
Returns whether this combatant is in an active combat state

Returns:
true if this combatant is in combat, false otherwise
See Also:
MOB.getVictim(), MOB.setVictim(MOB), setCombatant(PhysicalAgent), getCombatant(), makePeace(boolean), setRangeToTarget(int), mayIFight(PhysicalAgent)

setRangeToTarget

void setRangeToTarget(int newRange)
Sets the distance between this combatant and the current combat victim. This method only matters if the combatant is in combat and getCombatant() returns a non-null value. This method does not reciprocate by setting the range to target of the combat target.

Parameters:
newRange - the range from this combatant to their target
See Also:
MOB.getVictim(), setCombatant(PhysicalAgent), getCombatant(), rangeToTarget(), mayIFight(PhysicalAgent)

rangeToTarget

int rangeToTarget()
Gets the distance between this combatant and the current combat victim. This method only matters if the combatant is in combat and getCombatant() returns a non-null value.

Returns:
newRange the range from this combatant to their target
See Also:
MOB.getVictim(), setCombatant(PhysicalAgent), getCombatant(), setRangeToTarget(int), mayIFight(PhysicalAgent)

getDirectionToTarget

int getDirectionToTarget()
Gets the compass direction between this combatant and the current combat victim. This method only matters if the combatant is in combat and getCombatant() returns a non-null value.

Returns:
cardinal direction from this combatant to their target
See Also:
MOB.getVictim(), setCombatant(PhysicalAgent), getCombatant(), setRangeToTarget(int), mayIFight(PhysicalAgent)

mayPhysicallyAttack

boolean mayPhysicallyAttack(PhysicalAgent victim)
Returns whether this combatant is permitted to attack the given combatant, both this combatant and the potential target are alive, both the combatant and the target are confirmed to be the same place.

Parameters:
victim - the potential combat target
Returns:
true if this combatant can attack the given combatant, false otherwise
See Also:
MOB.getVictim(), setCombatant(PhysicalAgent), getCombatant(), setRangeToTarget(int), mayPhysicallyAttack(PhysicalAgent)

mayIFight

boolean mayIFight(PhysicalAgent victim)
Returns whether this combatant is both permitted to attack the given combatant, and that both this combatant and the potential target are alive. Being in the same place is not necessary.

Parameters:
victim - the potential combat target
Returns:
true if this combatant can fight the given combatant, false otherwise
See Also:
MOB.getVictim(), setCombatant(PhysicalAgent), getCombatant(), setRangeToTarget(int), mayPhysicallyAttack(PhysicalAgent)

makePeace

void makePeace(boolean includePlayerFollowers)
Clears the combat state between this combatant and their target, clears the targets combat state, as well as that of any followers of this combatant. It is at best an approximation of a universal combat ender.

Parameters:
includePlayerFollowers - false to apply only to npc followers, true for npc and player
See Also:
isInCombat(), MOB.getVictim(), MOB.setVictim(MOB), setCombatant(PhysicalAgent), getCombatant(), setRangeToTarget(int), mayIFight(PhysicalAgent)

getCombatant

PhysicalAgent getCombatant()
If this mob is in combat, this returns the mob that this mob is targeting. If this method returns null, the mob is not in combat.

Returns:
the combat target, or null for a peace state
See Also:
isInCombat(), setCombatant(PhysicalAgent), makePeace(boolean), setRangeToTarget(int), mayIFight(PhysicalAgent)

setCombatant

void setCombatant(PhysicalAgent other)
Sets the mob that this mob is targeting for combat, which either puts them into, or clears their combat state. If a null value, the mob is no longer fighting.

Parameters:
other - the combat target, or null for a peace state
See Also:
isInCombat(), getCombatant(), makePeace(boolean), setRangeToTarget(int), mayIFight(PhysicalAgent)