summaryrefslogtreecommitdiffstats
path: root/trunk/source/describe.cc
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2006-08-02 12:54:15 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2006-08-02 12:54:15 +0000
commitd5e5340c3926d1cf97f6cba151ffaecb20bfb35f (patch)
treed1faf7d5b27df8f3c523a8dd33357804118e62b1 /trunk/source/describe.cc
parent7b2204d69f21d7075e4666ee032d7a129081bc4b (diff)
downloadcrawl-ref-d5e5340c3926d1cf97f6cba151ffaecb20bfb35f.tar.gz
crawl-ref-d5e5340c3926d1cf97f6cba151ffaecb20bfb35f.zip
Integrated travel patch as of 20060727
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'trunk/source/describe.cc')
-rw-r--r--trunk/source/describe.cc159
1 files changed, 96 insertions, 63 deletions
diff --git a/trunk/source/describe.cc b/trunk/source/describe.cc
index a02e33b95d..173e9b0ed4 100644
--- a/trunk/source/describe.cc
+++ b/trunk/source/describe.cc
@@ -39,6 +39,7 @@
#include "randart.h"
#include "religion.h"
#include "skills2.h"
+#include "spl-book.h"
#include "stuff.h"
#include "wpn-misc.h"
#include "spl-util.h"
@@ -347,7 +348,8 @@ static std::string describe_demon(void)
globby *= strlen( ghost.name );
- srand( globby );
+ push_rng_state();
+ seed_rng( globby );
std::string description = "A powerful demon, ";
@@ -670,6 +672,7 @@ static std::string describe_demon(void)
break;
}
+ pop_rng_state();
return description;
} // end describe_demon()
@@ -3281,9 +3284,24 @@ void describe_item( const item_def &item )
clrscr();
std::string description = get_item_description( item, 1 );
-
print_description(description);
+ if ( (item.base_type == OBJ_BOOKS && item_type_known(item)
+ && item.sub_type != BOOK_DESTRUCTION
+ && item.sub_type != BOOK_MANUAL)
+ ||
+ count_staff_spells(item, true) > 1 )
+ {
+ formatted_string fs;
+ item_def dup = item;
+ spellbook_contents( dup,
+ item.base_type == OBJ_BOOKS?
+ RBOOK_READ_SPELL
+ : RBOOK_USE_STAFF,
+ &fs );
+ fs.display(2, -2);
+ }
+
if (getch() == 0)
getch();
@@ -5789,67 +5807,9 @@ void describe_monsters(int class_described, unsigned char which_mons)
break;
case MONS_PLAYER_GHOST:
- {
- char tmp_buff[ INFO_SIZE ];
-
- // We're fudgins stats so that unarmed combat gets based off
- // of the ghost's species, not the player's stats... exact
- // stats are required anyways, all that matters is whether
- // dex >= str. -- bwr
- const int dex = 10;
- int str;
- switch (ghost.values[GVAL_SPECIES])
- {
- case SP_HILL_DWARF:
- case SP_MOUNTAIN_DWARF:
- case SP_TROLL:
- case SP_OGRE:
- case SP_OGRE_MAGE:
- case SP_MINOTAUR:
- case SP_HILL_ORC:
- case SP_CENTAUR:
- case SP_NAGA:
- case SP_MUMMY:
- case SP_GHOUL:
- str = 15;
- break;
-
- case SP_HUMAN:
- case SP_DEMIGOD:
- case SP_DEMONSPAWN:
- str = 10;
- break;
-
- default:
- str = 5;
- break;
- }
-
- snprintf( tmp_buff, sizeof(tmp_buff),
- "The apparition of %s the %s, a%s %s %s.$",
- ghost.name,
-
- skill_title( ghost.values[GVAL_BEST_SKILL],
- ghost.values[GVAL_SKILL_LEVEL],
- ghost.values[GVAL_SPECIES],
- str, dex, GOD_NO_GOD ),
-
- (ghost.values[GVAL_EXP_LEVEL] < 4) ? " weakling" :
- (ghost.values[GVAL_EXP_LEVEL] < 7) ? "n average" :
- (ghost.values[GVAL_EXP_LEVEL] < 11) ? "n experienced" :
- (ghost.values[GVAL_EXP_LEVEL] < 16) ? " powerful" :
- (ghost.values[GVAL_EXP_LEVEL] < 22) ? " mighty" :
- (ghost.values[GVAL_EXP_LEVEL] < 26) ? " great" :
- (ghost.values[GVAL_EXP_LEVEL] < 27) ? "n awesomely powerful"
- : " legendary",
-
- species_name( ghost.values[GVAL_SPECIES],
- ghost.values[GVAL_EXP_LEVEL] ),
-
- get_class_name( ghost.values[GVAL_CLASS] ) );
-
- description += tmp_buff;
- }
+ description += "The apparition of ";
+ description += ghost_description();
+ description += ".$";
break;
case MONS_PANDEMONIUM_DEMON:
@@ -6168,6 +6128,79 @@ void describe_monsters(int class_described, unsigned char which_mons)
#endif
} // end describe_monsters
+//---------------------------------------------------------------
+//
+// ghost_description
+//
+// Describes the current ghost's previous owner. The caller must
+// prepend "The apparition of" or whatever and append any trailing
+// punctuation that's wanted.
+//
+//---------------------------------------------------------------
+std::string ghost_description(bool concise)
+{
+ char tmp_buff[ INFO_SIZE ];
+
+ // We're fudging stats so that unarmed combat gets based off
+ // of the ghost's species, not the player's stats... exact
+ // stats are required anyways, all that matters is whether
+ // dex >= str. -- bwr
+ const int dex = 10;
+ int str;
+ switch (ghost.values[GVAL_SPECIES])
+ {
+ case SP_HILL_DWARF:
+ case SP_MOUNTAIN_DWARF:
+ case SP_TROLL:
+ case SP_OGRE:
+ case SP_OGRE_MAGE:
+ case SP_MINOTAUR:
+ case SP_HILL_ORC:
+ case SP_CENTAUR:
+ case SP_NAGA:
+ case SP_MUMMY:
+ case SP_GHOUL:
+ str = 15;
+ break;
+
+ case SP_HUMAN:
+ case SP_DEMIGOD:
+ case SP_DEMONSPAWN:
+ str = 10;
+ break;
+
+ default:
+ str = 5;
+ break;
+ }
+
+ snprintf( tmp_buff, sizeof(tmp_buff),
+ "%s the %s, a%s %s %s",
+ ghost.name,
+
+ skill_title( ghost.values[GVAL_BEST_SKILL],
+ ghost.values[GVAL_SKILL_LEVEL],
+ ghost.values[GVAL_SPECIES],
+ str, dex, GOD_NO_GOD ),
+
+ (ghost.values[GVAL_EXP_LEVEL] < 4) ? " weakling" :
+ (ghost.values[GVAL_EXP_LEVEL] < 7) ? "n average" :
+ (ghost.values[GVAL_EXP_LEVEL] < 11) ? "n experienced" :
+ (ghost.values[GVAL_EXP_LEVEL] < 16) ? " powerful" :
+ (ghost.values[GVAL_EXP_LEVEL] < 22) ? " mighty" :
+ (ghost.values[GVAL_EXP_LEVEL] < 26) ? " great" :
+ (ghost.values[GVAL_EXP_LEVEL] < 27) ? "n awesomely powerful"
+ : " legendary",
+
+ ( concise? get_species_abbrev(ghost.values[GVAL_SPECIES]) :
+ species_name( ghost.values[GVAL_SPECIES],
+ ghost.values[GVAL_EXP_LEVEL] ) ),
+
+ ( concise? get_class_abbrev(ghost.values[GVAL_CLASS]) :
+ get_class_name( ghost.values[GVAL_CLASS] ) ) );
+
+ return std::string(tmp_buff);
+}
static void print_god_abil_desc( int abil )
{