/
mudd/docs/html/
mudd/world/
#include <sys/types.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "mud.h"

void 
do_consider (CHAR_DATA * ch, char *argy)
{
  char arg[SML_LENGTH];
  CHAR_DATA *victim;
  int cons_hps;
  int vict_hps;
  int attacker_rounds = 0;
  int victim_rounds = 0;
  int round_difference = 0;
  char *msg = '\0';
  DEFINE_COMMAND ("consider", do_consider, POSITION_RESTING, 0, LOG_NORMAL, "This command runs through the battle in your character's mind, and tells you the suspected outcome.")

    
    one_argy (argy, arg);
  if (arg[0] == '\0')
    {
      send_to_char ("Consider killing whom?\n\r", ch);
      return;
    }
  if ((victim = get_char_room (ch, arg)) == NULL)
    {
      send_to_char ("They're not here.\n\r", ch);
      return;
    }
  if (victim == ch)
    {
      send_to_char("Suicide is not an option.\n\r", ch);
      return;
    }
  
  consid = TRUE;
  
  cons_hps = ch->hit;
  vict_hps = victim->hit;
  
  
  if (cons_hps < 0 || vict_hps < 0)
    return;
  
  while (cons_hps > 0 && vict_hps > 0 && victim_rounds < 100)
    {
      victim_rounds++;
      consider_damage = 0;
      multi_hit(victim, ch, TYPE_UNDEFINED);
      cons_hps -= consider_damage;
    }
  
  cons_hps = ch->hit;
  vict_hps = victim->hit;
  
  while (cons_hps > 0 && vict_hps > 0 && attacker_rounds < 100)
    {
      attacker_rounds++;
      consider_damage = 0;
      multi_hit(ch, victim, TYPE_UNDEFINED);
      vict_hps -= consider_damage;
    }
  
  consid = FALSE;
  
  
  round_difference = (attacker_rounds - victim_rounds);


  send_to_char("You carefully go over the battle in your mind...\n\r", ch);
  if (round_difference <= - 10)
    msg = "You will have fun rearranging $N's bodyparts!";
  else
    {
      switch(round_difference)
	{
	case -9:
	  msg = "Why would you bore yourself killing $N...";
	  break;
	case -8:
	  msg = "$N stands no chance against you.";
	  break;
	case -7:
	  msg = "No sweat... a little work and $N will go down hard...";
	  break;
	case -6:
	  msg = "This should be fairly easy...";
	  break;
	case -5:
	  msg = "You should be able to beat $N unless $E has some tricks up $S sleeve.";  
	  break;
	case -4:
	  msg = "You would probably win unless $N has some tricks up $S sleeve.";
	  break;
	case -3:
	  msg = "It would be a close battle but you would probably win.";
	  break;
	case -2:
	  msg = "It would be a close battle without offensive magic.";
	  break;
	case -1:
	  msg = "You are almost exactly evenly matched (without offensive magic)";
	  break;
	case 0:
	  msg = "You are almost exactly evenly matched.";
	  break;
	case 1:
	  msg = "It would be a close battle but you would probably lose.";
	  break;
	case 2:
	  msg = "You would need a little luck.";
	  break;
	case 3:
	  msg = "You would need quite a bit of luck.";
	  break;
	case 4:
	  msg = "$N will probably beat you in a one on one battle.";
	  break;
	case 5:
	  msg = "You'd probably need a friend or two...";
	  break;
	case 6:
	  msg = "You better have brought some friends!";
	  break;
	case 7:
	  msg = "You better have brought A LOT of friends!";
	  break;
	case 8:
	  msg = "I hope you have an army to back you up!";
	  break;
	case 9:
	  msg = "$N will laugh as $E rips you in two.";
	  break;
	case 10:
	  msg = "$N will squish your face into the ground with ease.";
	  break;
	default:
	case 11:
	  msg = "You truly are a masochist! There is NO WAY!";
	  break;
	}
    }
  act (msg, ch, NULL, victim, TO_CHAR);
  return;
}


void 
do_group_consider (CHAR_DATA * ch, char *argy)
{
  char arg[SML_LENGTH];
  CHAR_DATA *victim;
  CHAR_DATA *gch;
  char *msg = '\0';
  int cons_hps;
  int vict_hps;
  int attacker_rounds = 0;
  int victim_rounds = 0;
  int round_difference = 0;
  DEFINE_COMMAND ("gconsider", do_group_consider, POSITION_RESTING, 0, LOG_NORMAL, "This command runs through the battle in your character's mind as if you were the tank for your group, and tells you the suspected outcome.")
    one_argy (argy, arg);
  if (chars_in_group (ch) < 2)
    {
      send_to_char ("But you aren't in a group!!\n\r", ch);
      return;
    }
  if (arg[0] == '\0')
    {
      send_to_char ("Group-Consider killing whom?\n\r", ch);
      return;
    }
  if ((victim = get_char_room (ch, arg)) == NULL)
    {
      send_to_char ("They're not here.\n\r", ch);
      return;
    }
  if (victim == ch)
    {
      send_to_char("Suicide is not an option.\n\r", ch);
      return;
    }
  
 
  consid = TRUE;
  
  cons_hps = ch->hit;
  vict_hps = victim->hit;
  

  if (cons_hps < 0 || vict_hps < 0)
    return;
  
  while (cons_hps > 0 && vict_hps > 0 && victim_rounds < 100)
    {
      victim_rounds++;
      multi_hit(victim, ch, TYPE_UNDEFINED);
      cons_hps -= consider_damage;
    }
  
  cons_hps = ch->hit;
  vict_hps = victim->hit;
  
  while (cons_hps > 0 && vict_hps > 0 && attacker_rounds < 100)
    {
      attacker_rounds++;
      for (gch = ch->in_room->people; gch != NULL; gch = gch->next_in_room)
	{
	  if (!is_same_group(ch, gch))
	    continue;
	  consider_damage = 0;
	  multi_hit(gch, victim, TYPE_UNDEFINED);
	  vict_hps -= consider_damage;
	}
    }
  consid = FALSE;
  
  
  round_difference = (attacker_rounds - victim_rounds);
  
  send_to_char("You carefully go over the battle in your mind...\n\r", ch);
  if (round_difference <= - 10)
    msg = "Your group will have fun ripping off $N's bodyparts!";
  else
    {
      switch(round_difference)
	{
	case -9:
	 msg = "Why would your group bore itself with $N...";
	  break;
	case -8:
	  msg = "$N stands no chance against your group.";
	  break;
	case -7:
	 msg = "A little teamwork and $N will go down hard...";
	  break;
	case -6:
	  msg = "This should be fairly easy...";
	  break;
	case -5:
	   msg = "Your group should be able to beat $N.";
	  break;
	case -4:
	  msg = "Your group would probably win but it might be close.";
	  break;
	case -3:
	  msg = "It would be a close battle but your group would probably win.";
	  break;
	case -2:
	  msg = "It would be a close battle without offensive magic.";
	  break;
	case -1:
	  msg = "Your group and the mob are almost exactly evenly matched."; 
	  break;
	case 0:
	 msg = "The mob might take you out before your group wins.";
	  break;
	case 1:
	  msg = "You will probably die, but your group should win.";
	  break;
	case 2:
	 msg = "You would need a little luck tanking this foe.";
	  break;
	case 3:
	  msg = "Your group probably will win, but you will might die in the process.";
	  break;
	case 4:
	  msg = "Your group may win, but you will probably die in the battle.";
	  break;
	case 5:
	  msg = "You will probably die, but your group still stands a small chance.";
	  break;
	case 6:
	 msg = "You will probably have to flee, as will others in your group.";
	  break;
	case 7:
	   msg = "Your group probably will have to flee unless you get lucky.";
	  break;
	case 8:
	   msg = "$N will probably triumph over your group!";
	  break;
	case 9:
	  msg = "$N will laugh as $E rips all of you apart.";
	  break;
	case 10:
	 msg = "$N will crush your group with ease.";
	  break;
	default:
	case 11:
	  msg = "$N could destroy your group with ease!";
	  break;
	}
    }
  act (msg, ch, NULL, victim, TO_CHAR); 
  return;
}