From cb479a4015cd207ba7b4f195b5fa3f7964d4264b Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Fri, 14 Aug 2009 21:19:38 +0000 Subject: Implement 2830788: Randomize the order of exercised skills for multischool spells. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@10545 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/spl-cast.cc | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'crawl-ref/source/spl-cast.cc') diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc index adf96aa5ff..73a025c069 100644 --- a/crawl-ref/source/spl-cast.cc +++ b/crawl-ref/source/spl-cast.cc @@ -2183,7 +2183,6 @@ spret_type your_spells(spell_type spell, int powc, bool allow_fail) void exercise_spell( spell_type spell, bool spc, bool success ) { // (!success) reduces skill increase for miscast spells - int ndx = 0; int skill; int exer = 0; int exer_norm = 0; @@ -2206,11 +2205,23 @@ void exercise_spell( spell_type spell, bool spc, bool success ) skillcount += 4 + random2(10); const int diff = spell_difficulty(spell); - for (ndx = 0; ndx <= SPTYP_LAST_EXPONENT; ndx++) + + // Fill all disciplines into a vector, then shuffle the vector, and + // train in that random order. That way, small xp pools don't always + // train exclusively the first skill. + std::vector disc; + for (int ndx = 0; ndx <= SPTYP_LAST_EXPONENT; ndx++) { if (!spell_typematch( spell, 1 << ndx )) continue; + disc.push_back(ndx); + } + std::random_shuffle(disc.begin(), disc.end()); + + for (unsigned int k = 0; k < disc.size(); ++k) + { + int ndx = disc[k]; skill = spell_type2skill( 1 << ndx ); workout = (random2(1 + diff) / skillcount); -- cgit v1.2.3-54-g00ecf