diff options
author | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-06-27 16:15:37 +0000 |
---|---|---|
committer | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-06-27 16:15:37 +0000 |
commit | d03ad7b05a931a1bd0bc69eb809d30fca8177cb6 (patch) | |
tree | 8d5d564a84a8d8cc9beb29dcd2f6220a318f268b /crawl-ref/source/newgame.cc | |
parent | d360a8a9373ac6d5760d1869617685d553c7b9fb (diff) | |
download | crawl-ref-d03ad7b05a931a1bd0bc69eb809d30fca8177cb6.tar.gz crawl-ref-d03ad7b05a931a1bd0bc69eb809d30fca8177cb6.zip |
Add a new command for firing without quivering on 'F'.
Use puff of fire/ice tiles for ammo of flame/ice being fired.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6169 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/newgame.cc')
-rw-r--r-- | crawl-ref/source/newgame.cc | 184 |
1 files changed, 99 insertions, 85 deletions
diff --git a/crawl-ref/source/newgame.cc b/crawl-ref/source/newgame.cc index e941a984c3..f5b6b9e661 100644 --- a/crawl-ref/source/newgame.cc +++ b/crawl-ref/source/newgame.cc @@ -1902,100 +1902,114 @@ static bool _is_good_combination( species_type spc, job_type cls, bool good) return (restrict != CC_BANNED); } -static bool _choose_book( item_def& book, int firstbook, int numbooks ) +// book 0 = fire (CONJ_I, MINOR_MAGIC_I), 1 = ice (CONJ_II, MINOR_MAGIC_II), +// 2 = summoning (MINOR_MAGIC_III) +static char_choice_restriction _book_restriction(int booktype, + bool summon_too = false) { - int keyin = 0; - clrscr(); - book.base_type = OBJ_BOOKS; - book.quantity = 1; - book.plus = 0; - book.special = 1; - - char_choice_restriction book_restrictions[3]; - - // Fire - switch (you.species) + switch (booktype) { - case SP_OGRE: - // Ogres are, of course, really bad at Fire and Ice, so it's usually - // restricted, but if the summoning book comes into play unrestrict - // those two because ogres are even *worse* at Summonings. - if (numbooks < 3) - book_restrictions[0] = CC_RESTRICTED; - // else fall-through - case SP_HUMAN: - case SP_HIGH_ELF: - case SP_GREY_ELF: - case SP_DEEP_ELF: - case SP_SLUDGE_ELF: - case SP_MOUNTAIN_DWARF: - case SP_HILL_ORC: - case SP_HALFLING: - case SP_GNOME: - case SP_KOBOLD: - case SP_NAGA: - case SP_OGRE_MAGE: - case SP_KENKU: - case SP_DEMONSPAWN: - book_restrictions[0] = CC_UNRESTRICTED; + case 0: // Fire + switch (you.species) + { + case SP_OGRE: + // Ogres are, of course, really bad at Fire and Ice, so it's usually + // restricted, but if the summoning book comes into play unrestrict + // those two because ogres are even *worse* at Summonings. + if (!summon_too) + return (CC_RESTRICTED); + // else fall-through + case SP_HUMAN: + case SP_HIGH_ELF: + case SP_GREY_ELF: + case SP_DEEP_ELF: + case SP_SLUDGE_ELF: + case SP_MOUNTAIN_DWARF: + case SP_HILL_ORC: + case SP_HALFLING: + case SP_GNOME: + case SP_KOBOLD: + case SP_NAGA: + case SP_OGRE_MAGE: + case SP_KENKU: + case SP_DEMONSPAWN: + return (CC_UNRESTRICTED); + + default: + return (CC_RESTRICTED); + } break; - default: - book_restrictions[0] = CC_RESTRICTED; - } + case 1: // Ice + switch (you.species) + { + case SP_OGRE_MAGE: + if (!summon_too) + return (CC_RESTRICTED); + // else fall-through + case SP_HUMAN: + case SP_HIGH_ELF: + case SP_GREY_ELF: + case SP_DEEP_ELF: + case SP_SLUDGE_ELF: + case SP_HILL_ORC: + case SP_MERFOLK: + case SP_HALFLING: + case SP_GNOME: + case SP_KOBOLD: + case SP_NAGA: + case SP_OGRE: + case SP_GHOUL: + case SP_VAMPIRE: + return (CC_UNRESTRICTED); - // Ice - switch (you.species) - { - case SP_OGRE_MAGE: - if (numbooks < 3) - book_restrictions[0] = CC_RESTRICTED; - // else fall-through - case SP_HUMAN: - case SP_HIGH_ELF: - case SP_GREY_ELF: - case SP_DEEP_ELF: - case SP_SLUDGE_ELF: - case SP_HILL_ORC: - case SP_MERFOLK: - case SP_HALFLING: - case SP_GNOME: - case SP_KOBOLD: - case SP_NAGA: - case SP_OGRE: - case SP_GHOUL: - case SP_VAMPIRE: - book_restrictions[1] = CC_UNRESTRICTED; + default: + return (CC_RESTRICTED); + } break; - default: - book_restrictions[1] = CC_RESTRICTED; + case 2: // Summoning + switch (you.species) + { + case SP_HUMAN: + case SP_GREY_ELF: + case SP_DEEP_ELF: + case SP_SLUDGE_ELF: + case SP_MERFOLK: + case SP_GNOME: + case SP_KOBOLD: + case SP_NAGA: + case SP_OGRE_MAGE: + case SP_KENKU: + case SP_DEMONSPAWN: + case SP_VAMPIRE: + return (CC_UNRESTRICTED); + break; + + default: + if (player_genus(GENPC_DRACONIAN)) + return (CC_UNRESTRICTED); + else + return (CC_RESTRICTED); + } } + return (CC_RESTRICTED); +} - // Summoning - switch (you.species) - { - case SP_HUMAN: - case SP_GREY_ELF: - case SP_DEEP_ELF: - case SP_SLUDGE_ELF: - case SP_MERFOLK: - case SP_GNOME: - case SP_KOBOLD: - case SP_NAGA: - case SP_OGRE_MAGE: - case SP_KENKU: - case SP_DEMONSPAWN: - case SP_VAMPIRE: - book_restrictions[2] = CC_UNRESTRICTED; - break; - default: - if (player_genus(GENPC_DRACONIAN)) - book_restrictions[2] = CC_UNRESTRICTED; - else - book_restrictions[2] = CC_RESTRICTED; - } +static bool _choose_book( item_def& book, int firstbook, int numbooks ) +{ + int keyin = 0; + clrscr(); + book.base_type = OBJ_BOOKS; + book.quantity = 1; + book.plus = 0; + book.special = 1; + + const bool summons_too = (numbooks == 3); + char_choice_restriction book_restrictions[3]; + for (int i = 0; i < numbooks; i++) + book_restrictions[i] = _book_restriction(i, summons_too); // Using the fact that CONJ_I and MINOR_MAGIC_I are both // fire books, CONJ_II and MINOR_MAGIC_II are both ice books. @@ -2083,7 +2097,7 @@ static bool _choose_book( item_def& book, int firstbook, int numbooks ) else ng_book = keyin - 'a' + 1; - if ( Options.random_pick || keyin == '*' ) + if (Options.random_pick || keyin == '*') keyin = random2(numbooks) + 'a'; book.sub_type = firstbook + keyin - 'a'; |