/* Filename : spectacles.c * Description : special item to assess monsters * * written : 05-10-1996 - Gunner * last modified : 28-05-1998 - Gunner * HTML-Version : 06-02-2000 - Ghorwin */ #include <mudlib.h> inherit I_ARMOUR; #define FUNC "/doc/crashcourse/course09/specfuncs" create() { ::create(); set_name("assessment spectacles"); add_id(({"spectacles","pair of spectacles","pair of assessment spectacles", "strange spectacles","special spectacles"})); set_short("A pair of spectacles"); set_long("This is a pair of spectacles. They look kinda strange. " "Wonder what's so special about them...\n"); set_weight(1); set_value(200+random(200)); set_type("helmet"); // Helmet? Ah, well.. Closest.. ;-) set_info("These specs are useful for assessing monsters.\n"); add_trigger("assess",(:call_other,FUNC,"assess",this_object():)); add_property(({"hidden","magic","glass"})); replace_program(I_ARMOUR); }
/* Filename : specfuncs.c * Description : the functionfile for spectacles.c * * written : 05-10-1996 - Gunner * last modified : 28-05-1998 - Gunner * HTML-Version : 06-02-2000 - Ghorwin */ #include <mudlib.h> #include "/doc/crashcourse/defs.h" inherit I_DAEMON; /* * assess : The assessment function */ int assess(object spectacles, string arg) { string pro, message; object mon; int str, dex, hp, sp, sum; if (!spectacles->query_worn_by()) return 0; // They're not worn... if (!arg) NOT_FAIL("Assess who?\n"); mon = present(arg,ENV(TP)); if (!mon) NOT_FAIL(arg + " is not here.\n"); if (!living(mon) || Q_NOMAGIC(ENV(TP))) NOT_FAIL("Somehow that's not possible.\n"); str = mon->query_str() - TP->query_str(); dex = mon->query_dex() - TP->query_dex(); hp = mon->query_hp(); sp = mon->query_sp(); pro = Q_PRO(mon); message = "You notice that " + pro + " is "; sum = str + dex; switch (sum) { case -1000..-10 : message += "much weaker than you"; break; case -9..-1 : message += "weaker than you"; break; case 0 : message += "just a strong as you"; break; case 1..10 : message += "stronger than you"; break; case 11..20 : message += "much stronger than you"; break; case 30..1000 : message += "strong as a god"; break; default : message += "possibly strong"; break; } message += ", and " + pro + " "; switch (hp) { case 0..50 : message += "has a fragile constitution"; break; case 51..100 : message += "has a weak constitution"; break; case 101..300 : message += "is quite healthy"; break; case 301..500 : message += "has a strong constitution"; break; case 501..1000 : message += "has a very good constitution"; break; case 1001..10000 : message += "has a godgiven health"; break; default : message += "has a weird health"; break; } message += ".\n" + CAP(pro) + " "; switch (sp) { case 0..50 : message += "has some small magical powers"; break; case 51..100 : message += "has some modest magical powers"; break; case 101..300 : message += "has some magical powers"; break; case 301..500 : message += "could be a strong spellcaster"; break; case 501..1000 : message += "could be a powerful spellcaster"; break; case 1001..10000 : message += "might be a godsent spellcaster"; break; default : message += "is an impossible spellcaster"; break; } message += ".\n"; tell_object(TP, "As you gaze through the spectacles at " + arg + ", you notice something about " + Q_OBJ(mon) + ".\n" + message); return 1; }