I have written up an assassination function.. and looking for ways to improve 
it.  I hacked slay, and backstab to pieces making it, and i would appreciate if 
someone can help the newbie coder here by commenting what the lines of code do 
(i know what send_to_char is ;) )  Any help is appreciated, and hope someone 
finds some use of this. It is my first code i've written (even if its hacking 
two to make one)  I do not wish for any credit, because the credit deserves to 
go to the makers of rom.  

Maybe someone can help me improve it?  
/*snip here*/ 


void do_assassinate( CHAR_DATA *ch, char *argument )
{ //main 
char arg[MAX_INPUT_LENGTH];
    CHAR_DATA *victim;
    OBJ_DATA *obj;

    one_argument( argument, arg );

    if (arg[0] == '\0')
    {
        send_to_char("Assassinate Whom?\n\r",ch);
        return;
    }

if (ch->fighting != NULL)
    {
    send_to_char("You cant sneak up on them.\n\r",ch);
    return;
    }
if ((victim = get_char_room(ch,arg)) == NULL)
    {
        send_to_char("They aren't here.\n\r",ch);
        return;
    }
if ( victim == ch )
    {
    send_to_char( "How can you assassinate yourself, Wouldn't that just be 
suicide?\n\r", ch );
    return;
    }
if ( is_safe( ch, victim ) )
{
    send_to_char("Not in here.\n\r",ch);
    return;
}
if (IS_NPC(victim) &&
     victim->fighting != NULL && 
    !is_same_group(ch,victim->fighting))
    {
        send_to_char("Kill stealing is not permitted.\n\r",ch);
        return;
    }

if ( ( obj = get_eq_char( ch, WEAR_WIELD ) ) == NULL)
    {
    send_to_char( "You need to wield a weapon to assassinate.\n\r", ch );
    return;
    }

if ( victim->hit != victim->max_hit)
    {
    act( "$N is too alert for you to assassinate them.",
        ch, NULL, victim, TO_CHAR );
    return;
    }

check_killer( ch, victim );
WAIT_STATE( ch, skill_table[gsn_assassinate].beats );
if (( number_percent( ) < 40)
|| ( get_skill(ch,gsn_backstab) >= 2 && !IS_AWAKE(victim) ) )
{
check_improve(ch,gsn_assassinate,TRUE,1);
 act( "You {R=++||{Gassassinate{R||++={x $N!",ch,NULL,victim,TO_CHAR);
 act( "$n {R=++||{Gassassinates{R||++={x you!",ch,NULL,victim,TO_VICT);
 act( "$n {R=++||{Gassassinates{R||++={x $N!",ch,NULL,victim,TO_NOTVICT);
   raw_kill( victim );
}
else
{
check_improve(ch,gsn_assassinate,FALSE,1);
damage( ch, victim, 0, gsn_assassinate,DAM_NONE,TRUE);
}

return;
}//end of funct.
/*End of Snip*/
Charlie <--- the completly newbie coder, with a will, and a vision!
aka Atm.  

__________________________________________________________________
The NEW Netscape 7.0 browser is now available. Upgrade now! 
http://channels.netscape.com/ns/browsers/download.jsp 

Get your own FREE, personal Netscape Mail account today at 
http://webmail.netscape.com/

Reply via email to