diff options
author | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-08-14 21:19:38 +0000 |
---|---|---|
committer | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-08-14 21:19:38 +0000 |
commit | cb479a4015cd207ba7b4f195b5fa3f7964d4264b (patch) | |
tree | 35f57dfc53840f170e9afbd9c8c926b9cdfb1406 /crawl-ref/source | |
parent | 115d82391cbda83ad4daeca001ff19e0bc3a71d6 (diff) | |
download | crawl-ref-cb479a4015cd207ba7b4f195b5fa3f7964d4264b.tar.gz crawl-ref-cb479a4015cd207ba7b4f195b5fa3f7964d4264b.zip |
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
Diffstat (limited to 'crawl-ref/source')
-rw-r--r-- | crawl-ref/source/spl-cast.cc | 15 |
1 files changed, 13 insertions, 2 deletions
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<int> 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); |