src/fight.c
/*
 * Compute xp for a kill.
 * Also adjust alignment of killer.
 * Edit this function to change xp computations.
 */
Compute xp for a kill.
Also adjust alignment of killer.
Edit this function to change xp computations.
Compute xp for a kill . Also adjust alignment of killer . Edit this function to change xp computations .
int xp_compute( CHAR_DATA *gch, CHAR_DATA *victim, int total_levels )
{
    int xp,base_exp;
    int align,level_range;
    int change;
    int time_per_level;
    level_range = victim->level - gch->level;
    switch (level_range)
    {
 	default : 	base_exp =   0;		break;
	case -9 :	base_exp =   1;		break;
	case -8 :	base_exp =   2;		break;
	case -7 :	base_exp =   5;		break;
	case -6 : 	base_exp =   9;		break;
	case -5 :	base_exp =  11;		break;
	case -4 :	base_exp =  22;		break;
	case -3 :	base_exp =  33;		break;
	case -2 :	base_exp =  50;		break;
	case -1 :	base_exp =  66;		break;
	case  0 :	base_exp =  83;		break;
	case  1 :	base_exp =  99;		break;
	case  2 :	base_exp = 121;		break;
	case  3 :	base_exp = 143;		break;
	case  4 :	base_exp = 165;		break;
    } 
    if (level_range > 4)
	base_exp = 160 + 20 * (level_range - 4);
    align = victim->alignment - gch->alignment;
    if (IS_SET(victim->act,ACT_NOALIGN))
    {
    }
    else if (align > 500) 
    {
	change = (align - 500) * base_exp / 500 * gch->level/total_levels; 
	change = UMAX(1,change);
        gch->alignment = UMAX(-1000,gch->alignment - change);
    }
    else if (align < -500) 
    {
	change =  ( -1 * align - 500) * base_exp/500 * gch->level/total_levels;
	change = UMAX(1,change);
	gch->alignment = UMIN(1000,gch->alignment + change);
    }
    else 
    {
	change =  gch->alignment * base_exp/500 * gch->level/total_levels;  
	gch->alignment -= change;
    }
    if (IS_SET(victim->act,ACT_NOALIGN))
	xp = base_exp;
    else if (gch->alignment > 500)  
    {
	if (victim->alignment < -750)
	    xp = (base_exp *4)/3;
 	else if (victim->alignment < -500)
	    xp = (base_exp * 5)/4;
        else if (victim->alignment > 750)
	    xp = base_exp / 4;
   	else if (victim->alignment > 500)
	    xp = base_exp / 2;
        else if (victim->alignment > 250)
	    xp = (base_exp * 3)/4; 
	else
	    xp = base_exp;
    }
    else if (gch->alignment < -500) 
    {
	if (victim->alignment > 750)
	    xp = (base_exp * 5)/4;
  	else if (victim->alignment > 500)
	    xp = (base_exp * 11)/10; 
   	else if (victim->alignment < -750)
	    xp = base_exp/2;
	else if (victim->alignment < -500)
	    xp = (base_exp * 3)/4;
	else if (victim->alignment < -250)
	    xp = (base_exp * 9)/10;
	else
	    xp = base_exp;
    }
    else if (gch->alignment > 200)  
    {
	if (victim->alignment < -500)
	    xp = (base_exp * 6)/5;
 	else if (victim->alignment > 750)
	    xp = base_exp/2;
	else if (victim->alignment > 0)
	    xp = (base_exp * 3)/4; 
	else
	    xp = base_exp;
    }
    else if (gch->alignment < -200) 
    {
	if (victim->alignment > 500)
	    xp = (base_exp * 6)/5;
	else if (victim->alignment < -750)
	    xp = base_exp/2;
	else if (victim->alignment < 0)
	    xp = (base_exp * 3)/4;
	else
	    xp = base_exp;
    }
    else 
    {
	if (victim->alignment > 500 || victim->alignment < -500)
	    xp = (base_exp * 4)/3;
	else if (victim->alignment < 200 && victim->alignment > -200)
	    xp = base_exp/2;
 	else
	    xp = base_exp;
    }
    if (gch->level < 6)
    	xp = 10 * xp / (gch->level + 4);
    if (gch->level > 35 )
	xp =  15 * xp / (gch->level - 25 );
    {
	time_per_level = 4 *
			 (gch->played + (int) (current_time - gch->logon))/3600
			 / gch->level;
	time_per_level = URANGE(2,time_per_level,12);
	if (gch->level < 15)  
	    time_per_level = UMAX(time_per_level,(15 - gch->level));
	xp = xp * time_per_level / 12;
    }
    xp = number_range (xp * 3/4, xp * 5/4);
    xp = xp * gch->level/( UMAX(1,total_levels -1) );
    return xp;
}
int xp_compute ( CHAR_DATA * gch , CHAR_DATA * victim , int total_levels ) { int xp , base_exp ; int align , level_range ; int change ; int time_per_level ; level_range = victim -> level - gch -> level ; switch ( level_range ) { default : base_exp = 0 ; break ; case -9 : base_exp = 1 ; break ; case -8 : base_exp = 2 ; break ; case -7 : base_exp = 5 ; break ; case -6 : base_exp = 9 ; break ; case -5 : base_exp = 11 ; break ; case -4 : base_exp = 22 ; break ; case -3 : base_exp = 33 ; break ; case -2 : base_exp = 50 ; break ; case -1 : base_exp = 66 ; break ; case 0 : base_exp = 83 ; break ; case 1 : base_exp = 99 ; break ; case 2 : base_exp = 121 ; break ; case 3 : base_exp = 143 ; break ; case 4 : base_exp = 165 ; break ; } if ( level_range > 4 ) base_exp = 160 + 20 * ( level_range - 4 ) ; align = victim -> alignment - gch -> alignment ; if ( IS_SET ( victim -> act , ACT_NOALIGN ) ) { } else if ( align > 500 ) { change = ( align - 500 ) * base_exp / 500 * gch -> level / total_levels ; change = UMAX ( 1 , change ) ; gch -> alignment = UMAX ( -1000 , gch -> alignment - change ) ; } else if ( align < -500 ) { change = ( -1 * align - 500 ) * base_exp / 500 * gch -> level / total_levels ; change = UMAX ( 1 , change ) ; gch -> alignment = UMIN ( 1000 , gch -> alignment + change ) ; } else { change = gch -> alignment * base_exp / 500 * gch -> level / total_levels ; gch -> alignment -= change ; } if ( IS_SET ( victim -> act , ACT_NOALIGN ) ) xp = base_exp ; else if ( gch -> alignment > 500 ) { if ( victim -> alignment < -750 ) xp = ( base_exp * 4 ) / 3 ; else if ( victim -> alignment < -500 ) xp = ( base_exp * 5 ) / 4 ; else if ( victim -> alignment > 750 ) xp = base_exp / 4 ; else if ( victim -> alignment > 500 ) xp = base_exp / 2 ; else if ( victim -> alignment > 250 ) xp = ( base_exp * 3 ) / 4 ; else xp = base_exp ; } else if ( gch -> alignment < -500 ) { if ( victim -> alignment > 750 ) xp = ( base_exp * 5 ) / 4 ; else if ( victim -> alignment > 500 ) xp = ( base_exp * 11 ) / 10 ; else if ( victim -> alignment < -750 ) xp = base_exp / 2 ; else if ( victim -> alignment < -500 ) xp = ( base_exp * 3 ) / 4 ; else if ( victim -> alignment < -250 ) xp = ( base_exp * 9 ) / 10 ; else xp = base_exp ; } else if ( gch -> alignment > 200 ) { if ( victim -> alignment < -500 ) xp = ( base_exp * 6 ) / 5 ; else if ( victim -> alignment > 750 ) xp = base_exp / 2 ; else if ( victim -> alignment > 0 ) xp = ( base_exp * 3 ) / 4 ; else xp = base_exp ; } else if ( gch -> alignment < -200 ) { if ( victim -> alignment > 500 ) xp = ( base_exp * 6 ) / 5 ; else if ( victim -> alignment < -750 ) xp = base_exp / 2 ; else if ( victim -> alignment < 0 ) xp = ( base_exp * 3 ) / 4 ; else xp = base_exp ; } else { if ( victim -> alignment > 500 || victim -> alignment < -500 ) xp = ( base_exp * 4 ) / 3 ; else if ( victim -> alignment < 200 && victim -> alignment > -200 ) xp = base_exp / 2 ; else xp = base_exp ; } if ( gch -> level < 6 ) xp = 10 * xp / ( gch -> level + 4 ) ; if ( gch -> level > 35 ) xp = 15 * xp / ( gch -> level - 25 ) ; { time_per_level = 4 * ( gch -> played + ( int ) ( current_time - gch -> logon ) ) / 3600 / gch -> level ; time_per_level = URANGE ( 2 , time_per_level , 12 ) ; if ( gch -> level < 15 ) time_per_level = UMAX ( time_per_level , ( 15 - gch -> level ) ) ; xp = xp * time_per_level / 12 ; } xp = number_range ( xp * 3 / 4 , xp * 5 / 4 ) ; xp = xp * gch -> level / ( UMAX ( 1 , total_levels - 1 ) ) ; return xp ; }
Compute xp for a kill.
Compute xp for a kill .
/* compute the base exp */ /* do alignment computations */ /* no change */ /* monster is more good than slayer */ /* monster is more evil than slayer */ /* improve this someday */ /* calculate exp multiplier */ /* for goodie two shoes */ /* for baddies */ /* a little good */ /* a little bad */ /* neutral */ /* more exp at the low levels */ /* less at high */ /* reduce for playing time */ /* compute quarter-hours per level */ /* make it a curve */ /* randomize the rewards */ /* adjust for grouping */