Difference between revisions of "Expected damage"

From Kolmafia
Jump to navigation Jump to search
(New page: expected_damage(monster) estimates how much damage the specified monster will do when hitting you given your current outfit, status, etc.)
 
imported>MapleMario
Line 1: Line 1:
expected_damage(monster) estimates how much damage the specified monster will do when hitting you given your current outfit, status, etc.
+
'''expected_damage(monster mon)'''
 +
<br /> Estimates how much damage the specified monster will deal to you (given your current player status).
 +
 
 +
<p><pre># 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;
 +
 
 +
}</pre></p>

Revision as of 21:00, 9 May 2009

expected_damage(monster mon)
Estimates how much damage the specified monster will deal to you (given your current player status).

# 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;

}