summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2006-12-10 20:28:21 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2006-12-10 20:28:21 +0000
commit2b7d6cadecf9c3d272cc1097824ffc7d7e770aab (patch)
tree9456a1e06e5f5399ae8eab1140f01d0cbd46204e /crawl-ref/source
parent1a21d2008a3f9bce922aa7d759b3e1df875ab37a (diff)
downloadcrawl-ref-2b7d6cadecf9c3d272cc1097824ffc7d7e770aab.tar.gz
crawl-ref-2b7d6cadecf9c3d272cc1097824ffc7d7e770aab.zip
Streamlined god-given abilities.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@609 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/abl-show.cc157
-rw-r--r--crawl-ref/source/acr.cc2
-rw-r--r--crawl-ref/source/command.cc2
-rw-r--r--crawl-ref/source/defines.h3
-rw-r--r--crawl-ref/source/describe.cc231
-rw-r--r--crawl-ref/source/externs.h1
-rw-r--r--crawl-ref/source/fight.cc2
-rw-r--r--crawl-ref/source/misc.cc4
-rw-r--r--crawl-ref/source/notes.cc49
-rw-r--r--crawl-ref/source/output.cc8
-rw-r--r--crawl-ref/source/religion.cc582
-rw-r--r--crawl-ref/source/religion.h1
-rw-r--r--crawl-ref/source/spells2.cc4
-rw-r--r--crawl-ref/source/spl-cast.cc2
14 files changed, 308 insertions, 740 deletions
diff --git a/crawl-ref/source/abl-show.cc b/crawl-ref/source/abl-show.cc
index 5f57f30b5c..b505e47e7a 100644
--- a/crawl-ref/source/abl-show.cc
+++ b/crawl-ref/source/abl-show.cc
@@ -80,6 +80,56 @@ static FixedVector< talent, 52 > Curr_abil;
static bool insert_ability( int which_ability );
+// declaring this const messes up externs later, so don't do it
+ability_type god_abilities[MAX_NUM_GODS][MAX_GOD_ABILITIES] =
+{
+ // no god
+ { ABIL_NON_ABILITY, ABIL_NON_ABILITY, ABIL_NON_ABILITY,
+ ABIL_NON_ABILITY, ABIL_NON_ABILITY },
+ // Zin
+ { ABIL_ZIN_REPEL_UNDEAD, ABIL_ZIN_HEALING, ABIL_ZIN_PESTILENCE,
+ ABIL_ZIN_HOLY_WORD, ABIL_ZIN_SUMMON_GUARDIAN },
+ // TSO
+ { ABIL_TSO_REPEL_UNDEAD, ABIL_TSO_SMITING, ABIL_TSO_ANNIHILATE_UNDEAD,
+ ABIL_TSO_CLEANSING_FLAME, ABIL_TSO_SUMMON_DAEVA },
+ // Kikubaaqudgha
+ { ABIL_KIKU_RECALL_UNDEAD_SLAVES, ABIL_NON_ABILITY,
+ ABIL_KIKU_ENSLAVE_UNDEAD, ABIL_NON_ABILITY,
+ ABIL_KIKU_INVOKE_DEATH },
+ // Yredelemnul
+ { ABIL_YRED_ANIMATE_CORPSE, ABIL_YRED_RECALL_UNDEAD,
+ ABIL_YRED_ANIMATE_DEAD, ABIL_YRED_DRAIN_LIFE,
+ ABIL_YRED_CONTROL_UNDEAD },
+ // Xom
+ { ABIL_NON_ABILITY, ABIL_NON_ABILITY, ABIL_NON_ABILITY,
+ ABIL_NON_ABILITY, ABIL_NON_ABILITY },
+ // Vehumet
+ { ABIL_NON_ABILITY, ABIL_NON_ABILITY, ABIL_NON_ABILITY,
+ ABIL_NON_ABILITY, ABIL_NON_ABILITY },
+ // Okawaru
+ { ABIL_OKAWARU_MIGHT, ABIL_OKAWARU_HEALING, ABIL_NON_ABILITY,
+ ABIL_NON_ABILITY, ABIL_OKAWARU_HASTE },
+ // Makhleb
+ { ABIL_NON_ABILITY, ABIL_MAKHLEB_MINOR_DESTRUCTION,
+ ABIL_MAKHLEB_LESSER_SERVANT_OF_MAKHLEB,
+ ABIL_MAKHLEB_MAJOR_DESTRUCTION,
+ ABIL_MAKHLEB_GREATER_SERVANT_OF_MAKHLEB },
+ // Sif Muna
+ { ABIL_SIF_MUNA_CHANNEL_ENERGY,
+ ABIL_SIF_MUNA_FORGET_SPELL, ABIL_NON_ABILITY,
+ ABIL_NON_ABILITY, ABIL_NON_ABILITY },
+ // Trog
+ { ABIL_TROG_BERSERK, ABIL_TROG_MIGHT, ABIL_NON_ABILITY,
+ ABIL_TROG_HASTE_SELF, ABIL_NON_ABILITY },
+ // Nemelex
+ { ABIL_NON_ABILITY, ABIL_NON_ABILITY, ABIL_NON_ABILITY,
+ ABIL_NON_ABILITY, ABIL_NON_ABILITY },
+ // Elyvilon
+ { ABIL_ELYVILON_LESSER_HEALING, ABIL_ELYVILON_PURIFICATION,
+ ABIL_ELYVILON_HEALING, ABIL_ELYVILON_RESTORATION,
+ ABIL_ELYVILON_GREATER_HEALING }
+};
+
// The description screen was way out of date with the actual costs.
// This table puts all the information in one place... -- bwr
//
@@ -1508,107 +1558,14 @@ bool generate_abilities( void )
// gods take abilities away until penance completed -- bwr
if (!player_under_penance() && !silenced( you.x_pos, you.y_pos ))
{
- switch (you.religion)
+ for ( int i = 0; i < MAX_GOD_ABILITIES; ++i )
{
- case GOD_ZIN:
- if (you.piety >= 30)
- insert_ability( ABIL_ZIN_REPEL_UNDEAD );
- if (you.piety >= 50)
- insert_ability( ABIL_ZIN_HEALING );
- if (you.piety >= 75)
- insert_ability( ABIL_ZIN_PESTILENCE );
- if (you.piety >= 100)
- insert_ability( ABIL_ZIN_HOLY_WORD );
- if (you.piety >= 120)
- insert_ability( ABIL_ZIN_SUMMON_GUARDIAN );
- break;
-
- case GOD_SHINING_ONE:
- if (you.piety >= 30)
- insert_ability( ABIL_TSO_REPEL_UNDEAD );
- if (you.piety >= 50)
- insert_ability( ABIL_TSO_SMITING );
- if (you.piety >= 75)
- insert_ability( ABIL_TSO_ANNIHILATE_UNDEAD );
- if (you.piety >= 100)
- insert_ability( ABIL_TSO_CLEANSING_FLAME );
- if (you.piety >= 120)
- insert_ability( ABIL_TSO_SUMMON_DAEVA );
- break;
-
- case GOD_YREDELEMNUL:
- if (you.piety >= 30)
- insert_ability( ABIL_YRED_ANIMATE_CORPSE );
- if (you.piety >= 50)
- insert_ability( ABIL_YRED_RECALL_UNDEAD );
- if (you.piety >= 75)
- insert_ability( ABIL_YRED_ANIMATE_DEAD );
- if (you.piety >= 100)
- insert_ability( ABIL_YRED_DRAIN_LIFE );
- if (you.piety >= 120)
- insert_ability( ABIL_YRED_CONTROL_UNDEAD );
- break;
-
- case GOD_ELYVILON:
- if (you.piety >= 30)
- insert_ability( ABIL_ELYVILON_LESSER_HEALING );
- if (you.piety >= 50)
- insert_ability( ABIL_ELYVILON_PURIFICATION );
- if (you.piety >= 75)
- insert_ability( ABIL_ELYVILON_HEALING );
- if (you.piety >= 100)
- insert_ability( ABIL_ELYVILON_RESTORATION );
- if (you.piety >= 120)
- insert_ability( ABIL_ELYVILON_GREATER_HEALING );
- break;
-
- case GOD_MAKHLEB:
- if (you.piety >= 50)
- insert_ability( ABIL_MAKHLEB_MINOR_DESTRUCTION );
- if (you.piety >= 75)
- insert_ability( ABIL_MAKHLEB_LESSER_SERVANT_OF_MAKHLEB );
- if (you.piety >= 100)
- insert_ability( ABIL_MAKHLEB_MAJOR_DESTRUCTION );
- if (you.piety >= 120)
- insert_ability( ABIL_MAKHLEB_GREATER_SERVANT_OF_MAKHLEB );
- break;
-
- case GOD_KIKUBAAQUDGHA:
- if (you.piety >= 30)
- insert_ability( ABIL_KIKU_RECALL_UNDEAD_SLAVES );
- if (you.piety >= 75)
- insert_ability( ABIL_KIKU_ENSLAVE_UNDEAD );
- if (you.piety >= 120)
- insert_ability( ABIL_KIKU_INVOKE_DEATH );
- break;
-
- case GOD_OKAWARU:
- if (you.piety >= 30)
- insert_ability( ABIL_OKAWARU_MIGHT );
- if (you.piety >= 50)
- insert_ability( ABIL_OKAWARU_HEALING );
- if (you.piety >= 120)
- insert_ability( ABIL_OKAWARU_HASTE );
- break;
-
- case GOD_TROG:
- if (you.piety >= 30)
- insert_ability( ABIL_TROG_BERSERK );
- if (you.piety >= 50)
- insert_ability( ABIL_TROG_MIGHT );
- if (you.piety >= 100)
- insert_ability( ABIL_TROG_HASTE_SELF );
- break;
-
- case GOD_SIF_MUNA:
- if (you.piety >= 30)
- insert_ability( ABIL_SIF_MUNA_CHANNEL_ENERGY );
- if (you.piety >= 50)
- insert_ability( ABIL_SIF_MUNA_FORGET_SPELL );
- break;
-
- default:
- break;
+ if ( you.piety >= piety_breakpoint(i) )
+ {
+ ability_type abil = god_abilities[(int)you.religion][i];
+ if ( abil != ABIL_NON_ABILITY )
+ insert_ability(abil);
+ }
}
}
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc
index b3b5e27943..a212571bab 100644
--- a/crawl-ref/source/acr.cc
+++ b/crawl-ref/source/acr.cc
@@ -2161,7 +2161,7 @@ static void world_reacts()
if (you.hunger <= 100)
{
mpr( "You have starved to death.", MSGCH_FOOD );
- ouch( -9999, 0, KILLED_BY_STARVATION );
+ ouch( INSTANT_DEATH, 0, KILLED_BY_STARVATION );
}
}
diff --git a/crawl-ref/source/command.cc b/crawl-ref/source/command.cc
index 2b97cf1536..6e3d15756c 100644
--- a/crawl-ref/source/command.cc
+++ b/crawl-ref/source/command.cc
@@ -48,7 +48,7 @@ static const char *wizard_string( int i );
void quit_game(void)
{
if (yesno("Really quit?", false, 'n'))
- ouch(-9999, 0, KILLED_BY_QUITTING);
+ ouch(INSTANT_DEATH, 0, KILLED_BY_QUITTING);
} // end quit_game()
static const char *features[] = {
diff --git a/crawl-ref/source/defines.h b/crawl-ref/source/defines.h
index eef208965d..6c61ec3ee8 100644
--- a/crawl-ref/source/defines.h
+++ b/crawl-ref/source/defines.h
@@ -153,6 +153,9 @@
#define CHUNK_BASE_NUTRITION 1000
+// The maximum number of abilities any god can have
+#define MAX_GOD_ABILITIES 5
+
// This value is used to mark immune levels of MR
#define MAG_IMMUNE 5000
diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc
index 8f3aca98fc..7b3d432543 100644
--- a/crawl-ref/source/describe.cc
+++ b/crawl-ref/source/describe.cc
@@ -6373,17 +6373,33 @@ std::string ghost_description(bool concise)
return std::string(tmp_buff);
}
-static void print_god_abil_desc( int abil )
-{
- const ability_def &abil_info = get_ability_def( abil );
-
- const std::string cost = "(" + make_cost_description( abil_info ) + ")";
+extern ability_type god_abilities[MAX_NUM_GODS][MAX_GOD_ABILITIES];
+static bool print_god_abil_desc( int god, int numpower )
+{
+ const char* pmsg = god_gain_power_messages[god][numpower];
+ char buf[200];
+ // if no message then no power
+ if ( !pmsg[0] )
+ return false;
+
+ // The power could be either passive or an active ability.
+ // Determine which.
+ const ability_type abil = god_abilities[god][numpower];
+ if ( isupper(pmsg[0]) )
+ strcpy(buf, pmsg);
+ else
+ snprintf(buf, sizeof buf, "You can %s.", pmsg);
+ std::string cost;
+ if ( abil != ABIL_NON_ABILITY )
+ {
+ cost = "(" + make_cost_description(get_ability_def(abil)) + ")";
+ cost = std::string(79 - strlen(buf) - cost.length(), ' ') + cost;
+ }
+
// Produce a 79 character string with cost right justified:
- std::string str( abil_info.name );
- str += std::string( 79 - str.length() - cost.length(), ' ' ) + cost + EOL;
-
- cprintf( "%s", str.c_str() );
+ cprintf( "%s%s\n", buf, cost.c_str() );
+ return true;
}
//---------------------------------------------------------------
@@ -6663,14 +6679,14 @@ void describe_god( int which_god, bool give_title )
// because god isn't really protecting player - he only sometimes
// saves his life (probably it shouldn't be displayed at all).
// What about this ?
- bool penance_ability = false;
+ bool have_any = false;
if ((which_god == GOD_ZIN
|| which_god == GOD_SHINING_ONE
|| which_god == GOD_ELYVILON
|| which_god == GOD_YREDELEMNUL)
&& you.piety >= 30)
{
- penance_ability = true; // suppress "none" later
+ have_any = true;
cprintf( "%s %s watches over you during prayer." EOL,
god_name(which_god),
(you.piety >= 150) ? "carefully": // > 4/5
@@ -6678,192 +6694,17 @@ void describe_god( int which_god, bool give_title )
"sometimes"); // less than 2:3
}
- // mv: No abilities (except divine protection)
- // under penance (fix me if I'm wrong)
- if (player_under_penance())
+ // mv: No abilities (except divine protection) under penance
+ if (!player_under_penance())
{
- if ( !penance_ability )
- cprintf( "None." EOL );
- }
- else
- {
- switch (which_god) //mv: finally let's print abilities
- {
- case GOD_ZIN:
- if (you.piety >= 30)
- print_god_abil_desc( ABIL_ZIN_REPEL_UNDEAD );
- else
- cprintf( "None." EOL );
-
- if (you.piety >= 50)
- print_god_abil_desc( ABIL_ZIN_HEALING );
-
- if (you.piety >= 75)
- print_god_abil_desc( ABIL_ZIN_PESTILENCE );
-
- if (you.piety >= 100)
- print_god_abil_desc( ABIL_ZIN_HOLY_WORD );
-
- if (you.piety >= 120)
- print_god_abil_desc( ABIL_ZIN_SUMMON_GUARDIAN );
- break;
-
- case GOD_SHINING_ONE:
- if (you.piety >= 30)
- print_god_abil_desc( ABIL_TSO_REPEL_UNDEAD );
- else
- cprintf( "None." EOL );
-
- if (you.piety >= 50)
- print_god_abil_desc( ABIL_TSO_SMITING );
-
- if (you.piety >= 75)
- print_god_abil_desc( ABIL_TSO_ANNIHILATE_UNDEAD );
-
- if (you.piety >= 100)
- print_god_abil_desc( ABIL_TSO_CLEANSING_FLAME );
-
- if (you.piety >= 120)
- print_god_abil_desc( ABIL_TSO_SUMMON_DAEVA );
- break;
-
- case GOD_KIKUBAAQUDGHA:
- if (you.piety >= 30)
- print_god_abil_desc( ABIL_KIKU_RECALL_UNDEAD_SLAVES );
- else
- cprintf( "None." EOL );
-
- if (you.piety >= 50)
- cprintf("You are protected from some of the side-effects of death magic." EOL);
-
- if (you.piety >= 75)
- print_god_abil_desc( ABIL_KIKU_ENSLAVE_UNDEAD );
-
- if (you.piety >= 120)
- print_god_abil_desc( ABIL_KIKU_INVOKE_DEATH );
- break;
-
- case GOD_YREDELEMNUL:
- if (you.piety >= 30)
- print_god_abil_desc( ABIL_YRED_ANIMATE_CORPSE );
- else
- cprintf( "None." EOL );
-
- if (you.piety >= 50)
- print_god_abil_desc( ABIL_YRED_RECALL_UNDEAD );
-
- if (you.piety >= 75)
- print_god_abil_desc( ABIL_YRED_ANIMATE_DEAD );
-
- if (you.piety >= 100)
- print_god_abil_desc( ABIL_YRED_DRAIN_LIFE );
-
- if (you.piety >= 120)
- print_god_abil_desc( ABIL_YRED_CONTROL_UNDEAD );
- break;
-
-
- case GOD_VEHUMET:
- if (you.piety >= 30)
- {
- cprintf( "You can gain power from the those you kill " EOL
- " in Vehumet's name, or those slain by your servants." EOL );
- }
- else
- cprintf( "None." EOL );
-
- if (you.piety >= 50)
- cprintf( "Vehumet assists with destructive magics during prayer." EOL );
-
- if (you.piety >= 75)
- cprintf( "During prayer you have some protection from summoned creatures." EOL );
- break;
-
-
- case GOD_OKAWARU:
- if (you.piety >= 30)
- print_god_abil_desc( ABIL_OKAWARU_MIGHT );
- else
- cprintf( "None." EOL );
-
- if (you.piety >= 50)
- print_god_abil_desc( ABIL_OKAWARU_HEALING );
-
- if (you.piety >= 120)
- print_god_abil_desc( ABIL_OKAWARU_HASTE );
- break;
-
- case GOD_MAKHLEB:
- if (you.piety >= 30)
- {
- cprintf( "You can gain power from the deaths " EOL
- " of those you kill in Makhleb's name." EOL );
- }
- else
- cprintf( "None." EOL );
-
- if (you.piety >= 50)
- print_god_abil_desc( ABIL_MAKHLEB_MINOR_DESTRUCTION );
-
- if (you.piety >= 75)
- print_god_abil_desc( ABIL_MAKHLEB_LESSER_SERVANT_OF_MAKHLEB );
-
- if (you.piety >= 100)
- print_god_abil_desc( ABIL_MAKHLEB_MAJOR_DESTRUCTION );
-
- if (you.piety >= 120)
- print_god_abil_desc( ABIL_MAKHLEB_GREATER_SERVANT_OF_MAKHLEB );
- break;
-
- case GOD_SIF_MUNA:
- if (you.piety >= 30)
- print_god_abil_desc( ABIL_SIF_MUNA_CHANNEL_ENERGY );
- else
- cprintf( "None." EOL );
-
- if (you.piety >= 50)
- print_god_abil_desc( ABIL_SIF_MUNA_FORGET_SPELL );
-
- if (you.piety >= 100)
- cprintf( "You are protected from some side-effects of spellcasting." EOL );
- break;
-
- case GOD_TROG:
- if (you.piety >= 30)
- print_god_abil_desc( ABIL_TROG_BERSERK );
- else
- cprintf( "None." EOL );
-
- if (you.piety >= 50)
- print_god_abil_desc( ABIL_TROG_MIGHT );
-
- if (you.piety >= 100)
- print_god_abil_desc( ABIL_TROG_HASTE_SELF );
- break;
-
- case GOD_ELYVILON:
- if (you.piety >= 30)
- print_god_abil_desc( ABIL_ELYVILON_LESSER_HEALING );
- else
- cprintf( "None." EOL );
-
- if (you.piety >= 50)
- print_god_abil_desc( ABIL_ELYVILON_PURIFICATION );
-
- if (you.piety >= 75)
- print_god_abil_desc( ABIL_ELYVILON_HEALING );
-
- if (you.piety >= 100)
- print_god_abil_desc( ABIL_ELYVILON_RESTORATION );
-
- if (you.piety >= 120)
- print_god_abil_desc( ABIL_ELYVILON_GREATER_HEALING );
- break;
-
- default: //mv: default is Xom, Nemelex and all bugs.
- cprintf( "None." EOL );
- } //end of printing abilities
+ for ( int i = 0; i < MAX_GOD_ABILITIES; ++i )
+ if ( you.piety >= piety_breakpoint(i) )
+ if (print_god_abil_desc(which_god, i))
+ have_any = true;
+
}
+ if ( !have_any )
+ cprintf( "None." EOL );
}
diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h
index a43f843e52..0992c8451d 100644
--- a/crawl-ref/source/externs.h
+++ b/crawl-ref/source/externs.h
@@ -1081,5 +1081,6 @@ private:
};
extern const struct coord_def Compass[8];
+extern const char* god_gain_power_messages[MAX_NUM_GODS][MAX_GOD_ABILITIES];
#endif // EXTERNS_H
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc
index d0ac7afc4b..d66e701a29 100644
--- a/crawl-ref/source/fight.cc
+++ b/crawl-ref/source/fight.cc
@@ -2057,7 +2057,7 @@ void monster_attack(int monster_attacking)
if (wearing_amulet(AMU_WARDING)
|| (you.religion == GOD_VEHUMET && you.duration[DUR_PRAYER]
- && (!player_under_penance() && you.piety >= 75)))
+ && (!player_under_penance() && you.piety >= piety_breakpoint(2))))
{
if (mons_has_ench(attacker, ENCH_ABJ_I, ENCH_ABJ_VI))
{
diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc
index e2be237862..6235ebd1b6 100644
--- a/crawl-ref/source/misc.cc
+++ b/crawl-ref/source/misc.cc
@@ -586,11 +586,11 @@ void up_stairs(void)
if (is_valid_item( you.inv[i] )
&& you.inv[i].base_type == OBJ_ORBS)
{
- ouch(-9999, 0, KILLED_BY_WINNING);
+ ouch(INSTANT_DEATH, 0, KILLED_BY_WINNING);
}
}
- ouch(-9999, 0, KILLED_BY_LEAVING);
+ ouch(INSTANT_DEATH, 0, KILLED_BY_LEAVING);
}
mpr("Entering...");
diff --git a/crawl-ref/source/notes.cc b/crawl-ref/source/notes.cc
index 50221376aa..9f645fa807 100644
--- a/crawl-ref/source/notes.cc
+++ b/crawl-ref/source/notes.cc
@@ -21,44 +21,17 @@
std::vector<Note> note_list;
-/* I can't believe I'm writing code this bad */
-static int real_god_power( int religion, int idx ) {
- switch ( religion ) {
- case GOD_NO_GOD:
- case GOD_XOM:
- case GOD_NEMELEX_XOBEH:
- return -1;
- case GOD_ZIN:
- case GOD_SHINING_ONE:
- case GOD_YREDELEMNUL:
- case GOD_MAKHLEB:
- case GOD_ELYVILON:
- return idx;
- case GOD_KIKUBAAQUDGHA:
- if ( idx < 3 )
- return idx;
- if ( idx == 3 )
- return -1;
- return idx-1;
- case GOD_VEHUMET:
- return ( idx > 3 ? -1 : idx );
- case GOD_OKAWARU:
- if ( idx < 2 )
- return idx;
- if ( idx == 2 || idx == 3 )
- return -1;
- return idx - 2;
- case GOD_SIF_MUNA:
- if ( idx == 2 || idx == 4 ) return -1;
- if ( idx < 2 ) return idx;
- if ( idx == 3 ) return 2;
- case GOD_TROG:
- if ( idx == 2 || idx == 4 ) return -1;
- if ( idx < 2 ) return idx;
- if ( idx == 3 ) return idx-1;
- default:
- return -1;
- }
+// return the real number of the power (casting out nonexistent powers),
+// starting from 0, or -1 if the power doesn't exist
+static int real_god_power( int religion, int idx )
+{
+ if ( god_gain_power_messages[religion][idx][0] == 0 )
+ return -1;
+ int count = 0;
+ for ( int j = 0; j < idx; ++j )
+ if ( god_gain_power_messages[religion][j][0] )
+ ++count;
+ return count;
}
static bool is_noteworthy_skill_level( int level ) {
diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc
index 900c8999fd..5af21edfc1 100644
--- a/crawl-ref/source/output.cc
+++ b/crawl-ref/source/output.cc
@@ -160,7 +160,7 @@ void print_stats(void)
you.redraw_strength = 0;
if (you.strength < 1)
- ouch(-9999, 0, KILLED_BY_WEAKNESS);
+ ouch(INSTANT_DEATH, 0, KILLED_BY_WEAKNESS);
burden_change();
}
@@ -191,7 +191,7 @@ void print_stats(void)
you.redraw_intelligence = 0;
if (you.intel < 1)
- ouch(-9999, 0, KILLED_BY_STUPIDITY);
+ ouch(INSTANT_DEATH, 0, KILLED_BY_STUPIDITY);
}
if (you.redraw_dexterity)
@@ -220,7 +220,7 @@ void print_stats(void)
you.redraw_dexterity = 0;
if (you.dex < 1)
- ouch(-9999, 0, KILLED_BY_CLUMSINESS);
+ ouch(INSTANT_DEATH, 0, KILLED_BY_CLUMSINESS);
}
if (you.redraw_armour_class)
@@ -853,7 +853,7 @@ std::vector<formatted_string> get_full_detail(bool calc_unid)
const int rinvi = player_see_invis(calc_unid);
const int rward = wearing_amulet(AMU_WARDING, calc_unid) ||
(you.religion == GOD_VEHUMET && you.duration[DUR_PRAYER] &&
- !player_under_penance() && you.piety >= 75);
+ !player_under_penance() && you.piety >= piety_breakpoint(2));
const int rcons = wearing_amulet(AMU_CONSERVATION, calc_unid);
const int rcorr = wearing_amulet(AMU_RESIST_CORROSION, calc_unid);
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
index 7c1e3400ca..74991b80c7 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -78,6 +78,150 @@ const char *sacrifice[] = {
" evaporates."
};
+const char* god_gain_power_messages[MAX_NUM_GODS][MAX_GOD_ABILITIES] =
+{
+ // no god
+ { "", "", "", "", "" },
+ // Zin
+ { "repel the undead",
+ "call upon Zin for minor healing",
+ "call down a plague",
+ "utter a Holy Word",
+ "summon a guardian angel" },
+ // TSO
+ { "repel the undead",
+ "smite your foes",
+ "dispel the undead",
+ "hurl bolts of divine anger",
+ "summon a divine warrior" },
+ // Kikubaaqudgha
+ { "recall your undead slaves",
+ "Kikubaaqudgha is protecting you from some side-effects of death magic.",
+ "permanently enslave the undead",
+ "",
+ "summon an emissary of Death" },
+ // Yredelemnul
+ { "animate corpses",
+ "recall your undead slaves",
+ "animate legions of the dead",
+ "drain ambient lifeforce",
+ "control the undead" },
+ // Xom
+ { "", "", "",
+ "", "" },
+ // Vehumet
+ { "gain power from killing in Vehumet's name",
+ "You can call upon Vehumet to aid your destructive magics with prayer.",
+ "During prayer you have some protection from summoned creatures.",
+ "", "" },
+ // Okawaru
+ { "give your body great, but temporary strength",
+ "call upon Okawaru for minor healing",
+ "",
+ "",
+ "haste yourself" },
+ // Makhleb
+ { "gain power from killing in Makhleb's name",
+ "harness Makhleb's destructive might",
+ "summon a lesser servant of Makhleb",
+ "hurl Makhleb's greater destruction",
+ "summon a greater servant of Makhleb" },
+ // Sif Muna
+ { "tap ambient magical fields",
+ "freely open your mind to new spells",
+ "",
+ "Sif Muna is protecting you from some side-effects of spellcasting.",
+ "" },
+ // Trog
+ { "go berserk at will",
+ "give your body great, but temporary, strength",
+ "",
+ "haste yourself",
+ "" },
+ // Nemelex
+ { "", "", "",
+ "", "" },
+ // Elyvilon
+ { "call upon Elyvilon for minor healing",
+ "call upon Elyvilon for purification",
+ "call upon Elyvilon for moderate healing",
+ "call upon Elyvilon to restore your abilities",
+ "call upon Elyvilon for incredible healing" }
+};
+
+const char* god_lose_power_messages[MAX_NUM_GODS][MAX_GOD_ABILITIES] =
+{
+ // no god
+ { "", "", "", "", "" },
+ // Zin
+ { "repel the undead",
+ "call upon Zin for minor healing",
+ "call down a plague",
+ "utter a Holy Word",
+ "summon a guardian angel" },
+ // TSO
+ { "repel the undead",
+ "smite your foes",
+ "dispel the undead",
+ "hurl bolts of divine anger",
+ "summon a divine warrior" },
+ // Kikubaaqudgha
+ { "recall your undead slaves",
+ "Kikubaaqudgha is no longer shielding you from miscast death magic.",
+ "permanently enslave the undead",
+ "",
+ "summon an emissary of Death" },
+ // Yredelemnul
+ { "animate corpses",
+ "recall your undead slaves",
+ "animate legions of the dead",
+ "drain ambient lifeforce",
+ "control the undead" },
+ // Xom
+ { "", "", "",
+ "", "" },
+ // Vehumet
+ { "gain power from killing in Vehumet's name",
+ "Vehumet will no longer aid your destructive magics.",
+ "Vehumet will no longer shield you from summoned creatures.",
+ "",
+ "" },
+ // Okawaru
+ { "give your body great, but temporary strength",
+ "call upon Okawaru for minor healing",
+ "",
+ "",
+ "haste yourself" },
+ // Makhleb
+ { "gain power from killing in Makhleb's name",
+ "harness Makhleb's destructive might",
+ "summon a lesser servant of Makhleb",
+ "hurl Makhleb's greater destruction",
+ "summon a greater servant of Makhleb" },
+ // Sif Muna
+ { "tap ambient magical fields",
+ "forget spells at will",
+ "",
+ "Sif Muna is no longer protecting you from miscast magic.",
+ "" },
+ // Trog
+ { "go berserk at will",
+ "give your body great, but temporary, strength",
+ "",
+ "haste yourself",
+ "" },
+ // Nemelex
+ { "", "", "",
+ "", "" },
+ // Elyvilon
+ { "call upon Elyvilon for minor healing",
+ "call upon Elyvilon for purification",
+ "call upon Elyvilon for moderate healing",
+ "call upon Elyvilon to restore your abilities",
+ "call upon Elyvilon for incredible healing" }
+};
+
+
void altar_prayer(void);
void dec_penance(int god, int val);
void divine_retribution(int god);
@@ -1400,208 +1544,24 @@ void gain_piety(char pgn)
you.piety += pgn;
- if (you.piety >= 30 && old_piety < 30)
- {
- take_note(Note(NOTE_GOD_POWER, you.religion, 0));
- switch (you.religion)
- {
- case GOD_NO_GOD:
- case GOD_XOM:
- case GOD_NEMELEX_XOBEH:
- break;
- default:
- strcpy(info, "You can now ");
- strcat(info,
- (you.religion == GOD_ZIN || you.religion == GOD_SHINING_ONE)
- ? "repel the undead" :
- (you.religion == GOD_SIF_MUNA)
- ? "tap ambient magical fields" :
- (you.religion == GOD_KIKUBAAQUDGHA)
- ? "recall your undead slaves" :
- (you.religion == GOD_YREDELEMNUL)
- ? "animate corpses" :
- (you.religion == GOD_VEHUMET)
- ? "gain power from killing in Vehumet's name" :
- (you.religion == GOD_MAKHLEB)
- ? "gain power from killing in Makhleb's name" :
- (you.religion == GOD_OKAWARU)
- ? "give your body great, but temporary strength" :
- (you.religion == GOD_TROG)
- ? "go berserk at will" :
- (you.religion == GOD_ELYVILON)
- ? "call upon Elyvilon for minor healing"
- // Unknown god
- : "endure this program bug @30");
-
- strcat(info, ".");
- god_speaks(you.religion, info);
- break;
- }
- }
-
- if (you.piety >= 50 && old_piety < 50)
- {
- take_note(Note(NOTE_GOD_POWER, you.religion, 1));
- switch (you.religion)
- {
- case GOD_NO_GOD:
- case GOD_XOM:
- case GOD_NEMELEX_XOBEH:
- break;
- case GOD_KIKUBAAQUDGHA:
- simple_god_message(" is protecting you from some side-effects of death magic.");
- break;
-
- case GOD_VEHUMET:
- god_speaks(you.religion, "You can call upon Vehumet to aid your destructive magics with prayer.");
- break;
-
- default:
- strcpy(info, "You can now ");
-
- strcat(info,
- (you.religion == GOD_ZIN)
- ? "call upon Zin for minor healing" :
- (you.religion == GOD_SHINING_ONE)
- ? "smite your foes" :
- (you.religion == GOD_YREDELEMNUL)
- ? "recall your undead slaves" :
- (you.religion == GOD_OKAWARU)
- ? "call upon Okawaru for minor healing" :
- (you.religion == GOD_MAKHLEB)
- ? "harness Makhleb's destructive might" :
- (you.religion == GOD_SIF_MUNA)
- ? "freely open your mind to new spells" :
- (you.religion == GOD_TROG)
- ? "give your body great, but temporary, strength" :
- (you.religion == GOD_ELYVILON)
- ? "call upon Elyvilon for purification"
- // Unknown god
- : "endure this program bug @50");
-
- strcat(info, ".");
- god_speaks(you.religion, info);
- break;
- }
- }
-
- if (you.piety >= 75 && old_piety < 75)
- {
- take_note(Note(NOTE_GOD_POWER, you.religion, 2));
- switch (you.religion)
- {
- case GOD_NO_GOD:
- case GOD_XOM:
- case GOD_OKAWARU:
- case GOD_NEMELEX_XOBEH:
- case GOD_SIF_MUNA:
- case GOD_TROG:
- break;
- case GOD_VEHUMET:
- god_speaks(you.religion,"During prayer you have some protection from summoned creatures.");
- break;
-
- default:
- strcpy(info, "You can now ");
- strcat(info,
- (you.religion == GOD_ZIN)
- ? "call down a plague" :
- (you.religion == GOD_SHINING_ONE)
- ? "dispel the undead" :
- (you.religion == GOD_KIKUBAAQUDGHA)
- ? "permanently enslave the undead" :
- (you.religion == GOD_YREDELEMNUL)
- ? "animate legions of the dead" :
- (you.religion == GOD_MAKHLEB)
- ? "summon a lesser servant of Makhleb" :
- (you.religion == GOD_ELYVILON)
- ? "call upon Elyvilon for moderate healing"
- // Unknown god
- : "endure this program bug @75");
- strcat(info, ".");
- god_speaks(you.religion, info);
- break;
- }
- }
-
- if (you.piety >= 100 && old_piety < 100)
- {
- take_note(Note(NOTE_GOD_POWER, you.religion, 3));
- switch (you.religion)
- {
- case GOD_NO_GOD:
- case GOD_XOM:
- case GOD_OKAWARU:
- case GOD_NEMELEX_XOBEH:
- case GOD_KIKUBAAQUDGHA:
- case GOD_VEHUMET:
- break;
- case GOD_SIF_MUNA:
- simple_god_message
- (" is protecting you from some side-effects of spellcasting.");
- break;
-
- default:
- strcpy(info, "You can now ");
-
- strcat(info,
- (you.religion == GOD_ZIN)
- ? "utter a Holy Word" :
- (you.religion == GOD_SHINING_ONE)
- ? "hurl bolts of divine anger" :
- (you.religion == GOD_YREDELEMNUL)
- ? "drain ambient lifeforce" :
- (you.religion == GOD_MAKHLEB)
- ? "hurl Makhleb's greater destruction" :
- (you.religion == GOD_TROG)
- ? "haste yourself" :
- (you.religion == GOD_ELYVILON)
- ? "call upon Elyvilon to restore your abilities"
- // Unknown god
- : "endure this program bug @100");
-
- strcat(info, ".");
- god_speaks(you.religion, info);
- break;
- }
- }
-
- if (you.piety >= 120 && old_piety < 120)
+ for ( int i = 0; i < MAX_GOD_ABILITIES; ++i )
{
- take_note(Note(NOTE_GOD_POWER, you.religion, 4));
- switch (you.religion)
+ if ( you.piety >= piety_breakpoint(i) &&
+ old_piety < piety_breakpoint(i) )
{
- case GOD_NO_GOD:
- case GOD_XOM:
- case GOD_NEMELEX_XOBEH:
- case GOD_VEHUMET:
- case GOD_SIF_MUNA:
- case GOD_TROG:
- break;
- default:
- strcpy(info, "You can now ");
-
- strcat(info,
- (you.religion == GOD_ZIN)
- ? "summon a guardian angel" :
- (you.religion == GOD_SHINING_ONE)
- ? "summon a divine warrior" :
- (you.religion == GOD_KIKUBAAQUDGHA)
- ? "summon an emissary of Death" :
- (you.religion == GOD_YREDELEMNUL)
- ? "control the undead" :
- (you.religion == GOD_OKAWARU)
- ? "haste yourself" :
- (you.religion == GOD_MAKHLEB)
- ? "summon a greater servant of Makhleb" :
- (you.religion == GOD_ELYVILON)
- ? "call upon Elyvilon for incredible healing"
- // Unknown god
- : "endure this program bug @120");
-
- strcat(info, ".");
- god_speaks(you.religion, info);
- break;
+ take_note(Note(NOTE_GOD_POWER, you.religion, i));
+ const char* pmsg = god_gain_power_messages[(int)you.religion][i];
+ const char first = pmsg[0];
+ if ( first )
+ {
+ if ( isupper(first) )
+ god_speaks(you.religion, pmsg);
+ else
+ {
+ snprintf(info, INFO_SIZE, "You can now %s.", pmsg);
+ god_speaks(you.religion, info);
+ }
+ }
}
}
@@ -1609,8 +1569,7 @@ void gain_piety(char pgn)
(you.religion == GOD_SHINING_ONE || you.religion == GOD_ZIN) &&
you.num_gifts[you.religion] == 0 )
simple_god_message( " will now bless your weapon at an altar...once.");
-
-} // end gain_piety()
+}
void lose_piety(char pgn)
{
@@ -1631,205 +1590,27 @@ void lose_piety(char pgn)
you.num_gifts[you.religion] == 0)
simple_god_message(" is no longer ready to bless your weapon.");
- if (you.piety < 120 && old_piety >= 120)
- {
- switch (you.religion)
- {
- case GOD_NO_GOD:
- case GOD_XOM:
- case GOD_NEMELEX_XOBEH:
- case GOD_VEHUMET:
- case GOD_SIF_MUNA:
- case GOD_TROG:
- break;
- default:
- strcpy(info, "You can no longer ");
-
- strcat(info,
- (you.religion == GOD_ZIN)
- ? "summon guardian angels" :
- (you.religion == GOD_SHINING_ONE)
- ? "summon divine warriors" :
- (you.religion == GOD_KIKUBAAQUDGHA)
- ? "summon Death's emissaries" :
- (you.religion == GOD_YREDELEMNUL)
- ? "control undead beings" :
- (you.religion == GOD_OKAWARU)
- ? "haste yourself" :
- (you.religion == GOD_MAKHLEB)
- ? "summon a greater servant of Makhleb" :
- (you.religion == GOD_ELYVILON)
- ? "call upon Elyvilon for incredible healing"
- // Unknown god
- : "endure this program bug @120");
-
- strcat(info, ".");
- god_speaks(you.religion, info);
- break;
- }
- }
-
- if (you.piety < 100 && old_piety >= 100)
- {
- switch (you.religion)
- {
- case GOD_NO_GOD:
- case GOD_XOM:
- case GOD_OKAWARU:
- case GOD_NEMELEX_XOBEH:
- case GOD_KIKUBAAQUDGHA:
- case GOD_VEHUMET:
- break;
- case GOD_SIF_MUNA:
- god_speaks(you.religion,"Sif Muna is no longer protecting you from miscast magic.");
- break;
- default:
- strcpy(info, "You can no longer ");
- strcat(info,
- (you.religion == GOD_ZIN)
- ? "utter a Holy Word" :
- (you.religion == GOD_ELYVILON)
- ? "call upon Elyvilon to restore your abilities" :
- (you.religion == GOD_SHINING_ONE)
- ? "hurl bolts of divine anger" :
- (you.religion == GOD_YREDELEMNUL)
- ? "drain ambient life force" :
- (you.religion == GOD_MAKHLEB)
- ? "direct Makhleb's greater destructive powers" :
- (you.religion == GOD_TROG)
- ? "haste yourself"
- // Unknown god
- : "endure this program bug @100");
-
- strcat(info, ".");
- god_speaks(you.religion, info);
- break;
- }
- }
-
- if (you.piety < 75 && old_piety >= 75)
- {
- switch (you.religion)
- {
- case GOD_NO_GOD:
- case GOD_XOM:
- case GOD_OKAWARU:
- case GOD_NEMELEX_XOBEH:
- case GOD_SIF_MUNA:
- case GOD_TROG:
- break;
- case GOD_VEHUMET:
- simple_god_message(" will no longer shield you from summoned creatures.");
- break;
- default:
- strcpy(info, "You can no longer ");
-
- strcat(info,
- (you.religion == GOD_ZIN)
- ? "call down a plague" :
- (you.religion == GOD_SHINING_ONE)
- ? "dispel undead" :
- (you.religion == GOD_KIKUBAAQUDGHA)
- ? "enslave undead" :
- (you.religion == GOD_YREDELEMNUL)
- ? "animate legions of the dead" :
- (you.religion == GOD_MAKHLEB)
- ? "summon a servant of Makhleb" :
- (you.religion == GOD_ELYVILON)
- ? "call upon Elyvilon for moderate healing"
- // Unknown god
- : "endure this program bug @75");
-
- strcat(info, ".");
- god_speaks(you.religion, info);
- break;
- }
- }
-
- if (you.piety < 50 && old_piety >= 50)
- {
- switch (you.religion)
- {
- case GOD_NO_GOD:
- case GOD_XOM:
- case GOD_NEMELEX_XOBEH:
- break;
- case GOD_KIKUBAAQUDGHA:
- simple_god_message(" is no longer shielding you from miscast death magic.");
- break;
- case GOD_VEHUMET:
- simple_god_message(" will no longer aid your destructive magics.");
- break;
-
- default:
- strcpy(info, "You can no longer ");
-
- strcat(info,
- (you.religion == GOD_ZIN)
- ? "call upon Zin for minor healing" :
- (you.religion == GOD_SHINING_ONE)
- ? "smite your foes" :
- (you.religion == GOD_YREDELEMNUL)
- ? "recall your undead slaves" :
- (you.religion == GOD_OKAWARU)
- ? "call upon Okawaru for minor healing" :
- (you.religion == GOD_MAKHLEB)
- ? "hurl Makhleb's destruction" :
- (you.religion == GOD_SIF_MUNA)
- ? "forget spells at will" :
- (you.religion == GOD_TROG)
- ? "give your body great, but temporary, strength" :
- (you.religion == GOD_ELYVILON)
- ? "call upon Elyvilon for Purification"
- // Unknown god
- : "endure this program bug @50");
-
- strcat(info, ".");
- god_speaks(you.religion, info);
- break;
- }
- }
-
- if (you.piety < 30 && old_piety >= 30)
+ for ( int i = 0; i < MAX_GOD_ABILITIES; ++i )
{
- switch (you.religion)
+ if ( you.piety < piety_breakpoint(i) &&
+ old_piety >= piety_breakpoint(i) )
{
- case GOD_NO_GOD:
- case GOD_XOM:
- case GOD_NEMELEX_XOBEH:
- break;
- default:
- strcpy(info, "You can no longer ");
-
- strcat(info,
- (you.religion == GOD_ZIN || you.religion == GOD_SHINING_ONE)
- ? "repel the undead" :
- (you.religion == GOD_KIKUBAAQUDGHA)
- ? "recall your undead slaves" :
- (you.religion == GOD_YREDELEMNUL)
- ? "animate corpses" :
- (you.religion == GOD_SIF_MUNA)
- ? "tap ambient magical fields" :
- (you.religion == GOD_VEHUMET)
- ? "gain power from killing in Vehumet's name" :
- (you.religion == GOD_MAKHLEB)
- ? "gain power from killing in Makhleb's name" :
- (you.religion == GOD_OKAWARU)
- ? "give your body great, but temporary, strength" :
- (you.religion == GOD_TROG)
- ? "go berserk at will" :
- (you.religion == GOD_ELYVILON)
- ? "call upon Elyvilon for minor healing."
- // Unknown god
- : "endure this program bug @30");
-
- strcat(info, ".");
- god_speaks(you.religion, info);
- break;
+ const char* pmsg=god_lose_power_messages[(int)you.religion][i];
+ const char first = pmsg[0];
+ if ( first )
+ {
+ if ( isupper(first) )
+ god_speaks(you.religion, pmsg);
+ else
+ {
+ snprintf(info,INFO_SIZE,"You can no longer %s.",pmsg);
+ god_speaks(you.religion, info);
+ }
+ }
}
}
}
-} // end lose_piety()
+}
void divine_retribution( int god )
{
@@ -2850,3 +2631,12 @@ int piety_rank( int piety )
return numbreakpoints - i;
return 0;
}
+
+int piety_breakpoint(int i)
+{
+ int breakpoints[MAX_GOD_ABILITIES] = { 30, 50, 75, 100, 120 };
+ if ( i >= MAX_GOD_ABILITIES || i < 0 )
+ return 255;
+ else
+ return breakpoints[i];
+}
diff --git a/crawl-ref/source/religion.h b/crawl-ref/source/religion.h
index 67ef4b15f6..11b2739227 100644
--- a/crawl-ref/source/religion.h
+++ b/crawl-ref/source/religion.h
@@ -17,6 +17,7 @@
#include "enum.h"
void simple_god_message( const char *event, int which_deity = GOD_NO_GOD );
+int piety_breakpoint(int i);
char *god_name(int which_god,bool long_name=false); //mv
void dec_penance(int val);
void dec_penance(int god, int val);
diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc
index 3a50f82608..fd03b4a2c7 100644
--- a/crawl-ref/source/spells2.cc
+++ b/crawl-ref/source/spells2.cc
@@ -41,6 +41,7 @@
#include "ouch.h"
#include "player.h"
#include "randart.h"
+#include "religion.h"
#include "spells4.h"
#include "spl-cast.h"
#include "stuff.h"
@@ -1539,7 +1540,8 @@ void summon_undead(int pow)
if (!you.is_undead
&& !(you.religion == GOD_KIKUBAAQUDGHA
&& (!player_under_penance()
- && you.piety >= 100 && random2(200) <= you.piety)))
+ && you.piety >= piety_breakpoint(3)
+ && random2(200) <= you.piety)))
{
disease_player( 25 + random2(50) );
}
diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc
index c492abf60e..19e28d8dd9 100644
--- a/crawl-ref/source/spl-cast.cc
+++ b/crawl-ref/source/spl-cast.cc
@@ -2699,7 +2699,7 @@ bool miscast_effect( unsigned int sp_type, int mag_pow, int mag_fail,
case SPTYP_NECROMANCY:
if (you.religion == GOD_KIKUBAAQUDGHA
- && (!player_under_penance() && you.piety >= 50
+ && (!player_under_penance() && you.piety >= piety_breakpoint(1)
&& random2(150) <= you.piety))
{
canned_msg(MSG_NOTHING_HAPPENS);