I am trying to rewrite what determines if you are hit or not, I'm just 
fooling around with it now, but I am having a weird problem.
What I have done works if there aren't using a weapon, they can either miss 
or make a hit, but if they wield a weapon, they hit no matter what, even if I 
set the damage to 0 right before it goes to bool damage (Which should return 
a miss).
Anyways, here is part of my void one_hit
===========================
void one_hit( CHAR_DATA *ch, CHAR_DATA *victim, int dt )
{
    OBJ_DATA *wield;
    char buf[MSL];
    int dam;
    int diceroll;
    int sn,skill;
    int dam_type;
    bool result;

    sn = -1;

    /* just in case */
    if (victim == ch || ch == NULL || victim == NULL)
        return;

    /*
     * Can't beat a dead char!
     * Guard against weird room-leavings.
     */
    if ( victim->position == POS_DEAD || ch->in_room != victim->in_room )
        return;

    /*
     * Figure out the type of damage message.
     */
    wield = get_eq_char( ch, WEAR_WIELD );


    if ( dt == TYPE_UNDEFINED )
    {
        dt = TYPE_HIT;
        if ( wield != NULL && wield->item_type == ITEM_WEAPON )
            dt += wield->value[3];
        else
            dt += ch->dam_type;
    }

    if (dt < TYPE_HIT)
        if (wield != NULL)
            dam_type = attack_table[wield->value[3]].damage;
        else
            dam_type = attack_table[ch->dam_type].damage;
    else
        dam_type = attack_table[dt - TYPE_HIT].damage;

    if (dam_type == -1)
        dam_type = DAM_BASH;

    /* get the weapon skill */
    sn = get_weapon_sn(ch);
    skill = 20 + get_weapon_skill(ch,sn);



   diceroll = number_range (1,2);
   sf(buf, "{BDiceroll: %d.{x\n\r", diceroll);
   stc(buf, ch);
if (wield != NULL)
{
        stc("{WIn the weapon if.\n\r", ch);
   if (diceroll == 2)
   {
        /*Miss.*/
        damage( ch, victim, 0, dt, dam_type, TRUE );
        tail_chain( );
        return;
    }
}
else
{
if (diceroll == 2)
   {
        /*Miss.*/
        damage( ch, victim, 0, dt, dam_type, TRUE );
        tail_chain( );
        return;
    }
}

 /*
     * Hit.
     * Calc damage.
     */
....and so on.

Im missing something and I can't figure it out...maybe someone can enlighten 
me. Thanks

Reply via email to