Monster defense: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>Bale
mNo edit summary
imported>Bale
mafia now accounts for in-combat deleveling!
Line 22: Line 22:
}}|
}}|
function_description=Returns the defense value of the specified monster {{pspan|check_me}}. If {{pspan|check_me}} is not specified, it will use the current monster if you are in a fight (i.e. you're calling the function from an [[In-combat Consulting]] script), or the last monster you encountered otherwise.</p>
function_description=Returns the defense value of the specified monster {{pspan|check_me}}. If {{pspan|check_me}} is not specified, it will use the current monster if you are in a fight (i.e. you're calling the function from an [[In-combat Consulting]] script), or the last monster you encountered otherwise.</p>
<p>The return value includes monster level modifications. This means that for monsters with unknown defense, the return value will be equivalent to monster_level_adjustment(). Relatedly, it will update the information returned each time it is called, to the best of KoLmafia's knowledge.|
<p>When the function is given a monster as a parameter it will return the monster's defense at the start of a fight including all monster level modifications. This means that for monsters with unknown defense, the return value will be equivalent to {{f|monster_level_adjustment}}. If the zero parameter version is called and the character is currently in a fight, then the function will include all current combat deleveling modifiers from the current combat.|


needscode=yes|
needscode=yes|
Line 31: Line 31:
}}
}}


[[Category:Adventuring]]|[[Category:In-combat Consulting]]
[[Category:Adventuring]][[Category:In-combat Consulting]]

Revision as of 21:30, 11 November 2010

needs(code_samples);

Function Syntax

int monster_defense()

int monster_defense(monster check_me )

  • check_me is the (optional) monster to get the defense value of

Returns the defense value of the specified monster check_me. If check_me is not specified, it will use the current monster if you are in a fight (i.e. you're calling the function from an In-combat Consulting script), or the last monster you encountered otherwise.

When the function is given a monster as a parameter it will return the monster's defense at the start of a fight including all monster level modifications. This means that for monsters with unknown defense, the return value will be equivalent to monster_level_adjustment(). If the zero parameter version is called and the character is currently in a fight, then the function will include all current combat deleveling modifiers from the current combat.

See Also

monster_attack() | monster_element() | monster_hp()

More Information

For the current discussion of what's being tracked in-combat for monster level adjustments, please see this thread.

Special

If no monster is specified and no monster has been fought in this session, this function returns 0. This is because mafia forgets the value of last_monster() when it logs out.