My mud has (or will have)
about 30-40% sci-fi in it, and as such 3 of my builders wish for gun support, I hacked this together (I can read C and do some basic things with it) and I was wondering if anyone could see any glaring mistakes, and where I could send it for more hel(SML mayhaps?)?
void do_shoot( CHAR_DATA *ch, char *argument )
OBJ_DATA *gun, *clip;
int dmg;
int shots;
int ammo_left;
int ammo;
char arg[MAX_INPUT_LENGTH];
char buf[MAX_STRING_LENGTH];
one_argument( argument, arg1); /* Declare Arguments */
one_argument( argument, arg2 );
if( arg1[0] == '\0' || !str_cmp(argument, " ") )
{
send_to_char( "Fire what at who?\n\r", ch );
return;
}
if( !IS_PKILL(ch) && !IS_IMMORTAL(ch) )
{
send_to_char( "Trying to shoot someone?!\n", ch );
send_to_char( "And you call yourself a pacifist. Tsk. Tsk. Tsk.\n", ch );
return;
}
if( (gun=get_eq_char(ch, WEAR_WIELD)) == NULL
|| (gun=get_eq_char(ch, WEAR_WIELD)) !== GUN_SHOTGUN)
{
send_to_char( "You dont have anything wielded!\n\r", ch );
return;
}
if( IS_SET( ch->in_room->room_flags, ROOM_SAFE ) )
{
set_char_color( AT_MAGIC, ch );
send_to_char( "A non dectatable force jams your gun...\n\r", ch );
return;
}
if( arg2[0] == !str_cmp(arg1, " ") )
send_to_char( "Please specify the gun after wielding it.\n\r", ch );
return;
}
if( !str_cmp(arg2, "shotgun") /* Example Entry */
&& get_eq_char(ch, WEAR_HOLD)) != GUN_SHOTGUN_AMMO
&& GUN_SHOTGUN_AMMO->pIndexData->value[0] > 0 );
gun = GUN_SHOTGUN; /* VNUM Defined in mud.h */
clip = GUN_SHOTGUN_CLIP; /* VNUM Defined in mud.h */
recoil = gun->value[1];
shots = gun->value[0];
ammo_left = clip->value[0];
dmg = 1d5+5
AT_BLOOD( "$n fires his shotgun at $N!\n", ch, NULL, NULL, TO_ROOM );
AT_BLOOD( "You shoot $N with your shotgun!\n", ch, NULL, NULL, TO_CHAR );
AT_BLOOD( "$n shoots you with a shotgun!\n", ch, NULL, NULL, TO_VICT );
return damage( ch, victim, dam, sn );
wait_state(ch, 10);
for ( ammo = clip->pIndexData->value[0] - shots )
{
if( clip->pIndexData->value[0] == 0 )
{
send_to_char( "Your shotgun shell set falls out of the barrell and vanishes...\n\r", ch );
remove_obj(clip);
break;
}
}
} |