diff options
-rw-r--r-- | crawl-ref/source/abl-show.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/religion.cc | 8 | ||||
-rw-r--r-- | crawl-ref/source/spells2.cc | 103 | ||||
-rw-r--r-- | crawl-ref/source/spells2.h | 9 | ||||
-rw-r--r-- | crawl-ref/source/spl-cast.cc | 4 |
5 files changed, 68 insertions, 58 deletions
diff --git a/crawl-ref/source/abl-show.cc b/crawl-ref/source/abl-show.cc index 8a616712b3..edd6fd5902 100644 --- a/crawl-ref/source/abl-show.cc +++ b/crawl-ref/source/abl-show.cc @@ -1434,7 +1434,7 @@ static bool _do_ability(const ability_def& abil) break; case ABIL_TSO_SUMMON_DAEVA: - cast_summon_daeva(you.skills[SK_INVOCATIONS] * 4, true); + summon_daeva(you.skills[SK_INVOCATIONS] * 4); exercise(SK_INVOCATIONS, 8 + random2(10)); break; diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index b0571ab956..dec968345d 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -3016,9 +3016,7 @@ static bool _tso_retribution() for (int i = 0; i < how_many; ++i) { - if (create_monster( - mgen_data::alert_hostile_at(MONS_DAEVA, - you.pos(), MF_GOD_GIFT)) != -1) + if (summon_daeva(0, true, true, true)) { success = true; } @@ -3117,9 +3115,7 @@ static bool _zin_retribution() for (int i = 0; i < how_many; ++i) { - if (create_monster( - mgen_data::alert_hostile_at(MONS_ANGEL, - you.pos(), MF_GOD_GIFT)) != -1) + if (summon_guardian(0, true, true, true)) { success = true; } 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; diff --git a/crawl-ref/source/spells2.h b/crawl-ref/source/spells2.h index 47a9546440..4d4c01faa8 100644 --- a/crawl-ref/source/spells2.h +++ b/crawl-ref/source/spells2.h @@ -163,10 +163,6 @@ bool cast_summon_greater_demon(int pow, bool god_gift = false); bool cast_summon_wraiths(int pow, bool god_gift = false); -bool cast_summon_guardian(int pow, bool god_gift = false); - -bool cast_summon_daeva(int pow, bool god_gift = false); - bool cast_summon_dragon(int pow, bool god_gift = false); bool summon_minor_demon(int pow, bool god_gift = false); @@ -191,6 +187,11 @@ void summon_small_mammals(int pow); bool summon_berserker(int pow, bool force_hostile = false); +bool summon_guardian(int pow, bool force_hostile = false, bool quiet = false, + bool permanent = false); + +bool summon_daeva(int pow, bool force_hostile = false, bool quiet = false, + bool permanent = false); // last updated 24may2000 {dlb} /* *********************************************************************** diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc index 7cad63c787..2f4a22bcee 100644 --- a/crawl-ref/source/spl-cast.cc +++ b/crawl-ref/source/spl-cast.cc @@ -1521,11 +1521,11 @@ spret_type your_spells(spell_type spell, int powc, bool allow_fail) break; case SPELL_SUMMON_GUARDIAN: - cast_summon_guardian(powc); + summon_guardian(powc); break; case SPELL_SUMMON_DAEVA: - cast_summon_daeva(powc); + summon_daeva(powc); break; case SPELL_SUMMON_DRAGON: |