From 450f6fd14fe0c09e89ad90eac2a9a6ee9521af69 Mon Sep 17 00:00:00 2001 From: dolorous Date: Thu, 30 Oct 2008 19:08:31 +0000 Subject: Add various holy being-related cleanups. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7312 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/mon-util.cc | 2 +- crawl-ref/source/monplace.cc | 6 +----- crawl-ref/source/monplace.h | 3 +-- crawl-ref/source/religion.cc | 22 +++++++++++----------- crawl-ref/source/spells2.cc | 30 +++++++++++++++++++----------- crawl-ref/source/spells2.h | 7 ++++--- 6 files changed, 37 insertions(+), 33 deletions(-) (limited to 'crawl-ref/source') diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc index 8dd9584afe..dbd06b30d6 100644 --- a/crawl-ref/source/mon-util.cc +++ b/crawl-ref/source/mon-util.cc @@ -4960,7 +4960,7 @@ void monsters::banish(const std::string &) int monsters::holy_aura() const { - return ((type == MONS_DAEVA || type == MONS_ANGEL) ? hit_dice : 0); + return (mons_is_holy(this) ? hit_dice : 0); } bool monsters::has_spell(spell_type spell) const diff --git a/crawl-ref/source/monplace.cc b/crawl-ref/source/monplace.cc index 0c1f05d43b..9f1299d5da 100644 --- a/crawl-ref/source/monplace.cc +++ b/crawl-ref/source/monplace.cc @@ -2291,12 +2291,8 @@ monster_type summon_any_holy_being(holy_being_class_type hbct) switch (hbct) { - case HOLY_BEING_ZIN: - mon = MONS_ANGEL; - break; - case HOLY_BEING_TSO: - mon = MONS_DAEVA; + mon = coinflip() ? MONS_DAEVA : MONS_ANGEL; break; default: diff --git a/crawl-ref/source/monplace.h b/crawl-ref/source/monplace.h index 1ce27e9e77..4c489686b4 100644 --- a/crawl-ref/source/monplace.h +++ b/crawl-ref/source/monplace.h @@ -76,8 +76,7 @@ enum demon_class_type enum holy_being_class_type { - HOLY_BEING_ZIN, // 0: Angel - HOLY_BEING_TSO, // 1: Daeva + HOLY_BEING_TSO, // 0: Daeva or Angel HOLY_BEING_RANDOM // any of the above }; diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index 7db608706a..5fa56ac0e2 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -3536,25 +3536,29 @@ static bool _tso_retribution() { const god_type god = GOD_SHINING_ONE; - // daevas/cleansing theme + // holy warriors/cleansing theme int punishment = random2(7); switch (punishment) { case 0: case 1: - case 2: // summon daevas (3/7) + case 2: // summon holy warriors (3/7) { bool success = false; int how_many = 1 + random2(you.experience_level / 5) + random2(3); for (int i = 0; i < how_many; ++i) { - if (create_monster( - mgen_data::hostile_at(coinflip() ? MONS_ANGEL : MONS_DAEVA, - you.pos(), 0, 0, true, god)) != -1) + if (coinflip()) { - success = true; + if (summon_daeva(100, god, true, true, true)) + success = true; + } + else + { + if (summon_angel(100, god, true, true, true)) + success = true; } } @@ -3646,12 +3650,8 @@ static bool _zin_retribution() for (int i = 0; i < how_many; ++i) { - if (create_monster( - mgen_data::hostile_at(MONS_ANGEL, - you.pos(), 0, 0, true, god)) != -1) - { + if (summon_angel(100, god, true, true, true)) success = true; - } } simple_god_message(success ? " sends the divine host to punish " diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc index 6f22a8fa27..5d32629448 100644 --- a/crawl-ref/source/spells2.cc +++ b/crawl-ref/source/spells2.cc @@ -1614,11 +1614,9 @@ bool summon_berserker(int pow, god_type god, bool force_hostile) return (true); } -static bool _summon_holy_being_wrapper(int pow, god_type god, - monster_type mon, bool quiet) +static bool _summon_holy_being_wrapper(god_type god, monster_type mon, int dur, + bool friendly, bool quiet) { - const int dur = std::min(2 + (random2(pow) / 4), 6); - const int monster = create_monster( mgen_data(mon, BEH_FRIENDLY, dur, @@ -1633,25 +1631,35 @@ static bool _summon_holy_being_wrapper(int pow, god_type god, if (!quiet) { - mprf("You are momentarily dazzled by a brilliant %s light.", - (mon == MONS_DAEVA) ? "golden" - : "white"); + mprf("You are momentarily dazzled by a brilliant %slight.", + (mon == MONS_DAEVA) ? "golden " : + (mon == MONS_ANGEL) ? "white " + : ""); } + player_angers_monster(&menv[monster]); return (true); } // TSO sends an angel for a follower. -bool summon_angel(int pow, god_type god, bool quiet) +bool summon_angel(int pow, god_type god, bool quiet, + bool force_hostile, bool permanent) { - return _summon_holy_being_wrapper(pow, god, MONS_ANGEL, quiet); + int dur = !permanent ? std::min(2 + (random2(pow) / 4), 6) : 0; + + return _summon_holy_being_wrapper(god, MONS_ANGEL, dur, !force_hostile, + quiet); } // TSO sends a daeva for a follower. -bool summon_daeva(int pow, god_type god, bool quiet) +bool summon_daeva(int pow, god_type god, bool quiet, + bool force_hostile, bool permanent) { - return _summon_holy_being_wrapper(pow, god, MONS_DAEVA, quiet); + int dur = !permanent ? std::min(2 + (random2(pow) / 4), 6) : 0; + + return _summon_holy_being_wrapper(god, MONS_DAEVA, dur, !force_hostile, + quiet); } bool cast_tukimas_dance(int pow, god_type god, diff --git a/crawl-ref/source/spells2.h b/crawl-ref/source/spells2.h index 74c49984e8..9f583b1030 100644 --- a/crawl-ref/source/spells2.h +++ b/crawl-ref/source/spells2.h @@ -63,9 +63,10 @@ bool cast_summon_ugly_thing(int pow, god_type god = GOD_NO_GOD); bool cast_summon_dragon(int pow, god_type god = GOD_NO_GOD); bool summon_berserker(int pow, god_type god = GOD_NO_GOD, bool force_hostile = false); -bool summon_angel(int pow, god_type god = GOD_NO_GOD, bool quiet = false); -bool summon_daeva(int pow, god_type god = GOD_NO_GOD, bool quiet = false); - +bool summon_angel(int pow, god_type god = GOD_NO_GOD, bool quiet = false, + bool force_hostile = false, bool permanent = false); +bool summon_daeva(int pow, god_type god = GOD_NO_GOD, bool quiet = false, + bool force_hostile = false, bool permanent = false); bool cast_tukimas_dance(int pow, god_type god = GOD_NO_GOD, bool force_hostile = false); bool cast_conjure_ball_lightning(int pow, god_type god = GOD_NO_GOD); -- cgit v1.2.3-54-g00ecf