The Shield Block BUG for EmberMUD
                       Fix Sheet by Rindar (Ron Cole)
                        Fix 1.1 by Rindar (Ron Cole)


The Bug:  The code that allowed for activation of the shield block 
skill was never added to EmberMUD, and as such shield block is 
currently a waste of creation points.  This fix adds new code that
will activate shield block, making it a worth while skill.

The Check:  If you've ever seen a shield block an attack, you do 
not have this bug.  If you see code in fight.c that allows for 
shields to parry blows, you also do not have the bug.  Most 
EmberMUDs, however, will have this bug.

The Bugfix:  This fix is really in two seperate parts: installing 
the function and installing the checks.  Here is how to do it:

        1)  Open fight.c
        2)  Find the function "bool check_dodge"
        3)  Below the completed function, paste the "bool check_block" 
            function that can be found at the bottom of this sheet.
        4)  Find the section marked Local Functions at the top of 
            fight.c. Look for the following two lines of code:

void    check_killer    args( ( CHAR_DATA *ch, CHAR_DATA *victim ) );
bool    check_parry     args( ( CHAR_DATA *ch, CHAR_DATA *victim ) );
           
            Install this line underneat the bool check_parry:

bool    check_block     args( ( CHAR_DATA *ch, CHAR_DATA *victim ) );
        
        5)  Inside the functions "bool damage" and "bool new_damage"
            find the following lines of code:
    
    if ( dt >= TYPE_HIT && ch != victim)
    {
        if ( check_parry( ch, victim ) )
            return FALSE;
        if ( check_dodge( ch, victim ) )
            return FALSE;
    }
           Insert these two lines of code within the { }'s:
        
        if ( check_block( ch, victim ) )
            return FALSE;

        
        5)  Recompile.  You are done.


Notes:  Much of this function is based on the parry function from 
EmberMUD.  To make it different from the parry function, our MUD 
lowered the chance of a successful shield block and added other 
bonuses for a high shield-block level.  I suggest you add other
benefits as well, making shield block a unique skill.

        This skill has not been thoroughly tested, though it has
been compiled and run through a number of combat situations.  
Feel free to write me and let me know how it works.

-= Rindar
clogar@concentric.net


** Note:  This function is provided "as is" and may be used so long as 
1)  The author's name is kept at the top of the function (if requested) and
2)  all other previous licensing aggreements are abided by.  The author 
assumes no responsibility for problems that occur through use or install-
ation, including lost wages, bugs, deletions, downtimes, etc...  Use at 
your own risk.  All new code is copyrighted by its author.


New check_block function (fight.c):

bool check_block( CHAR_DATA *ch, CHAR_DATA *victim )
{
    int chancea;
    int chance;

    if ( !IS_AWAKE(victim) )
        return FALSE;

    if ( get_eq_char( victim, WEAR_SHIELD ) == NULL )
        return FALSE;

    if ( IS_NPC(victim) )
    {
        chance = UMIN( 30, victim->level );
    }
    else
    {
        chance = victim->pcdata->learned[gsn_shield_block] / 4;
    }
    
    /* Must get a successful check before a parry can be attempted */ 
    if ( !IS_NPC(victim) )
    {
       if ( number_percent( ) > victim->pcdata->learned[gsn_shield_block])
          return FALSE;
    }

    chancea = 0;
    
    if (!can_see(victim,ch))    
    chance  -= 25; 

    if (!can_see(ch,victim))    
    chancea  -= 25; 

    chance  += get_curr_stat(victim,STAT_DEX)/4;
    chancea += (get_curr_stat(ch,STAT_DEX)/4) + ((ch->level)/2)+(get_curr_stat(ch,STAT_WIS)/3);


/* A high chance is good.  A low chance means a failed parry */
    if ( number_percent( ) >= chance + ((victim->level)/2) - chancea )
        return FALSE;

    act( "`BYou block $n's attack.`w",  ch, NULL, victim, TO_VICT    );
    act( "`B$N blocks your attack.`w", ch, NULL, victim, TO_CHAR    );

    if ( ((victim->level) - 5)>(ch->level) )
    return TRUE;   

    check_improve(victim,gsn_shield_block,TRUE,6);
    return TRUE;
}





 =============================================================================
/   ______ _______ ____   _____   ___ __    _ ______    ____  ____   _____   /
\  |  ____|__   __|  _ \ / ____\ / _ \| \  / |  ____|  / __ \|  _ \ / ____\  \
/  | |__     | |  | |_| | |     | |_| | |\/| | |___   | |  | | |_| | |       /
/  | ___|    | |  | ___/| |   __|  _  | |  | | ____|  | |  | |  __/| |   ___ \
\  | |       | |  | |   | |___| | | | | |  | | |____  | |__| | |\ \| |___| | /
/  |_|       |_|  |_|  o \_____/|_| |_|_|  |_|______|o \____/|_| \_|\_____/  \
\                                                                            /
 ============================================================================

------------------------------------------------------------------------------
ftp://ftp.game.org/pub/mud      FTP.GAME.ORG      http://www.game.org/ftpsite/
------------------------------------------------------------------------------

 This file came from FTP.GAME.ORG, the ultimate source for MUD resources.

------------------------------------------------------------------------------