summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/spl-cast.cc
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-12 03:57:11 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-12 03:57:11 +0000
commita6b399eae4cd72f6bc2f077a694ecf5ef6b75ffc (patch)
tree5f9ce43c244881192bede86434a5e8382c85fb15 /crawl-ref/source/spl-cast.cc
parent662e3cb4688c794cfb3294772cc49b96e5311bb8 (diff)
downloadcrawl-ref-a6b399eae4cd72f6bc2f077a694ecf5ef6b75ffc.tar.gz
crawl-ref-a6b399eae4cd72f6bc2f077a694ecf5ef6b75ffc.zip
Overhaul god gift handling again so that we can tell which god sent
which gift. There was an unused god parameter in the monsters struct, which was probably intended to hold which god a monster worshipped. I've used it as an indicator of which god sent the monster, under the assumption that gods would send their own worshippers as gifts. (I hope this isn't an abuse of it.) git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5748 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/spl-cast.cc')
-rw-r--r--crawl-ref/source/spl-cast.cc94
1 files changed, 51 insertions, 43 deletions
diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc
index 4a8bed7ba3..5f84cf81cc 100644
--- a/crawl-ref/source/spl-cast.cc
+++ b/crawl-ref/source/spl-cast.cc
@@ -1071,7 +1071,9 @@ spret_type your_spells(spell_type spell, int powc, bool allow_fail)
mprf(MSGCH_DIAGNOSTICS, "Spell #%d, power=%d", spell, powc );
#endif
- const bool god_gift = crawl_state.is_god_acting();
+ const god_type god =
+ (crawl_state.is_god_acting()) ? crawl_state.which_god_acting()
+ : GOD_NO_GOD;
switch (spell)
{
@@ -1421,113 +1423,113 @@ spret_type your_spells(spell_type spell, int powc, bool allow_fail)
// If a god is making you cast one of these spells, any monsters
// produced will count as god gifts.
case SPELL_SUMMON_BUTTERFLIES:
- cast_summon_butterflies(powc, god_gift);
+ cast_summon_butterflies(powc, god);
break;
case SPELL_SUMMON_SMALL_MAMMALS:
- cast_summon_small_mammals(powc, god_gift);
+ cast_summon_small_mammals(powc, god);
break;
case SPELL_STICKS_TO_SNAKES:
- cast_sticks_to_snakes(powc, god_gift);
+ cast_sticks_to_snakes(powc, god);
break;
case SPELL_SUMMON_SCORPIONS:
- cast_summon_scorpions(powc, god_gift);
+ cast_summon_scorpions(powc, god);
break;
case SPELL_SUMMON_SWARM:
- cast_summon_swarm(powc, god_gift);
+ cast_summon_swarm(powc, god);
break;
case SPELL_CALL_CANINE_FAMILIAR:
- cast_call_canine_familiar(powc, god_gift);
+ cast_call_canine_familiar(powc, god);
break;
case SPELL_SUMMON_ELEMENTAL:
- if (!cast_summon_elemental(powc, god_gift))
+ if (!cast_summon_elemental(powc, god))
return (SPRET_ABORT);
break;
case SPELL_SUMMON_ICE_BEAST:
- cast_summon_ice_beast(powc, god_gift);
+ cast_summon_ice_beast(powc, god);
break;
case SPELL_SUMMON_UGLY_THING:
- cast_summon_ugly_thing(powc, god_gift);
+ cast_summon_ugly_thing(powc, god);
break;
case SPELL_SUMMON_DRAGON:
- cast_summon_dragon(powc, god_gift);
+ cast_summon_dragon(powc, god);
break;
case SPELL_SUMMON_GUARDIAN:
- summon_guardian(powc, god_gift);
+ summon_guardian(powc, god);
break;
case SPELL_SUMMON_DAEVA:
- summon_daeva(powc, god_gift);
+ summon_daeva(powc, god);
break;
case SPELL_TUKIMAS_DANCE:
// Temporarily turn a wielded weapon into a dancing weapon.
crawl_state.cant_cmd_repeat("You can't repeat Tukima's Dance.");
- cast_tukimas_dance(powc, god_gift);
+ cast_tukimas_dance(powc, god);
break;
case SPELL_CONJURE_BALL_LIGHTNING:
- cast_conjure_ball_lightning(powc, god_gift);
+ cast_conjure_ball_lightning(powc, god);
break;
case SPELL_CALL_IMP:
- cast_call_imp(powc, god_gift);
+ cast_call_imp(powc, god);
break;
case SPELL_SUMMON_DEMON:
- cast_summon_demon(powc, god_gift);
+ cast_summon_demon(powc, god);
break;
case SPELL_DEMONIC_HORDE:
- cast_demonic_horde(powc, god_gift);
+ cast_demonic_horde(powc, god);
break;
case SPELL_SUMMON_GREATER_DEMON:
- cast_summon_greater_demon(powc, god_gift);
+ cast_summon_greater_demon(powc, god);
break;
case SPELL_SHADOW_CREATURES:
- cast_shadow_creatures(god_gift);
+ cast_shadow_creatures(god);
break;
case SPELL_SUMMON_HORRIBLE_THINGS:
- cast_summon_horrible_things(powc, god_gift);
+ cast_summon_horrible_things(powc, god);
break;
case SPELL_ANIMATE_SKELETON:
mpr("You attempt to give life to the dead...");
animate_a_corpse(you.x_pos, you.y_pos, CORPSE_SKELETON, BEH_FRIENDLY,
- you.pet_target, god_gift);
+ you.pet_target, god);
break;
case SPELL_ANIMATE_DEAD:
mpr("You call on the dead to walk for you.");
- animate_dead(&you, powc + 1, BEH_FRIENDLY, you.pet_target, god_gift);
+ animate_dead(&you, powc + 1, BEH_FRIENDLY, you.pet_target, god);
break;
case SPELL_SIMULACRUM:
- cast_simulacrum(powc, god_gift);
+ cast_simulacrum(powc, god);
break;
case SPELL_TWISTED_RESURRECTION:
- cast_twisted_resurrection(powc, god_gift);
+ cast_twisted_resurrection(powc, god);
break;
case SPELL_SUMMON_WRAITHS:
- cast_summon_wraiths(powc, god_gift);
+ cast_summon_wraiths(powc, god);
break;
case SPELL_DEATH_CHANNEL:
- cast_death_channel(powc, god_gift);
+ cast_death_channel(powc, god);
break;
// Enchantments.
@@ -2338,7 +2340,9 @@ static void _miscast_enchantment(int severity, const char* cause)
static void _miscast_translocation(int severity, const char* cause)
{
- const unsigned flags = (crawl_state.is_god_acting()) ? MG_GOD_GIFT : 0;
+ const god_type god =
+ (crawl_state.is_god_acting()) ? crawl_state.which_god_acting()
+ : GOD_NO_GOD;
switch (severity)
{
@@ -2396,7 +2400,7 @@ static void _miscast_translocation(int severity, const char* cause)
case 5:
if (create_monster(
mgen_data::alert_hostile_at(MONS_SPATIAL_VORTEX,
- you.pos(), 3, flags)) != -1)
+ you.pos(), 3, 0, god)) != -1)
{
mpr("Space twists in upon itself!");
}
@@ -2435,7 +2439,7 @@ static void _miscast_translocation(int severity, const char* cause)
{
if (create_monster(
mgen_data::alert_hostile_at(MONS_SPATIAL_VORTEX,
- you.pos(), 3, flags)) != -1)
+ you.pos(), 3, 0, god)) != -1)
{
success = true;
}
@@ -2481,7 +2485,9 @@ static void _miscast_translocation(int severity, const char* cause)
static void _miscast_summoning(int severity, const char* cause)
{
- const unsigned flags = (crawl_state.is_god_acting()) ? MG_GOD_GIFT : 0;
+ const god_type god =
+ (crawl_state.is_god_acting()) ? crawl_state.which_god_acting()
+ : GOD_NO_GOD;
switch (severity)
{
@@ -2536,7 +2542,7 @@ static void _miscast_summoning(int severity, const char* cause)
case 3:
if (create_monster(
mgen_data::alert_hostile_at(MONS_SPATIAL_VORTEX,
- you.pos(), 3, flags)) != -1)
+ you.pos(), 3, 0, god)) != -1)
{
mpr("Space twists in upon itself!");
}
@@ -2548,7 +2554,7 @@ static void _miscast_summoning(int severity, const char* cause)
if (create_monster(
mgen_data::alert_hostile_at(
summon_any_demon(DEMON_LESSER),
- you.pos(), 5, flags)) != -1)
+ you.pos(), 5, 0, god)) != -1)
{
mpr("Something appears in a flash of light!");
}
@@ -2569,7 +2575,7 @@ static void _miscast_summoning(int severity, const char* cause)
{
if (create_monster(
mgen_data::alert_hostile_at(MONS_SPATIAL_VORTEX,
- you.pos(), 3, flags)) != -1)
+ you.pos(), 3, 0, god)) != -1)
{
success = true;
}
@@ -2587,7 +2593,7 @@ static void _miscast_summoning(int severity, const char* cause)
if (create_monster(
mgen_data::alert_hostile_at(
summon_any_demon(DEMON_COMMON),
- you.pos(), 5, flags)) != -1)
+ you.pos(), 5, 0, god)) != -1)
{
mpr("Something forms out of thin air!");
}
@@ -2606,7 +2612,7 @@ static void _miscast_summoning(int severity, const char* cause)
if (create_monster(
mgen_data::alert_hostile_at(
summon_any_demon(DEMON_LESSER),
- you.pos(), 5, flags)) != -1)
+ you.pos(), 5, 0, god)) != -1)
{
success = true;
}
@@ -2627,7 +2633,7 @@ static void _miscast_summoning(int severity, const char* cause)
case 0:
if (create_monster(
mgen_data::alert_hostile_at(MONS_ABOMINATION_SMALL,
- you.pos(), 0, flags)) != -1)
+ you.pos(), 0, 0, god)) != -1)
{
mpr("Something forms out of thin air.");
}
@@ -2639,7 +2645,7 @@ static void _miscast_summoning(int severity, const char* cause)
if (create_monster(
mgen_data::alert_hostile_at(
summon_any_demon(DEMON_GREATER),
- you.pos(), 0, flags)) != -1)
+ you.pos(), 0, 0, god)) != -1)
{
mpr("You sense a hostile presence.");
}
@@ -2656,7 +2662,7 @@ static void _miscast_summoning(int severity, const char* cause)
if (create_monster(
mgen_data::alert_hostile_at(
summon_any_demon(DEMON_COMMON),
- you.pos(), 3, flags)) != -1)
+ you.pos(), 3, 0, god)) != -1)
{
success = true;
}
@@ -2795,7 +2801,9 @@ static void _miscast_necromancy(int severity, const char* cause)
return;
}
- const unsigned flags = (crawl_state.is_god_acting()) ? MG_GOD_GIFT : 0;
+ const god_type god =
+ (crawl_state.is_god_acting()) ? crawl_state.which_god_acting()
+ : GOD_NO_GOD;
switch (severity)
{
@@ -2885,7 +2893,7 @@ static void _miscast_necromancy(int severity, const char* cause)
{
if (create_monster(
mgen_data::alert_hostile_at(MONS_SHADOW,
- you.pos(), 2, flags)) != -1)
+ you.pos(), 2, 0, god)) != -1)
{
success = true;
}
@@ -2950,7 +2958,7 @@ static void _miscast_necromancy(int severity, const char* cause)
case 4:
if (create_monster(
mgen_data::alert_hostile_at(MONS_SOUL_EATER,
- you.pos(), 4, flags)) != -1)
+ you.pos(), 4, 0, god)) != -1)
{
mpr("Something reaches out for you...");
}
@@ -2961,7 +2969,7 @@ static void _miscast_necromancy(int severity, const char* cause)
case 5:
if (create_monster(
mgen_data::alert_hostile_at(MONS_REAPER,
- you.pos(), 4, flags)) != -1)
+ you.pos(), 4, 0, god)) != -1)
{
mpr("Death has come for you...");
}