#pragma save_binary /* ** enchanment stuff. You can enchant up to a maximun of 50. ** This will raise the ac of the armour by 50 over its start value ** and raise the price by the amount of enchantment it has. */ int enchanted; string enchant_string() { if( !enchanted ) return ""; return "It is surrounded by a " + ({ "very faint", "faint", "quite faint", "pale", "dull", "medium", "quite strong", "strong", "very strong", "extremely strong" })[ enchanted / 5 ] + " magical field.\n"; } void set_enchant( int i ) { if( i > 50 ) i = 50; if( !i ) this_object()->set_value( (int)this_object()->query_value() / enchanted ); else if( enchanted ) this_object()->set_value( ((int)this_object()->query_value() * i) / enchanted ); else this_object()->set_value( (int)this_object()->query_value() * i ); enchanted = i; } int add_enchant( int i ) { if( i + enchanted > 50 ) i = 50 - enchanted; if( enchanted ) this_object()->set_value( ((int)this_object()->query_value() * (i + enchanted)) / enchanted ); else if( i ) this_object()->set_value( (int)this_object()->query_value() * i ); enchanted += i; return i; } int query_enchant() { return enchanted; }