/* * This is a general protection spell. Inherit or clone and configure after * you own needs. * * Auronthas 30.06.91 */ string name, alias, short_desc, value, weight; string type, spell_name, long_desc; int worn, ac; object worn_by, caster; object next; string info; link(ob) { next = ob; } remove_link(str) { object ob; if (str == name) { ob = next; next = 0; return ob; } if (next) next = next->remove_link(str); return this_object(); } init() { wear(name); } rec_short() { if (next) return name + ", " + next->rec_short(); return name; } short() { if (!short_desc) return 0; return short_desc; } long(str) { write(long_desc); } id(str) { return str == name || str == alias || str == type || str == "spell"; } get() { return 1; } drop() { dispel(); return 1; } test_type(str) { if (str == type) return this_object(); if (next) return next->test_type(str); return 0; } tot_ac() { if (next) return ac + next->tot_ac(); return ac; } query_type() { return type; } query_worn() { return worn; } query_name() { return name; } armour_class() { return ac; } wear(str) { object ob; if (!id(str)) return 0; if (environment() != this_player()) { return 0; } next = 0; ob = this_player()->wear(this_object()); if (!ob) { worn_by = this_player(); worn = 1; write("You get the protection of a spell.\n"); return 1; } write("You already have a " + spell_name + " spell cast upon you.\n"); destruct(this_object()); return 0; } set_duration(d) { call_out("expire", d * this_player()->query_int()); } set_name(n) { name = n; } set_short(s) { short_desc = s; } set_ac(a) { ac = a; } set_alias(a) { alias = a; } set_type(t) { type = t; } set_arm_light(l) { set_light(l); } set_caster(who) { caster = who; } set_long(l) { long_desc = l; } set_spell_name(n) { spell_name = n; type = n; short_desc = n + " spell"; long_desc = capitalize(short_desc) + ".\n"; } query_cast_by() { return caster; } magical() { return 1; } dispel() { remove_call_out("expire"); tell_object(environment(), "Your " + spell_name + " spell disappears.\n"); destruct(this_object()); return 1; } expire() { tell_object(environment(), "Your " + spell_name + " spell becomes unstable.\n"); dispel(); } mage_friendly() { return 1; } exit() { destruct(this_object()); }