Expected damage: Difference between revisions
New page: expected_damage(monster) estimates how much damage the specified monster will do when hitting you given your current outfit, status, etc. |
imported>StDoodle mNo edit summary |
||
(6 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
expected_damage(monster | {{ | ||
#vardefine:name|expected_damage}}{{ | |||
#vardefine:return_type|int}}{{ | |||
FunctionPage| | |||
name={{#var:name}}| | |||
function1={{Function| | |||
name={{#var:name}}| | |||
aggregate={{#var:aggregate}}| | |||
return_type={{#var:return_type}}| | |||
return_also={{#var:return_also}}| | |||
}}| | |||
function2={{Function| | |||
name={{#var:name}}| | |||
aggregate={{#var:aggregate}}| | |||
return_type={{#var:return_type}}| | |||
return_also={{#var:return_also}}| | |||
parameter1={{Param|monster|check_me}}| | |||
p1desc={{Pspan|check_me}} is the (optional) monster to check the expected damage from| | |||
}}| | |||
function_description=Estimates how much damage the specified monster {{pspan|check_me}} will deal to you (given your current player status). If {{pspan|check_me}} is not specified, it defaults to the last monster you encountered. This function adjusts for know effects (such as monster level modifications).</p> | |||
<p>This function can be used from within an [[In-combat Consulting]] script to help determine your fight strategy. When used this way, it isn't necessary to specify a monster, as the function will default to the one currently being fought. It will update the information returned each time it is called, to the best of KoLmafia's knowledge.| | |||
code1={{CodeSample| | |||
title=Code Sample| | |||
description=Scriptlet that determines whether it is safe to fight a certain monster (if they deal less than 20% of your hp each hit)| | |||
code= | |||
<syntaxhighlight> | |||
boolean safe_to_fight(monster mon) | |||
{ | |||
int expected_dmg = expected_damage(mon); | |||
int hp = my_maxhp(); | |||
int hp_limit = hp * 0.2; | |||
if (expected_dmg < hp_limit) return true; | |||
return false; | |||
} | |||
</syntaxhighlight> | |||
}}| | |||
more_info=For the current discussion of what's being tracked in-combat for monster level adjustments, please see [http://kolmafia.us/showthread.php?3452 this thread].| | |||
}} | |||
[[Category:Adventuring]][[Category:In-combat Consulting]] |
Latest revision as of 05:46, 31 October 2010
Function Syntax
int expected_damage()
int expected_damage(monster check_me )
- check_me is the (optional) monster to check the expected damage from
Estimates how much damage the specified monster check_me will deal to you (given your current player status). If check_me is not specified, it defaults to the last monster you encountered. This function adjusts for know effects (such as monster level modifications).
This function can be used from within an In-combat Consulting script to help determine your fight strategy. When used this way, it isn't necessary to specify a monster, as the function will default to the one currently being fought. It will update the information returned each time it is called, to the best of KoLmafia's knowledge.
Code Sample
Scriptlet that determines whether it is safe to fight a certain monster (if they deal less than 20% of your hp each hit)
boolean safe_to_fight(monster mon)
{
int expected_dmg = expected_damage(mon);
int hp = my_maxhp();
int hp_limit = hp * 0.2;
if (expected_dmg < hp_limit) return true;
return false;
}
More Information
For the current discussion of what's being tracked in-combat for monster level adjustments, please see this thread.