summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-11-01 11:59:18 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-11-01 11:59:18 +0000
commitb0bb78bd1d4f2364fb560ce31dadd878d3253573 (patch)
tree2ca8deb6038537b73f70788bd8a424cf982eb87a /crawl-ref/source
parent22995abf93b5514ed2b71219a693355ae9f7281f (diff)
downloadcrawl-ref-b0bb78bd1d4f2364fb560ce31dadd878d3253573.tar.gz
crawl-ref-b0bb78bd1d4f2364fb560ce31dadd878d3253573.zip
Added you.good_god() and you.evil_god() to check if the player is worshipping a good/evil god. Passing a god name is optional, and will check if that god is good/evil (you.good_god("Elyvilon") == true).
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2715 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/clua.cc9
-rw-r--r--crawl-ref/source/religion.cc4
-rw-r--r--crawl-ref/source/religion.h3
3 files changed, 13 insertions, 3 deletions
diff --git a/crawl-ref/source/clua.cc b/crawl-ref/source/clua.cc
index 4539a81da2..d21522aeca 100644
--- a/crawl-ref/source/clua.cc
+++ b/crawl-ref/source/clua.cc
@@ -717,6 +717,12 @@ LUARET1(you_race, string,
species_name(you.species, you.experience_level).c_str())
LUARET1(you_class, string, get_class_name(you.char_class))
LUARET1(you_god, string, god_name(you.religion))
+LUARET1(you_good_god, boolean,
+ lua_isstring(ls, 1) ? is_good_god(str_to_god(lua_tostring(ls, 1)))
+ : is_good_god(you.religion))
+LUARET1(you_evil_god, boolean,
+ lua_isstring(ls, 1) ? is_evil_god(str_to_god(lua_tostring(ls, 1)))
+ : is_evil_god(you.religion))
LUARET2(you_hp, number, you.hp, you.hp_max)
LUARET2(you_mp, number, you.magic_points, you.max_magic_points)
LUARET1(you_hunger, string, hunger_level())
@@ -797,6 +803,8 @@ static const struct luaL_reg you_lib[] =
{ "race" , you_race },
{ "class" , you_class },
{ "god" , you_god },
+ { "good_god" , you_good_god },
+ { "evil_god" , you_evil_god },
{ "hp" , you_hp },
{ "mp" , you_mp },
{ "hunger" , you_hunger },
@@ -805,7 +813,6 @@ static const struct luaL_reg you_lib[] =
{ "dexterity" , you_dexterity },
{ "xl" , you_exp },
{ "exp" , you_exp_points },
-
{ "res_poison" , you_res_poison },
{ "res_fire" , you_res_fire },
{ "res_cold" , you_res_cold },
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
index 8aab39d714..e924109a87 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -359,7 +359,7 @@ void inc_penance(int god, int val);
void inc_penance(int val);
static bool followers_abandon_you(void); // Beogh
-static bool is_evil_god(god_type god)
+bool is_evil_god(god_type god)
{
return
god == GOD_KIKUBAAQUDGHA ||
@@ -370,7 +370,7 @@ static bool is_evil_god(god_type god)
god == GOD_LUGONU;
}
-static bool is_good_god(god_type god)
+bool is_good_god(god_type god)
{
return
god == GOD_SHINING_ONE ||
diff --git a/crawl-ref/source/religion.h b/crawl-ref/source/religion.h
index 669b474e72..092de3edd0 100644
--- a/crawl-ref/source/religion.h
+++ b/crawl-ref/source/religion.h
@@ -52,4 +52,7 @@ bool ely_destroy_weapons();
bool trog_burn_books();
bool tso_stab_safe_monster(const actor *act);
+bool is_evil_god(god_type god);
+bool is_good_god(god_type god);
+
#endif