Difference between revisions of "Expected damage"

From Kolmafia
Jump to navigation Jump to search
imported>StDoodle
imported>StDoodle
m
Line 15: Line 15:
  
 
}</pre></p>
 
}</pre></p>
 +
{{Format}}

Revision as of 21:23, 11 March 2010

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;

}

Formatting Needed