nightmare3_fluffos_v2/
nightmare3_fluffos_v2/bin/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/ChangeLog.old/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/Win32/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/compat/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/compat/simuls/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/include/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/clone/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/command/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/data/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/etc/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/include/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/inherit/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/inherit/master/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/log/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/single/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/single/tests/compiler/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/single/tests/efuns/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/single/tests/operators/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/u/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/tmp/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/windows/
nightmare3_fluffos_v2/lib/cmds/ambassador/
nightmare3_fluffos_v2/lib/cmds/database/
nightmare3_fluffos_v2/lib/cmds/hm/
nightmare3_fluffos_v2/lib/cmds/soul/
nightmare3_fluffos_v2/lib/daemon/cfg/
nightmare3_fluffos_v2/lib/daemon/cfg/mon_races/
nightmare3_fluffos_v2/lib/daemon/cfg/races/
nightmare3_fluffos_v2/lib/daemon/include/
nightmare3_fluffos_v2/lib/daemon/save/
nightmare3_fluffos_v2/lib/daemon/services/
nightmare3_fluffos_v2/lib/daemon/soul/
nightmare3_fluffos_v2/lib/doc/
nightmare3_fluffos_v2/lib/doc/TestPlans/
nightmare3_fluffos_v2/lib/doc/approval/
nightmare3_fluffos_v2/lib/doc/approval/QC/
nightmare3_fluffos_v2/lib/doc/approval/balance/
nightmare3_fluffos_v2/lib/doc/build/
nightmare3_fluffos_v2/lib/doc/build/armours/
nightmare3_fluffos_v2/lib/doc/build/economy/
nightmare3_fluffos_v2/lib/doc/build/etc/
nightmare3_fluffos_v2/lib/doc/build/monster/
nightmare3_fluffos_v2/lib/doc/build/room/
nightmare3_fluffos_v2/lib/doc/build/virtual/
nightmare3_fluffos_v2/lib/doc/build/weapon/
nightmare3_fluffos_v2/lib/doc/classes/
nightmare3_fluffos_v2/lib/doc/efun/
nightmare3_fluffos_v2/lib/doc/etc/
nightmare3_fluffos_v2/lib/doc/help/creator/
nightmare3_fluffos_v2/lib/doc/help/hm/
nightmare3_fluffos_v2/lib/doc/law/
nightmare3_fluffos_v2/lib/doc/lpc/basic/
nightmare3_fluffos_v2/lib/doc/lpc/data_types/
nightmare3_fluffos_v2/lib/doc/lpc/etc/
nightmare3_fluffos_v2/lib/doc/lpc/intermediate/
nightmare3_fluffos_v2/lib/doc/lpc/types/
nightmare3_fluffos_v2/lib/doc/mudlib/
nightmare3_fluffos_v2/lib/doc/mudlib/features/
nightmare3_fluffos_v2/lib/domains/Examples/etc/
nightmare3_fluffos_v2/lib/domains/Examples/room/
nightmare3_fluffos_v2/lib/domains/Examples/virtual/
nightmare3_fluffos_v2/lib/domains/Examples/virtual/exaA/
nightmare3_fluffos_v2/lib/domains/Examples/virtual/exaB/
nightmare3_fluffos_v2/lib/domains/Examples/weapon/
nightmare3_fluffos_v2/lib/domains/Praxis/
nightmare3_fluffos_v2/lib/domains/Praxis/adm/
nightmare3_fluffos_v2/lib/domains/Praxis/attic/
nightmare3_fluffos_v2/lib/domains/Praxis/cemetary/
nightmare3_fluffos_v2/lib/domains/Praxis/cemetary/mon/
nightmare3_fluffos_v2/lib/domains/Praxis/data/
nightmare3_fluffos_v2/lib/domains/Praxis/death/
nightmare3_fluffos_v2/lib/domains/Praxis/mountains/
nightmare3_fluffos_v2/lib/domains/Praxis/obj/armour/
nightmare3_fluffos_v2/lib/domains/Praxis/obj/magic/
nightmare3_fluffos_v2/lib/domains/Praxis/obj/weapon/
nightmare3_fluffos_v2/lib/domains/Praxis/orc_valley/
nightmare3_fluffos_v2/lib/domains/Praxis/quests/
nightmare3_fluffos_v2/lib/domains/Praxis/standardOld/
nightmare3_fluffos_v2/lib/include/
nightmare3_fluffos_v2/lib/log/
nightmare3_fluffos_v2/lib/log/errors/
nightmare3_fluffos_v2/lib/log/reports/
nightmare3_fluffos_v2/lib/log/watch/
nightmare3_fluffos_v2/lib/news/
nightmare3_fluffos_v2/lib/secure/cfg/
nightmare3_fluffos_v2/lib/secure/cmds/ambassador/
nightmare3_fluffos_v2/lib/secure/cmds/mortal/
nightmare3_fluffos_v2/lib/secure/save/users/d/
nightmare3_fluffos_v2/lib/secure/std/
nightmare3_fluffos_v2/lib/std/hm/
nightmare3_fluffos_v2/lib/std/living/
nightmare3_fluffos_v2/lib/std/room/
nightmare3_fluffos_v2/lib/std/user/
nightmare3_fluffos_v2/lib/std/virtual/
nightmare3_fluffos_v2/lib/www/
nightmare3_fluffos_v2/lib/www/errors/
nightmare3_fluffos_v2/lib/www/gateways/
nightmare3_fluffos_v2/win32/
// _balefire.c
// Cleric/Monk ability
// Coded by Drakken and Aleas.
// Sat Oct 15 16:38:52 CET 1994

#include <std.h>

inherit DAEMON;

#define ANGEL "/cmds/skills/mon/angel"

void clone_angel(int nr, int power, object foe) {
    object ob;
    string * x = ({ "first", "second" });

    ob = new(ANGEL);
    ob->set_short(lower_case(possessive_noun(this_player()))+" "+x[nr-1]+" guardian angel");
    ob->setup_angel(power);
    message("enviroment","%^BOLD%^%^MAGENTA%^A guardian angel decends from heaven to assist "+
        (string)this_player()->query_cap_name()+"!%^RESET%^",environment(this_player()),this_player());
    message("enviroment","%^BOLD%^%^MAGENTA%^A guardian angel decends from heaven to assist "
        "you!%^RESET%^",this_player());
    ob->move(environment(this_player()));
    if (!ob->kill_ob(foe,0)) foe->kill_ob(ob,0);
}
 
int cmd_balefire (string str) {
    object tp, ob;
    object env, *rooms, *attackers, *inv, *helpers;
    string *sorties, Class;
    int i, j, tmp, level, faith, power;

    tp = this_player();
    env = environment(tp);
    if (!env) return 0;

    if(tp->query_ghost())
        return notify_fail("Your voice is hollow.\n");

    if(tp->query_casting()) return 1;
    tp->set_magic_round();

    Class = (string)tp->query_class();
    if (Class != "monk" && Class != "cleric") {
	if(Class == "kataan") {
	    message("my_action","%^BOLD%^A lightning bold shoot from the sky and hits you!%^RESET%^",tp);
	    message("other_action","%^BOLD%^A lightning bold shoot from the sky and hits "+
		(string)tp->query_cap_name()+"!%^RESET%^",environment(tp),tp);
	    tp->add_mp(-25);
	    tp->do_damage((string)tp->return_limb(),25);
	    return 1;
	    } else
            return notify_fail("You aren't a faithful one!\n");
    }

    if (tp->query_alignment() < 1350)
        return notify_fail("The powers of goodness only help their strongest followers.\n");

    if(environment(tp)->query_property("no magic"))
        return notify_fail("A magical force prevents you from setting the signal.\n");

    if (str)
        return notify_fail("Balefire does affect everyone!\n");

    tmp = 0;
    attackers = (object *)this_player()->query_attackers();
    if(attackers && sizeof(attackers))
        for(i=0; i<sizeof(attackers); i++) {
            ob = attackers[i];
            if (ob && objectp(ob) && environment(ob) == env) {
                tmp = 1;
                break;
            }
        }
    if (!tmp)
        return notify_fail("You are not in battle!\n");

    level = (int)tp->query_level();
    faith = (int)tp->query_skill("faith");
    if(faith < 60 || level < 6)
        return  notify_fail("You are not skilled enough for setting the signal.\n");

    power = tp->query_mp();
    if (power < 250)
        return  notify_fail("You currently lack the mental strength to set the signal.\n");

    rooms = ({ env });
    sorties = (string *)env->query_exits();
    if(sorties && sizeof(sorties)) {
        for(i=0, tmp = sizeof(sorties); i<tmp; i++) {
            catch(call_other((object)env->query_exit(sorties[i]),"???"));
            if(!(ob = find_object(env->query_exit(sorties[i])))) continue;
            if(ob->query_property("no magic")) continue;
            rooms += ({ ob });
        }
        rooms = distinct_array(rooms);
    }

    tp->set_disable();
    tp->add_mp(-250);
    for(i=0; i<sizeof(attackers); i++) {
        ob = attackers[i];
        if (ob && objectp(ob) && member_array(environment(ob),rooms) != -1 ) {
            if (ob->query_alignment() < -1) {
                power += ob->query_mp();
                ob->add_mp(-2 * (int)ob->query_max_mp());
            } else if (ob->query_alignment() > 200)
                power -= ob->query_mp();
        }
    }
    message("my_action","%^YELLOW%^You set a balefire!%^RESET%^",tp);
    helpers = ({ });
    i = sizeof(rooms);
    while (i--) {
        message("environment","%^YELLOW%^"+(string)tp->query_cap_name()+
            " has set a balefire!%^RESET%^",rooms[i],tp);
        inv = all_inventory(rooms[i]);
        j = sizeof(inv);
        while (j--) {
            if (living(inv[j]) 
                && inv[j] != tp
                && !creatorp(inv[j])
                && !inv[j]->query_ghost()
                && member_array(inv[j],attackers) == -1
                && inv[j]->query_alignment() > 200
            ) {
                helpers += ({ inv[j] });
                power += inv[j]->query_mp();
                power += inv[j]->query_skill("faith");
                if (userp(inv[j])) {
                    message("other_action","%^RESET%^%^BOLD%^"
                        "You feel an undeniable demand to assist a good soul in need!%^RESET%^",inv[j]);
                    if (environment(inv[j]) != env)
                        inv[j]->move_player(env,"to help");
                    inv[j]->set_mp(0);
                    if (!inv[j]->kill_ob(ob,0)) ob->kill_ob(inv[j],0);
                }
            }
        }
    }
    power += faith * 3;
    power *= level/10 + 1;
    ob->do_damage("torso",power/50);
    tp->add_skill_points("faith",power/100);
    tp->add_alignment(random(10));
    if ((int)tp->query_skill("faith") > 90) {
        if (power > 1000)
            clone_angel(1, power, ob);
        if (power > 2000)
            clone_angel(2, power, ob);
    }   
    ob->kill_ob(tp,1);
    return 1;
}

void help() { 
    message("help",
        "Syntax: <balefire>\n\n"
        "Allows a follower of faith to set a signal to the forces of "
        "good that the caster is in danger. Anyone around with a saintly soul "
        "will hear the call and try to help. Those of really high "
        "faith might even get devine assistance. ",
        this_player());
}