summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/spl-cast.cc
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2006-12-11 17:36:10 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2006-12-11 17:36:10 +0000
commit605ad1a626360b651b73805372bf74453a6f2410 (patch)
tree2646e8daf9d0dd14a16eaf9efefd55975c56f79c /crawl-ref/source/spl-cast.cc
parent914104c2b2d2600c415caa321690708317a4db6c (diff)
downloadcrawl-ref-605ad1a626360b651b73805372bf74453a6f2410.tar.gz
crawl-ref-605ad1a626360b651b73805372bf74453a6f2410.zip
More streamlining, this time of code which shows power and spell failure.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@616 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/spl-cast.cc')
-rw-r--r--crawl-ref/source/spl-cast.cc61
1 files changed, 35 insertions, 26 deletions
diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc
index 19e28d8dd9..0495670490 100644
--- a/crawl-ref/source/spl-cast.cc
+++ b/crawl-ref/source/spl-cast.cc
@@ -174,36 +174,12 @@ char list_spells(void)
// 35--48 is the spell schools
gotoxy(51, wherey());
- int spell_p = calc_spell_power( spell, true );
- cprintf( (spell_p > 100) ? "Enormous" :
- (spell_p > 90) ? "Huge" :
- (spell_p > 80) ? "Massive" :
- (spell_p > 70) ? "Major" :
- (spell_p > 60) ? "Impressive" :
- (spell_p > 50) ? "Reasonable" :
- (spell_p > 40) ? "Moderate" :
- (spell_p > 30) ? "Adequate" :
- (spell_p > 20) ? "Mediocre" :
- (spell_p > 10) ? "Minor"
- : "Negligible");
+ cprintf("%s",spell_power_to_string(calc_spell_power(spell,true)));
//gotoxy(58, wherey());
gotoxy(65, wherey());
- int spell_f = spell_fail( spell );
-
- cprintf( (spell_f == 100) ? "Useless" :
- (spell_f > 90) ? "Terrible" :
- (spell_f > 80) ? "Cruddy" :
- (spell_f > 70) ? "Bad" :
- (spell_f > 60) ? "Very Poor" :
- (spell_f > 50) ? "Poor" :
- (spell_f > 40) ? "Fair" :
- (spell_f > 30) ? "Good" :
- (spell_f > 20) ? "Very Good" :
- (spell_f > 10) ? "Great" :
- (spell_f > 0) ? "Excellent"
- : "Perfect" );
+ cprintf( "%s", failure_rate_to_string(spell_fail(spell)));
gotoxy(77, wherey());
@@ -3610,3 +3586,36 @@ bool miscast_effect( unsigned int sp_type, int mag_pow, int mag_fail,
return (true);
} // end miscast_effect()
+
+const char* failure_rate_to_string( int fail )
+{
+ return
+ (fail == 100) ? "Useless" :
+ (fail > 90) ? "Terrible" :
+ (fail > 80) ? "Cruddy" :
+ (fail > 70) ? "Bad" :
+ (fail > 60) ? "Very Poor" :
+ (fail > 50) ? "Poor" :
+ (fail > 40) ? "Fair" :
+ (fail > 30) ? "Good" :
+ (fail > 20) ? "Very Good" :
+ (fail > 10) ? "Great" :
+ (fail > 0) ? "Excellent"
+ : "Perfect";
+}
+
+const char* spell_power_to_string( int power )
+{
+ return
+ (power > 100) ? "Enormous" :
+ (power > 90) ? "Huge" :
+ (power > 80) ? "Massive" :
+ (power > 70) ? "Major" :
+ (power > 60) ? "Impressive" :
+ (power > 50) ? "Reasonable" :
+ (power > 40) ? "Moderate" :
+ (power > 30) ? "Adequate" :
+ (power > 20) ? "Mediocre" :
+ (power > 10) ? "Minor"
+ : "Negligible";
+}