summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-18 20:21:53 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-18 20:21:53 +0000
commit341258b95e2dde491b2b8aef794e5fd6ac3156ee (patch)
tree260ca53fb36d35627b441d400b26b4beb8404135
parentc64b21cdfddbb84b459273e7990bd80a1e91d970 (diff)
downloadcrawl-ref-341258b95e2dde491b2b8aef794e5fd6ac3156ee.tar.gz
crawl-ref-341258b95e2dde491b2b8aef794e5fd6ac3156ee.zip
Add the framework for descriptions for abilities to be read from the
ability menu (a!) Currently only contains descriptions for Zin, TSO and "Renounce Religion". Also, now I'm worried that players might accidentally press '?' instead of '!' and then apply an ability when they only wanted to read its description. (Of course, with some of them you can opt out, e.g. because they need targeting, but for others it's a real problem.) There must be a good solution around somewhere. Abilities are not (yet) searchable in the database. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5958 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/docs/changes.stone_soup1
-rw-r--r--crawl-ref/source/abl-show.cc84
-rw-r--r--crawl-ref/source/abl-show.h3
-rw-r--r--crawl-ref/source/dat/descript/ability.txt350
-rw-r--r--crawl-ref/source/dat/descript/spells.txt2
-rw-r--r--crawl-ref/source/database.cc11
-rw-r--r--crawl-ref/source/decks.cc6
-rw-r--r--crawl-ref/source/describe.cc9
-rw-r--r--crawl-ref/source/spl-data.h2
9 files changed, 441 insertions, 27 deletions
diff --git a/crawl-ref/docs/changes.stone_soup b/crawl-ref/docs/changes.stone_soup
index 240044de5e..5a069227d4 100644
--- a/crawl-ref/docs/changes.stone_soup
+++ b/crawl-ref/docs/changes.stone_soup
@@ -23,6 +23,7 @@ Interface
* Overhauled (f)iring interface: abolish (t)hrowing, output quiver in status.
* Allow selection of equipment slots from '%' overview screen.
* Improved butchering interface.
+* Improved religion and skills interface. (Press ^! and m?, respectively.)
* Added coloured HP/Magic bars.
* Many new tutorial information triggers.
* Allow searching item/monster/spell descriptions ('?/' command).
diff --git a/crawl-ref/source/abl-show.cc b/crawl-ref/source/abl-show.cc
index 8bd24d35a2..12e09d2be3 100644
--- a/crawl-ref/source/abl-show.cc
+++ b/crawl-ref/source/abl-show.cc
@@ -38,8 +38,10 @@
#include "abyss.h"
#include "beam.h"
+#include "database.h"
#include "decks.h"
#include "delay.h"
+#include "describe.h"
#include "effects.h"
#include "food.h"
#include "it_use2.h"
@@ -208,7 +210,7 @@ static const ability_def Ability_List[] =
// as exhaustion's only (and designed) effect is preventing Berserk. -- bwr
{ ABIL_FLY_II, "Fly", 0, 0, 25, 0, ABFLAG_NONE },
{ ABIL_DELAYED_FIREBALL, "Release Delayed Fireball", 0, 0, 0, 0, ABFLAG_INSTANT },
- { ABIL_MUMMY_RESTORATION, "Restoration", 1, 0, 0, 0, ABFLAG_PERMANENT_MP },
+ { ABIL_MUMMY_RESTORATION, "Self-Restoration", 1, 0, 0, 0, ABFLAG_PERMANENT_MP },
// EVOKE abilities use Evocations and come from items:
// Mapping, Teleportation, and Blink can also come from mutations
@@ -321,7 +323,6 @@ static const ability_def Ability_List[] =
{ ABIL_RENOUNCE_RELIGION, "Renounce Religion", 0, 0, 0, 0, ABFLAG_NONE },
};
-
const struct ability_def & get_ability_def( ability_type abil )
{
for (unsigned int i = 0;
@@ -810,6 +811,35 @@ std::vector<const char*> get_ability_names()
return result;
}
+static void _print_talent_description(talent tal)
+{
+ clrscr();
+
+ std::string name = get_ability_def(tal.which).name;
+
+ // The suffix is necessary to distinguish between similarly named spells.
+ // Yes, this is a hack. (XXX)
+ std::string lookup = getLongDescription(name + "ability");
+ if (lookup.empty())
+ {
+ // Try again without the suffix.
+ lookup = getLongDescription(name);
+ }
+
+ if (lookup.empty()) // Still nothing found?
+ cprintf("No description found.");
+ else
+ {
+ std::ostringstream data;
+ data << name << "$$" << lookup;
+ print_description(data.str());
+ }
+ if (getch() == 0)
+ getch();
+
+ clrscr();
+}
+
bool activate_ability()
{
if (you.duration[DUR_BERSERKER])
@@ -855,7 +885,8 @@ bool activate_ability()
int selected = -1;
while (selected < 0)
{
- msg::streams(MSGCH_PROMPT) << "Use which ability? (? or * to list)"
+ msg::streams(MSGCH_PROMPT) << "Use which ability? (? or * to list, ! "
+ "for descriptions)"
<< std::endl;
const int keyin = get_ch();
@@ -869,15 +900,28 @@ bool activate_ability()
return (false);
}
}
- else if (keyin == ESCAPE || keyin == ' '
- || keyin == '\r' || keyin == '\n')
+ else if (keyin == '!')
+ {
+ while (true)
+ {
+ selected = choose_ability_menu(talents, true);
+ if (selected == -1)
+ {
+ canned_msg( MSG_OK );
+ return (false);
+ }
+ _print_talent_description(talents[selected]);
+ }
+ }
+ else if (keyin == ESCAPE || keyin == ' ' || keyin == '\r'
+ || keyin == '\n')
{
canned_msg( MSG_OK );
return (false);
}
else if ( isalpha(keyin) )
{
- // try to find the hotkey
+ // Try to find the hotkey.
for (unsigned int i = 0; i < talents.size(); ++i)
{
if (talents[i].hotkey == keyin)
@@ -887,7 +931,7 @@ bool activate_ability()
}
}
- // if we can't, cancel out
+ // If we can't, cancel out.
if (selected < 0)
{
mpr("You can't do that.");
@@ -1902,24 +1946,34 @@ static void _pay_ability_costs(const ability_def& abil)
lose_piety( piety_cost );
}
-int choose_ability_menu(const std::vector<talent>& talents)
+int choose_ability_menu(const std::vector<talent>& talents, bool describe)
{
Menu abil_menu(MF_SINGLESELECT | MF_ANYPRINTABLE, "ability");
+
abil_menu.set_highlighter(NULL);
abil_menu.set_title(
new MenuEntry(" Ability "
"Cost Success"));
+ if (describe)
+ {
+ abil_menu.set_more(formatted_string::parse_string(
+ "Choose any ability to read its description, "
+ "or exit the menu with Escape."));
+ abil_menu.set_flags(MF_SINGLESELECT | MF_ANYPRINTABLE |
+ MF_ALWAYS_SHOW_MORE);
+ }
+
int numbers[52];
- for ( int i = 0; i < 52; ++i )
+ for (int i = 0; i < 52; ++i)
numbers[i] = i;
bool found_invocations = false;
- // first add all non-invocations
- for ( unsigned int i = 0; i < talents.size(); ++i )
+ // First add all non-invocations.
+ for (unsigned int i = 0; i < talents.size(); ++i)
{
- if ( talents[i].is_invocation )
+ if (talents[i].is_invocation)
found_invocations = true;
else
{
@@ -1930,12 +1984,12 @@ int choose_ability_menu(const std::vector<talent>& talents)
}
}
- if ( found_invocations )
+ if (found_invocations)
{
abil_menu.add_entry(new MenuEntry(" Invocations - ", MEL_SUBTITLE));
- for ( unsigned int i = 0; i < talents.size(); ++i )
+ for (unsigned int i = 0; i < talents.size(); ++i)
{
- if ( talents[i].is_invocation )
+ if (talents[i].is_invocation)
{
MenuEntry* me = new MenuEntry(_describe_talent(talents[i]),
MEL_ITEM, 1, talents[i].hotkey);
diff --git a/crawl-ref/source/abl-show.h b/crawl-ref/source/abl-show.h
index 387d7b7749..c7207ee688 100644
--- a/crawl-ref/source/abl-show.h
+++ b/crawl-ref/source/abl-show.h
@@ -70,7 +70,8 @@ const struct ability_def & get_ability_def( ability_type abil );
const char* ability_name(ability_type ability);
const std::string make_cost_description( ability_type ability );
std::vector<const char*> get_ability_names();
-int choose_ability_menu(const std::vector<talent>& talents);
+int choose_ability_menu(const std::vector<talent>& talents,
+ bool describe = false);
// last updated 12may2000 {dlb}
/* ***********************************************************************
diff --git a/crawl-ref/source/dat/descript/ability.txt b/crawl-ref/source/dat/descript/ability.txt
new file mode 100644
index 0000000000..2cdea0c389
--- /dev/null
+++ b/crawl-ref/source/dat/descript/ability.txt
@@ -0,0 +1,350 @@
+%%%%
+No ability
+
+If you get this description, it is a bug.
+%%%%
+Spit Poison
+
+There's currently no description for this ability...
+%%%%
+Sense Surroundings
+
+There's currently no description for this ability...
+%%%%
+Teleportation
+
+There's currently no description for this ability...
+%%%%
+Blink ability
+
+There's currently no description for this ability...
+%%%%
+Breathe Fire
+
+There's currently no description for this ability...
+%%%%
+Breathe Frost
+
+There's currently no description for this ability...
+%%%%
+Breathe Poison Gas
+
+There's currently no description for this ability...
+%%%%
+Breathe Lightning
+
+There's currently no description for this ability...
+%%%%
+Breathe Power
+
+There's currently no description for this ability...
+%%%%
+Breathe Sticky Flame
+
+There's currently no description for this ability...
+%%%%
+Breathe Steam
+
+There's currently no description for this ability...
+%%%%
+Bat Form
+
+There's currently no description for this ability...
+%%%%
+Spit Acid
+
+There's currently no description for this ability...
+%%%%
+# Both for Fly I and II.
+Fly
+
+There's currently no description for this ability...
+%%%%
+Summon Minor Demon
+
+There's currently no description for this ability...
+%%%%
+Summon Demon
+
+There's currently no description for this ability...
+%%%%
+Hellfire
+
+There's currently no description for this ability...
+%%%%
+Torment
+
+There's currently no description for this ability...
+%%%%
+Raise Dead
+
+There's currently no description for this ability...
+%%%%
+Control Demon
+
+There's currently no description for this ability...
+%%%%
+Gate Yourself to Pandemonium
+
+There's currently no description for this ability...
+%%%%
+Channeling
+
+There's currently no description for this ability...
+%%%%
+Throw Flame ability
+
+There's currently no description for this ability...
+%%%%
+Throw Frost ability
+
+There's currently no description for this ability...
+%%%%
+Bolt of Draining ability
+
+There's currently no description for this ability...
+%%%%
+Release Delayed Fireball
+
+There's currently no description for this ability...
+%%%%
+Self-Restoration
+
+There's currently no description for this ability...
+%%%%
+Evoke Sense Surroundings
+
+There's currently no description for this ability...
+%%%%
+Evoke Teleportation
+
+There's currently no description for this ability...
+%%%%
+Evoke Blink
+
+There's currently no description for this ability...
+%%%%
+Evoke Berserk Rage
+
+There's currently no description for this ability...
+%%%%
+Evoke Invisibility
+
+There's currently no description for this ability...
+%%%%
+Turn Visible
+
+There's currently no description for this ability...
+%%%%
+Evoke Levitation
+
+There's currently no description for this ability...
+%%%%
+Stop Levitating
+
+There's currently no description for this ability...
+%%%%
+End Transformation
+
+There's currently no description for this ability...
+%%%%
+# Zin
+Recite
+
+Preaching to monsters about Zin's laws leads to various results. It
+works best on humanoids, worse on demons and not at all on beasts.
+%%%%
+Vitalisation
+
+If Zin is most pleased with you, you can Vitalise yourself. This will
+restore Health, Magic, attribute points, or unrot you. In case none of
+these is necessary, you gain temporary boosts to your attributes
+instead. It is possible to Vitalise several times in succession for
+greater effect.
+%%%%
+Sanctuary
+
+There's currently no description for this ability...
+%%%%
+# The Shining One
+Divine Shield
+
+Conjures up a divine shield that stacks with an ordinary shield and can
+be used even when wielding a two-handed weapon, as the Divine Shield is
+managed by the Shining One.
+%%%%
+Cleansing Flame
+
+Hurls a huge blast of divine fury, severely damaging undead and demons.
+All other hostiles also take damage, if less so, whereas allies are
+never affected.
+%%%%
+Summon Daeva
+
+Summoned Daevas are powerful warriors against evil. They might be blessed
+by the Shining One to stay longer or even permanently in this world.
+%%%%
+# Both Kikubaaqudgha and Yredelmnul.
+Recall Undead Slaves
+
+There's currently no description for this ability...
+%%%%
+# Kikubaaqudgha
+Enslave Undead
+
+There's currently no description for this ability...
+%%%%
+Invoke Death
+
+There's currently no description for this ability...
+%%%%
+# Yredelemnul
+Animate Corpse
+
+There's currently no description for this ability...
+%%%%
+Animate Dead ability
+
+There's currently no description for this ability...
+%%%%
+Drain Life
+
+There's currently no description for this ability...
+%%%%
+Control Undead
+
+There's currently no description for this ability...
+%%%%
+# Okawaru
+Might
+
+There's currently no description for this ability...
+%%%%
+Haste
+
+There's currently no description for this ability...
+%%%%
+# Makhleb
+Minor Destruction
+
+There's currently no description for this ability...
+%%%%
+Lesser Servant of Makhleb
+
+There's currently no description for this ability...
+%%%%
+Major Destruction
+
+There's currently no description for this ability...
+%%%%
+Greater Servant of Makhleb
+
+There's currently no description for this ability...
+%%%%
+# Sif Muna
+Channel Energy
+
+There's currently no description for this ability...
+%%%%
+Forget Spell
+
+There's currently no description for this ability...
+%%%%
+# Trog
+Burn Books
+
+There's currently no description for this ability...
+%%%%
+Berserk
+
+There's currently no description for this ability...
+%%%%
+Trog's Hand
+
+There's currently no description for this ability...
+%%%%
+Brothers in Arms
+
+There's currently no description for this ability...
+%%%%
+# Elyvilon
+Destroy Weapons
+
+There's currently no description for this ability...
+%%%%
+Lesser Healing
+
+There's currently no description for this ability...
+%%%%
+Purification
+
+There's currently no description for this ability...
+%%%%
+Healing
+
+There's currently no description for this ability...
+%%%%
+Restoration
+
+There's currently no description for this ability...
+%%%%
+Greater Healing
+
+There's currently no description for this ability...
+%%%%
+# Lugonu
+Depart the Abyss
+
+There's currently no description for this ability...
+%%%%
+Bend Space
+
+There's currently no description for this ability...
+%%%%
+Banish
+
+There's currently no description for this ability...
+%%%%
+Corrupt
+
+There's currently no description for this ability...
+%%%%
+Enter the Abyss
+
+There's currently no description for this ability...
+%%%%
+# Nemelex Xobeh
+Draw One
+
+There's currently no description for this ability...
+%%%%
+Peek at Two
+
+There's currently no description for this ability...
+%%%%
+Triple Draw
+
+There's currently no description for this ability...
+%%%%
+Mark Four
+
+There's currently no description for this ability...
+%%%%
+Stack Five
+
+There's currently no description for this ability...
+%%%%
+# Beogh
+Smiting
+
+There's currently no description for this ability...
+%%%%
+Recall Orcish Followers
+
+There's currently no description for this ability...
+%%%%
+Renounce Religion
+
+Renouncing your faith will make your character leave your god (and
+usually anger said god).
+%%%%
diff --git a/crawl-ref/source/dat/descript/spells.txt b/crawl-ref/source/dat/descript/spells.txt
index d578ece4d4..7bb4ebccea 100644
--- a/crawl-ref/source/dat/descript/spells.txt
+++ b/crawl-ref/source/dat/descript/spells.txt
@@ -279,7 +279,7 @@ Flame Tongue
This spell creates a short burst of flame.
%%%%
-Fly
+Flight
This spell grants to the caster the ability to fly through the air.
%%%%
diff --git a/crawl-ref/source/database.cc b/crawl-ref/source/database.cc
index a700e4d825..50c3ca4c7a 100644
--- a/crawl-ref/source/database.cc
+++ b/crawl-ref/source/database.cc
@@ -66,6 +66,7 @@ static TextDB AllDBs[] =
"descript/gods.txt",
"descript/branches.txt",
"descript/skills.txt",
+ "descript/ability.txt",
NULL),
TextDB( "db/randart",
@@ -89,13 +90,13 @@ static TextDB AllDBs[] =
"database/insult.txt", // imp/demon taunts, again
NULL),
- TextDB( "db/help",
- "database/help.txt",
- NULL),
-
TextDB( "db/misc",
"database/miscname.txt", // names for miscellaneous things
NULL),
+
+ TextDB( "db/help", // database for outsourced help texts
+ "database/help.txt",
+ NULL),
};
static TextDB& DescriptionDB = AllDBs[0];
@@ -309,7 +310,7 @@ static void _execute_embedded_lua(std::string &str)
str.replace(pos, lua_full.length(), result);
pos = str.find("{{", pos + result.length());
- } // while (pos != std::string::npos)
+ }
}
static void _trim_leading_newlines(std::string &s)
diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc
index 6306292177..61eb11b43f 100644
--- a/crawl-ref/source/decks.cc
+++ b/crawl-ref/source/decks.cc
@@ -1390,6 +1390,12 @@ static void _swap_monster_card(int power, deck_rarity_type rarity)
{
you.attribute[ATTR_HELD] = 10;
mpr("You become entangled in the net!");
+
+ // Xom thinks this is hilarious if you trap yourself this way.
+ if (you_caught)
+ xom_is_stimulated(16);
+ else
+ xom_is_stimulated(255);
}
if (!you_caught)
diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc
index 669453395b..74eefe2487 100644
--- a/crawl-ref/source/describe.cc
+++ b/crawl-ref/source/describe.cc
@@ -1836,7 +1836,7 @@ void describe_feature_wide(int x, int y)
if (Options.tutorial_left)
tutorial_describe_pos(x, y);
- if ( getch() == 0 )
+ if (getch() == 0)
getch();
}
@@ -1853,7 +1853,8 @@ static bool _show_item_description(const item_def &item)
if (item.has_spells())
{
if (item.base_type == OBJ_BOOKS && !player_can_read_spellbook( item ))
- return false;
+ return (false);
+
formatted_string fs;
item_def dup = item;
spellbook_contents( dup,
@@ -1862,10 +1863,10 @@ static bool _show_item_description(const item_def &item)
: RBOOK_USE_STAFF,
&fs );
fs.display(2, -2);
- return true;
+ return (true);
}
- return false;
+ return (false);
}
static bool _describe_spells(const item_def &item)
diff --git a/crawl-ref/source/spl-data.h b/crawl-ref/source/spl-data.h
index 063d1a68fb..98dffe7970 100644
--- a/crawl-ref/source/spl-data.h
+++ b/crawl-ref/source/spl-data.h
@@ -1404,7 +1404,7 @@
},
{
- SPELL_FLY, "Fly",
+ SPELL_FLY, "Flight",
SPTYP_ENCHANTMENT | SPTYP_AIR,
SPFLAG_NONE,
4,