Roll - Prog , 29.10.2001 00:45 MSK

Таинство roll'a в DIKU MUD :


void roll_abilities(struct char_data *ch)
{
int i, j, k, temp;
ubyte table[5];
ubyte rools[4];
for(i=0; i < 5; table[i++]=0) ;
for(i=0; i < 5; i++) {
for(j=0; j < 4; j++)
rools[j] = number(1,6);
temp = rools[0]+rools[1]+rools[2]+rools[3] - MIN(rools[0], MIN(rools[1], MIN(rools[2],rools[3])));
for(k=0; k < 5; k++)
if (table[k] < temp)
SWITCH(temp, table[k]);
}

ch- > abilities.str_add = 0;
switch (GET_CLASS(ch)) {
case CLASS_MAGIC_USER: {
ch- > abilities.intel = table[0];
ch- > abilities.wis = table[1];
ch- > abilities.dex = table[2];
ch- > abilities.str = table[3];
ch- > abilities.con = table[4];
} break;
case CLASS_CLERIC: {
ch- > abilities.wis = table[0];
ch- > abilities.intel = table[1];
ch- > abilities.str = table[2];
ch- > abilities.dex = table[3];
ch- > abilities.con = table[4];
} break;
case CLASS_THIEF: {
ch- > abilities.dex = table[0];
ch- > abilities.str = table[1];
ch- > abilities.con = table[2];
ch- > abilities.intel = table[3];
ch- > abilities.wis = table[4];
} break;
case CLASS_WARRIOR: {
ch- > abilities.str = table[0];
ch- > abilities.dex = table[1];
ch- > abilities.con = table[2];
ch- > abilities.wis = table[3];
ch- > abilities.intel = table[4];
if (ch- > abilities.str == 18)
ch- > abilities.str_add = number(0,100);
} break;
}
ch- > tmpabilities = ch- > abilities;
}