/** * This is a pocketed armour inherit. * @author Sandoz, 2002. */ #define AC_LIMIT 100 // This is used in pocket_armour as well. inherit "/std/armour_logic"; inherit CLOTHING_OBJ; /** * This method queries wether or not the object is a clothing object. * This is an override of the same function in the inherited * clothing object. * @return always return 0, because this is armour */ int query_clothing() { return 0; } /** * This method returns 1 to tell us that it is armour. * @return always returns 1 */ int query_armour() { return 1; } /** @ignore yes */ void create() { do_setup++; armour_logic::create(); clothing::create(); remove_immune_to("blunt"); remove_alias("clothing"); remove_plural("clothes"); do_setup--; if( !do_setup ) TO->setup(); } /* create() */ /** @ignore yes */ varargs int query_ac( string type, int amount, string zone ) { int a_class; #ifdef INFORM string message; #endif a_class = armour_logic::query_ac( type, amount, zone ); #ifdef INFORM message = query_short() +": striking " + zone + ", basic value "+ a_class; #endif if( a_class > AC_LIMIT ) a_class = AC_LIMIT; a_class += ( a_class * query_enchant() ) / query_max_enchant() + query_enchant(); #ifdef INFORM message += "; after enchant "+ a_class; if( objectp( worn_by ) ) event( ENV( worn_by ), "inform", message, "combat" ); #endif do_damage( type, amount ); a_class = ( a_class * cond ) / max_cond; // damage may get through depending on how good the armour is. switch( random( a_class ) ) { case 0: return 0; case 1: return a_class / 2; case 2..3: return a_class * 2 / 3; default: // they'll always take a small amount of damage. if( a_class > amount ) return amount - ( amount / ( 5 + random( 10 ) ) ); return a_class - ( amount / ( 5 + random( 10 ) ) ); } } /* query_ac() */ /** @ignore yes */ void setup_armour( int i ) { return setup_clothing( i ); } /** @ignore yes */ mixed stats() { return clothing::stats() + armour_logic::stats() + ({ ({ "max ac", AC_LIMIT }) }); } /* stat() */ /** @ignore yes */ mapping int_query_static_auto_load() { return ([ "::" : clothing::int_query_static_auto_load(), "ac" : ac, "armour types" : armour_types, ]); } /* query_static_auto_load() */ /** @ignore yes */ mapping query_static_auto_load() { if( base_name(TO) != __FILE__[0..<3] ) return ([ ]); return int_query_static_auto_load(); } /* query_static_auto_load() */ /** @ignore yes */ void init_static_arg( mapping map ) { if( !mapp( map ) ) return; if( map[ "::" ] ) clothing::init_static_arg( map[ "::" ] ); if( map[ "ac" ] ) ac = map[ "ac" ]; if( map["armour types"] ) armour_types = map["armour types"]; } /* init_static_arg() */