"A dump of #328 on Sun Dec 17 13:47:50 1995 PST @create #517 named Magic Database:Magic Database,Database @prop #328."wallers" {} r @prop #328."storms" {} r ;;#328.("storms") = {{1924090216, #104762, 19, 27, 10}} @prop #328."silent_storms" {} r @prop #328."fw_combat_effect" #31690 r "#328.("condition") => E_NONE (No error) ;;#328.("odrop_failed_msg") = "% to drop %t but fails!" ;;#328.("odrop_succeeded_msg") = "% %t." ;;#328.("otake_succeeded_msg") = "% up %t." ;;#328.("key") = 0 ;;#328.("aliases") = {"Magic Database", "Database"} ;;#328.("description") = "A tangible object for use in the LambdaMOO RPG." ;;#328.("object_size") = {26915, 819192237} @verb #328:"firebolt" this none this @program #328:firebolt ":firebolt(caste-doll, target-doll, quality)"; db = $local.rpg; if (!db:trust()) return; endif att = args[1]; doll = args[2]; qual = args[3]; by = att.character; target = doll.character; area = target.location; skilldb = db.skills; dodge = skilldb.dodge; firebolt = skilldb.firebolt; if (valid(att)) att:do_attack_notification(target, firebolt); endif doll.aggressor = setadd(doll.aggressor, by); att.aggressor = setadd(att.aggressor, doll.character); if (typeof(effect = doll:magic_effects(@args)) != NUM) return effect; elseif ((qual = qual - effect) <= 0) area:announce_all(target.name, " seems unaffected by the spell."); elseif (((doll != att) && (doll.magic > 0)) && (firebolt:resolve(target, -qual) > 0)) area:announce_all(target.name, " deflects the spell with an occult gesture."); elseif ((doll != att) && (dodge:resolve(target, 30 - doll.slowness) > qual)) area:announce_all(target.name, " jumps nimbly to one side as a bolt of fire passes ", target.po, "."); else area:announce_all("A bolt of fire strikes ", target.name, ", enveloping ", target.po, " in flame."); doll:receive_damage(100 + (4 * qual), 15, "The bolt burns itself out without penetrating your armour.", ("The bolt fails to penetrate " + target.name) + "'s armour.", "You feel a searing pain.", target.name + " is lightly toasted by the bolt.", "You black out briefly as the bolt strikes you.", target.name + " is stunned by the firebolt.", ("You are incinerated by " + by.name) + "'s firebolt.", ("The bolt of fire incinerates " + target.name) + ".", by, firebolt); endif "Profane 2/5/95 13:02EST - Hacked so mages don't resist their own firebolt spells."; "Profane 2/6/95 21:28EST - Changed call to doll:magic_effect to new :magic_effects verb."; . @verb #328:"slow" this none this @program #328:slow ":slow(caster-doll, target-doll, quality)"; if (!$local.rpg:trust()) return E_PERM; endif att = args[1]; doll = args[2]; qual = args[3]; by = att.character; target = doll.character; area = target.location; slow = $local.rpg.skills.slow; if (valid(att)) att:do_attack_notification(target, slow); endif doll.aggressor = setadd(doll.aggressor, by); att.aggressor = setadd(att.aggressor, doll.character); if (typeof(effect = doll:magic_effects(@args)) != NUM) return effect; elseif ((qual = qual - effect) <= 0) area:announce_all(target.name, " seems unaffected by the spell."); elseif (((doll != att) && (doll.magic > 0)) && (slow:resolve(target, -qual) > 0)) area:announce_all(target.name, " deflects the spell with an occult gesture."); else area:announce_all(target.name, " seems to slow down suddenly, as though ", target.ps, " was wading through molasses."); s = doll.slowness; s = max(s + 10, s * 2); s0 = $object_utils:isa(target, $local.rpg.monster) ? target.islowness | 10; doll.slowness = s; for event in (doll.schedule) if (event[2] == "unslow") return event[3] = ((event[3] + (qual * 5)) + 30) + random(30); endif endfor doll:schedule(this, "unslow", ((time() + (qual * 10)) + 60) + random(60), {s0}); endif "Quinn 12-OCT-93 0348: Cleaned up the code; Hacked to use new absolute time with schedule; Re-slows increment half as much as new ones."; "Profane 2/5/95 13:02EST - Hacked so mages don't resist their own slow spells."; "Profane 2/6/95 21:34EST - Changed call to doll:magic_effect to new :magic_effects verb."; . @verb #328:"unslow" this none this @program #328:unslow if ($local.rpg:trusted(caller_perms())) s0 = args[2]; doll = args[1]; target = doll.character; doll:set_att("slowness", s0); target.location:announce_all(target.name, "'s speed picks up suddenly."); else return E_PERM; endif . @verb #328:"heal" none none none rxd @program #328:heal if (!$local.rpg:trusted(caller_perms())) return E_PERM; endif doll = args[2]; qual = args[3]; target = doll.character; if ((magic_eff = doll:magic_effect(@args)) <= 0) return E_NONE; else qual = qual + magic_eff; endif amount = ((350 + (15 * qual)) + 25) / (50 + qual); inj = doll.inj; if (inj > amount) doll.inj = inj - amount; target.location:announce_all("Some of ", target.name, "'s injuries are healed."); else doll.inj = 0; target.location:announce_all(target.name, "'s injuries are healed."); endif "DR 02-AUG-94 -- Changed security, added magic_effect code."; . @verb #328:"blastfork" this none this @program #328:blastfork ":blastfork(caster, strikes, quality[, interval])"; doll = $local.rpg:get_doll(by = args[1]); if ((!$local.rpg:trusted(caller_perms())) || (!valid(doll))) return; endif this = $code_utils:verb_loc(); strikes = args[2]; qual = args[3]; time = max(args[4], 10); this.storms = listappend(this.storms, info = {task_id(), @args}); for i in [1..strikes] suspend(max(time, 10)); if ((info in this.storms) && ((!is_player(args[1])) || (args[1] in connected_players()))) this:blast(by, by.location, qual); else if (!(info in this.silent_storms)) this:endblast(by); else this.silent_storms = setremove(this.silent_storms, info); endif return 0; endif endfor this:endblast(by); this.storms = setremove(this.storms, info); "DR 25-MAR-94 -- Hacked so that if the storm was killed with the 'silent' optional second argument to kill_storm, it will not call :endblast on exiting...it assumes that whatever killed it handled the message."; "DR 02-APR-94 -- Added a check to make sure the player is still connected before dispensing another jolt :) ... in response to a report from Miles that people were casting storms then disconnecting to avoid being hit by the monsters they were killing!"; "Miles 5/22/94 added $code_utils:verb_loc() as suggested by Isagi so players can't cast additional storms using staffs from kids of .magic_db"; . @verb #328:"blast" this none this @program #328:blast if ($local.rpg:trust()) att = $local.rpg:get_doll(args[1]); area = args[2]; qual = args[3]; by = att.character; for targ in (enemies = att:get_att("aggressor")) if ((($recycler:valid($local.rpg:get_doll(targ)) && ((targ in connected_players()) || $object_utils:isa(targ, #259))) && (targ.location == area)) && (targ != by)) this:zap(by, targ, qual, area); else att:set_att("aggressor", setremove(enemies, targ)); endif endfor if ((!att:get_att("aggressor")) && (random(4) == 4)) area:announce("The storm over ", by.name, "'s head gives a grumble of thunder."); else att:invite((att:get_att("slowness") / 2) + 1, {2}); endif endif . @verb #328:"zap" this none this @program #328:zap db = $local.rpg; if (db:trust()) by = args[1]; targ = args[2]; qual = args[3]; area = args[4]; skilldb = db.skills; storm = skilldb.storm; dodge = skilldb.dodge; if (db:trust() && $recycler:valid(doll = db:get_doll(targ))) if (db:trusted_verb(area, "weather_effect")) if (typeof(weffect = area:weather_effect(@args)) != NUM) return weffect; else qual = qual - weffect; endif endif if (valid(bydoll = $local.rpg:get_doll(by))) bydoll:do_attack_notification(targ, storm); endif doll:set_att("aggressor", setadd(doll:get_att("aggressor"), by)); if (typeof(effect = doll:magic_effects(db:get_doll(by), doll, qual, storm)) != NUM) return effect; elseif (effect && ((qual = qual - effect) <= 0)) elseif ((qual = qual - effect) <= 0) area:announce_all("A lightning bolt lashes out from ", by.name, "'s storm, but ", targ.name, " seems unaffected."); elseif (((magic = doll:get_att("magic")) > 0) && (storm:resolve(db:get_doll (targ), -qual) > 0)) area:announce_all(targ.name, " deflects a lightning bolt with an occult gesture."); elseif (dodge:resolve(targ, -qual) > 0) area:announce_all(targ.name, " leaps aside as a lightning bolt strikes the ground beside ", targ.po, "."); else area:announce_all("A lightning bolt lashes out from ", by.name, "'s storm, impacting into ", targ.name, "."); doll:receive_damage(4 * max((((3 * qual) / 2) - random(qual + 10)) + magic, 1), 3, "The bolt fails to do any significant damage.", ("The bolt only gives " + targ.name) + " a slight jolt.", "You are given a powerful shock.", ("The bolt shocks " + targ.name) + ".", "You are blasted and sent reeling.", targ.name + " is blasted and stunned by the bolt.", ("You are electrocuted by a lightning stroke from " + by.name) + "'s storm.", ("The lightning stroke electrocutes " + targ.name) + ".", by, storm); endif endif endif "Miles 5/23/94 added a call to weather_effect suggested by Taskmaster"; "Profane 2/6/95 21:39EST - Subtracted any returned numeric weather_effect from quality of storm. Changed call to doll:magic_effect to new :magic_effects verb."; . @verb #328:"storm" this none this @program #328:storm ":storm(caster-doll, dummy-arg, quality)"; if (!$local.rpg:trusted(caller_perms())) return E_PERM; endif by = args[1].character; "quinn 19-NOV-93 0839: More storms, less quality."; qual = args[3] - (length(this:storms_cast_by(by)) * (25 + random(25))); duration = ((qual * 5) + 30) + random(20); origstrikes = duration / 10; firstrike = 0; area = by.location; if (qual > 50) by:tell(("You conjure up a raging electrical storm in " + area.name) + "."); area:announce_all_but({by}, ((by.name + " has conjured a rampant electrical storm that rages over ") + by.pp) + " head."); strikes = origstrikes + 2; firstrike = 1; elseif (qual > 15) by:tell(("You summon a thunderstorm in " + area.name) + "."); area:announce_all_but({by}, ((by.name + " has summoned a miniature thunderstorm that roars above ") + by.po) + "."); strikes = origstrikes + 1; elseif (qual > 0) by:tell(("You call up a minor storm in " + area.name) + "."); area:announce_all_but({by}, ((by.name + " has called up a minor storm that grumbles over ") + by.po) + "."); strikes = origstrikes; else return by:room_announce_all("Nothing happens."); endif if (firstrike == 1) strikes = strikes - 1; this:blast(by, area, qual); endif this:blastfork(by, strikes, qual, 10); "6/1/95 Slither -- changed the announce_all's to announce_all_but's as Quisinart suggested."; . @verb #328:"endblast" this none this @program #328:endblast ":endblast(by) => Simply prints messages signalling the end of a storm spell."; by = args[1]; by:tell(("The storm over your head slowly dissipates, leaving " + by.location.name) + " calm once again."); by.location:announce(((("The thunderstorm over " + by.name) + "'s head dissipates, leaving ") + by.location.name) + " calm once again."); where = $code_utils:verb_loc(); for info in (where.silent_storms) if (!$code_utils:task_valid(info[1])) where.silent_storms = setremove(where.silent_storms, info); endif endfor . @verb #328:"storms_cast_by" this none this @program #328:storms_cast_by ":storms_cast_by(who) => a list of lists of info on storms cast by `who'."; " Each list is in the format {task_id, caster, strikes, qual, interval}"; if (!$local.rpg:trusted(caller_perms())) return E_PERM; endif this = $code_utils:verb_loc(); who = args[1]; storms = {}; for storm in (this.storms) if (!$code_utils:task_valid(storm[1])) this.storms = setremove(this.storms, storm); elseif (storm[2] == who) storms = {@storms, storm}; endif endfor return storms; "DR 18-MAR-94: Added security, callable only by trusted folks."; "Miles 5/22/94 added $code_utils:verb_loc() as suggested by Isagi so that players can't cast additional storms using staffs from kids of .magic_db"; . @verb #328:"kill_storm" this none this rx @program #328:kill_storm ":kill_storm(caster|task_id [, \"silent\"]) => Either cancel all storms cast by `player', or a specific storm specified by task_id (given by this:storms_cast_by). If the\"silent\" parameter is called, the forked task associated with the storm will not cause a message showing the storm's dissipation to be displayed."; this = $code_utils:verb_loc(); if (!$local.rpg:trusted(caller_perms())) return E_PERM; elseif (typeof(p = args[1]) == OBJ) stormcount = 0; for storm in (this:storms_cast_by(p)) this.storms = setremove(this.storms, storm); stormcount = stormcount + 1; if (length(args) > 1) this.silent_storms = setadd(this.silent_storms, storm); endif endfor return stormcount; elseif (typeof(p) != NUM) return E_INVARG; elseif (i = $list_utils:assoc(p, this.storms)) this.storms = setremove(this.storms, i); if (length(args) > 1) this.silent_storms = setadd(this.silent_storms, i); endif return 1; else return E_NONE; endif "DR 25-MAR-94 -- Hacked to add the kludge that allows a storm to be silently dissipated, in order for Frobno's magic storm-sweeping amulet and other such things to control how it looks when the storm goes away."; "Miles 5/22/94 added $code_utils:verb_loc() as suggested by Isagi so that players can't cast additional storms by using staffs from kids of .magic_db"; . @verb #328:"storms_active_in" this none this @program #328:storms_active_in ":storms_active_in(room) => a list of lists of info on storms raging in the given location."; " Each list is in the format {task_id, caster, strikes, qual, interval}"; if (!$local.rpg:trusted(caller_perms())) return E_PERM; endif where = args[1]; this = $code_utils:verb_loc(); people = where:contents(); storms = {}; for storm in (this.storms) if (!$code_utils:task_valid(storm[1])) this.storms = setremove(this.storms, storm); elseif (storm[2] in people) storms = {@storms, storm}; endif endfor return storms; "Miles 5/22/94 added $code_utils:verb_loc() as suggested by Isagi so that players can't cast additional storms using staffs from kids of .magic_db"; . @verb #328:"teleport" this none this rx @program #328:teleport ":teleport(doll, where)"; "An RPG-teleportation, without exit penalties."; if (!$local.rpg:trusted(caller_perms())) return E_PERM; endif who = (doll = args[1]).character; where = args[2]; old = who.location; if (!where:accept(who)) old:announce_all_but({who}, tostr(who:title(), " yowls! as ", who.pp, " body flickers for a moment, then snaps back into corporeality.")); endif who:tell("The image of ", where:title(), " gains resolution in your mind. Space warps around your body and suddenly..."); old:bless_exit(who); who:moveto(where); if (who.location == old) old:announce_all(tostr(who:title(), " flashes out of existence for a brief moment. The air crackles around ", who.pp, " body.")); endif old:announce_all(tostr(who:title(), " flashes out of existence, leaving only an electric tinge of magick.")); where:announce_all_but({who}, tostr(who:title(), " flashes into existence, clutching ", who.pp, " ", doll.wielding[1]:title() || {"chest", "groin", "face"}[random(3)], " with desperate anxiety.")); . @verb #328:"recall" this none this rx @program #328:recall "Teleport the caster into eir home."; if (!$local.rpg:trusted(caller_perms())) return E_PERM; endif who = (doll = args[2]).character; if ((typeof(home = who.home) != OBJ) || (who.location == home)) who:room_announce_all("Nothing happens."); return E_NONE; elseif ((!$perm_utils:controls(who, home)) && (!(who in home.residents))) who:tell("Nothing happens. Your link with that location just isn't strong enough."); who:room_announce_all_but({who}, "Nothing happens."); return E_PERM; endif return this:teleport(doll, home); . @verb #328:"unwall(old)" this none this @program #328:unwall(old) ":unwall(who-doll, caster, wall)"; "Remove a conjured wall of force."; if (!$local.rpg:trusted(caller_perms())) return E_PERM; endif who = (doll = args[1]).character; wall = args[3]; if (!(wall in doll.wielding)) return E_NONE; endif this.wallers = setremove(this.wallers, caster = args[2]); who:room_announce_all("The wall of frosted haze around ", who:title(), " drops and a magical hum is silenced."); doll.wielding = setremove(doll.wielding, wall); wall:moveto($nothing); $local.rpg.grabber:destroy(wall); . @verb #328:"forcewall(old)" this none this @program #328:forcewall(old) "Conjure up a wall of force."; if (!$local.rpg:trusted(caller_perms())) return E_PERM; endif who = (doll = args[2]).character; adjusted_qual = (args[3] / 10) || 1; index = 0; for i in [1..length(s = doll.schedule)] index = index || (s[i][2] == "unwall"); endfor if (index) who:room_announce_all("The frosted haze around ", who:title(), " goes opaque for an instant, then fades back into milky translucence."); doll.schedule[index][3] = doll.schedule[index][3] + ((60 * adjusted_qual) * 100); else wall = $local.rpg.grabber:grab("wall of force"); doll.wielding = {@doll.wielding, wall}; this.wallers = {@this.wallers, caster = args[1].character}; who:room_announce_all("A hum of magic rises around ", who:title(), " surrounding ", who.po, " with a frosted haze of force."); doll:schedule(this, "unwall", time() + (300 * adjusted_qual), {caster, wall}); endif . @verb #328:"slow(old)" this none this @program #328:slow(old) if ($local.rpg:trust()) att = args[1]; doll = args[2]; qual = args[3]; by = att.character; target = doll.character; area = target.location; if (valid(att)) att:do_attack_notification(target, #6564); endif doll.aggressor = setadd(doll.aggressor, by); att.aggressor = setadd(att.aggressor, doll.character); if ((qual = doll:magic_effect(@args)) <= 0) elseif ((doll.magic > 0) && (#6564:resolve(target, -qual) > 0)) area:announce_all(target.name, " deflects the spell with an occult gesture."); else area:announce_all(target.name, " seems to slow down suddenly, as though ", target.ps, " was wading through molasses."); s = doll.slowness; s = max(s + 10, s * 2); if ($object_utils:isa(target, #259)) s0 = target.islowness; else s0 = 10; endif doll.slowness = s; if (doll.schedule) for thing in (doll.schedule) if (thing[2] == "unslow") thing[3] = ((thing[3] + (qual * 50)) + 1000) + random(1000); return; endif endfor endif doll:schedule(this, "unslow", ((time() + (qual * 50)) + 1000) + random(1000), {s0}); endif endif . @verb #328:"print_storms" this none this @program #328:print_storms "print_storms(no args | OBJ)"; "returns {} or a list of strings formatted for player:tell_lines()"; "If argument is given and is a room, print info for that room, if it is not a room, print storms cast by that object. If no argument, do all storms globally"; if (!$local.rpg:trust()) return E_PERM; endif db = $local.rpg.magic_db; if ((!args) || (typeof(args[1]) != OBJ)) storms = db.storms; elseif ($object_utils:isa(args[1], $room)) storms = db:storms_active_in(args[1]); else storms = db:storms_cast_by(args[1]); endif if (!storms) return {}; endif biglist = stormlist = {}; for i in [1..length(storms)] who = storms[i][2]; qual = storms[i][4]; if (ind = $list_utils:iassoc(who, stormlist)) if (qual > 50) stormlist[ind][2] = stormlist[ind][2] + 1; elseif (qual > 15) stormlist[ind][3] = stormlist[ind][3] + 1; else stormlist[ind][4] = stormlist[ind][4] + 1; endif else raging = thunder = minor = 0; if (qual > 50) raging = 1; elseif (qual > 15) thunder = 1; else minor = 1; endif stormlist = {@stormlist, {who, raging, thunder, minor}}; endif endfor for j in [1..length(stormlist)] plyr = stormlist[j][1]; text = {}; r = stormlist[j][2]; t = stormlist[j][3]; m = stormlist[j][4]; if (r == 1) text = {@text, "a raging electrical storm"}; elseif (r > 1) text = {@text, tostr(r) + " raging electrical storms"}; endif if (t == 1) text = {@text, "a thunderstorm"}; elseif (t > 1) text = {@text, tostr(t) + " thunderstorms"}; endif if (m == 1) text = {@text, "a minor storm"}; elseif (m > 1) text = {@text, tostr(m) + " minor storms"}; endif biglist = {@biglist, tostr(plyr.name, " has up ", $string_utils:english_list( text), ".")}; endfor return biglist; "Profane 17-DEC-95 1211EST -- (re)modified to do storms_cast_by as well."; . @verb #328:"forcewall" this none this @program #328:forcewall "Conjure up a wall of force."; RPG = $local.RPG; if (!RPG:trusted(caller_perms())) return E_PERM; endif mage_doll = args[1]; doll = args[2]; char = doll.character; qual = min(args[3], 30); doll.combat_effects = setadd(doll.combat_effects, this.fw_combat_effect); doll:write_misc_note("force_wall", {mage_doll, qual}); if (i = $list_utils:iassoc("unwall", doll.schedule, 2)) $you:say_action("The frosted haze around %n goes opaque for an instant, then fades back into milky translucence.", char); doll.schedule[i][3] = doll.schedule[i][3] + (60 * qual); else $you:say_action("A hum of magic rises around %n, surrounding %o with a frosted haze of force.", char); doll:schedule(this, "unwall", time() + (60 * qual), {mage_doll}); endif . @verb #328:"unwall" this none this @program #328:unwall ":unwall(who_doll, caster_doll)"; "Remove a conjured wall of force."; RPG = $local.RPG; if (!RPG:trusted(caller_perms())) return E_PERM; endif doll = args[1]; char = doll.character; doll.combat_effects = setremove(doll.combat_effects, this.fw_combat_effect); doll:erase_misc_note("force_wall"); if (i = $list_utils:iassoc("unwall", doll.schedule, 2)) doll.schedule = listdelete(doll.schedule, i); endif $you:say_action("The wall of frosted haze around %n drops and a magical hum is silenced.", char); if (valid(mage_doll = args[2]) && (parent(mage_doll) == RPG.doll)) mage_doll.character:tell(("You feel a burden of sustained magic lifted from your mind as the force wall around " + char.name) + " drops."); endif . "***finished***