Expected damage

From Kolmafia
Revision as of 21:23, 11 March 2010 by imported>StDoodle
Jump to navigation Jump to search

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