git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1865 c06c8d41-db1a-0410-9941-cceddc491573
XEC3L6W6TGIRWHINULNLKCIP4UBMHFYE33WJL7272I2GRRCFZBWAC }}int count_worn_ego( special_armour_type ego ){int result = 0;for ( int slot = EQ_CLOAK; slot <= EQ_BODY_ARMOUR; ++slot )if (you.equip[slot] != -1 &&get_armour_ego_type(you.inv[you.equip[slot]]) == ego)result++;return result;}static int strength_modifier(){int result = 0;if ( you.duration[DUR_MIGHT] )result += 5;// ego items of strengthresult += 3 * count_worn_ego(SPARM_STRENGTH);// rings of strengthresult += player_equip( EQ_RINGS_PLUS, RING_STRENGTH );// randarts of strengthresult += scan_randarts(RAP_STRENGTH);// mutationsresult += you.mutation[MUT_STRONG] - you.mutation[MUT_WEAK];result += you.mutation[MUT_STRONG_STIFF]-you.mutation[MUT_FLEXIBLE_WEAK];// transformationsswitch ( you.attribute[ATTR_TRANSFORMATION] ){case TRAN_STATUE: result += 2; break;case TRAN_DRAGON: result += 10; break;case TRAN_LICH: result += 3; break;case TRAN_SERPENT_OF_HELL: result += 13; break;default: break;
static int dex_modifier(){int result = 0;// ego items of dexterityresult += 3 * count_worn_ego(SPARM_DEXTERITY);// rings of dexterityresult += player_equip( EQ_RINGS_PLUS, RING_DEXTERITY );// randarts of dexterityresult += scan_randarts(RAP_DEXTERITY);// mutationsresult += you.mutation[MUT_AGILE] - you.mutation[MUT_CLUMSY];result += you.mutation[MUT_FLEXIBLE_WEAK]-you.mutation[MUT_STRONG_STIFF];result -= you.mutation[MUT_BLACK_SCALES];result -= you.mutation[MUT_BONEY_PLATES];const int grey2_modifier[] = { 0, -1, -1, -2 };const int metallic_modifier[] = { 0, -2, -3, -4 };const int yellow_modifier[] = { 0, 0, -1, -2 };const int red2_modifier[] = { 0, 0, -1, -2 };result -= grey2_modifier[you.mutation[MUT_GREY2_SCALES]];result -= metallic_modifier[you.mutation[MUT_METALLIC_SCALES]];result -= yellow_modifier[you.mutation[MUT_YELLOW_SCALES]];result -= red2_modifier[you.mutation[MUT_RED2_SCALES]];// transformationsswitch ( you.attribute[ATTR_TRANSFORMATION] ){case TRAN_SPIDER: result += 5; break;case TRAN_STATUE: result -= 2; break;case TRAN_AIR: result += 8; break;default: break;}return result;}static int int_modifier(){int result = 0;// ego items of intelligenceresult += 3 * count_worn_ego(SPARM_INTELLIGENCE);// rings of intelligenceresult += player_equip( EQ_RINGS_PLUS, RING_INTELLIGENCE );// randarts of intelligenceresult += scan_randarts(RAP_INTELLIGENCE);// mutationsresult += you.mutation[MUT_CLEVER] - you.mutation[MUT_DOPEY];return result;}int stat_modifier( stat_type stat ){switch ( stat ){case STAT_STRENGTH: return strength_modifier();case STAT_DEXTERITY: return dex_modifier();case STAT_INTELLIGENCE: return int_modifier();default:mprf(MSGCH_DANGER, "Bad stat: %d", stat);return 0;}}
// not yet implemented// should shuffle *base* stat levelsreturn;
stat_type stats[3] = {STAT_STRENGTH, STAT_DEXTERITY, STAT_INTELLIGENCE};int old_base[3] = { you.strength, you.dex, you.intel};int old_max[3] = {you.max_strength, you.max_dex, you.max_intel};int modifiers[3];int perm[3] = { 0, 1, 2 };for ( int i = 0; i < 3; ++i )modifiers[i] = stat_modifier(stats[i]);std::random_shuffle( perm, perm + 3 );int new_base[3];int new_max[3];for ( int i = 0; i < 3; ++i ){new_base[perm[i]] = old_base[i] - modifiers[i] + modifiers[perm[i]];new_max[perm[i]] = old_max[i] - modifiers[i] + modifiers[perm[i]];}// Sometimes you just long for Python.you.strength = new_base[0];you.dex = new_base[1];you.intel = new_base[2];you.max_strength = new_max[0];you.max_dex = new_max[1];you.max_intel = new_max[2];you.redraw_strength = true;you.redraw_intelligence = true;you.redraw_dexterity = true;you.redraw_evasion = true;