armour #418

Parent #112297Owner Flags Source rpg_march_2006/armor.txt

Aliases: armour

23 verbs · 28 properties · 0 children

Verbs

VerbSpecFlagsDefinerLines
wearthis none nonerxd#41830
rem*ovethis none nonerxd#41824
encumbrancethis none this#4185
fitsthis none this#41840
protectionthis none thisrx#4187
coverthis none this#41818
check_degradethis none thisrx#41827
breakthis none this#41819
absorptionthis none thisrx#4185
do_movethis none this#41811
may_wearthis none this#41814
do_wearthis none this#4187
do_removethis none this#4183
may_removethis none this#41811
custom modified off_the_shelfthis none this#4187
hidden_verbsthis none this#41810
descriptionthis none this#4186
announce_clangthis none thisrx#41814
announce_clang(old)this none thisrx#4186
can_degradethis none this#4181
coveragethis none this#4181
_wearthis none this#41814
_removethis none this#41815

Properties

PropertyDefinerFlagsOwnerValue
size#418rc10
cover#418r{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
protection#418r0
bulk#418r1
body_areas#418rc{#39284, #60746, #61688, #61605, #9655, #51172, #75697, #38715, #52374, #47817, #33584, #54898}
leather#418r0
absorption#418not readable (E_PERM)
worn_area#418not readable (E_PERM)
wear_msg#418rc"%N %<puts> on %p %t."
remove_msg#418rc"%N %<takes> off %p %t."
custom#418rc{}
break_msg#418rc"%T shatters into slivers."
announce_clang_msgs#418r{"%N's armoured %locstr %clanged the blow.", "The blow is %clanged by the armour on %n's %locstr."}
clang_verbs#418r{"deflected", "stopped", "repelled", "deflected", "blocked", "deflected", "absorbed", "deflected", "stopped", "diverted", "deflected"}
can_degrade#418not readable (E_PERM)
too_small_msg#418r"The %t appears to be too small for you to wear."
layers#418r0
manufactured#418923451666
worth#418-1
condition#418100
last_action#4181102246102
odrop_failed_msg#418"%<tries> to drop %t but fails!"
odrop_succeeded_msg#418"%<drops> %t."
otake_succeeded_msg#418"%<picks> up %t."
key#418not readable (E_PERM)
aliases#418{"armour"}
description#418"Something to watch over you."
object_size#418{21406, 1141286558}

Ancestry

Ancestors (nearest first): #112297 Generic Dyable LRPG Thing#517 Generic LRPG Thing

Children: none

Call graph

calls n418_0 #418:wear n418_10 #418:may_wear n418_0->n418_10 n418_3 #418:fits n418_0->n418_3 n418_21 #418:_wear n418_0->n418_21 n418_20 #418:coverage n418_3->n418_20 n418_11 #418:do_wear n418_21->n418_11 n418_1 #418:rem*ove n418_13 #418:may_remove n418_1->n418_13 n418_22 #418:_remove n418_1->n418_22 n418_12 #418:do_remove n418_22->n418_12 n418_5 #418:cover n517_32 #517:do_update n418_5->n517_32 n418_7 #418:break n517_20 #517:unclaim_for n418_7->n517_20 n517_30 #517:moveto n418_7->n517_30 n418_9 #418:do_move n418_9->n418_12 n517_24 #517:do_move n418_9->n517_24 n418_12->n517_32 n418_11->n517_32 n418_15 #418:hidden_verbs n112297_3 #112297:hidden_verbs n418_15->n112297_3 n418_16 #418:description n112297_2 #112297:description n418_16->n112297_2 n418_18 #418:announce_clang(old) n418_18->n517_32

Source

wear

Spec this none noneFlags rxdDefiner #418

Referenced by

none

Source

1if (!(rpg = $local.rpg):trust($nothing, player))
2  return E_PERM;
3elseif (this.location != player)
4  rpg:playertell(player, "You don't have ", this.name, ".");
5elseif (!valid(doll = rpg:get_doll(player)))
6  rpg:playertell(player, "You can't work out which way round it goes. Perhaps some training at the Bovine Illuminati would help.");
7elseif (p = doll.paralyzed)
8  return rpg:playertell(player, (typeof(p) == STR) ? p | "Trying to adjust your fashion statement while paralyzed is just about close to impossible.");
9elseif (rpg.magic_db.en_combat_effect in doll.combat_effects)
10  return rpg:playertell(player, "The vines entangling you make that just a wee bit difficult.");
11elseif (this in doll.wearing)
12  rpg:playertell(player, "You're already wearing ", this.name, ".");
13elseif (doll:aggressor() && (!(this.worn_area in {"ring"})))
14  rpg:playertell(player, "Getting dressed in the middle of battle is sort of hard; try putting your armour on BEFORE you pick a fight.");
15elseif (!this:may_wear(player))
16  return;
17elseif (fits = this:fits(player))
18  "doll.wearing = listappend(doll.wearing, this);";
19  "this:do_wear(player);";
20  rpg:say_action(this.wear_msg, player, this, player.location);
21  "rpg:playertell(player, \"You are now wearing \", $string_utils:title_list(doll.wearing), \".\");";
22  "return 1;";
23  return this:_wear(doll);
24elseif (fits != doll)
25  rpg:playertell(player, "You try to put on your ", this.name, " but your ", fits.name, " keeps getting in the way.");
26else
27  rpg:playertell(player, this.name, (this.size < doll.size) ? " is too small for you." | " doesn't seem to fit you.");
28endif
29"Hydros (#106189) - Tue Jul 5, 2005 - Commented out the hard code grunt work and moved it to :_wear().  The same done for :remove => :_remove.";
30"Hydros(#106189) - Sat Jul 9, 2005 - Moved messaging from :_wear back into this verb. :_* verbs should be programmatic, sans messaging.  Silly me.";

rem*ove

Spec this none noneFlags rxdDefiner #418

Referenced by

none

Source

1if (!(rpg = $local.rpg):trust($nothing, player))
2  return E_PERM;
3elseif ((!valid(doll = rpg:get_doll(player))) || (!(this in doll.wearing)))
4  rpg:playertell(player, "You're not wearing ", this.name, ".");
5elseif (p = doll:cannot_move())
6  rpg:playertell(player, (typeof(p) == STR) ? p | "Hahahha.  Take that off?  While paralyzed?  Good one.");
7elseif (rpg.magic_db.en_combat_effect in doll.combat_effects)
8  rpg:playertell(player, "The vines entangling you make that just a wee bit difficult.");
9elseif (`player.location:sleeping(player) ! ANY => 0')
10  return rpg:playertell(player, "You dream of removing your ", this.name, ".");
11elseif (!doll:hands_free())
12  rpg:playertell(player, "You'll need to have your hands free to get undressed.");
13elseif (doll:aggressor())
14  rpg:playertell(player, "Getting undressed in the middle of battle is kind of hard; who wants to see your ugly bod anyway?");
15elseif (this:may_remove(player))
16  "doll.wearing = setremove(doll.wearing, this);";
17  "this:do_remove(player);";
18  rpg:say_action(this.remove_msg, player, this, player.location);
19  "text = $string_utils:english_list($list_utils:map_prop(doll.wearing, \"name\"));";
20  "rpg:playertell(player, \"You are now wearing \", text, \".\");";
21  this:_remove(doll);
22endif
23"Hydros (#106189) - Tue Jul 5, 2005 - Commented out the hard code grunt work and moved it to :_remove().  The same done for :wear => :_wear.";
24"Hydros(#106189) - Sat Jul 9, 2005 - Moved messaging from :_remove back into this verb. :_* verbs should be programmatic, sans messaging.  Silly me.";

encumbrance

Spec this none thisDefiner #418

Referenced by

none

Source

1enc = this.encumbrance;
2if (valid(doll = $local.rpg:get_doll(this.location)))
3  enc = (this in doll.wearing) ? (enc * 8) / 9 | (enc + 1);
4endif
5return (this.size * enc) / 10;

fits

Spec this none thisDefiner #418

Referenced by

Source

1":fits(who) => True if armour will fit on given character. --Quinn (08-MAR-93)";
2{who} = args;
3if (!valid(doll = $local.rpg:get_doll(who)))
4  return E_INVARG;
5elseif ((body_size = doll.size) > (new_armour_size = this.size))
6  return doll;
7endif
8coverage = this:coverage();
9for area in (this.body_areas)
10  if ((!(area in doll.body_areas)) && (cover = coverage[area in this.body_areas]))
11    return doll;
12  endif
13  if (cover = coverage[area in this.body_areas])
14    for armour in (doll.wearing)
15      narea = area in armour.body_areas;
16      if ((narea && (nac = armour.cover[narea])) && ((nac == cover) || (((nac + cover) - (doll.agl * 2)) > (100 + random(50)))))
17        body_size = armour.size + armour.bulk;
18        if ((new_armour_size <= body_size) || ((new_armour_size * 5) > (body_size * 6)))
19          return armour;
20        endif
21      endif
22    endfor
23  endif
24endfor
25num_worn = 0;
26warea = this.worn_area;
27max_worn = {99, 1, 1, 1, doll.hands}[(warea in {"necklace", "amulet", "nose ring", "ring"}) + 1];
28for armour in (doll.wearing)
29  if (warea == armour.worn_area)
30    num_worn = num_worn + 1;
31    if (num_worn >= max_worn)
32      return armour;
33    endif
34  endif
35endfor
36return 1;
37"Profane 20-JAN-96 1523EST: Added check to make sure body areas covered are same as on doll.";
38"Irin Sun Sep 29 15:19:01 1996 PDT -- Added check for worn area.";
39"Irin Thu Oct 10 13:51:40 1996 PDT -- Rewrite to allow items with non-identical .cover property to be used.";
40"Profane (#30788) - Sun Aug  5, 2001 - Deny fitting in case of missing body area only if .cover is positive.";

protection

Spec this none thisFlags rxDefiner #418

Referenced by

none

Source

1":protection(attacker, target, weapon, hit-location, penetration, damage)";
2"=> Protection this armour affords from an attack with the given stats.";
3"Note that 'target' will be the wearer of the armour.";
4prot = this.protection;
5return max(((prot * this.condition) / 100) || 0, prot / 2);
6"Quinn 11-AUG-93 1012: Added.";
7"Profane 2-17-95 23:18EST - Modified for condition of armour.";

cover

Spec this none thisDefiner #418

Referenced by

none

Source

1":cover(LIST body_areas)";
2"-> Percentage chance of the armour affording protection to the given body areas.  The final coverage factor is that of the area least protected.";
3targs1 = typeof(areas = args[1]);
4cover = this.cover;
5this.last_action && this:do_update();
6if (targs1 == NUM)
7  return cover[areas];
8endif
9coverage = 0;
10covered = this.body_areas;
11areas = (targs1 == LIST) ? areas | {areas};
12for area in (areas)
13  if (i = area in covered)
14    coverage = coverage + cover[i];
15  endif
16endfor
17return coverage ? coverage / length(areas) | 0;
18"Quinn 18-NOV-93 0402: Added.";

check_degrade

Spec this none thisFlags rxDefiner #418

Referenced by

none

Source

1":check_degrade(OBJ attacker, OBJ victim, location, OBJ other weapon/armour, NUM qual of attack)";
2{attacker, victim, loc, weapon, qual} = args;
3if (typeof(condition = this.condition) == NUM)
4  if ((this.unique || children(this)) || (qual < 1))
5    return;
6  endif
7  "Chance of breaking: 1% for every 5 condition points we are below 50. e.g. .condition 40 == 2% chance of breaking.";
8  break_chance = max((50 - condition) / 5, 0);
9  if (random(99) <= break_chance)
10    $local.rpg:secure();
11    this:("break")();
12    kill_task(task_id());
13  else
14    chance = (5 + (5 * (this.leather && (!weapon.blunt)))) + (qual / 99);
15    "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.";
16    if (random(999) <= chance)
17      "Alright, real simple formula since old one was tick-intensive and people whined it did too much damage.";
18      amt = (5 * qual) / 99;
19      amt = random(max(amt, 1));
20      (rpg = $local.rpg):secure();
21      this.condition = max(condition - amt, 0);
22      rpg:playertell(victim, "Your ", this.name, " seems a little worse for wear.");
23    endif
24  endif
25endif
26"Profane 2-17-95 23:50EST - Added.";
27"THX (#105941) - Tue Dec 21, 1999 - Put security in _only_ if the armour degrades or breaks.";

break

Spec this none thisDefiner #418

Referenced by

none

Source

1":break() -- Make the armour break. Instead of recycling it, we just move it to the cemetery and let the regular reaping take care of it.";
2if (!(rpg = $local.rpg):trusted(caller_perms()))
3  return E_PERM;
4elseif ((((this.owner != rpg.owner) || this.unique) || (typeof(condition = this.condition) != NUM)) || children(this))
5  return E_NACC;
6else
7  if (valid(doll = rpg:get_doll(who = this.location)) && (this in doll.wearing))
8    rpg:s_i_n(0);
9    rpg:playertell(who, "Your ", this.name, " disintegrates from the abuse it has taken!");
10    rpg:rpg_announce_all_but(who.location, {who}, who.name, "'s ", this.name, " disintegrates from the abuse it has taken!");
11    doll.wearing = setremove(doll.wearing, this);
12  else
13    rpg:say_action(this.break_msg, who, this, who);
14  endif
15  this:unclaim_for(this.claimed_by);
16  this:moveto(rpg.cemetery);
17endif
18"Profane 2-17-95 23:55EST - Added.";
19"Hydros (#106189) - Tue Jul 12, 2005 - Inserted a :s_i_n() call because the sweep task exploded.";

absorption

Spec this none thisFlags rxDefiner #418

Referenced by

none

Source

1":absorption(attacker, target, weapon, hit-location, concussion, damage)";
2a = this.absorption;
3return max(0, ((this.condition || 100) > 50) ? a | (a - 1));
4"Irin Sept 16 1996 -- added.";
5"THX (#105941) - Fri May  5, 2000 - Fixed for 0 absorption.";

do_move

Spec this none thisDefiner #418

Referenced by

none

Source

1":do_move(oldloc, newloc) => remove this from oldloc.wielding.";
2rpg = $local.rpg;
3if (rpg:trusted(caller_perms()))
4  if (valid(doll = rpg:get_doll(args[1])))
5    doll.wearing = setremove(doll.wearing, this);
6    this:do_remove(args[1]);
7  endif
8  pass(@args);
9else
10  return E_PERM;
11endif

may_wear

Spec this none thisDefiner #418

Referenced by

Source

1":may_wear(who) => Who is allowed to wear armour.";
2{who} = args;
3if (valid(doll = (rpg = $local.rpg):get_doll(who)))
4  if (msg = doll:immobilized())
5    rpg:playertell(who, msg);
6    return 0;
7  elseif (`who.location:sleeping(who) ! E_VERBNF => 0')
8    rpg:playertell(who, "You are asleep and cannot do that.");
9    return 0;
10  endif
11  return 1;
12else
13  return 0;
14endif

do_wear

Spec this none thisDefiner #418

Referenced by

Source

1":do_wear(who) => Perform whatever additional tasks are required to allow 'who' to wear the armour.";
2if ((!(this.owner in $local.rpg.gms)) && `verb_info(this, "0") ! E_VERBNF')
3  raise(E_PERM, "Sorry, but non-gms may not own armour objects. Thanks for playing.");
4else
5  this.last_action && this:do_update();
6  return 1;
7endif

do_remove

Spec this none thisDefiner #418

Referenced by

Source

1":do_remove(who) => Perform whatever tasks are necessary to remove the armour from who...";
2this.last_action && this:do_update();
3return 1;

may_remove

Spec this none thisDefiner #418

Referenced by

Source

1":may_remove(who) => Who is allowed to take off the armour.";
2{who} = args;
3if (valid(doll = (rpg = $local.rpg):get_doll(who)))
4  if (msg = doll:immobilized())
5    rpg:playertell(who, msg);
6    return 0;
7  endif
8  return 1;
9else
10  return 0;
11endif

custom modified off_the_shelf

Spec this none thisDefiner #418

Referenced by

none

Source

1$local.rpg:secure();
2{?who} = args;
3if (verb == "off_the_shelf")
4  clear_property(this.custom);
5else
6  this.custom = {who, verb};
7endif

hidden_verbs

Spec this none thisDefiner #418

Referenced by

none

Source

1{who} = args;
2prev = pass(who);
3armour = (rpg = $local.rpg).armour;
4if (((!valid(doll = rpg:get_doll(who))) || (this in doll.wearing)) || (who != this.location))
5  prev = {@prev, {armour, "wear", {"this", "none", "none"}}};
6endif
7if (((!valid(doll)) || (!(this in doll.wearing))) || (who != this.location))
8  prev = {@prev, {armour, "rem*ove", {"this", "none", "none"}}};
9endif
10return prev;

description

Spec this none thisDefiner #418

Referenced by

none

Source

1desc = pass(@args);
2if (valid(doll = $local.rpg:get_doll(player)) && (this.size < doll.size))
3  desc = (typeof(desc) == LIST) ? desc | {desc};
4  desc = setadd(desc, strsub(this.too_small_msg, "%t", this.name));
5endif
6return desc;

announce_clang

Spec this none thisFlags rxDefiner #418

Referenced by

none

Source

1":announce_clang(attacker, target, location-string, clanging weapon, quality of attack)";
2"Announce that this armour has deflected a blow from `attacker' to `location-string' while being worn by `target'.";
3{attacker, defender, locstr, weapon, qual} = args;
4string = this.announce_clang_msgs[random($)];
5string = strsub(string, "%locstr", locstr);
6weap = weapon:used_title();
7string = strsub(string, "%weapon is ", weap + ((weap[$] == "s") ? " are " | " is "));
8string = strsub(string, "%weapon", weap);
9string = strsub(string, "%clanged", this.clang_verbs[random($)]);
10dobj = attacker;
11(rpg = $local.rpg):say_action(string, defender);
12if (attacker.location != defender.location)
13  rpg:playertell(attacker, $string_utils:pronoun_sub(string, defender));
14endif

announce_clang(old)

Spec this none thisFlags rxDefiner #418

Referenced by

none

Source

1":announce_clang(attacker, target, location-string, clanging weapon, quality of attack)";
2"Announce that this armour has deflected a blow from `attacker' to `location-string' while being worn by `target'.";
3{attacker, defender, locstr, weapon, qual} = args;
4(rpg = $local.rpg):playertell(defender, "Your armoured ", locstr, " deflected the blow.");
5rpg:rpg_announce_all_but(defender.location, {defender}, "The blow is stopped by the armour on ", defender.name, "'s ", locstr, ".");
6this.last_action && this:do_update();

can_degrade

Spec this none thisDefiner #418

Referenced by

none

Source

1return this.(verb);

coverage

Spec this none thisDefiner #418

Referenced by

Source

1return this.cover;

_wear

Spec this none thisDefiner #418

Referenced by

Source

1"This does the grunt work of :wear.";
2(rpg = $local.rpg):secure();
3{doll} = args;
4who = doll.character;
5doll.wearing = listappend(doll.wearing, this);
6this:do_wear(who);
7rpg:playertell(who, "You are now wearing ", $string_utils:title_list(doll.wearing), ".");
8for eq in (setremove({@doll.wearing, @doll.wielding}, this))
9  fork (0)
10    `rpg:trusted_verb(eq, "notify_equip") ! E_VERBNF => 0' && eq:notify_equip(doll, this);
11  endfork
12endfor
13"Hydros (#106189) - Tue Jul 5, 2005 - Added, including a check of all your current equipment for :notify_equip.";
14"Hydros(#106189) - Sat Jul 9, 2005 - Moved messaging back into :wear. :_* verbs should be programmatic, sans messaging.  Silly me.";

_remove

Spec this none thisDefiner #418

Referenced by

Source

1"This does the grunt work of :remove.";
2(rpg = $local.rpg):secure();
3{doll} = args;
4who = doll.character;
5doll.wearing = setremove(doll.wearing, this);
6this:do_remove(who);
7text = $string_utils:english_list($list_utils:map_prop(doll.wearing, "name"));
8rpg:playertell(who, "You are now wearing ", text, ".");
9for eq in (setremove({@doll.wearing, @doll.wielding}, this))
10  fork (0)
11    `rpg:trusted_verb(eq, "notify_unequip") ! E_VERBNF => 0' && eq:notify_unequip(doll, this);
12  endfork
13endfor
14"Hydros (#106189) - Tue Jul 5, 2005 - Added, including a check of all your current equipment for :notify_unequip.";
15"Hydros(#106189) - Sat Jul 9, 2005 - Moved messaging back into :remove. :_* verbs should be programmatic, sans messaging.  Silly me.";