Simplify the message given when none of the available spells can be memorised.
The descriptions of the three dangerous spellbooks now mention that the books will lash out at the player if a memorisation fails. Also, the "some of the more powerful grimoires are not to be toyed with" warning has been removed from all of the normal spellbooks, since the dangerous spellbooks are adequetly warned.
If a spell to be memorised is only available from a dangerous spell book then colour that spell light red and warn the player if they select it for memorisation. (Not yet handled is any logic for choosing between multiple dangerous spell books if the same spell is in more than one of them)
is_dangerous_item() now returns true for the three dangerous spellbooks, so they'll be colored differently in the inventory.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9891 c06c8d41-db1a-0410-9941-cceddc491573
I6BG7QKQHT7OMBMSD5LN6ILPSZOT6RM4RY3VB2HFUXZMWQTZPW2AC
T35GO7UD2HKES4FLJWS3VPJ2AIM5JE7ROGY6EUH6CKPG7WUBNG5QC
BUCKUU5YFFMAWNPUA3F2PKUEYA6SUDITRKIZUMAQ3SLC4M3ZGR3QC
QO5ZJWQ3JK3PEGBPTQSAYIPEJEHG2M2KTD74227G5VG7DVXUL3BQC
K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC
ASLW3Z5PAVZSWJEMMMVZT226P44EKSAD47QS72JIFJESAI3RPN3AC
4NNN5LKBZLDXMDN2322PBG7WFHF4TWOEMVODSO7BXXCM3AZKQN4QC
SR63JKG2P3RFZPY4CCMS4M6RZWUPKOQ4KAQN2JD6WKZLF3S6V3GAC
R7TUO3AXCHGFSVHHXDNGAAXLWSNY7L4T5D7LOPQILBHGFDA3KFNAC
DO6W27HYFNVFMX7FSGG4RCX5UW32ORCVYZBQYPCUD4VCHMA4LFFQC
UEI5JAVCMN7Y2SACTEZPZSNFJWOJTC55G24Q6LKQCT4XNDH5ZQIAC
FOQJ5S5WR7P7YMEWQ5Q4O7LTGLQ7LFVM4I2SG2Q7MIVC4PB2JHTQC
RPOZZWKG5GLPHVZZ7ZKMKS64ZMV2LDCQSARBJFJ6FZOTOKCQO7FAC
YCL3W2PFE6ILTGBFODCSXNPDIA46KVSZP2TI7HDMYAOEJT65RIEAC
GSJA56E3ORVIBCBA6T6WU2HE4DCLJ6NZPW76O7L54N4CYPKLJOWQC
MRYUR2FR4XTN6J7KNILDIB7ZUNDOXM35BD2C3AT24T4AXQOVD4AAC
VCG3BRIYRTNNWYC3LOXD6KFGXOX37HAFW2HNV7WXVG2V7EUHLDZQC
VMIKJGB6CSFVZS6VMQNP33ALEDEO2TARDICVGDJFMZ4WSPTV3LFAC
I7QLYOTE6DLQZM7YWUWYLKHRJRB2A3STQ42ALSRGQICEWKD2QTEQC
UALBRD4RSL2YLBM76I62QZGC2SKRT2ZUPSKQE3E4KEGZ3VZNCJFQC
SXBH7XRYBHBTXUKW3BTHBTS556XX7LOAFVOHFN4DFLHUPLKLIM2QC
CCRQESB4ADT4WA7FGLNZZXAJ6G5QMCTYCZIWORBN45P6ZPILC34AC
FZ6BRY753ZMHCLP6EKOHJDA4J2BTND3UXVHVLZBBT77R4CMETMPAC
// None of the spells can be memorised; tell the player why.
std::string prefix =
make_stringf("You cannot memorise any new spells. Out of %u "
"available spells, ", all_spells.size());
unsigned int total = num_known + num_race + num_low_xl + num_low_levels;
std::vector<std::string> causes;
if (num_known)
{
causes.push_back(make_stringf("you already know %u of them",
num_known));
}
if (num_race)
{
causes.push_back(make_stringf("%u cannot be memorised because of "
"your race", num_race));
}
if (num_low_xl)
{
causes.push_back(make_stringf("%u cannot be memorised because of "
"your low experience level",
num_low_xl));
}
if (num_low_levels)
if (num_known == total)
mpr("You already know all available spells.", MSGCH_PROMPT);
else if (num_race == total || (num_known + num_race) == total)
causes.push_back(make_stringf("%u cannot be memorised because you "
"don't have enough free spell levels",
num_low_levels));
std::string species = species_name(you.species, 0);
mprf(MSGCH_PROMPT,
"You cannot memorize any of the available spells because you "
"are a %s.", lowercase_string(species).c_str());
else if (num_low_levels > 0)
mpr("You do not have enough free spell levels to memorize any of the "
"available spells.", MSGCH_PROMPT);
else if (num_low_xl > 0)
mpr("You aren't experienced enough yet to memorize any of the "
"available spells.", MSGCH_PROMPT);
else
mpr("You can't memorize any new spells for an unknown reason; "
"please file a bug report.", MSGCH_PROMPT);
unsigned int total = num_known + num_race + num_low_xl + num_low_levels;
if (total < all_spells.size())
{
causes.push_back(make_stringf("%u cannot be accounted for (please "
"file a bug report)",
all_spells.size() - total));
}
mpr_comma_separated_list(prefix, causes, " and ", ", ", MSGCH_PROMPT);
chance = spell_fail(specspell);
if (chance > 0 && is_dangerous_spellbook(it->second))
{
item_def book;
book.base_type = OBJ_BOOKS;
book.sub_type = it->second;
book.quantity = 1;
book.flags |= ISFLAG_IDENT_MASK;
char buf[180];
sprintf(buf, "The only spellbook you have which contains that spell "
"is %s, a dangerous spellbook which will strike back at you "
"if you memorisation attempt fails. Attempt to memorise "
"anyways?",
book.name(DESC_NOCAP_THE).c_str());
if (!yesno(buf, false, 'n'))
{
canned_msg( MSG_OK );
return (false);
}
}
bool is_dangerous_spellbook(const int book_type)
{
switch(book_type)
{
case BOOK_NECRONOMICON:
case BOOK_DEMONOLOGY:
case BOOK_ANNIHILATIONS:
return (true);
default:
break;
}
return (false);
}
bool is_dangerous_spellbook(const item_def &book)
{
ASSERT(book.base_type == OBJ_BOOKS);
return is_dangerous_spellbook(book.sub_type);
}