summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-09-10 21:34:21 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-09-10 21:34:21 +0000
commitaf7fe6ad37f466a8e926cc29765197f5b0e7224f (patch)
treef2362740ab56fec3d7f6018688c79221e9974615 /crawl-ref/source
parent1d23ad9eae6203fcabc6b1f9a933174bc907f2a9 (diff)
downloadcrawl-ref-af7fe6ad37f466a8e926cc29765197f5b0e7224f.tar.gz
crawl-ref-af7fe6ad37f466a8e926cc29765197f5b0e7224f.zip
Display spell cost, success chance, schools, power, range, and hunger in
the new tiles display (in the title, quantity, mouse-over description, and right-click description). git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@10649 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/describe.cc41
-rw-r--r--crawl-ref/source/spl-cast.cc25
-rw-r--r--crawl-ref/source/tilereg.cc6
-rw-r--r--crawl-ref/source/tilesdl.cc5
4 files changed, 43 insertions, 34 deletions
diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc
index 08afab6671..4dd09e5d6d 100644
--- a/crawl-ref/source/describe.cc
+++ b/crawl-ref/source/describe.cc
@@ -50,6 +50,7 @@ REVISION("$Rev$");
#include "spells3.h"
#include "spl-book.h"
#include "stuff.h"
+#include "spl-cast.h"
#include "spl-util.h"
#include "transfor.h"
#include "tutorial.h"
@@ -1562,26 +1563,10 @@ void append_spells(std::string &desc, const item_def &item)
for (unsigned int i = 0; i < 35 - name.length(); ++i)
desc += " ";
- name = "";
if (item.base_type == OBJ_STAVES)
- name += "Evocations";
+ desc += "Evocations";
else
- {
- bool already = false;
-
- for (int i = 0; i <= SPTYP_LAST_EXPONENT; ++i)
- {
- if (spell_typematch( stype, 1 << i ))
- {
- if (already)
- name += "/" ;
-
- name += spelltype_name( 1 << i );
- already = true;
- }
- }
- }
- desc += name;
+ desc += spell_schools_string(stype);
for (unsigned int i = 36; i < 65 - name.length(); ++i)
desc += " ";
@@ -2424,6 +2409,26 @@ bool _get_spell_description(const spell_type spell, std::string &description,
description += "(M)emorise this spell.";
return (true);
}
+#ifdef USE_TILE
+ else
+ {
+ const std::string schools = spell_schools_string(spell);
+ snprintf(info, INFO_SIZE,
+ "$Level: %d School%s: %s (%s)",
+ spell_difficulty(spell),
+ schools.find("/") != std::string::npos ? "s" : "",
+ schools.c_str(),
+ failure_rate_to_string(spell_fail(spell)));
+ description += info;
+
+ description += "$$Power : ";
+ description += spell_power_string(spell);
+ description += "$Range : ";
+ description += spell_range_string(spell);
+ description += "$Hunger: ";
+ description += spell_hunger_string(spell);
+ }
+#endif
return (false);
}
diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc
index a58e66ff1f..ea184c8b49 100644
--- a/crawl-ref/source/spl-cast.cc
+++ b/crawl-ref/source/spl-cast.cc
@@ -2266,19 +2266,18 @@ void exercise_spell( spell_type spell, bool spc, bool success )
const char* failure_rate_to_string( int fail )
{
- return
- (fail == 100) ? "Useless" : // 0% success chance
- (fail > 77) ? "Terrible" : // 0-5%
- (fail > 71) ? "Cruddy" : // 5-10%
- (fail > 64) ? "Bad" : // 10-20%
- (fail > 59) ? "Very Poor" : // 20-30%
- (fail > 50) ? "Poor" : // 30-50%
- (fail > 40) ? "Fair" : // 50-70%
- (fail > 35) ? "Good" : // 70-80%
- (fail > 28) ? "Very Good" : // 80-90%
- (fail > 22) ? "Great" : // 90-95%
- (fail > 0) ? "Excellent" : // 95-100%
- "Perfect"; // 100%
+ return (fail == 100) ? "Useless" : // 0% success chance
+ (fail > 77) ? "Terrible" : // 0-5%
+ (fail > 71) ? "Cruddy" : // 5-10%
+ (fail > 64) ? "Bad" : // 10-20%
+ (fail > 59) ? "Very Poor" : // 20-30%
+ (fail > 50) ? "Poor" : // 30-50%
+ (fail > 40) ? "Fair" : // 50-70%
+ (fail > 35) ? "Good" : // 70-80%
+ (fail > 28) ? "Very Good" : // 80-90%
+ (fail > 22) ? "Great" : // 90-95%
+ (fail > 0) ? "Excellent" // 95-100%
+ : "Perfect"; // 100%
}
static unsigned int _breakpoint_rank(int val, const int breakpoints[],
diff --git a/crawl-ref/source/tilereg.cc b/crawl-ref/source/tilereg.cc
index dadf97d0e1..51a55d9074 100644
--- a/crawl-ref/source/tilereg.cc
+++ b/crawl-ref/source/tilereg.cc
@@ -1620,7 +1620,11 @@ void InventoryRegion::render()
std::string desc = "";
if (Options.tile_display_spells)
{
- desc = spell_title((spell_type) idx);
+ const spell_type spell = (spell_type) idx;
+ snprintf(info, INFO_SIZE, "%d MP %s (%s)",
+ spell_difficulty(spell), spell_title(spell),
+ failure_rate_to_string(spell_fail(spell)));
+ desc = info;
}
else if (floor && is_valid_item(mitm[idx]))
desc = mitm[idx].name(DESC_PLAIN);
diff --git a/crawl-ref/source/tilesdl.cc b/crawl-ref/source/tilesdl.cc
index a3c72e7de2..4343718816 100644
--- a/crawl-ref/source/tilesdl.cc
+++ b/crawl-ref/source/tilesdl.cc
@@ -1445,8 +1445,9 @@ void TilesFramework::update_spells()
InventoryTile desc;
// desc.tile = tileidx_spell(item);
- desc.tile = TILE_ERROR;
- desc.idx = (int) spell;
+ desc.tile = TILE_ERROR;
+ desc.idx = (int) spell;
+ desc.quantity = spell_difficulty(spell);
// If an equipped artefact prevents teleportation, the following spells
// cannot be cast.