From 6b01578aea5d2f44172181e9aacd65d068e21a58 Mon Sep 17 00:00:00 2001 From: dolorous Date: Thu, 19 Jun 2008 02:32:59 +0000 Subject: Add various god gift-related cleanups. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5966 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/decks.cc | 28 +++++++++++----------------- crawl-ref/source/mon-util.cc | 13 ++----------- crawl-ref/source/mon-util.h | 1 - crawl-ref/source/monplace.cc | 2 +- crawl-ref/source/religion.cc | 20 +++++++++++++++----- crawl-ref/source/religion.h | 3 +++ 6 files changed, 32 insertions(+), 35 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc index 61eb11b43f..c7c31cc632 100644 --- a/crawl-ref/source/decks.cc +++ b/crawl-ref/source/decks.cc @@ -2487,31 +2487,25 @@ static void _crusade_card(int power, deck_rarity_type rarity) // (though not immunity) check. Specifically, // you can convert Killer Klowns this way. // Might be too good. - if ( monster->hit_dice * 35 < random2(power) ) + if (monster->hit_dice * 35 < random2(power)) { - bool converted = false; + simple_monster_message(monster, " is converted."); - if ( one_chance_in(5 - power_level) ) + if (one_chance_in(5 - power_level)) { - if (you.religion == GOD_BEOGH && - mons_species(monster->type) == MONS_ORC) - { - beogh_convert_orc(monster, false); - } - else + monster->attitude = ATT_FRIENDLY; + + // If you worship a god that lets you recruit + // permanent followers, count this as a recruitment. + if (you.religion == GOD_SHINING_ONE + || you.religion == GOD_BEOGH + && mons_species(monster->type) == MONS_ORC) { - monster->attitude = ATT_FRIENDLY; - converted = true; + mons_make_god_gift(monster); } } else - { monster->add_ench(ENCH_CHARM); - converted = true; - } - - if (converted) - simple_monster_message(monster, " is converted."); } } } diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc index 57e71996b2..620b0e30ec 100644 --- a/crawl-ref/source/mon-util.cc +++ b/crawl-ref/source/mon-util.cc @@ -497,14 +497,6 @@ bool mons_is_native_in_branch(const monsters *monster, } } -bool mons_is_god_gift(const monsters *mon, god_type god) -{ - if (god == GOD_NO_GOD) - return (false); - - return (mon->god == god); -} - bool mons_is_chaotic(const monsters *mon) { if (mon->has_ench(ENCH_GLOWING_SHAPESHIFTER, ENCH_SHAPESHIFTER)) @@ -5281,11 +5273,10 @@ void monsters::remove_enchantment_effect(const mon_enchant &me, bool quiet) case ENCH_SHORT_LIVED: add_ench(mon_enchant(ENCH_ABJ)); - // Just for flavour. - if (mons_is_god_gift(this) && this->has_ench(ENCH_BERSERK)) + if (this->has_ench(ENCH_BERSERK)) simple_monster_message(this, " is no longer berserk."); - monster_die( this, quiet ? KILL_DISMISSED : KILL_RESET, 0 ); + monster_die(this, quiet ? KILL_DISMISSED : KILL_RESET, 0); break; case ENCH_SUBMERGED: diff --git a/crawl-ref/source/mon-util.h b/crawl-ref/source/mon-util.h index ce71eccfa7..22932a3677 100644 --- a/crawl-ref/source/mon-util.h +++ b/crawl-ref/source/mon-util.h @@ -647,7 +647,6 @@ mon_attitude_type mons_attitude(const monsters *m); bool mons_behaviour_perceptible(const monsters *mon); bool mons_is_native_in_branch(const monsters *monster, const branch_type branch = you.where_are_you); -bool mons_is_god_gift(const monsters *mon, god_type god = you.religion); bool mons_is_chaotic(const monsters *mon); bool mons_is_poisoner(const monsters *mon); bool mons_is_confused(const monsters *m); diff --git a/crawl-ref/source/monplace.cc b/crawl-ref/source/monplace.cc index 01a7cf4f8c..9e3df59bd1 100644 --- a/crawl-ref/source/monplace.cc +++ b/crawl-ref/source/monplace.cc @@ -1884,7 +1884,7 @@ int mons_place( mgen_data mg ) monsters *creation = &menv[mid]; - creation->god = mg.god; + mons_make_god_gift(creation, mg.god); // Look at special cases: CHARMED, FRIENDLY, NEUTRAL, GOOD_NEUTRAL, // HOSTILE. diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index 31094974da..d26828f0f7 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -1069,6 +1069,16 @@ static void _give_nemelex_gift() } } +void mons_make_god_gift(monsters *mon, god_type god) +{ + mon->god = god; +} + +bool mons_is_god_gift(const monsters *mon, god_type god) +{ + return (mon->god == god); +} + bool is_orcish_follower(const monsters* mon) { return (mon->alive() && mons_species(mon->type) == MONS_ORC @@ -1320,7 +1330,7 @@ static bool _tso_blessing_friendliness(monsters* mon) // become hostile later on, it won't count as a good kill. mon->flags |= MF_CREATED_FRIENDLY; - mon->god = GOD_SHINING_ONE; + mons_make_god_gift(mon, GOD_SHINING_ONE); // If the monster is charmed, make it permanently friendly. Note // that we have to delete the enchantment without removing the @@ -2150,13 +2160,13 @@ void god_speaks( god_type god, const char *mesg ) bool did_god_conduct(conduct_type thing_done, int level, bool known, const monsters *victim) { + if (you.religion == GOD_NO_GOD || you.religion == GOD_XOM) + return (false); + bool ret = false; int piety_change = 0; int penance = 0; - if (you.religion == GOD_NO_GOD || you.religion == GOD_XOM) - return (false); - god_acting gdact; switch (thing_done) @@ -4659,7 +4669,7 @@ void beogh_convert_orc(monsters *orc, bool emergency, // become hostile later on, it won't count as a good kill. orc->flags |= MF_CREATED_FRIENDLY; - orc->god = GOD_BEOGH; + mons_make_god_gift(orc, GOD_BEOGH); if (orc->is_patrolling()) { diff --git a/crawl-ref/source/religion.h b/crawl-ref/source/religion.h index 75dbfa5f1f..332a0fa703 100644 --- a/crawl-ref/source/religion.h +++ b/crawl-ref/source/religion.h @@ -110,6 +110,9 @@ bool ely_destroy_weapons(); bool trog_burn_books(); bool tso_unchivalric_attack_safe_monster(const actor *act); +void mons_make_god_gift(monsters *mon, god_type god = you.religion); +bool mons_is_god_gift(const monsters *mon, god_type god = you.religion); + bool is_orcish_follower(const monsters* mon); bool is_good_lawful_follower(const monsters* mon); bool is_good_follower(const monsters* mon); -- cgit v1.2.3-54-g00ecf