nightmare4_fluffos_v1/
nightmare4_fluffos_v1/bin/
nightmare4_fluffos_v1/fluffos-2.9-ds2.14/
nightmare4_fluffos_v1/fluffos-2.9-ds2.14/ChangeLog.old/
nightmare4_fluffos_v1/fluffos-2.9-ds2.14/Win32/
nightmare4_fluffos_v1/fluffos-2.9-ds2.14/compat/
nightmare4_fluffos_v1/fluffos-2.9-ds2.14/compat/simuls/
nightmare4_fluffos_v1/fluffos-2.9-ds2.14/include/
nightmare4_fluffos_v1/fluffos-2.9-ds2.14/testsuite/
nightmare4_fluffos_v1/fluffos-2.9-ds2.14/testsuite/clone/
nightmare4_fluffos_v1/fluffos-2.9-ds2.14/testsuite/command/
nightmare4_fluffos_v1/fluffos-2.9-ds2.14/testsuite/data/
nightmare4_fluffos_v1/fluffos-2.9-ds2.14/testsuite/etc/
nightmare4_fluffos_v1/fluffos-2.9-ds2.14/testsuite/include/
nightmare4_fluffos_v1/fluffos-2.9-ds2.14/testsuite/inherit/
nightmare4_fluffos_v1/fluffos-2.9-ds2.14/testsuite/inherit/master/
nightmare4_fluffos_v1/fluffos-2.9-ds2.14/testsuite/log/
nightmare4_fluffos_v1/fluffos-2.9-ds2.14/testsuite/single/
nightmare4_fluffos_v1/fluffos-2.9-ds2.14/testsuite/single/tests/compiler/
nightmare4_fluffos_v1/fluffos-2.9-ds2.14/testsuite/single/tests/efuns/
nightmare4_fluffos_v1/fluffos-2.9-ds2.14/testsuite/single/tests/operators/
nightmare4_fluffos_v1/fluffos-2.9-ds2.14/testsuite/u/
nightmare4_fluffos_v1/fluffos-2.9-ds2.14/tmp/
nightmare4_fluffos_v1/fluffos-2.9-ds2.14/windows/
nightmare4_fluffos_v1/lib/cfg/
nightmare4_fluffos_v1/lib/cmds/admins/
nightmare4_fluffos_v1/lib/cmds/common/
nightmare4_fluffos_v1/lib/cmds/creators/include/
nightmare4_fluffos_v1/lib/cmds/creators/include/SCCS/
nightmare4_fluffos_v1/lib/cmds/hm/
nightmare4_fluffos_v1/lib/daemon/services/
nightmare4_fluffos_v1/lib/doc/
nightmare4_fluffos_v1/lib/doc/faq/
nightmare4_fluffos_v1/lib/doc/help/classes/
nightmare4_fluffos_v1/lib/doc/help/creators/
nightmare4_fluffos_v1/lib/doc/help/hm/
nightmare4_fluffos_v1/lib/doc/help/players/
nightmare4_fluffos_v1/lib/doc/help/races/
nightmare4_fluffos_v1/lib/doc/help/religion/
nightmare4_fluffos_v1/lib/doc/mudlib/
nightmare4_fluffos_v1/lib/doc/mudlib/cfg/
nightmare4_fluffos_v1/lib/domains/Ylsrim/
nightmare4_fluffos_v1/lib/domains/Ylsrim/adm/
nightmare4_fluffos_v1/lib/domains/Ylsrim/armour/
nightmare4_fluffos_v1/lib/domains/Ylsrim/fish/
nightmare4_fluffos_v1/lib/domains/Ylsrim/meal/
nightmare4_fluffos_v1/lib/domains/Ylsrim/npc/
nightmare4_fluffos_v1/lib/domains/Ylsrim/virtual/
nightmare4_fluffos_v1/lib/domains/Ylsrim/weapon/
nightmare4_fluffos_v1/lib/domains/Ylsrim/xtra/
nightmare4_fluffos_v1/lib/lib/comp/
nightmare4_fluffos_v1/lib/lib/lvs/
nightmare4_fluffos_v1/lib/lib/std/
nightmare4_fluffos_v1/lib/lib/user/
nightmare4_fluffos_v1/lib/news/
nightmare4_fluffos_v1/lib/obj/
nightmare4_fluffos_v1/lib/obj/include/
nightmare4_fluffos_v1/lib/save/
nightmare4_fluffos_v1/lib/save/kills/a/
nightmare4_fluffos_v1/lib/save/kills/b/
nightmare4_fluffos_v1/lib/save/kills/f/
nightmare4_fluffos_v1/lib/save/kills/m/
nightmare4_fluffos_v1/lib/save/kills/q/
nightmare4_fluffos_v1/lib/save/kills/r/
nightmare4_fluffos_v1/lib/secure/cfg/
nightmare4_fluffos_v1/lib/secure/cfg/classes/
nightmare4_fluffos_v1/lib/secure/cfg/races/SCCS/
nightmare4_fluffos_v1/lib/secure/cmds/creators/include/
nightmare4_fluffos_v1/lib/secure/cmds/players/
nightmare4_fluffos_v1/lib/secure/cmds/players/include/
nightmare4_fluffos_v1/lib/secure/daemon/include/
nightmare4_fluffos_v1/lib/secure/lib/
nightmare4_fluffos_v1/lib/secure/lib/include/
nightmare4_fluffos_v1/lib/secure/lib/net/
nightmare4_fluffos_v1/lib/secure/lib/std/
nightmare4_fluffos_v1/lib/secure/obj/
nightmare4_fluffos_v1/lib/secure/obj/include/
nightmare4_fluffos_v1/lib/secure/save/
nightmare4_fluffos_v1/lib/secure/save/boards/
nightmare4_fluffos_v1/lib/secure/save/votes/
nightmare4_fluffos_v1/lib/spells/
nightmare4_fluffos_v1/lib/verbs/admins/include/
nightmare4_fluffos_v1/lib/verbs/common/
nightmare4_fluffos_v1/lib/verbs/common/include/
nightmare4_fluffos_v1/lib/verbs/creators/
nightmare4_fluffos_v1/lib/verbs/creators/include/
nightmare4_fluffos_v1/lib/verbs/players/include/SCCS/
nightmare4_fluffos_v1/lib/verbs/rooms/
nightmare4_fluffos_v1/lib/verbs/rooms/include/
nightmare4_fluffos_v1/lib/www/
nightmare4_fluffos_v1/old/
nightmare4_fluffos_v1/old/tools/
nightmare4_fluffos_v1/win32/
/*   /lib/combatmsg.c
 *   from the Nightmare IVr2.4 LPC Library
 *   combat message handling
 *   created by Blitz@Nightmare
 */
 
#include <combat_messages.h>
#include "include/combatmsg.h"

static mixed GetMissData(object targ, int type, string limb) {
    string targ_name = (string)targ->GetName(); 
    if( type == -2 ) switch( random(7) ) {
        case 0:
        return ({ "%s completely %s %s.",
               ({ "You", "miss", targ_name }),
               ({ GetName(), "misses", "you" }),
               ({ GetName(), "misses", targ_name }) });
        case 1:
        return ({ "%s %s at %s and %s with thin air.",
               ({ "You", "swing", targ_name, "connect" }),
               ({ GetName(), "swings", "you", "connects" }),
               ({ GetName(), "swings", targ_name, "connects" }) });
        case 2:
        return ({ "%s %s a stunning blow but %s %s by a mile!",
               ({ "You", "deliver", "miss", targ_name }),
               ({ GetName(), "delivers", "misses", "you" }),
               ({ GetName(), "delivers", "misses", targ_name }), });
        case 3:
        return ({ "After a flurry of attacks, %s %s absolutely nothing.",
               ({ "you", "hit" }),
               ({ GetName(), "hits" }),
               ({ GetName(), "hits" }), });
        case 4:
        return ({ "%s %s out at %s %s, but %s it completely.",
               ({ "You", "lash", possessive_noun(targ), limb, "miss" }),
               ({ GetName(), "lashes", "your", limb, "misses" }),
               ({ GetName(), "lashes", possessive_noun(targ), limb, "misses" }) });
        case 5:
        return ({ "%s %s silly as %s %s in the wrong direction.",
               ({ "You", "look", "you", "swing" }),
               ({ GetName(), "looks", nominative(this_object()), "swings" }),
               ({ GetName(), "looks", nominative(this_object()), "swings" }) });
        default:
        return ({ "%s totally %s %s.",
               ({ "You", "miss", targ_name }),
               ({ GetName(), "misses", "you" }),
               ({ GetName(), "misses", targ_name }) });   
    }
    else {
        string pos = possessive_noun(this_object());
        switch( random(7) ) {
        case 0:
        return ({ "%s quickly %s out of %s way.",
               ({ targ_name, "jumps", "your" }),
               ({ "You", "jump", pos }),
               ({ targ_name, "jumps", pos }) });
        case 1:
        return ({ "%s deftly %s %s pathetic attack.",
               ({ targ_name, "blocks", "your" }),
               ({ "You", "block", pos }),
               ({ targ_name, "blocks", pos }) });
        case 2:
        return ({ "%s easily %s %s inept attack.",
               ({ targ_name, "dodges", "your" }),
               ({ "You", "dodge", pos }),
               ({ targ_name, "dodges", pos }) });
        case 3:
        return ({ "%s narrowly %s %s quick swing.",
               ({ targ_name, "avoids", "your" }),
               ({ "You", "avoid", pos }),
               ({ targ_name, "avoids", pos }) });
        case 4:
        return ({ "%s attack is thwarted by %s quick defenses.",
               ({ "Your", possessive_noun(targ_name) }),
               ({ pos, "your" }),
               ({ pos, possessive_noun(targ_name) }) });
        case 5:
        return ({ "%s %s beneath %s attack.",
               ({ targ_name, "ducks", "your" }),
               ({ "You", "duck", pos }),
               ({ targ_name, "ducks", pos }) });
        default:
        return ({ "%s %s %s lame attack.",
               ({ targ_name, "dodges", "your" }),
               ({ "You", "dodge", pos }),
               ({ targ_name, "dodges", pos }) });
        }
    }
    return 0;
}
 
static void eventSendMissMessages(object target, int x, string limb) {
    mixed data;
    if( !limb ) limb = "body";
    data = GetMissData(target, x, limb);
    if( sizeof(data) != 4 ) return;
    eventPrint(sprintf(data[0], data[1]...));
    target->eventPrint(sprintf(data[0], data[2]...));
    environment()->eventPrint(sprintf(data[0], data[3]...), 
                  ({ this_object(), target }) );
}
 
mixed GetCombatVerbs(string type, int damage) {
  mixed ptr;
  switch(type) {
    case "knife": case "blade":
      ptr = BLADE_DEGREES;
      break;
    case "projectile":
      ptr = PROJECTILE_DEGREES;
      break;
    default:
      ptr = BLUNT_DEGREES;
      break;
  }
  if( !sizeof(ptr) || !arrayp(ptr))
    return ({ ({ "hit", "hits" }), ({ "solidly" }) });
  damage /= 5;
  if( damage > (sizeof(ptr) - 1) ) damage = (sizeof(ptr) - 1);
  if( sizeof(ptr) == 1 ) return ({ ptr[damage], ({ "solidly" }) });
  else return ptr[damage];
}
 
mixed GetCombatMove(string type, int skill) {
  int i;
  mixed foo;
 
  if( skill < random(100) ) return 0;
  if( !i = sizeof(MOVE_TYPES) ) return 0;
  foo = MOVE_TYPES[ random(i) ];
  if( sizeof(foo) < 2 ) return 0;
  else return foo;
}
 
varargs void
SendMeleeMessages(object target, int x, string targlimb, string limb) {
   int i;
   string adverb, str;
   mixed verb, ptr, moves;
   if( x < 0 ) {
     eventSendMissMessages(target, x, limb);
     return;
   }
   ptr  = GetCombatVerbs("melee", x);
   verb = ptr[0];
   if( sizeof(ptr) > 1 && i = sizeof(ptr[1]) )
     adverb = (ptr[1][ random(i) ] + " in");
     else adverb = "in";
   if( moves = GetCombatMove("melee", 
              (int)this_object()->GetSkillLevel("melee attack")) ) {
     verb[0] = moves[0] + " and " + verb[0];
     verb[1] = moves[1] + " and " + verb[1];
   }
   if( !limb ) limb = "attack";
   if( !targlimb ) targlimb = "body";
   eventPrint(sprintf("You %s %s %s the %s with your %s.",
     verb[0], (string)target->GetName(), adverb, targlimb, limb) );
   target->eventPrint(sprintf("%s %s you %s your %s with %s %s.",
     GetName(), verb[1], adverb, targlimb, possessive(this_object()), limb));
   environment()->eventPrint(sprintf("%s %s %s %s the %s with %s %s.",
     GetName(), verb[1], (string)target->GetName(), adverb, targlimb, 
     possessive(this_object()), limb), ({ target, this_object() }) );
}
 
varargs void
SendWeaponMessages(object target, int x, object weapon, string limb) {
   int i;
   string adverb, type, weap;
   mixed verb, ptr, moves;
   if( x < 0 ) {
     eventSendMissMessages(target, x, limb);
     return;
   }
   if( weapon ) {
     type = (string)weapon->GetWeaponType();
     weap = (string)weapon->GetKeyName();
   }
   else {
     type = "blunt";
     weap = "weapon";
   }
   ptr = GetCombatVerbs(type, x);
   verb = ptr[0];
   if( sizeof(ptr) > 1 && i = sizeof(ptr[1]) )
     adverb = (ptr[1][ random(i) ] + " in");
     else adverb = "in";
   if( moves = GetCombatMove(type, 
              (int)this_object()->GetSkillLevel(type + " attack")) ) {
     verb[0] = moves[0] + " and " + verb[0];
     verb[1] = moves[1] + " and " + verb[1];
   }
   if( !limb ) limb = "body";
   eventPrint(sprintf("You %s %s %s the %s with your %s.",
     verb[0], (string)target->GetName(), adverb, limb, weap) );
   target->eventPrint(sprintf("%s %s you %s your %s with %s %s.",
     GetName(), verb[1], adverb, limb, possessive(this_object()), weap) );
   environment()->eventPrint(sprintf("%s %s %s %s the %s with %s %s.",
     GetName(), verb[1], (string)target->GetName(), adverb, limb,
     possessive(this_object()), weap), ({ target, this_object() }) );
}