generic poison #1760

Parent #8868Owner Flags Source rpg_march_2006/Misc/poison.txt

Aliases: generic poison, poison

12 verbs · 22 properties · 0 children

Verbs

VerbSpecFlagsDefinerLines
effectthis none this#176015
schedulethis none this#176031
instant_effectthis none this#17602
delayed_effectthis none this#17603
announce_poisoningthis none this#17603
damagethis none this#176042
make_fertilethis none this#176013
cancelthis none this#17608
death_effectthis none this#176012
schedule(old)this none this#176025
death_msg stun_msg damage_msg odeath_msg ostun_msg odamage_msg cure_msg ocure_msgthis none this#17602
damage(old)this none this#176024

Properties

PropertyDefinerFlagsOwnerValue
data#1760r{}
task#1760r1698963992
delayed#1760rc0
poisoner#1760rc"empty slot"
death_msg#1760rc""
stun_msg#1760rc""
damage_msg#1760rc""
ostun_msg#1760rc""
odamage_msg#1760rc""
odeath_msg#1760rc""
cure_msg#1760rc""
ocure_msg#1760rc""
manufactured#1760947275400
worth#1760-1
condition#1760E_NONE
odrop_failed_msg#1760"%<tries> to drop %t but fails!"
odrop_succeeded_msg#1760"%<drops> %t."
otake_succeeded_msg#1760"%<picks> up %t."
key#1760not readable (E_PERM)
aliases#1760{"generic poison", "poison"}
description#1760
value (450 chars){"Ok, so here's how it works:", "", "Design the effect object with combat and/or armour and/or magic effects ", "and make it a child of Generic Armour/Combat/Magic Effect (#8868) as ", "appropriate.", "", "Set the .effects to be {\"magic_effects\", \"combat_effects\"} or whatever ", "you've defined.", "", "Now you can use this:add(<doll>) and this:remove(<doll>) to add/remove ", "this object from the correct effects properties on <doll>. Whee."}
object_size#1760{11716, 1141286558}

Ancestry

Ancestors (nearest first): #8868 Generic Casting/Armour/View/Freeze/Combat/Magic Effect#517 Generic LRPG Thing

Children: none

Call graph

calls n1760_0 #1760:effect n1760_1 #1760:schedule n1760_0->n1760_1 n1760_4 #1760:announce_poisoning n1760_0->n1760_4 n1760_2 #1760:instant_effect n1760_0->n1760_2 n8868_0 #8868:add n1760_1->n8868_0 n1760_8 #1760:death_effect n1760_8->n8868_0

Source

effect

Spec this none thisDefiner #1760

Referenced by

none

Source

1"poison:effect(OBJ doll, OBJ source, INT quality, LIST body areas) => Poison the target with whatever the poison does.";
2$local.rpg:secure();
3"We need some sort of dollish hook here.  Like maybe the following?";
4"This might be able to substitute for monster:receive_damage_poison.";
5{doll, source, qual, areas} = args;
6if (typeof(effect = doll:chemical_effects(source, this, qual)) != INT)
7  return;
8endif
9qual = qual - effect;
10"Such a hook should probably be checked in :delayed_effect too.";
11if (this.delayed)
12  this:schedule(doll, source, qual, areas);
13endif
14this:announce_poisoning(doll, source, qual, areas);
15this:instant_effect(doll, source, qual, areas);

schedule

Spec this none thisDefiner #1760

Referenced by

Source

1":schedule(OBJ doll, OBJ source, INT quality, LIST body areas) => Schedule an even with the root poison task.";
2"We're not using doll.schedule, well, because it's icky.";
3{doll, source, qual, areas} = args;
4$local.rpg:secure();
5root = $code_utils:verb_loc();
6root.data = listappend(root.data, {this, doll, source, qual, areas});
7this:add(doll);
8if (!$code_utils:task_valid(root.task))
9  fork t (0)
10    n = length(root.data);
11    while (root.data)
12      current = root.data[1];
13      if ((!is_player(current[3])) || (`idle_seconds(current[3]) ! E_INVARG' != E_INVARG))
14        fork (0)
15          current[1]:delayed_effect(@current[2..$]);
16          current[1]:remove(current[2]);
17        endfork
18        root.data = root.data[2..$];
19      endif
20      n = n - 1;
21      suspend(random(20) + 5);
22      if (n < 1)
23        suspend(200 + random(100));
24        n = length(root.data);
25      endif
26    endwhile
27  endfork
28  root.task = t;
29endif
30"THX (#105941) - Wed Oct 13, 1999 - Changed listappend(this.data to listappend(root.data on line 5";
31"Profane (#30788) - Wed Feb 14, 2001 - disconnected players get poison saved for them when they come back on.";

instant_effect

Spec this none thisDefiner #1760

Referenced by

Source

1":instant_effect(OBJ doll, OBJ source, INT quality, LIST body areas) => What happens when the poison first takes effect.";
2return 0;

delayed_effect

Spec this none thisDefiner #1760

Referenced by

none

Source

1":delayed_effect(OBJ doll, OBJ source, INT quality, LIST body areas) => What happens when they've been poisoned for a while.";
2"This will get called within 5 minutes of the poisoning.  If it wants to continue the effects, it should call :schedule again, presumably with decreased quality (unless the poison is permanent :>).";
3return 0;

announce_poisoning

Spec this none thisDefiner #1760

Referenced by

Source

1":announce_poisoning(OBJ doll, OBJ source, INT quality, LIST body areas) => Hi, we'd like you to know that you've been poisoned.";
2"If the poison was from a weapon, tell the player, mention what part of them feels queasy, etc, etc.";
3return 0;

damage

Spec this none thisDefiner #1760

Referenced by

none

Source

1":damage(OBJ doll, OBJ amount, [STR type]) => doll takes damage from poison.  Like :receive_damage, but no critical hits and no armour or other wackiness.  Damage _is_ modified for size.";
2"We _may_ want to check some dollish hook, so there is some sort of protection possible against poisons.  At least monsters will be covered in their :receive_damage_poison, though.  I'll stick the hook in as soon as I figure out what it should be.";
3"The optional type arg should probably be \"inj\", \"ins\", or \"fat\", though it _could_ be something wacky like pot ;).  Not sure if there's a point to this, because ins and fat don't affect shock rolls anymore, but what the heck.";
4(rpg = $local.rpg):secure();
5{doll, amount, ?type = "inj"} = args;
6who = doll.character;
7amount = amount / doll.size;
8if (amount < 1)
9  ret_val = 0;
10  msgname = "cure_msg";
11else
12  resolve = rpg:resolve(who, "shock", -amount);
13  "We do the resolve _first_, to give shock a chance to improve.";
14  doll:mod_att(type, amount, 0);
15  end = doll.end;
16  "You can announce your own messages from the ret_val = value if you feel like it.";
17  if (((killer = doll:read_misc_note(this.poisoner)) != E_PROPNF) && (resolve < (-(4 * end))))
18    ret_val = -9;
19    msgname = "death_msg";
20  elseif (resolve < (-end))
21    ret_val = -3;
22    msgname = "stun_msg";
23  else
24    ret_val = -2;
25    msgname = "damage_msg";
26  endif
27endif
28if (msg = this:(msgname)(who))
29  if ((type == "inj") && (ret_val != 0))
30    rpg:tell_damage(who, msg);
31  else
32    rpg:playertell(who, msg);
33  endif
34endif
35if (msg = this:("o" + msgname)(who))
36  rpg:rpg_announce_all_but(who.location, {who}, msg);
37endif
38if (ret_val == -9)
39  doll:die(killer, this);
40endif
41return ret_val;
42"Profane (#30788) - Tue Jan  2, 2001 - Move messaging inside this verb to avoid forking off the :die, which was dumb code.";

make_fertile

Spec this none thisDefiner #1760

Referenced by

none

Source

1":make_fertile() -- Temporarily toggles the 'f' bit, allowing GMs (and not builders in general) to create a child of adventure gear.  To be used as follows:";
2";;#equipment:make_fertile();return player:_create(#equipment)";
3"Where '#equipment' is the number of the object you're wanting to create.  The blank object returned will be your child.  Congratulations, Mommy.";
4if ($local.rpg:trusted(caller_perms()))
5  if (!this.f)
6    this.f = 1;
7    fork (0)
8      this.f = 0;
9    endfork
10  endif
11  return this.f;
12endif
13"Quinn 09-JUL-93 0343: Changed :trust call to :trusted(caller_perms()); Updated comment lines;  eliminated check for ownership in first 'if'.  Let it crash if a kid not owned by GM uses the parent; Now returns status of f-bit.";

cancel

Spec this none thisDefiner #1760

Referenced by

none

Source

1":cancel(LIST element in this.data) => remove poisoning task from the queue";
2$local.rpg:secure();
3{elem} = args;
4root = $code_utils:verb_loc();
5if (elem in root.data)
6  root.data = setremove(root.data, elem);
7endif
8return length(root.data);

death_effect

Spec this none thisDefiner #1760

Referenced by

none

Source

1{victim, attacker} = args;
2if (caller.character != victim)
3  return 0;
4endif
5(rpg = $local.rpg):secure();
6for item in (rpg.poison.data)
7  if (item[2] == caller)
8    rpg.poison.data = setremove(rpg.poison.data, item);
9  endif
10endfor
11this:remove(caller);
12return 0;

schedule(old)

Spec this none thisDefiner #1760

Referenced by

none

Source

1":schedule(OBJ doll, OBJ source, INT quality, LIST body areas) => Schedule an even with the root poison task.";
2"We're not using doll.schedule, well, because it's icky.";
3{doll, source, qual, areas} = args;
4$local.rpg:secure();
5root = $code_utils:verb_loc();
6root.data = listappend(this.data, {this, doll, source, qual, areas});
7if (!$code_utils:task_valid(root.task))
8  fork t (0)
9    n = length(root.data);
10    while (root.data)
11      current = root.data[1];
12      fork (0)
13        current[1]:delayed_effect(@current[2..$]);
14      endfork
15      root.data = root.data[2..$];
16      n = n - 1;
17      suspend(random(20) + 5);
18      if (n < 1)
19        suspend(200 + random(100));
20        n = length(root.data);
21      endif
22    endwhile
23  endfork
24  root.task = t;
25endif

death_msg stun_msg damage_msg odeath_msg ostun_msg odamage_msg cure_msg ocure_msg

Spec this none thisDefiner #1760

Referenced by

none

Source

1msg = this.(verb);
2return msg ? $string_utils:pronoun_sub(msg, @args) | "";

damage(old)

Spec this none thisDefiner #1760

Referenced by

none

Source

1":damage(OBJ doll, OBJ amount, [STR type]) => doll takes damage from poison.  Like :receive_damage, but no critical hits and no armour or other wackiness.  Damage _is_ modified for size.";
2"We _may_ want to check some dollish hook, so there is some sort of protection possible against poisons.  At least monsters will be covered in their :receive_damage_poison, though.  I'll stick the hook in as soon as I figure out what it should be.";
3"The optional type arg should probably be \"inj\", \"ins\", or \"fat\", though it _could_ be something wacky like pot ;).  Not sure if there's a point to this, because ins and fat don't affect shock rolls anymore, but what the heck.";
4(rpg = $local.rpg):secure();
5{doll, amount, ?type = "inj"} = args;
6amount = amount / doll.size;
7if (amount < 1)
8  return 0;
9endif
10resolve = rpg:resolve(doll.character, "shock", -amount);
11"We do the resolve _first_, to give shock a chance to improve.";
12doll:mod_att(type, amount, 0);
13end = doll.end;
14"You can announce your own messages from the return value if you feel like it.";
15if (((killer = doll:read_misc_note(this.poisoner)) != E_PROPNF) && (resolve < (-(4 * end))))
16  fork (0)
17    doll:die(killer, this);
18  endfork
19  return -9;
20elseif (resolve < (-end))
21  return -3;
22else
23  return -2;
24endif