diff options
author | Johanna Ploog <j-p-e-g@users.sourceforge.net> | 2009-12-15 23:26:01 +0100 |
---|---|---|
committer | Johanna Ploog <j-p-e-g@users.sourceforge.net> | 2009-12-16 00:37:56 +0100 |
commit | 615f045509987fc9012c764b956d000108452428 (patch) | |
tree | 97050f283044e817db6b1e2ff277c5b5d0305196 /crawl-ref/source | |
parent | eafd79ae664bb6e38f4ddcd97fda1ef60570e0e1 (diff) | |
download | crawl-ref-615f045509987fc9012c764b956d000108452428.tar.gz crawl-ref-615f045509987fc9012c764b956d000108452428.zip |
For the acquirement statistics, count unseen/total spells per discipline.
Diffstat (limited to 'crawl-ref/source')
-rw-r--r-- | crawl-ref/source/wiz-item.cc | 52 |
1 files changed, 50 insertions, 2 deletions
diff --git a/crawl-ref/source/wiz-item.cc b/crawl-ref/source/wiz-item.cc index f214c2846c..843535e374 100644 --- a/crawl-ref/source/wiz-item.cc +++ b/crawl-ref/source/wiz-item.cc @@ -991,8 +991,56 @@ static void _debug_acquirement_stats(FILE *ostat) dump_skills(skills); fprintf(ostat, "%s\n\n", skills.c_str()); - // TODO: For spellbooks, for each spell discipline list the number of - // known spells and castable seen/unseen spells + if (type == OBJ_BOOKS && you.skills[SK_SPELLCASTING]) + { + // For spellbooks, for each spell discipline, list the number of + // unseen and total spells available. + std::vector<int> total_spells(SPTYP_LAST_EXPONENT); + std::vector<int> unseen_spells(SPTYP_LAST_EXPONENT); + + for (int i = 0; i < NUM_SPELLS; ++i) + { + const spell_type spell = (spell_type) i; + + if (!is_valid_spell(spell)) + continue; + + if (you_cannot_memorise(spell)) + continue; + + // Only use spells available in books you might find lying about + // the dungeon. + if (spell_rarity(spell) == -1) + continue; + + const bool seen = you.seen_spell[spell]; + + const unsigned int disciplines = get_spell_disciplines(spell); + for (int d = 0; d < SPTYP_LAST_EXPONENT; ++d) + { + const int disc = 1 << d; + if (disc & SPTYP_DIVINATION) + continue; + + if (disciplines & disc) + { + total_spells[d]++; + if (!seen) + unseen_spells[d]++; + } + } + } + for (int d = 0; d < SPTYP_LAST_EXPONENT; ++d) + { + const int disc = 1 << d; + if (disc & SPTYP_DIVINATION) + continue; + + fprintf(ostat, "%-13s: %d/%d spells unseen\n", + spelltype_long_name(disc), + unseen_spells[d], total_spells[d]); + } + } fprintf(ostat, "\nAcquirement called %d times, total quantity = %d\n\n", acq_calls, total_quant); |