Calculating monster level

Tirian

Member
Macman104 was asking holatuwol for a function to calculate +ML. Whether it is approved or not, I thought I'd share my solution for this problem, which might save some people a few lookups of their own.

Code:
boolean [ slot ] Sslot;
Sslot[ $slot[ hat ]] = true;
Sslot[ $slot[ weapon ]] = true;
Sslot[ $slot[ off-hand ]] = true;
Sslot[ $slot[ shirt ]] = true;
Sslot[ $slot[ pants ]] = true;
Sslot[ $slot[ acc1 ]] = true;
Sslot[ $slot[ acc2 ]] = true;
Sslot[ $slot[ acc3 ]] = true;
Sslot[ $slot[ familiar ]] = false;

int [item] Mitem_to_ml_boost;
Mitem_to_ml_boost[ $item[ hockey stick of furious angry rage ]] = 30;
Mitem_to_ml_boost[ $item[ stainless steel scarf ]] = 20;
Mitem_to_ml_boost[ $item[ ice sickle ]] = 15;
Mitem_to_ml_boost[ $item[ hippo whip ]] = 10;
Mitem_to_ml_boost[ $item[ annoying pitchfork ]] = 5;
Mitem_to_ml_boost[ $item[ giant needle ]] = 5;
Mitem_to_ml_boost[ $item[ goth kid t-shirt ]] = 5;
Mitem_to_ml_boost[ $item[ ring of aggravate monster ]] = 5;

int current_monster_level()
{
  int x = 0;
  foreach sl in Sslot
    x = x + Mitem_to_ml_boost[ current_equipment( sl )];

  if ( have_effect( $effect[ Ur-Kel's Aria of Annoyance ]) > 0)
    x = x + 2 * my_level();
  if ( have_effect( $effect[ the cupcake of wrath ]) > 0) 
    x = x + 10;
  if ( have_effect( $effect[ eau d'enmity ]) > 0) 
    x = x + 5;

  return x;
}
 
Top