"A dump of #418 on Sun Dec 17 13:04:06 1995 PST @create #517 named armour:armour @prop #418."size" 10 rc @prop #418."cover" {} r ;;#418.("cover") = {0, 0, 0, 0, 0, 0, 0} @prop #418."protection" 0 r @prop #418."bulk" 1 r @prop #418."body_areas" {} rc ;;#418.("body_areas") = {#39284, #61605, #51172, #60746, #61688, #52374, #47817} ;;#418.("condition") = 100 ;;#418.("odrop_failed_msg") = "% to drop %t but fails!" ;;#418.("odrop_succeeded_msg") = "% %t." ;;#418.("otake_succeeded_msg") = "% up %t." ;;#418.("key") = 0 ;;#418.("aliases") = {"armour"} ;;#418.("description") = "Something to watch over you." ;;#418.("object_size") = {7768, 819192250} @verb #418:"wear" this none none rxd @program #418:wear if (!#46:trust($nothing, player)) return E_PERM; elseif (!valid(doll = #46:get_doll(player))) player:tell("You can't work out which way round it goes. Perhaps some training at the Bovine Illuminati would help."); elseif (this in doll.wearing) player:tell("You're already wearing ", this.name, "."); elseif (this.location != player) player:tell("You don't have ", this.name, "."); elseif (fits = this:fits(player)) doll.wearing = listappend(doll.wearing, this); player:tell("You put on your ", this.name, "."); player.location:announce($string_utils:pronoun_sub(("%n % %p " + this.name) + ".")); player:tell("You are now wearing ", $string_utils:title_list(doll.wearing), "."); return 1; elseif (fits != doll) player:tell("You try to put on your ", this.name, " but your ", fits.name, " keeps getting in the way."); else player:tell(this.name, " doesn't seem to fit you."); endif . @verb #418:"rem*ove" this none none rxd @program #418:remove if (!#46:trust($nothing, player)) return E_PERM; elseif ((!valid(doll = #46:get_doll(player))) || (!(this in doll.wearing))) player:tell("You're not wearing ", this.name, "."); return; endif doll.wearing = setremove(doll.wearing, this); player:tell("You take off your ", this.name, "."); player.location:announce($string_utils:pronoun_sub(("%n % %p " + this.name) + ".")); text = $string_utils:english_list($list_utils:map_prop(doll.wearing, "name")); player:tell("You are now wearing ", text); . @verb #418:"encumbrance" this none this @program #418:encumbrance return (this.size * this.encumbrance) / 10; . @verb #418:"fits" this none this @program #418:fits ":fits(who) => True if armour will fit on given character. --Quinn (08-MAR-93)"; if (!valid(doll = #46:get_doll(args[1]))) return E_INVARG; elseif ((body_size = doll.size) > (new_armour_size = this.size)) return doll; endif for area in [1..length(coverage = this.cover)] if (cover = coverage[area]) for armour in (doll.wearing) if ((nac = armour.cover[area]) && ((nac == cover) || (((nac + cover) - (doll.agl * 2)) > (100 + random(50))))) body_size = armour.size + armour.bulk; if ((new_armour_size <= body_size) || ((new_armour_size * 5) > (body_size * 6))) return armour; endif endif endfor endif endfor return 1; . @verb #418:"protection" this none this rx @program #418:protection ":protection(attacker, target, weapon, hit-location, penetration, damage)"; "=> Protection this armour affords from an attack with the given stats."; "Note that 'target' will be the wearer of the armour."; prot = this.protection; return max(((prot * this.condition) / 100) || 0, prot / 2); "Quinn 11-AUG-93 1012: Added."; "Profane 2-17-95 23:18EST - Modified for condition of armour."; . @verb #418:"cover" this none this @program #418:cover ":cover(LIST body_areas)"; "-> Percentage chance of the armour affording protection to the given body areas. The final coverage factor is that of the area least protected."; targs1 = typeof(areas = args[1]); cover = this.cover; if (targs1 == NUM) return cover[areas]; endif coverage = 0; covered = this.body_areas; areas = (targs1 == LIST) ? areas | {areas}; for area in (areas) if (i = area in covered) coverage = coverage + cover[i]; endif endfor return coverage ? coverage / length(areas) | 0; "Quinn 18-NOV-93 0402: Added."; . @verb #418:"announce_clang" this none this rx @program #418:announce_clang ":announce_clang(attacker, target, location-string, clanging weapon, qaulity of attack)"; "Announce that this armour has deflected a blow from `attacker' to `location-string' while being worn by `target'."; "Messages are run through $local.rpg:combat_sub."; who = args[2]; who:tell(strsub("Your armoured %w deflected the blow.", "%w", loc = args[3])); $local.rpg:rpg_announce_all_but(who.location, {who}, strsub(("The blow is stopped by the armour on " + who.name) + "'s %w.", "%w", loc)); "this:check_degrade(@args)"; "StarDancer 11-19-95 comment out the degrade check, 'cause we're *always* runnin outa ticks."; "Profane 2-18-95 00:26EST - Added check for armour degrading."; . @verb #418:"is_leather" this none this rx @program #418:is_leather ":is_leather() => true or false; Is this piece of armour made of leather or cloth?"; return (((this in (arf = $local.rpg.leather_armour)) || (parent(this) in arf)) || (parent(parent(this)) in arf)) || 0; . @verb #418:"check_degrade" this none this @program #418:check_degrade ":check_degrade(OBJ attacker, OBJ victim, location, OBJ other weapon/armour, NUM qual of attack)"; if (!$local.rpg:trusted(caller_perms())) return E_PERM; elseif (typeof(condition = this.condition) == NUM) "Chance of breaking: 1% for every 5 condition points we are below 50. e.g. .condition 40 == 2% chance of breaking."; break_chance = max((50 - condition) / 5, 0); if (random(100) <= break_chance) return this:break(); else chance = (5 + (5 * (this:is_leather() && (!args[4]:is_blunt())))) + ((qual = args[5]) / 100); "Base chance = .5%, 1% if this is a piece of leather armour and the attacking weapon is sharp (!blunt). Add in quality of attack expressed as a percentage. For yer average attack, this works out to be ~.8% or ~1.3%, respectively."; if (random(1000) <= chance) if (this.unique || children(this)) return; endif "Alright, real simple formula since old one was tick-intensive and people whined it did too much damage."; amt = (5 * qual) / 100; amt = random(max(amt, 1)); this.condition = max(condition - amt, 0); args[2]:tell("Your ", this.name, " seems a little worse for wear."); endif endif endif "Profane 2-17-95 23:50EST - Added."; . @verb #418:"break" this none this @program #418:break ":break() -- Make the armour break. Instead of recycling it, we just move it to the cemetary and let the regular reaping take care of it."; if (!$local.rpg:trusted(caller_perms())) return E_PERM; elseif ((((this.owner != $local.rpg.owner) || this.unique) || (typeof(condition = this.condition) != NUM)) || children(this)) return E_NACC; else if (valid(doll = $local.rpg:get_doll(who = this.location)) && (this in doll.wearing)) who:tell("Your ", this.name, " disintegrates from the abuse it has taken!"); who:room_announce(who.name, "'s ", this.name, " disintegrates from the abuse it has taken!"); doll.wearing = setremove(doll.wearing, this); endif this:moveto($local.rpg.cemetery); endif "Profane 2-17-95 23:55EST - Added."; . "***finished***