diff options
author | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-09-26 18:20:20 +0000 |
---|---|---|
committer | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-09-26 18:20:20 +0000 |
commit | 057afedbab6f22f1cad4c2e31a46e88296b0c0cb (patch) | |
tree | a23194b54053801f7a4fd8017205594ea49e3a74 /crawl-ref/source/religion.cc | |
parent | a75579a687e271d33078425cefc6ce29c7b87fd6 (diff) | |
download | crawl-ref-057afedbab6f22f1cad4c2e31a46e88296b0c0cb.tar.gz crawl-ref-057afedbab6f22f1cad4c2e31a46e88296b0c0cb.zip |
When under penance from Yred, give his servants on the current level a
chance to randomly abandon you.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7015 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/religion.cc')
-rw-r--r-- | crawl-ref/source/religion.cc | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index 91d75c5a8f..d971d9154b 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -362,6 +362,7 @@ static bool _holy_beings_attitude_change(); static bool _evil_beings_attitude_change(); static bool _chaotic_beings_attitude_change(); static bool _magic_users_attitude_change(); +static bool _yred_slaves_abandon_you(); static bool _beogh_followers_abandon_you(); static void _altar_prayer(); static void _dock_piety(int piety_loss, int penance); @@ -1114,6 +1115,13 @@ bool mons_is_god_gift(const monsters *mon, god_type god) return (mon->god == god); } +bool is_yred_slave(const monsters* mon) +{ + return (mon->alive() && mons_holiness(mon) == MH_UNDEAD + && mon->attitude == ATT_FRIENDLY + && mons_is_god_gift(mon, GOD_YREDELEMNUL)); +} + bool is_orcish_follower(const monsters* mon) { return (mon->alive() && mons_species(mon->type) == MONS_ORC @@ -1135,7 +1143,9 @@ bool is_good_follower(const monsters* mon) bool is_follower(const monsters* mon) { - if (you.religion == GOD_BEOGH) + if (you.religion == GOD_YREDELEMNUL) + return is_yred_slave(mon); + else if (you.religion == GOD_BEOGH) return is_orcish_follower(mon); else if (you.religion == GOD_ZIN) return is_good_lawful_follower(mon); @@ -3765,7 +3775,11 @@ static bool _yredelemnul_retribution() // undead theme const god_type god = GOD_YREDELEMNUL; - if (random2(you.experience_level) > 4) + if (coinflip() && you.religion == god && _yred_slaves_abandon_you()) + { + ; + } + else if (random2(you.experience_level) > 4) { int how_many = 1 + random2(1 + (you.experience_level / 5)); int count = 0; @@ -4543,6 +4557,29 @@ static bool _orcish_followers_on_level_abandon_you() return success; } +static bool _yred_slaves_abandon_you() +{ + int how_many = 1 + random2(1 + (you.experience_level / 5)); + int count = 0; + + for (; how_many > 0; --how_many) + { + monsters *slave = choose_random_nearby_monster(0, is_yred_slave, true, + true); + if (slave) + { + slave->attitude = ATT_HOSTILE; + behaviour_event(slave, ME_ALERT, MHITYOU); + + simple_monster_message(slave, " turns against you!"); + + count++; + } + } + + return (count > 0); +} + // Upon excommunication, ex-Beoghites lose all their orcish followers. // When under penance, Beoghites can lose all orcish followers in sight, // subject to a few limitations. |