/* This goes into fight.c*/
Do_Fun(do_dispatch)
{
dam_class dam_type;
char arg[MAX_INPUT_LENGTH];
CharData *victim;
ObjData *wield;
wield = get_eq_char(ch, WEAR_WIELD);
int dam, chance, diceroll = number_percent();
one_argument(argument, arg);
ObjData *obj;
if (wield != NULL)
dam_type = attack_table[wield->value[3]].damage;
else
dam_type = attack_table[ch->dam_type].damage;
if (dam_type == -1)
dam_type = DAM_BASH;
if (NullStr(arg))
{
chprintln(ch, "Who will you try to kill?");
return;
}
if (ch->fighting != NULL)
{
chprintln(ch, "You're already engaged in battle.");
return;
}
else if ((victim = get_char_room(ch, NULL, arg)) == NULL)
{
chprintln(ch, "They aren't here.");
return;
}
if ((obj = get_eq_char(ch, WEAR_WIELD)) == NULL)
{
chprintln(ch, "To attempt that you need to wield a weapon.");
return;
}
if (victim == ch)
{
chprintln(ch, "Try the 'delete' command.");
return;
}
if (is_safe(ch, victim))
return;
if (IsNPC(victim) && victim->fighting != NULL
&& !is_same_group(ch, victim->fighting))
{
chprintln(ch, "Kill stealing is not permitted.");
return;
}
chance = ((get_skill(ch, gsn_dispatch) / 10) - (victim->level - ch->level));
if (IsAffected(ch, AFF_SNEAK))
chance += 10;
if (IsAffected(ch, AFF_HIDE))
chance += 5;
if (IsAffected(ch, AFF_HASTE))
chance += 5;
check_killer(ch, victim);
chance = Max(2, chance);
chance = Min(50, chance);
WaitState(ch, skill_table[gsn_dispatch].beats);
if (diceroll < chance
|| (get_skill(ch, gsn_dispatch) >= 2 && !IsAwake(victim)))
{
check_improve(ch, gsn_dispatch, true, 1);
if (skill_table[gsn_dispatch].sound)
act_sound(skill_table[gsn_dispatch].sound, ch, victim,
skill_table[gsn_dispatch].sound->to, POS_RESTING);
victim->hit = 1;
dam = Max(99999, victim->max_hit);
damage(ch, victim, dam, gsn_dispatch, DAM_NONE, false);
chprintln(victim, "A movement out of the corner of your eye makes you turn around, but it is too late...");
chprintln(ch, "You quietly deal with your mark. It is done.");
if (victim->level > ch->level)
{
chprintln(ch, "Your impeccable performance has earned you a reward. You feel favored.");
ch->max_hit += 1;
ch->hit += 1;
ch->pcdata->perm_hit += 1;
}
}
else
{
chprintln(ch, "Your mark notices you, and you're forced to attempt a backstab.");
check_improve(ch, gsn_dispatch, false, 1);
do_function(ch, &do_backstab, arg);
}
return;
}
/* This goes into special.c, in spec_nasty, under for (victim = ch->in_room->person_first; victim != NULL;
victim = v_next)*/
else if (!IsNPC(victim) && (victim->level > ch->level)
&& (victim->level < ch->level + 10))
{
do_function(ch, &do_dispatch, victim->name);
if (ch->position != POS_FIGHTING)
{
do_function(ch, &do_dispatch, victim->name);
}
return true;
}