From b857cd3be4fe4adcf3a5abcf83d9873439dc1ab1 Mon Sep 17 00:00:00 2001 From: dolorous Date: Sun, 8 Jun 2008 00:13:14 +0000 Subject: Simplify summoning of hostile holy beings. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5565 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/spells2.cc | 103 +++++++++++++++++++++++++------------------- 1 file changed, 58 insertions(+), 45 deletions(-) (limited to 'crawl-ref/source/spells2.cc') diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc index 5d2edc99c0..c9531a7d7e 100644 --- a/crawl-ref/source/spells2.cc +++ b/crawl-ref/source/spells2.cc @@ -2045,50 +2045,6 @@ bool cast_summon_wraiths(int pow, bool god_gift) return (success); } -static bool _summon_holy_being_wrapper(int pow, bool god_gift, - holy_being_class_type hbct) -{ - bool success = false; - - monster_type mon = summon_any_holy_being(hbct); - - const int dur = std::min(2 + (random2(pow) / 4), 6); - - mprf("You open a gate to %s's realm!", - (mon == MONS_DAEVA) ? god_name(GOD_SHINING_ONE).c_str() - : god_name(GOD_ZIN).c_str()); - - int monster = create_monster( - mgen_data(mon, BEH_FRIENDLY, dur, you.pos(), - you.pet_target, - god_gift ? MF_GOD_GIFT : 0)); - if (monster != -1) - { - success = true; - - monsters *summon = &menv[monster]; - summon->flags |= MF_ATT_CHANGE_ATTEMPT; - - mprf("You are momentarily dazzled by a brilliant %s light.", - (mon == MONS_DAEVA) ? "golden" - : "white"); - } - else - canned_msg(MSG_NOTHING_HAPPENS); - - return (success); -} - -bool cast_summon_guardian(int pow, bool god_gift) -{ - return _summon_holy_being_wrapper(pow, god_gift, HOLY_BEING_ANGEL); -} - -bool cast_summon_daeva(int pow, bool god_gift) -{ - return _summon_holy_being_wrapper(pow, god_gift, HOLY_BEING_DAEVA); -} - bool cast_summon_dragon(int pow, bool god_gift) { // Removed the chance of multiple dragons... one should be more @@ -2157,7 +2113,7 @@ bool summon_specific_demon(monster_type mon, int pow, bool god_gift) return (success); } -// Trog sends some fighting buddies (or enemies) for his followers. +// Trog sends a fighting buddy (or enemy) for a follower. bool summon_berserker(int pow, bool force_hostile) { bool success = false; @@ -2236,6 +2192,63 @@ bool summon_berserker(int pow, bool force_hostile) return (success); } +static bool _summon_holy_being_wrapper(int pow, holy_being_class_type hbct, + bool force_hostile, bool quiet, + bool permanent) +{ + bool success = false; + + monster_type mon = summon_any_holy_being(hbct); + + const int dur = (permanent) ? 0 : std::min(2 + (random2(pow) / 4), 6); + + if (!quiet) + { + mprf("You open a gate to %s's realm!", + (mon == MONS_DAEVA) ? god_name(GOD_SHINING_ONE).c_str() + : god_name(GOD_ZIN).c_str()); + } + + int monster = create_monster( + mgen_data(mon, + !force_hostile ? BEH_FRIENDLY : BEH_HOSTILE, + dur, you.pos(), + !force_hostile ? you.pet_target : MHITYOU, + MF_GOD_GIFT)); + if (monster != -1) + { + success = true; + + monsters *summon = &menv[monster]; + summon->flags |= MF_ATT_CHANGE_ATTEMPT; + + if (!quiet) + { + mprf("You are momentarily dazzled by a brilliant %s light.", + (mon == MONS_DAEVA) ? "golden" + : "white"); + } + } + + return (success); +} + +// Zin sends an angel for a follower. +bool summon_guardian(int pow, bool force_hostile, bool quiet, + bool permanent) +{ + return _summon_holy_being_wrapper(pow, HOLY_BEING_ANGEL, force_hostile, + quiet, permanent); +} + +// TSO sends a daeva for a follower. +bool summon_daeva(int pow, bool force_hostile, bool quiet, + bool permanent) +{ + return _summon_holy_being_wrapper(pow, HOLY_BEING_DAEVA, force_hostile, + quiet, permanent); +} + void summon_things(int pow) { int big_things = 0; -- cgit v1.2.3-54-g00ecf