Expected damage: Difference between revisions
imported>StDoodle mNo edit summary |
imported>StDoodle mNo edit summary |
||
Line 40: | Line 40: | ||
</syntaxhighlight> | </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]. | 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: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.