Generic Weapon Spell Focus #59933

Parent #82Owner Flags Source rpg_march_2006/Dependencies/59933.txt

Aliases: Generic Weapon Spell Focus, weapon spell focus, spell focus, focus

14 verbs · 28 properties · 2 children

Verbs

VerbSpecFlagsDefinerLines
check_castingthis none this#599333
check_live_targetthis none this#599333
check_object_targetthis none this#5993318
check_multiple_live_targetsthis none this#5993329
casting_msgthis none thisrx#5993332
check_casting_loc*ationthis none this#599330
may_castthis none this#599336
pay_costthis none this#599336
bonusthis none this#599332
sing_spellthis none this#5993311
hidden_verbsthis none this#5993317
spellthis none this#5993376
check_live_target(obsolete)this none this#5993350
eggiethis none this#599333

Properties

PropertyDefinerFlagsOwnerValue
default_cast_msg#59933rc"%N %<waves> %p arms and %<mutters> weird syllables."
db#59933r#328
bonus#59933not readable (E_PERM)
visible_spells#59933not readable (E_PERM)
no_imp#59933not readable (E_PERM)
dodgable#59933not readable (E_PERM)
parryable#59933not readable (E_PERM)
slowness#59933not readable (E_PERM)
parry#59933not readable (E_PERM)
attack#59933not readable (E_PERM)
pen#59933not readable (E_PERM)
dam#59933not readable (E_PERM)
skill#59933not readable (E_PERM)
pierce#599330
max_str_bonus#59933not readable (E_PERM)
can_degrade#59933not readable (E_PERM)
track_usage#59933not readable (E_PERM)
manufactured#59933820783482
worth#59933-1
condition#59933100
use_spell_msg_db#599331
odrop_failed_msg#59933"%<tries> to drop %t but fails!"
odrop_succeeded_msg#59933"%<drops> %t."
otake_succeeded_msg#59933"%<picks> up %t."
key#59933not readable (E_PERM)
aliases#59933{"Generic Weapon Spell Focus", "weapon spell focus", "spell focus", "focus"}
description#59933"A generic instrument of destuction, albiet one crackling with magickal potential."
object_size#59933{19508, 1141286561}

Ancestry

Ancestors (nearest first): #82 generic weapon#517 Generic LRPG Thing

Children: #331 staff, #18754 generic light source

Call graph

calls n59933_3 #59933:check_multiple_live_targets n59933_1 #59933:check_live_target n59933_3->n59933_1 n59933_10 #59933:hidden_verbs n82_39 #82:hidden_verbs n59933_10->n82_39 n59933_11 #59933:spell n59933_8 #59933:bonus n59933_11->n59933_8 n59933_6 #59933:may_cast n59933_11->n59933_6 n59933_4 #59933:casting_msg n59933_11->n59933_4 n59933_9 #59933:sing_spell n59933_11->n59933_9 n59933_7 #59933:pay_cost n59933_11->n59933_7

Source

check_casting

Spec this none thisDefiner #59933

Referenced by

Source

1":check_casting_location([OBJ caster character]) => return true if the caster is an acceptable location to cast spells (i.e. in an RPG-type room.)";
2{?who = player} = args;
3return $local.rpg:is_rpg_room(who.location);

check_live_target

Spec this none thisDefiner #59933

Referenced by

Source

1":check_live_target(OBJ caster character, [OBJ target, OBJ spell, NUM boolean peaceful]) => doll of target || $nothing.  For spells that want one living target.";
2return this.db:(verb)(@args);
3"THX (#105941) - Wed May 10, 2000 - Moved the guts of this verb to $local.rpg.magic_db.";

check_object_target

Spec this none thisDefiner #59933

Referenced by

Source

1":check_object_target(OBJ caster character, [STR target]) => OBJ target. Designed for spells who take an inanimate object as a target.";
2{by, ?tstr = dobjstr, @rest} = args;
3(rpg = $local.rpg):secure();
4stuff = rpg:trusted_verb(where = by.location, "visible") ? where:visible() | where.contents;
5target = $match_utils:match(tstr, stuff);
6if ($command_utils:object_match_failed(target, tstr))
7elseif (!(where in {tloc = target.location, `tloc.location ! ANY => tloc'}))
8  rpg:playertell(player, "You can't affect ", target.name, " from where you are.");
9elseif (((tloc != where) && rpg:trusted_verb(tloc, "visible")) && (!(target in tloc:visible())))
10  rpg:playertell(player, "The ", target:title(), " seems to be protected by its containment.");
11elseif (((!rpg.object_db:is_monster(target)) && (!$object_utils:isa(target, rpg.thing))) && (!((target.owner in rpg.gms) && $object_utils:has_verb(target, "receive_" + callers()[1][2]))))
12  rpg:playertell(player, "My God!  ", target:titlec(), " seems to be immune to Illuminati magick.");
13else
14  return target;
15endif
16return $nothing;
17"Profane 22-DEC-95 2014EST -- Added.";
18"THX 20-MAR-1997 -- Added a hook to let gms hide equipment in containers and cleaned up a bit.";

check_multiple_live_targets

Spec this none thisDefiner #59933

Referenced by

Source

1":check_multiple_live_targets(OBJ caster character, [STR target]) => LIST of dolls. For spells that want to affect more than one living character at once.";
2if ((rpg = $local.rpg):trusted(caller_perms()))
3  {by, ?tstr = dobjstr, ?spell = $nothing, ?peaceful = 0} = args;
4  words = setremove($list_utils:remove_duplicates($string_utils:words(tstr)), "and");
5  targets = {};
6  if ((!words) || (words == {"all"}))
7    targs = setremove(rpg:find_chars(by.location)[1], by);
8    targs = setremove(targs, rpg:get_doll(by).mounted);
9    for dude in (targs)
10      if (valid(arf = this:check_live_target(by, dude)))
11        targets = setadd(targets, arf);
12      endif
13    endfor
14  else
15    for try_ in (words)
16      try_ = (try_[length(try_)] == ",") ? try_[1..length(try_) - 1] | try_;
17      who = this:check_live_target(by, try_, spell, peaceful);
18      targets = valid(who) ? setadd(targets, who) | targets;
19    endfor
20  endif
21  if (!targets)
22    rpg:playertell(by, "Erm, you've managed to pick no living targets.");
23  endif
24  return targets;
25else
26  return E_PERM;
27endif
28"Profane 22-DEC-95 2022EST -- Added";
29"Profane (#30788) - Wed Jan 10, 2001 - `all' does not include your mount.";

casting_msg

Spec this none thisFlags rxDefiner #59933

Referenced by

Source

1":casting_msg(OBJ caster character, OBJ spell || STR property name, OBJ target) => STR message for casting spell.";
2"Targets can be characters, LRPG objects, or lists of characters. We check to see if we've been passed a character's doll, and convert target to the character in that case, otherwise leave it alone.  Lists will get converted to title_list's down below";
3{by, spell, target} = args;
4target = (typeof(target) != LIST) ? valid(`target.character ! E_PROPNF, E_INVIND') ? target.character | target | target;
5spell = (typeof(spell) == OBJ) ? spell.aliases[1] | spell;
6if ($local.rpg:is_monster(by))
7  if (by in {target, target.character})
8    mesgs = ((((by.(spell + "_cast_self_msg") || by.(spell + "_cast_msg")) || by.default_self_cast_msg) || by.default_cast_msg) || this.default_self_cast_msg) || this.default_cast_msg;
9  else
10    mesgs = (by.(spell + "_cast_msg") || by.default_cast_msg) || this.default_cast_msg;
11  endif
12else
13  if (by in {target, target.character})
14    mesgs = ((this.(spell + "_cast_self_msg") || this.(spell + "_cast_msg")) || this.default_self_cast_msg) || this.default_cast_msg;
15  else
16    mesgs = this.(spell + "_cast_msg") || this.default_cast_msg;
17  endif
18endif
19msg = (typeof(mesgs) == LIST) ? $list_utils:random_element(mesgs) | mesgs;
20msg = strsub(msg, "%[focus]", this.name);
21if (typeof(target) != LIST)
22  names = target.name;
23else
24  dudes = `$list_utils:map_prop(target, "character") ! E_TYPE, E_PROPNF => target';
25  names = $string_utils:title_list(dudes);
26endif
27msg = strsub(msg, "%[target]", names);
28return msg;
29"Profane 22-DEC-95 2026EST -- Added";
30"StarDancer 24-DEC-95 -- removed call to pronoun_sub, 'cause it's in :say_action already.";
31"StarDancer 24-DEC-95 -- added code ta 'low for lists a strings inna `_msg' prop.";
32"StarDancer 31-JUL-96 -- replaced call to $string_utils:substitute with strsub, and set dobj = target in :spell";

check_casting_loc*ation

Spec this none thisDefiner #59933

Referenced by

none

Source

No program (verb defined but unprogrammed).

may_cast

Spec this none thisDefiner #59933

Referenced by

Source

1":may_cast(doll, spell) => Allowed to cast the spell.";
2{doll, spell} = args;
3if (this in `doll.character.gaglist ! E_PROPNF, E_PERM => {}')
4  return 0;
5endif
6return 1;

pay_cost

Spec this none thisDefiner #59933

Referenced by

Source

1":pay_cost(doll, spell, skillobj, costdiv) => Pay the cost of casting a spell.  Separated from :spell to shrink the thing down a bit, and so we don have to maintain so many copies of :spell. -- Irin";
2{doll, spell, skill, cost} = args;
3if (caller == this)
4  doll:check_ins(skill.sane / cost);
5  "args[1]:check_ins(args[3].sane / args[4]);";
6endif

bonus

Spec this none thisDefiner #59933

Referenced by

Source

1":bonus(by, target, spell) => bonus of this foci on casting.";
2return this.(verb);

sing_spell

Spec this none thisDefiner #59933

Referenced by

Source

1{by, spell, target} = args;
2songs = `this.(spell + "_lyrics") ! ANY => 0';
3if (songs && (song = songs[random($)]))
4  {rpg, loc} = {$local.rpg, by.location};
5  for dude in (loc)
6    if (is_player(dude) && rpg.options:get(`rpg:get_doll(dude).rpg_options ! E_INVIND', "lyrics"))
7      rpg:playertell_lines(dude, song);
8    endif
9  endfor
10endif
11"Mooshie (#106469) - Fri Dec 12, 1997 - Let caster see lyrics.";

hidden_verbs

Spec this none thisDefiner #59933

Referenced by

Source

1{who} = args;
2if (!valid(doll = (rpg = $local.rpg):get_doll(who)))
3  doll = rpg.doll;
4endif
5prev = pass(@args);
6for spell in (this.visible_spells)
7  try
8    {spellname, skillname, objdef} = spell;
9    `arglist = verb_args(objdef, spellname) ! ANY => {}';
10    if ((arglist != {}) && (!doll.(skillname)))
11      prev = {@prev, {objdef, spellname, verb_args(objdef, spellname)}};
12    endif
13  except v (ANY)
14    "Ignore 'em";
15  endtry
16endfor
17return prev;

spell

Spec this none thisDefiner #59933

Referenced by

Source

1":spell(OBJ caster character, OBJ|LIST target, OBJ spell, [NUM qual modifier, NUM (true|false) peaceful, OBJ skill object]";
2"+ [ANY extra arguments to pass to spell verb on #328]) -- call spell on magic database if all is well.";
3(rpg = $local.rpg):secure();
4{by, target, spell, ?mod = 0, ?peaceful = 0, ?skillobj = spell, @extra_args} = args;
5target = valid(x = rpg:get_doll(target)) ? x | target;
6if (typeof(spell) == OBJ)
7  spell = spell.aliases[1];
8elseif (typeof(skillobj) != OBJ)
9  skillobj = rpg:match_skill(skillobj);
10  if (!valid(skillobj))
11    raise(E_INVARG, "Spell focus was passed incorrect spell object: " + tostr(`args[6] ! E_RANGE => spell'));
12  endif
13endif
14loc = by.location;
15doll = rpg:get_doll(by);
16peaceful = peaceful ? peaceful | rpg.magic_db:is_peaceful_spell(doll, target, spell);
17self_cast = (`loc.peaceful ! ANY' || (doll == target)) && ((spell in rpg.magic_db.self_cast_difficult) ? random(3) - 1 | (!(spell in rpg.magic_db.self_cast_allowed)));
18mod = mod + this:bonus(by, target, spell);
19if (!this:may_cast(doll, spell))
20  return;
21endif
22rpg:playertell(by, "You try to cast ", (spell in skillobj.aliases) ? skillobj:title() | $string_utils:capitalize(spell), ".");
23(dobj == $failed_match) && (dobj = `target.character ! ANY => $nothing');
24rpg:say_action(`caller:casting_msg(by, spell, target) ! ANY => this:casting_msg(by, spell, target)', by);
25if ((!peaceful) && is_player(by))
26  rpg.magic_db.sc_recovery_effect:add(doll);
27  doll:write_misc_note("spell recover", time() + ((2 * skillobj.slow) / 5));
28endif
29qual = 0;
30if (rpg:trusted_verb(loc, "magic_effect"))
31  if (typeof(effect = `loc:magic_effects(doll, qual, skillobj, target) ! E_VERBNF, E_PERM => loc:magic_effect(doll, qual, skillobj, target)') != NUM)
32    return effect;
33  endif
34  qual = qual - effect;
35endif
36qual = qual + skillobj:resolve(by, (mod - skillobj.diff) - ((length(doll.aggressor) - 1) * 15), self_cast || `caller.no_imp ! ANY => this.no_imp');
37this:sing_spell(by, spell, target);
38if (typeof(effect = doll:casting_effects(doll, target, qual, skillobj)) != NUM)
39  return effect;
40elseif ((qual = qual - effect) <= 0)
41  rpg:rpg_announce_all(loc, "Nothing happens.");
42  if (qual < -50)
43    rpg:playertell(by, "Disturbed demons buffet your mind.  You feel like your soul is being put through the wringer.");
44    this:pay_cost(doll, spell, skillobj, 1);
45  else
46    this:pay_cost(doll, spell, skillobj, 3);
47  endif
48else
49  this.db:(spell)(doll, target, qual, skillobj, @extra_args);
50  this:pay_cost(doll, spell, skillobj, 1);
51endif
52if (!peaceful)
53  "Target/targets become aggressors.  Then they get a chance to nail caster.  No more hail freebies.";
54  targets = (typeof(target) == LIST) ? target | {target};
55  for t in (targets)
56    if ((parent(t) == rpg.doll) && (t != doll))
57      if (is_player(char = t.character))
58        add = t in rpg.pcs;
59      else
60        char:set_last_attacker(by);
61        add = char.alive;
62      endif
63      if (add)
64        (t in doll.aggressor) || doll:first_blood(by, char);
65        t.aggressor = setadd(t.aggressor, by);
66        doll.aggressor = setadd(doll.aggressor, char);
67      endif
68    endif
69  endfor
70  (by.location == loc) && (`loc.peaceful ! ANY' || doll:invite(skillobj.slow));
71endif
72"Profane (#30788) - Sat Aug  1, 1998 - Add bit for self_cast -- casting spells on yourself == no improvement of skills";
73"Profane (#30788) - Mon Aug 24, 1998 - No skill improve for casting in `peaceful' rooms.";
74"Mooshie (#106469) - Wed Feb 10, 1999 - I moved the location's :magic_effect check before the :resolve. This way rooms that disallow spells won't let people macro away casting spells in them.";
75"THX (#105941) - Mon Jun 26, 2000 - Check that by.location == loc before even thinking about calling doll:invite().";
76"THX (#105941) - Sat Apr 14, 2001 - Put an explicit check into the loop that adds targets into the aggressors property after the spell runs.  If the thing has died, we really don't want to add it to aggressors or it'll screw up first_blood stuff.";

check_live_target(obsolete)

Spec this none thisDefiner #59933

Referenced by

none

Source

1":check_live_target(OBJ caster character, [OBJ target, OBJ spell, NUM boolean peaceful]) => doll of target || $nothing. For spells that want one living target.";
2{by, ?tstr = dobjstr, ?spell = $nothing, ?peaceful = 0} = args;
3(rpg = $local.rpg):secure();
4"by = args[1];";
5"tstr = (length(args) > 1) ? tostr(args[2]) | dobjstr;";
6"peaceful = (length(args) > 3) ? args[4] | 0;";
7tstr = tostr(tstr);
8target = valid(x = by:my_match_object(tstr)) ? x | dobj;
9{loc, mdb, odb} = {by.location, rpg.magic_db, rpg.object_db};
10no_target = ((!valid(target)) || (target.location != loc)) && (target != loc);
11if (no_target && (spell in mdb.range_spells))
12  exits = loc:exits();
13  what = {};
14  for x in (exits)
15    while (`valid(x.succ_exit) ! ANY')
16      x = x.succ_exit;
17    endwhile
18    if (odb:is_missile_exit(x))
19      what = {@what, @x.dest.contents};
20    endif
21  endfor
22  target = $match_utils:match(tstr, what);
23  if (target in what)
24    no_target = 0;
25  endif
26elseif (no_target && valid(`target = loc:match_for_spell(by, tstr, spell, peaceful) ! ANY => $nothing'))
27  (loc.owner in rpg.gms) && (no_target = 0);
28endif
29caster = rpg:get_doll(by);
30doll = rpg:get_doll(target);
31peaceful = peaceful ? peaceful | mdb:is_peaceful_spell(caster, doll, spell);
32if (no_target)
33  rpg:playertell(by, "I don't see any `", tstr, "' here.");
34elseif (!valid(doll))
35  verbname = "receive_" + spell.aliases[1];
36  (`rpg:trusted_verb(target, verbname) ! E_INVIND => 0' && target:(verbname)(dobj, spell)) || rpg:playertell(by, "My God! ", target.name, " seems to be immune to Illuminati magic.");
37elseif (((!peaceful) && is_player(target)) && ((!$object_utils:connected(target)) || ((idle_seconds(target) > rpg.idle_threshold) && ((time() - doll.last_attack) > rpg.idle_threshold))))
38  rpg:playertell(by, "Hold your magic!  By the edict of the great wizard, bystanders must not be molested.");
39elseif (((((!peaceful) && is_player(target)) && (target != player)) && (!(target in caster.aggressor))) && rpg.rpg_options:get(caster.rpg_options, "peacenik"))
40  rpg:playertell(by, "Whoa!  You don't really want to commit violence upon your fellow human beings, do you?  Even if it is ", target:title(), ".  After all, love is the most powerful weapon.  Play nice, now.");
41else
42  return doll;
43endif
44return $nothing;
45"Profane 22-DEC-95 2008EST -- Added.";
46"THX (#105941) - Sun May 31, 1998 - Scatter assignment.  Checking for custom receive_\"spell\" on !alive targets too.";
47"Profane (#30788) - Mon Jul  6, 1998 - uncommented the bit about setting tstr- a plain scatter dun hack it. Also error trap receive_* call";
48"Profane (#30788) - Wed Apr 21, 1999 - check new peacenik option";
49"THX (#105941) - Mon Jan  3, 2000 - Commented the tstr length(args) stuff and replaced with a tostr().  Put in  some stuff to check peaceful for the peacenik stuff.";
50"THX (#105941) - Tue Mar  7, 2000 - Added a check for \"range_spells\" ... maybe we can make some spells work through missile-transmitting exits.";

eggie

Spec this none thisDefiner #59933

Referenced by

none

Source

1if (this == #14197)
2  this:set_aliases({"rotten egg", "egg"});
3endif