summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
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
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')
-rw-r--r--crawl-ref/source/abl-show.cc11
-rw-r--r--crawl-ref/source/debug.cc5
-rw-r--r--crawl-ref/source/dungeon.cc2
-rw-r--r--crawl-ref/source/enum.h29
-rw-r--r--crawl-ref/source/it_use3.cc6
-rw-r--r--crawl-ref/source/mon-util.cc9
-rw-r--r--crawl-ref/source/mon-util.h1
-rw-r--r--crawl-ref/source/monplace.cc3
-rw-r--r--crawl-ref/source/monplace.h29
-rw-r--r--crawl-ref/source/monstuff.cc9
-rw-r--r--crawl-ref/source/religion.cc44
-rw-r--r--crawl-ref/source/spells2.cc71
-rw-r--r--crawl-ref/source/spells2.h30
-rw-r--r--crawl-ref/source/spells3.cc86
-rw-r--r--crawl-ref/source/spells3.h35
-rw-r--r--crawl-ref/source/spl-cast.cc94
-rw-r--r--crawl-ref/source/xom.cc10
17 files changed, 249 insertions, 225 deletions
diff --git a/crawl-ref/source/abl-show.cc b/crawl-ref/source/abl-show.cc
index c462265d16..3ce63a4a6b 100644
--- a/crawl-ref/source/abl-show.cc
+++ b/crawl-ref/source/abl-show.cc
@@ -1458,14 +1458,15 @@ static bool _do_ability(const ability_def& abil)
case ABIL_KIKU_INVOKE_DEATH:
summon_demon_type(MONS_REAPER,
- 20 + you.skills[SK_INVOCATIONS] * 3, true);
+ 20 + you.skills[SK_INVOCATIONS] * 3,
+ GOD_KIKUBAAQUDGHA);
exercise(SK_INVOCATIONS, 10 + random2(14));
break;
case ABIL_YRED_ANIMATE_CORPSE:
mpr("You call on the dead to walk for you...");
animate_a_corpse(you.x_pos, you.y_pos, CORPSE_BODY, BEH_FRIENDLY,
- you.pet_target, true);
+ you.pet_target, GOD_YREDELEMNUL);
exercise(SK_INVOCATIONS, 2 + random2(4));
break;
@@ -1477,7 +1478,7 @@ static bool _do_ability(const ability_def& abil)
case ABIL_YRED_ANIMATE_DEAD:
mpr("You call on the dead to walk for you...");
animate_dead(&you, 1 + you.skills[SK_INVOCATIONS], BEH_FRIENDLY,
- you.pet_target, true);
+ you.pet_target, GOD_YREDELEMNUL);
exercise(SK_INVOCATIONS, 2 + random2(4));
break;
@@ -1535,7 +1536,7 @@ static bool _do_ability(const ability_def& abil)
case ABIL_MAKHLEB_LESSER_SERVANT_OF_MAKHLEB:
summon_demon_type(static_cast<monster_type>(MONS_NEQOXEC + random2(5)),
- 20 + you.skills[SK_INVOCATIONS] * 3, true);
+ 20 + you.skills[SK_INVOCATIONS] * 3, GOD_MAKHLEB);
exercise(SK_INVOCATIONS, 2 + random2(3));
break;
@@ -1594,7 +1595,7 @@ static bool _do_ability(const ability_def& abil)
case ABIL_MAKHLEB_GREATER_SERVANT_OF_MAKHLEB:
summon_demon_type(static_cast<monster_type>(MONS_EXECUTIONER + random2(5)),
- 20 + you.skills[SK_INVOCATIONS] * 3, true);
+ 20 + you.skills[SK_INVOCATIONS] * 3, GOD_MAKHLEB);
exercise(SK_INVOCATIONS, 6 + random2(6));
break;
diff --git a/crawl-ref/source/debug.cc b/crawl-ref/source/debug.cc
index ce2e5f254a..29bba0cff6 100644
--- a/crawl-ref/source/debug.cc
+++ b/crawl-ref/source/debug.cc
@@ -1698,7 +1698,7 @@ void stethoscope(int mwh)
const habitat_type hab = mons_habitat( &menv[i] );
mprf(MSGCH_DIAGNOSTICS,
- "hab=%s beh=%s(%d) foe=%s(%d) mem=%d target=(%d,%d)",
+ "hab=%s beh=%s(%d) foe=%s(%d) mem=%d target=(%d,%d) god=%s",
((hab == HT_WATER) ? "water" :
(hab == HT_LAVA) ? "lava" :
(hab == HT_ROCK) ? "rock" :
@@ -1717,7 +1717,8 @@ void stethoscope(int mwh)
: menv[menv[i].foe].name(DESC_PLAIN, true).c_str()),
menv[i].foe,
menv[i].foe_memory,
- menv[i].target_x, menv[i].target_y );
+ menv[i].target_x, menv[i].target_y,
+ god_name(menv[i].god).c_str() );
// print resistances
mprf(MSGCH_DIAGNOSTICS, "resist: fire=%d cold=%d elec=%d pois=%d neg=%d",
diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc
index 0fb14bb8e6..53af68600b 100644
--- a/crawl-ref/source/dungeon.cc
+++ b/crawl-ref/source/dungeon.cc
@@ -2870,7 +2870,7 @@ static int _place_uniques(int level_number, char level_type)
mgen_data mg( which_unique, BEH_SLEEP, 0,
coord_def(), MHITNOT, MG_PERMIT_BANDS,
- MONS_PROGRAM_BUG, 0, BLACK,
+ GOD_NO_GOD, MONS_PROGRAM_BUG, 0, BLACK,
level_number, PROX_ANYWHERE );
mg.map_mask = MMT_NO_MONS;
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h
index 6dc9dca27e..09e084eb4b 100644
--- a/crawl-ref/source/enum.h
+++ b/crawl-ref/source/enum.h
@@ -1898,27 +1898,26 @@ enum mon_flight_type
enum monster_flag_type
{
MF_CREATED_FRIENDLY = 0x01, // no benefit from killing
- MF_GOD_GIFT = 0x02, // player not penalized by its death
- MF_BATTY = 0x04, // flutters like a bat
- MF_JUST_SUMMONED = 0x08, // monster skips next available action
- MF_TAKING_STAIRS = 0x10, // is following player through stairs
+ MF_BATTY = 0x02, // flutters like a bat
+ MF_JUST_SUMMONED = 0x04, // monster skips next available action
+ MF_TAKING_STAIRS = 0x08, // is following player through stairs
- MF_INTERESTING = 0x20, // Player finds monster interesting
- MF_SEEN = 0x40, // Player already seen monster
- MF_DIVINE_PROTECTION = 0x80, // Monster has divine protection.
+ MF_INTERESTING = 0x10, // Player finds monster interesting
+ MF_SEEN = 0x20, // Player already seen monster
+ MF_DIVINE_PROTECTION = 0x40, // Monster has divine protection.
- MF_KNOWN_MIMIC = 0x100, // Mimic that has taken a swing at the PC,
+ MF_KNOWN_MIMIC = 0x80, // Mimic that has taken a swing at the PC,
// or that the player has inspected with ?
- MF_BANISHED = 0x200, // Monster that has been banished.
- MF_HARD_RESET = 0x400, // Summoned, should not drop gear on reset
- MF_WAS_NEUTRAL = 0x800, // mirror to CREATED_FRIENDLY for neutrals
- MF_ATT_CHANGE_ATTEMPT = 0x1000, // Saw player and attitude changed (or
+ MF_BANISHED = 0x100, // Monster that has been banished.
+ MF_HARD_RESET = 0x200, // Summoned, should not drop gear on reset
+ MF_WAS_NEUTRAL = 0x400, // mirror to CREATED_FRIENDLY for neutrals
+ MF_ATT_CHANGE_ATTEMPT = 0x800, // Saw player and attitude changed (or
// not); currently used for holy beings
// (good god worshippers -> neutral)
// and orcs (Beogh worshippers -> friendly)
- MF_WAS_IN_VIEW = 0x2000, // Was in view during previous turn
- MF_BAND_MEMBER = 0x4000, // Created as a member of a band
- MF_GOT_HALF_XP = 0x8000 // Player already got half xp value earlier
+ MF_WAS_IN_VIEW = 0x1000, // Was in view during previous turn
+ MF_BAND_MEMBER = 0x2000, // Created as a member of a band
+ MF_GOT_HALF_XP = 0x4000 // Player already got half xp value earlier
};
// Adding slots breaks saves. YHBW.
diff --git a/crawl-ref/source/it_use3.cc b/crawl-ref/source/it_use3.cc
index 5f257fb335..f7fc48e9cb 100644
--- a/crawl-ref/source/it_use3.cc
+++ b/crawl-ref/source/it_use3.cc
@@ -621,7 +621,7 @@ bool evoke_wielded()
canned_msg(MSG_NOTHING_HAPPENS);
else
{
- cast_summon_elemental(100, false, MONS_AIR_ELEMENTAL, 4);
+ cast_summon_elemental(100, GOD_NO_GOD, MONS_AIR_ELEMENTAL, 4);
pract = (one_chance_in(5) ? 1 : 0);
}
break;
@@ -631,7 +631,7 @@ bool evoke_wielded()
canned_msg(MSG_NOTHING_HAPPENS);
else
{
- cast_summon_elemental(100, false, MONS_FIRE_ELEMENTAL, 4);
+ cast_summon_elemental(100, GOD_NO_GOD, MONS_FIRE_ELEMENTAL, 4);
pract = (one_chance_in(5) ? 1 : 0);
}
break;
@@ -641,7 +641,7 @@ bool evoke_wielded()
canned_msg(MSG_NOTHING_HAPPENS);
else
{
- cast_summon_elemental(100, false, MONS_EARTH_ELEMENTAL, 4);
+ cast_summon_elemental(100, GOD_NO_GOD, MONS_EARTH_ELEMENTAL, 4);
pract = (one_chance_in(5) ? 1 : 0);
}
break;
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index 9d87f166eb..7d780b0c54 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -490,6 +490,11 @@ bool mons_is_native_in_branch(const monsters *monster,
}
}
+bool mons_is_god_gift(const monsters *mon)
+{
+ return (mon->god != GOD_NO_GOD);
+}
+
bool mons_is_icy(const monsters *mon)
{
return (mons_is_icy(mon->type));
@@ -5133,10 +5138,10 @@ void monsters::remove_enchantment_effect(const mon_enchant &me, bool quiet)
add_ench(mon_enchant(ENCH_ABJ));
// Just for flavour.
- if (testbits(this->flags, MF_GOD_GIFT) && this->has_ench(ENCH_BERSERK))
+ if (mons_is_god_gift(this) && 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 b5bc41741b..24b978b3a1 100644
--- a/crawl-ref/source/mon-util.h
+++ b/crawl-ref/source/mon-util.h
@@ -638,6 +638,7 @@ 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);
+bool mons_is_god_gift(const monsters *mon);
bool mons_is_confused(const monsters *m);
bool mons_is_caught(const monsters *m);
bool mons_is_fleeing(const monsters *m);
diff --git a/crawl-ref/source/monplace.cc b/crawl-ref/source/monplace.cc
index b007d5374b..3b0c2bab3c 100644
--- a/crawl-ref/source/monplace.cc
+++ b/crawl-ref/source/monplace.cc
@@ -1874,8 +1874,7 @@ int mons_place( mgen_data mg )
monsters *creation = &menv[mid];
- if (mg.flags & MG_GOD_GIFT)
- creation->flags |= MF_GOD_GIFT;
+ creation->god = mg.god;
// Look at special cases: CHARMED, FRIENDLY, NEUTRAL, GOOD_NEUTRAL,
// HOSTILE.
diff --git a/crawl-ref/source/monplace.h b/crawl-ref/source/monplace.h
index ddc2d01458..9a8cbbf33d 100644
--- a/crawl-ref/source/monplace.h
+++ b/crawl-ref/source/monplace.h
@@ -101,12 +101,11 @@ enum proximity_type // proximity to player to create monster
enum mgen_flag_type
{
- MG_GOD_GIFT = 0x01,
- MG_PERMIT_BANDS = 0x02,
- MG_FORCE_PLACE = 0x04,
- MG_FORCE_BEH = 0x08,
- MG_PLAYER_MADE = 0x10,
- MG_PATROLLING = 0x20
+ MG_PERMIT_BANDS = 0x01,
+ MG_FORCE_PLACE = 0x02,
+ MG_FORCE_BEH = 0x04,
+ MG_PLAYER_MADE = 0x08,
+ MG_PATROLLING = 0x10
};
// A structure with all the data needed to whip up a new monster.
@@ -144,11 +143,16 @@ struct mgen_data
// Generation flags from mgen_flag_type.
unsigned flags;
+ // What god the monster worships, if any. This is currently only
+ // used for monsters that are god gifts, to indicate which god sent
+ // them.
+ god_type god;
+
// The number of hydra heads or manticore attack volleys. Note:
// in older version this field was used for both this and for base_type.
int number;
- // The colour of the monster
+ // The colour of the monster.
int colour;
// A measure of how powerful the generated monster should be (for
@@ -179,6 +183,7 @@ struct mgen_data
const coord_def &p = coord_def(-1, -1),
unsigned short mfoe = MHITNOT,
unsigned monflags = 0,
+ god_type which_god = GOD_NO_GOD,
monster_type base = MONS_PROGRAM_BUG,
int monnumber = 0,
int moncolour = BLACK,
@@ -188,8 +193,8 @@ struct mgen_data
: cls(mt), base_type(base), behaviour(beh),
abjuration_duration(abj), pos(p), foe(mfoe), flags(monflags),
- number(monnumber), colour(moncolour), power(monpower),
- proximity(prox), level_type(ltype), map_mask(0)
+ god(which_god), number(monnumber), colour(moncolour),
+ power(monpower), proximity(prox), level_type(ltype), map_mask(0)
{
}
@@ -219,9 +224,11 @@ struct mgen_data
static mgen_data alert_hostile_at(monster_type what,
const coord_def &where,
int abj_deg = 0,
- unsigned flags = 0)
+ unsigned flags = 0,
+ god_type god = GOD_NO_GOD)
{
- return mgen_data(what, BEH_HOSTILE, abj_deg, where, MHITYOU, flags);
+ return mgen_data(what, BEH_HOSTILE, abj_deg, where, MHITYOU, flags,
+ god);
}
};
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index d6a0f29e54..7f8506f0a6 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -1003,14 +1003,13 @@ void monster_die(monsters *monster, killer_type killer, int i, bool silent)
&& mons_weight(mons_species(monster->type)))
{
const monster_type spectre = mons_species(monster->type);
- const bool god_gift = you.attribute[ATTR_DIVINE_DEATH_CHANNEL];
// Don't allow 0-headed hydras to become spectral hydras.
if ((spectre != MONS_HYDRA || monster->number != 0)
&& create_monster(
mgen_data( MONS_SPECTRAL_THING, BEH_FRIENDLY,
0, monster->pos(), you.pet_target,
- god_gift ? MG_GOD_GIFT : 0,
+ 0, static_cast<god_type>(you.attribute[ATTR_DIVINE_DEATH_CHANNEL]),
spectre, monster->number )) != -1)
{
if (death_message)
@@ -1032,7 +1031,7 @@ void monster_die(monsters *monster, killer_type killer, int i, bool silent)
}
// No piety loss if god gifts killed by other monsters.
- if (mons_friendly(monster) && !testbits(monster->flags, MF_GOD_GIFT))
+ if (mons_friendly(monster) && !mons_is_god_gift(monster))
{
did_god_conduct(DID_FRIEND_DIED, 1 + (monster->hit_dice / 2),
true, monster);
@@ -1076,7 +1075,7 @@ void monster_die(monsters *monster, killer_type killer, int i, bool silent)
else if (you.religion == GOD_VEHUMET
|| you.religion == GOD_MAKHLEB
|| you.religion == GOD_SHINING_ONE
- || !anon && testbits(menv[i].flags, MF_GOD_GIFT))
+ || !anon && mons_is_god_gift(&menv[i]))
{
// Yes, we are splitting undead pets from the others
// as a way to focus Necromancy vs Summoning (ignoring
@@ -5130,7 +5129,7 @@ static bool _handle_spell( monsters *monster, bolt & beem )
// Try to animate dead: if nothing rises, pretend we didn't cast it.
if (spell_cast == SPELL_ANIMATE_DEAD
&& !animate_dead(monster, 100, SAME_ATTITUDE(monster),
- monster->foe, false, false))
+ monster->foe, GOD_NO_GOD, false))
{
return (false);
}
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
index acb6b3ae94..7a362bbf0c 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -829,8 +829,7 @@ bool is_good_follower(const monsters* mon)
bool is_orcish_follower(const monsters* mon)
{
return (mon->alive() && mons_species(mon->type) == MONS_ORC
- && mon->attitude == ATT_FRIENDLY
- && testbits(mon->flags, MF_GOD_GIFT));
+ && mon->attitude == ATT_FRIENDLY && mons_is_god_gift(mon));
}
bool is_follower(const monsters* mon)
@@ -1063,7 +1062,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->flags |= MF_GOD_GIFT;
+ mon->god = GOD_SHINING_ONE;
// If the monster is charmed, make it permanently friendly. Note
// that we have to delete the enchantment without removing the
@@ -1108,7 +1107,7 @@ static bool _beogh_blessing_reinforcement()
int monster =
create_monster(
mgen_data(follower_type, BEH_FRIENDLY, 0,
- you.pos(), you.pet_target, MG_GOD_GIFT));
+ you.pos(), you.pet_target, 0, GOD_BEOGH));
if (monster != -1)
{
@@ -1543,7 +1542,7 @@ static void _do_god_gift(bool prayed_for)
if (create_monster(
mgen_data(mon, BEH_FRIENDLY, 0,
you.pos(), you.pet_target,
- MG_GOD_GIFT)) != -1)
+ 0, GOD_YREDELEMNUL)) != -1)
{
simple_god_message(" grants you an undead servant!");
more();
@@ -3027,7 +3026,7 @@ static bool _tso_retribution()
{
if (create_monster(
mgen_data::alert_hostile_at(MONS_DAEVA,
- you.pos(), 0, MG_GOD_GIFT)) != -1)
+ you.pos(), 0, 0, GOD_SHINING_ONE)) != -1)
{
success = true;
}
@@ -3128,7 +3127,7 @@ static bool _zin_retribution()
{
if (create_monster(
mgen_data::alert_hostile_at(MONS_ANGEL,
- you.pos(), 0, MG_GOD_GIFT)) != -1)
+ you.pos(), 0, 0, GOD_ZIN)) != -1)
{
success = true;
}
@@ -3143,7 +3142,7 @@ static bool _zin_retribution()
else
{
bool success = cast_summon_swarm(you.experience_level * 20,
- true, true);
+ GOD_ZIN, true);
simple_god_message(success ?
" sends a plague down upon you!" :
"'s plague fails to arrive.",
@@ -3292,7 +3291,7 @@ static bool _makhleb_retribution()
mgen_data::alert_hostile_at(
static_cast<monster_type>(
MONS_EXECUTIONER + random2(5)),
- you.pos(), 0, MG_GOD_GIFT)) != -1);
+ you.pos(), 0, 0, GOD_MAKHLEB)) != -1);
simple_god_message(success ?
" sends a greater servant after you!" :
@@ -3310,7 +3309,7 @@ static bool _makhleb_retribution()
mgen_data::alert_hostile_at(
static_cast<monster_type>(
MONS_NEQOXEC + random2(5)),
- you.pos(), 0, MG_GOD_GIFT)) != -1)
+ you.pos(), 0, 0, GOD_MAKHLEB)) != -1)
{
count++;
}
@@ -3338,7 +3337,7 @@ static bool _kikubaaqudgha_retribution()
{
if (create_monster(
mgen_data::alert_hostile_at(MONS_REAPER,
- you.pos(), 0, MG_GOD_GIFT)) != -1)
+ you.pos(), 0, 0, GOD_KIKUBAAQUDGHA)) != -1)
{
success = true;
}
@@ -3377,7 +3376,7 @@ static bool _yredelemnul_retribution()
if (create_monster(
mgen_data::alert_hostile_at(punisher,
- you.pos(), 0, MG_GOD_GIFT)) != -1)
+ you.pos(), 0, 0, GOD_YREDELEMNUL)) != -1)
{
count++;
}
@@ -3426,7 +3425,7 @@ static bool _trog_retribution()
points -= cost;
- if (summon_berserker(cost * 20, true, true))
+ if (summon_berserker(cost * 20, GOD_TROG, true))
count++;
}
}
@@ -3542,7 +3541,7 @@ static bool _beogh_retribution()
int mons =
create_monster(
mgen_data::alert_hostile_at(MONS_DANCING_WEAPON,
- you.pos(), 0, MG_GOD_GIFT));
+ you.pos(), 0, 0, GOD_BEOGH));
// Hand item information over to monster.
if (mons != -1)
@@ -3597,7 +3596,7 @@ static bool _beogh_retribution()
int mons = create_monster(
mgen_data::alert_hostile_at(punisher,
- you.pos(), 0, MG_GOD_GIFT | MG_PERMIT_BANDS));
+ you.pos(), 0, MG_PERMIT_BANDS, GOD_BEOGH));
// sometimes name band leader
if (mons != -1 && one_chance_in(3))
@@ -3627,7 +3626,7 @@ static bool _okawaru_retribution()
if (create_monster(
mgen_data::alert_hostile_at(punisher,
- you.pos(), 0, MG_GOD_GIFT)) != -1)
+ you.pos(), 0, 0, GOD_OKAWARU)) != -1)
{
success = true;
}
@@ -3720,7 +3719,7 @@ static bool _lugonu_retribution()
mgen_data::alert_hostile_at(
static_cast<monster_type>(
MONS_GREEN_DEATH + random2(3)),
- you.pos(), 0, MG_GOD_GIFT)) != -1);
+ you.pos(), 0, 0, GOD_LUGONU)) != -1);
simple_god_message(success ?
" sends a demon after you!" :
@@ -3738,7 +3737,7 @@ static bool _lugonu_retribution()
mgen_data::alert_hostile_at(
static_cast<monster_type>(
MONS_NEQOXEC + random2(5)),
- you.pos(), 0, MG_GOD_GIFT)) != -1)
+ you.pos(), 0, 0, GOD_LUGONU)) != -1)
{
success = true;
}
@@ -3993,7 +3992,7 @@ static bool _make_god_gifts_on_level_disappear(bool seen = false)
if (monster->type != -1
&& monster->attitude == ATT_FRIENDLY
&& monster->has_ench(ENCH_ABJ)
- && testbits(monster->flags, MF_GOD_GIFT))
+ && mons_is_god_gift(monster))
{
if (!seen || simple_monster_message(monster, " abandons you!"))
count++;
@@ -4034,7 +4033,7 @@ static bool _make_holy_god_gifts_on_level_good_neutral(bool seen = false)
if (monster->type != -1
&& mons_is_holy(monster)
&& monster->attitude == ATT_FRIENDLY
- && testbits(monster->flags, MF_GOD_GIFT))
+ && mons_is_god_gift(monster))
{
// monster changes attitude
monster->attitude = ATT_GOOD_NEUTRAL;
@@ -4074,7 +4073,7 @@ static bool _make_god_gifts_on_level_hostile(bool seen = false)
monsters *monster = &menv[i];
if (monster->type != -1
&& monster->attitude == ATT_FRIENDLY
- && testbits(monster->flags, MF_GOD_GIFT))
+ && mons_is_god_gift(monster))
{
// monster changes attitude and behaviour
monster->attitude = ATT_HOSTILE;
@@ -4363,7 +4362,8 @@ void beogh_convert_orc(monsters *orc, bool emergency,
// The monster is not really *created* friendly, but should it
// become hostile later on, it won't count as a good kill.
orc->flags |= MF_CREATED_FRIENDLY;
- orc->flags |= MF_GOD_GIFT;
+
+ orc->god = GOD_BEOGH;
if (orc->is_patrolling())
{
diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc
index 0a54720815..19a89f2919 100644
--- a/crawl-ref/source/spells2.cc
+++ b/crawl-ref/source/spells2.cc
@@ -1025,7 +1025,7 @@ bool summon_animals(int pow)
return (success);
}
-bool cast_summon_butterflies(int pow, bool god_gift)
+bool cast_summon_butterflies(int pow, god_type god)
{
bool success = false;
@@ -1036,7 +1036,7 @@ bool cast_summon_butterflies(int pow, bool god_gift)
if (create_monster(
mgen_data(MONS_BUTTERFLY, BEH_FRIENDLY, 3,
you.pos(), you.pet_target,
- god_gift ? MG_GOD_GIFT : 0)) != -1)
+ 0, god)) != -1)
{
success = true;
}
@@ -1049,7 +1049,7 @@ bool cast_summon_butterflies(int pow, bool god_gift)
}
//jmf: beefed up higher-level casting of this (formerly lame) spell
-bool cast_summon_small_mammals(int pow, bool god_gift)
+bool cast_summon_small_mammals(int pow, god_type god)
{
bool success = false;
@@ -1095,7 +1095,7 @@ bool cast_summon_small_mammals(int pow, bool god_gift)
if (create_monster(
mgen_data(mon, BEH_FRIENDLY, 3,
you.pos(), you.pet_target,
- god_gift ? MG_GOD_GIFT : 0)) != -1)
+ 0, god)) != -1)
{
success = true;
}
@@ -1104,7 +1104,7 @@ bool cast_summon_small_mammals(int pow, bool god_gift)
return (success);
}
-bool cast_sticks_to_snakes(int pow, bool god_gift)
+bool cast_sticks_to_snakes(int pow, god_type god)
{
const int wpn = you.equip[EQ_WEAPON];
@@ -1158,7 +1158,7 @@ bool cast_sticks_to_snakes(int pow, bool god_gift)
if (create_monster(
mgen_data(mon, beha, dur,
you.pos(), hitting,
- god_gift ? MG_GOD_GIFT : 0)) != -1)
+ 0, god)) != -1)
{
count++;
}
@@ -1205,7 +1205,7 @@ bool cast_sticks_to_snakes(int pow, bool god_gift)
if (create_monster(
mgen_data(mon, beha, dur,
you.pos(), hitting,
- god_gift ? MG_GOD_GIFT : 0)) != -1)
+ 0, god)) != -1)
{
count++;
}
@@ -1229,7 +1229,7 @@ bool cast_sticks_to_snakes(int pow, bool god_gift)
return (false);
}
-bool cast_summon_scorpions(int pow, bool god_gift)
+bool cast_summon_scorpions(int pow, god_type god)
{
bool success = false;
@@ -1245,7 +1245,7 @@ bool cast_summon_scorpions(int pow, bool god_gift)
friendly ? BEH_FRIENDLY : BEH_HOSTILE,
3, you.pos(),
friendly ? you.pet_target : MHITYOU,
- god_gift ? MG_GOD_GIFT : 0)) != -1)
+ 0, god)) != -1)
{
success = true;
}
@@ -1259,7 +1259,7 @@ bool cast_summon_scorpions(int pow, bool god_gift)
// Creates a mixed swarm of typical swarming animals.
// Number, duration and friendlinesss depend on spell power.
-bool cast_summon_swarm(int pow, bool god_gift, bool force_hostile)
+bool cast_summon_swarm(int pow, god_type god, bool force_hostile)
{
bool success = false;
@@ -1327,7 +1327,7 @@ bool cast_summon_swarm(int pow, bool god_gift, bool force_hostile)
friendly ? BEH_FRIENDLY : BEH_HOSTILE,
dur, you.pos(),
friendly ? you.pet_target : MHITYOU,
- god_gift ? MG_GOD_GIFT : 0)) != -1)
+ 0, god)) != -1)
{
success = true;
}
@@ -1339,7 +1339,7 @@ bool cast_summon_swarm(int pow, bool god_gift, bool force_hostile)
return (success);
}
-bool cast_call_canine_familiar(int pow, bool god_gift)
+bool cast_call_canine_familiar(int pow, god_type god)
{
bool success = false;
@@ -1386,7 +1386,7 @@ bool cast_call_canine_familiar(int pow, bool god_gift)
friendly ? BEH_FRIENDLY : BEH_HOSTILE,
dur, you.pos(),
friendly ? you.pet_target : MHITYOU,
- god_gift ? MG_GOD_GIFT : 0)) != -1)
+ 0, god)) != -1)
{
success = true;
@@ -1405,7 +1405,7 @@ bool cast_call_canine_familiar(int pow, bool god_gift)
// postal on the caster (after taking into account
// chance of that happening to unskilled casters
// anyway).
-bool cast_summon_elemental(int pow, bool god_gift,
+bool cast_summon_elemental(int pow, god_type god,
monster_type restricted_type,
int unfriendly)
{
@@ -1419,6 +1419,7 @@ bool cast_summon_elemental(int pow, bool god_gift,
int targ_y;
const int dur = std::min(2 + (random2(pow) / 5), 6);
+
const bool any_elemental = (restricted_type == MONS_PROGRAM_BUG);
while (true)
@@ -1533,7 +1534,7 @@ bool cast_summon_elemental(int pow, bool god_gift,
friendly ? BEH_FRIENDLY : BEH_HOSTILE,
dur, coord_def(targ_x, targ_y),
friendly ? you.pet_target : MHITYOU,
- god_gift ? MG_GOD_GIFT : 0)) != -1)
+ 0, god)) != -1)
{
canned_msg(MSG_NOTHING_HAPPENS);
return (false);
@@ -1547,7 +1548,7 @@ bool cast_summon_elemental(int pow, bool god_gift,
return (true);
}
-bool cast_summon_ice_beast(int pow, bool god_gift)
+bool cast_summon_ice_beast(int pow, god_type god)
{
bool success = false;
@@ -1558,7 +1559,7 @@ bool cast_summon_ice_beast(int pow, bool god_gift)
if (create_monster(
mgen_data(mon, BEH_FRIENDLY, dur, you.pos(),
you.pet_target,
- god_gift ? MG_GOD_GIFT : 0)) != -1)
+ 0, god)) != -1)
{
success = true;
@@ -1570,7 +1571,7 @@ bool cast_summon_ice_beast(int pow, bool god_gift)
return (success);
}
-bool cast_summon_ugly_thing(int pow, bool god_gift)
+bool cast_summon_ugly_thing(int pow, god_type god)
{
bool success = false;
@@ -1587,7 +1588,7 @@ bool cast_summon_ugly_thing(int pow, bool god_gift)
friendly ? BEH_FRIENDLY : BEH_HOSTILE,
dur, you.pos(),
friendly ? you.pet_target : MHITYOU,
- god_gift ? MG_GOD_GIFT : 0)) != -1)
+ 0, god)) != -1)
{
success = true;
@@ -1603,7 +1604,7 @@ bool cast_summon_ugly_thing(int pow, bool god_gift)
return (success);
}
-bool cast_summon_dragon(int pow, bool god_gift)
+bool cast_summon_dragon(int pow, god_type god)
{
// Removed the chance of multiple dragons... one should be more
// than enough, and if it isn't, the player can cast again...
@@ -1619,7 +1620,7 @@ bool cast_summon_dragon(int pow, bool god_gift)
friendly ? BEH_FRIENDLY : BEH_HOSTILE,
3, you.pos(),
friendly ? you.pet_target : MHITYOU,
- god_gift ? MG_GOD_GIFT : 0)) != -1)
+ 0, god)) != -1)
{
success = true;
@@ -1635,7 +1636,7 @@ bool cast_summon_dragon(int pow, bool god_gift)
}
// Trog sends a fighting buddy (or enemy) for a follower.
-bool summon_berserker(int pow, bool god_gift, bool force_hostile)
+bool summon_berserker(int pow, god_type god, bool force_hostile)
{
bool success = false;
@@ -1689,7 +1690,7 @@ bool summon_berserker(int pow, bool god_gift, bool force_hostile)
!force_hostile ? BEH_FRIENDLY : BEH_HOSTILE,
dur, you.pos(),
!force_hostile ? you.pet_target : MHITYOU,
- god_gift ? MG_GOD_GIFT : 0));
+ 0, god));
if (monster != -1)
{
@@ -1713,7 +1714,7 @@ bool summon_berserker(int pow, bool god_gift, bool force_hostile)
return (success);
}
-static bool _summon_holy_being_wrapper(int pow, bool god_gift,
+static bool _summon_holy_being_wrapper(int pow, god_type god,
monster_type mon, bool quiet)
{
bool success = false;
@@ -1722,9 +1723,9 @@ static bool _summon_holy_being_wrapper(int pow, bool god_gift,
const int monster =
create_monster(
- mgen_data(mon, BEH_FRIENDLY, dur, you.pos(),
- you.pet_target,
- (god_gift ? MG_GOD_GIFT : 0) | MG_FORCE_BEH));
+ mgen_data(mon, BEH_FRIENDLY, dur,
+ you.pos(), you.pet_target,
+ MG_FORCE_BEH, god));
if (monster != -1)
{
@@ -1747,18 +1748,18 @@ static bool _summon_holy_being_wrapper(int pow, bool god_gift,
}
// Zin sends an angel for a follower.
-bool summon_guardian(int pow, bool god_gift, bool quiet)
+bool summon_guardian(int pow, god_type god, bool quiet)
{
- return _summon_holy_being_wrapper(pow, god_gift, MONS_ANGEL, quiet);
+ return _summon_holy_being_wrapper(pow, god, MONS_ANGEL, quiet);
}
// TSO sends a daeva for a follower.
-bool summon_daeva(int pow, bool god_gift, bool quiet)
+bool summon_daeva(int pow, god_type god, bool quiet)
{
- return _summon_holy_being_wrapper(pow, god_gift, MONS_DAEVA, quiet);
+ return _summon_holy_being_wrapper(pow, god, MONS_DAEVA, quiet);
}
-bool cast_tukimas_dance(int pow, bool god_gift,
+bool cast_tukimas_dance(int pow, god_type god,
bool force_hostile, bool quiet_failure)
{
bool success = true;
@@ -1795,7 +1796,7 @@ bool cast_tukimas_dance(int pow, bool god_gift,
friendly ? BEH_FRIENDLY : BEH_HOSTILE,
dur, you.pos(),
friendly ? you.pet_target : MHITYOU,
- god_gift ? MG_GOD_GIFT : 0));
+ 0, god));
if (monster == -1)
success = false;
@@ -1842,7 +1843,7 @@ bool cast_tukimas_dance(int pow, bool god_gift,
return (true);
}
-bool cast_conjure_ball_lightning(int pow, bool god_gift)
+bool cast_conjure_ball_lightning(int pow, god_type god)
{
bool success = false;
@@ -1874,7 +1875,7 @@ bool cast_conjure_ball_lightning(int pow, bool god_gift)
mons_place(
mgen_data(MONS_BALL_LIGHTNING, BEH_FRIENDLY, 0,
coord_def(tx, ty), MHITNOT,
- god_gift ? MG_GOD_GIFT : 0));
+ 0, god));
if (monster != -1)
{
diff --git a/crawl-ref/source/spells2.h b/crawl-ref/source/spells2.h
index 12db20b0bc..8cd5b9cfb9 100644
--- a/crawl-ref/source/spells2.h
+++ b/crawl-ref/source/spells2.h
@@ -108,29 +108,29 @@ bool summon_animals(int pow);
/* ***********************************************************************
* called from: ability - spell
* *********************************************************************** */
-bool cast_summon_butterflies(int pow, bool god_gift = false);
-bool cast_summon_small_mammals(int pow, bool god_gift = false);
-bool cast_sticks_to_snakes(int pow, bool god_gift = false);
-bool cast_summon_scorpions(int pow, bool god_gift = false);
+bool cast_summon_butterflies(int pow, god_type god = GOD_NO_GOD);
+bool cast_summon_small_mammals(int pow, god_type god = GOD_NO_GOD);
+bool cast_sticks_to_snakes(int pow, god_type god = GOD_NO_GOD);
+bool cast_summon_scorpions(int pow, god_type god = GOD_NO_GOD);
// last updated 24may2000 {dlb}
/* ***********************************************************************
* called from: ability - religion - spell
* *********************************************************************** */
-bool cast_summon_swarm(int pow, bool god_gift = false,
+bool cast_summon_swarm(int pow, god_type god = GOD_NO_GOD,
bool force_hostile = false);
// last updated 24may2000 {dlb}
/* ***********************************************************************
* called from: ability - spell
* *********************************************************************** */
-bool cast_call_canine_familiar(int pow, bool god_gift = false);
+bool cast_call_canine_familiar(int pow, god_type god = GOD_NO_GOD);
// last updated 24may2000 {dlb}
/* ***********************************************************************
* called from: it_use3 - spell
* *********************************************************************** */
-bool cast_summon_elemental(int pow, bool god_gift = false,
+bool cast_summon_elemental(int pow, god_type god = GOD_NO_GOD,
monster_type restricted_type = MONS_PROGRAM_BUG,
int unfriendly = 2);
@@ -138,31 +138,31 @@ bool cast_summon_elemental(int pow, bool god_gift = false,
/* ***********************************************************************
* called from: ability - spell
* *********************************************************************** */
-bool cast_summon_ice_beast(int pow, bool god_gift = false);
-bool cast_summon_ugly_thing(int pow, bool god_gift = false);
-bool cast_summon_dragon(int pow, bool god_gift = false);
+bool cast_summon_ice_beast(int pow, god_type god = GOD_NO_GOD);
+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);
// last updated 24may2000 {dlb}
/* ***********************************************************************
* called from: ability - spell
* *********************************************************************** */
-bool summon_berserker(int pow, bool god_gift = false,
+bool summon_berserker(int pow, god_type god = GOD_NO_GOD,
bool force_hostile = false);
-bool summon_guardian(int pow, bool god_gift = false, bool quiet = false);
-bool summon_daeva(int pow, bool god_gift = false, bool quiet = false);
+bool summon_guardian(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);
// last updated 24may2000 {dlb}
/* ***********************************************************************
* called from: ability - religion - spell
* *********************************************************************** */
-bool cast_tukimas_dance(int pow, bool god_gift = false,
+bool cast_tukimas_dance(int pow, god_type god = GOD_NO_GOD,
bool force_hostile = false, bool quiet_failure = false);
// last updated 24may2000 {dlb}
/* ***********************************************************************
* called from: ability - spell
* *********************************************************************** */
-bool cast_conjure_ball_lightning(int pow, bool god_gift = false);
+bool cast_conjure_ball_lightning(int pow, god_type god = GOD_NO_GOD);
// last updated 24may2000 {dlb}
/* ***********************************************************************
diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc
index 130d46ff3a..57750b8e1c 100644
--- a/crawl-ref/source/spells3.cc
+++ b/crawl-ref/source/spells3.cc
@@ -413,7 +413,7 @@ bool cast_sublimation_of_blood(int pow)
return (success);
}
-bool cast_call_imp(int pow, bool god_gift)
+bool cast_call_imp(int pow, god_type god)
{
bool success = false;
@@ -427,7 +427,7 @@ bool cast_call_imp(int pow, bool god_gift)
create_monster(
mgen_data(mon, BEH_FRIENDLY, dur, you.pos(),
you.pet_target,
- (god_gift ? MG_GOD_GIFT : 0) | MG_FORCE_BEH));
+ MG_FORCE_BEH, god));
if (monster != -1)
{
@@ -445,7 +445,7 @@ bool cast_call_imp(int pow, bool god_gift)
return (success);
}
-static bool _summon_demon_wrapper(int pow, bool god_gift, monster_type mon,
+static bool _summon_demon_wrapper(int pow, god_type god, monster_type mon,
int dur, bool friendly, bool charmed,
bool quiet)
{
@@ -458,7 +458,7 @@ static bool _summon_demon_wrapper(int pow, bool god_gift, monster_type mon,
charmed ? BEH_CHARMED : BEH_HOSTILE,
dur, you.pos(),
friendly ? you.pet_target : MHITYOU,
- (god_gift ? MG_GOD_GIFT : 0) | MG_FORCE_BEH));
+ MG_FORCE_BEH, god));
if (monster != -1)
{
@@ -476,50 +476,52 @@ static bool _summon_demon_wrapper(int pow, bool god_gift, monster_type mon,
return (success);
}
-static bool _summon_demon_wrapper(int pow, bool god_gift, demon_class_type dct,
+static bool _summon_demon_wrapper(int pow, god_type god, demon_class_type dct,
int dur, bool friendly, bool charmed,
bool quiet)
{
monster_type mon = summon_any_demon(dct);
- return _summon_demon_wrapper(pow, god_gift, mon, dur, friendly, charmed,
- quiet);
+ return _summon_demon_wrapper(pow, god, mon, dur, friendly, charmed, quiet);
}
-bool summon_lesser_demon(int pow, bool god_gift, bool quiet)
+bool summon_lesser_demon(int pow, god_type god,
+ bool quiet)
{
- return _summon_demon_wrapper(pow, god_gift, DEMON_LESSER,
+ return _summon_demon_wrapper(pow, god, DEMON_LESSER,
std::min(2 + (random2(pow) / 4), 6),
random2(pow) > 3, false, quiet);
}
-bool summon_common_demon(int pow, bool god_gift, bool quiet)
+bool summon_common_demon(int pow, god_type god,
+ bool quiet)
{
- return _summon_demon_wrapper(pow, god_gift, DEMON_COMMON,
+ return _summon_demon_wrapper(pow, god, DEMON_COMMON,
std::min(2 + (random2(pow) / 4), 6),
random2(pow) > 3, false, quiet);
}
-bool summon_greater_demon(int pow, bool god_gift, bool quiet)
+bool summon_greater_demon(int pow, god_type god,
+ bool quiet)
{
- return _summon_demon_wrapper(pow, god_gift, DEMON_GREATER,
+ return _summon_demon_wrapper(pow, god, DEMON_GREATER,
5, false, random2(pow) > 5, quiet);
}
// Makhleb or Kikubaaqudgha sends a demonic buddy (or enemy) for a
// follower.
-bool summon_demon_type(monster_type mon, int pow, bool god_gift)
+bool summon_demon_type(monster_type mon, int pow, god_type god)
{
- return _summon_demon_wrapper(pow, god_gift, mon,
+ return _summon_demon_wrapper(pow, god, mon,
std::min(2 + (random2(pow) / 4), 6),
false, random2(pow) > 3, false);
}
-bool cast_summon_demon(int pow, bool god_gift)
+bool cast_summon_demon(int pow, god_type god)
{
mpr("You open a gate to Pandemonium!");
- bool success = summon_common_demon(pow, god_gift);
+ bool success = summon_common_demon(pow, god);
if (!success)
canned_msg(MSG_NOTHING_HAPPENS);
@@ -527,7 +529,7 @@ bool cast_summon_demon(int pow, bool god_gift)
return (success);
}
-bool cast_demonic_horde(int pow, bool god_gift)
+bool cast_demonic_horde(int pow, god_type god)
{
bool success = false;
@@ -537,7 +539,7 @@ bool cast_demonic_horde(int pow, bool god_gift)
for (int i = 0; i < how_many; ++i)
{
- if (summon_lesser_demon(pow, god_gift, true))
+ if (summon_lesser_demon(pow, god, true))
success = true;
}
@@ -547,11 +549,11 @@ bool cast_demonic_horde(int pow, bool god_gift)
return (success);
}
-bool cast_summon_greater_demon(int pow, bool god_gift)
+bool cast_summon_greater_demon(int pow, god_type god)
{
mpr("You open a gate to Pandemonium!");
- bool success = summon_greater_demon(pow, god_gift);
+ bool success = summon_greater_demon(pow, god);
if (!success)
canned_msg(MSG_NOTHING_HAPPENS);
@@ -559,7 +561,7 @@ bool cast_summon_greater_demon(int pow, bool god_gift)
return (success);
}
-bool cast_shadow_creatures(bool god_gift)
+bool cast_shadow_creatures(god_type god)
{
bool success = false;
@@ -569,7 +571,7 @@ bool cast_shadow_creatures(bool god_gift)
create_monster(
mgen_data(RANDOM_MONSTER, BEH_FRIENDLY, 2,
you.pos(), you.pet_target,
- (god_gift ? MG_GOD_GIFT : 0) | MG_FORCE_BEH));
+ MG_FORCE_BEH, god));
if (monster != -1)
{
@@ -583,7 +585,7 @@ bool cast_shadow_creatures(bool god_gift)
return (success);
}
-bool cast_summon_horrible_things(int pow, bool god_gift)
+bool cast_summon_horrible_things(int pow, god_type god)
{
if (one_chance_in(3)
&& !lose_stat(STAT_INTELLIGENCE, 1, true, "summoning horrible things"))
@@ -615,7 +617,7 @@ bool cast_summon_horrible_things(int pow, bool god_gift)
if (create_monster(
mgen_data(MONS_TENTACLED_MONSTROSITY, BEH_FRIENDLY, 6,
you.pos(), you.pet_target,
- god_gift ? MG_GOD_GIFT : 0)) != -1)
+ 0, god)) != -1)
{
count++;
}
@@ -628,7 +630,7 @@ bool cast_summon_horrible_things(int pow, bool god_gift)
if (create_monster(
mgen_data(MONS_ABOMINATION_LARGE, BEH_FRIENDLY, 6,
you.pos(), you.pet_target,
- god_gift ? MG_GOD_GIFT : 0)) != -1)
+ 0, god)) != -1)
{
count++;
}
@@ -804,7 +806,7 @@ static void _equip_undead(int x, int y, int corps, int monster, int monnum)
}
static bool _raise_corpse(int x, int y, int corps, beh_type beha,
- unsigned short hitting, bool god_gift, bool actual)
+ unsigned short hitting, god_type god, bool actual)
{
const item_def& item = mitm[corps];
@@ -840,7 +842,7 @@ static bool _raise_corpse(int x, int y, int corps, beh_type beha,
const int monster = create_monster(
mgen_data(mon, beha, 0,
coord_def(x, y), hitting,
- god_gift ? MG_GOD_GIFT : 0,
+ 0, god,
zombie_type, number));
if (monster != -1)
@@ -869,7 +871,7 @@ static bool _raise_corpse(int x, int y, int corps, beh_type beha,
bool animate_a_corpse(int x, int y, corpse_type class_allowed,
beh_type beha, unsigned short hitting,
- bool god_gift, bool actual,
+ god_type god, bool actual,
bool quiet)
{
bool success = false;
@@ -887,8 +889,7 @@ bool animate_a_corpse(int x, int y, corpse_type class_allowed,
{
const bool was_butchering = is_being_butchered(item);
- success = _raise_corpse(x, y, corps, beha, hitting, god_gift,
- actual);
+ success = _raise_corpse(x, y, corps, beha, hitting, god, actual);
if (actual && success)
{
@@ -914,7 +915,7 @@ bool animate_a_corpse(int x, int y, corpse_type class_allowed,
}
int animate_dead(actor *caster, int pow, beh_type beha, unsigned short hitting,
- bool god_gift, bool actual)
+ god_type god, bool actual)
{
UNUSED(pow);
@@ -976,7 +977,7 @@ int animate_dead(actor *caster, int pow, beh_type beha, unsigned short hitting,
was_butchering = true;
if (animate_a_corpse(a.x, a.y, CORPSE_BODY, beha,
- hitting, god_gift, actual, true))
+ hitting, god, actual, true))
{
number_raised++;
@@ -1019,7 +1020,7 @@ int animate_dead(actor *caster, int pow, beh_type beha, unsigned short hitting,
// Hides and other "animal part" items are intentionally left out, it's
// unrequired complexity, and fresh flesh makes more "sense" for a spell
// reforming the original monster out of ice anyways.
-bool cast_simulacrum(int pow, bool god_gift)
+bool cast_simulacrum(int pow, god_type god)
{
int how_many_max = std::min(8, 4 + random2(pow) / 20);
@@ -1047,8 +1048,7 @@ bool cast_simulacrum(int pow, bool god_gift)
if (create_monster(
mgen_data(MONS_SIMULACRUM_SMALL, BEH_FRIENDLY,
6, you.pos(), you.pet_target,
- god_gift ? MG_GOD_GIFT : 0,
- mon)) != -1)
+ 0, god, mon)) != -1)
{
count++;
}
@@ -1071,7 +1071,7 @@ bool cast_simulacrum(int pow, bool god_gift)
return (false);
}
-bool cast_twisted_resurrection(int pow, bool god_gift)
+bool cast_twisted_resurrection(int pow, god_type god)
{
if (igrd[you.x_pos][you.y_pos] == NON_ITEM)
{
@@ -1143,7 +1143,7 @@ bool cast_twisted_resurrection(int pow, bool god_gift)
create_monster(
mgen_data(mon, BEH_FRIENDLY,
0, you.pos(), you.pet_target,
- (god_gift ? MG_GOD_GIFT : 0) | MG_FORCE_BEH,
+ MG_FORCE_BEH, god,
MONS_PROGRAM_BUG, 0, colour));
if (monster == -1)
@@ -1178,7 +1178,7 @@ bool cast_twisted_resurrection(int pow, bool god_gift)
return (true);
}
-bool cast_summon_wraiths(int pow, bool god_gift)
+bool cast_summon_wraiths(int pow, god_type god)
{
bool success = false;
@@ -1195,7 +1195,7 @@ bool cast_summon_wraiths(int pow, bool god_gift)
friendly ? BEH_FRIENDLY : BEH_HOSTILE,
5, you.pos(),
friendly ? you.pet_target : MHITYOU,
- (god_gift ? MG_GOD_GIFT : 0) | MG_FORCE_BEH));
+ MG_FORCE_BEH, god));
if (monster != -1)
{
@@ -1221,7 +1221,7 @@ bool cast_summon_wraiths(int pow, bool god_gift)
return (success);
}
-bool cast_death_channel(int pow, bool god_gift)
+bool cast_death_channel(int pow, god_type god)
{
bool success = false;
@@ -1236,8 +1236,8 @@ bool cast_death_channel(int pow, bool god_gift)
if (you.duration[DUR_DEATH_CHANNEL] > 100)
you.duration[DUR_DEATH_CHANNEL] = 100;
- if (god_gift)
- you.attribute[ATTR_DIVINE_DEATH_CHANNEL] = 1;
+ if (god != GOD_NO_GOD)
+ you.attribute[ATTR_DIVINE_DEATH_CHANNEL] = static_cast<int>(god);
}
else
canned_msg(MSG_NOTHING_HAPPENS);
diff --git a/crawl-ref/source/spells3.h b/crawl-ref/source/spells3.h
index 854438e4bd..58ffefcbe5 100644
--- a/crawl-ref/source/spells3.h
+++ b/crawl-ref/source/spells3.h
@@ -113,16 +113,19 @@ bool remove_curse(bool suppress_msg);
* *********************************************************************** */
bool cast_sublimation_of_blood(int pow);
-bool cast_call_imp(int pow, bool god_gift = false);
-bool summon_lesser_demon(int pow, bool god_gift = false, bool quiet = false);
-bool summon_common_demon(int pow, bool god_gift = false, bool quiet = false);
-bool summon_greater_demon(int pow, bool god_gift = false, bool quiet = false);
-bool summon_demon_type(monster_type mon, int pow, bool god_gift = false);
-bool cast_summon_demon(int pow, bool god_gift = false);
-bool cast_demonic_horde(int pow, bool god_gift = false);
-bool cast_summon_greater_demon(int pow, bool god_gift = false);
-bool cast_shadow_creatures(bool god_gift = false);
-bool cast_summon_horrible_things(int pow, bool god_gift = false);
+bool cast_call_imp(int pow, god_type god = GOD_NO_GOD);
+bool summon_lesser_demon(int pow, god_type god = GOD_NO_GOD,
+ bool quiet = false);
+bool summon_common_demon(int pow, god_type god = GOD_NO_GOD,
+ bool quiet = false);
+bool summon_greater_demon(int pow, god_type god = GOD_NO_GOD,
+ bool quiet = false);
+bool summon_demon_type(monster_type mon, int pow, god_type god = GOD_NO_GOD);
+bool cast_summon_demon(int pow, god_type god = GOD_NO_GOD);
+bool cast_demonic_horde(int pow, god_type god = GOD_NO_GOD);
+bool cast_summon_greater_demon(int pow, god_type god = GOD_NO_GOD);
+bool cast_shadow_creatures(god_type god = GOD_NO_GOD);
+bool cast_summon_horrible_things(int pow, god_type god = GOD_NO_GOD);
// last updated 24may2000 {dlb}
/* ***********************************************************************
@@ -130,7 +133,7 @@ bool cast_summon_horrible_things(int pow, bool god_gift = false);
* *********************************************************************** */
bool animate_a_corpse(int x, int y, corpse_type class_allowed,
beh_type beha, unsigned short hitting,
- bool god_gift = false, bool actual = true,
+ god_type god = GOD_NO_GOD, bool actual = true,
bool quiet = false);
// last updated 24may2000 {dlb}
@@ -138,16 +141,16 @@ bool animate_a_corpse(int x, int y, corpse_type class_allowed,
* called from: ability - it_use3 - monstuff - mstuff2 - spell
* *********************************************************************** */
int animate_dead(actor *caster, int pow, beh_type beha, unsigned short hitting,
- bool god_gift = false, bool actual = true);
+ god_type god = GOD_NO_GOD, bool actual = true);
// updated 24may2000 {dlb}
/* ***********************************************************************
* called from: spell
* *********************************************************************** */
-bool cast_simulacrum(int pow, bool god_gift = false);
-bool cast_twisted_resurrection(int pow, bool god_gift = false);
-bool cast_summon_wraiths(int pow, bool god_gift = false);
-bool cast_death_channel(int pow, bool god_gift = false);
+bool cast_simulacrum(int pow, god_type god = GOD_NO_GOD);
+bool cast_twisted_resurrection(int pow, god_type god = GOD_NO_GOD);
+bool cast_summon_wraiths(int pow, god_type god = GOD_NO_GOD);
+bool cast_death_channel(int pow, god_type god = GOD_NO_GOD);
// updated 24may2000 {dlb}
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...");
}
diff --git a/crawl-ref/source/xom.cc b/crawl-ref/source/xom.cc
index 8b681c21eb..18de3e6075 100644
--- a/crawl-ref/source/xom.cc
+++ b/crawl-ref/source/xom.cc
@@ -498,7 +498,7 @@ static bool xom_is_good(int sever)
summons[i] =
create_monster(
mgen_data(mon, BEH_FRIENDLY, 3,
- you.pos(), you.pet_target, MG_GOD_GIFT));
+ you.pos(), you.pet_target, 0, GOD_XOM));
if (summons[i] != -1)
success = true;
@@ -587,7 +587,7 @@ static bool xom_is_good(int sever)
if (create_monster(
mgen_data(mon, beha, 6,
- you.pos(), hitting, MG_GOD_GIFT)) != -1)
+ you.pos(), hitting, 0, GOD_XOM)) != -1)
{
if (different)
god_speaks(GOD_XOM, _get_xom_speech("single holy summon"));
@@ -683,7 +683,7 @@ static bool xom_is_good(int sever)
if (create_monster(
mgen_data(xom_random_demon(sever, one_chance_in(8)),
beha, 0,
- you.pos(), hitting, MG_GOD_GIFT)) != -1)
+ you.pos(), hitting, 0, GOD_XOM)) != -1)
{
if (different)
god_speaks(GOD_XOM, _get_xom_speech("single major holy summon"));
@@ -849,7 +849,7 @@ static bool xom_is_bad(int sever)
// Nasty, but fun.
if (one_chance_in(4))
- success = cast_tukimas_dance(100, true, true, true);
+ success = cast_tukimas_dance(100, GOD_XOM, true, true);
else
{
const int numdemons =
@@ -860,7 +860,7 @@ static bool xom_is_bad(int sever)
if (create_monster(
mgen_data::alert_hostile_at(
xom_random_punishment_demon(sever),
- you.pos(), 4, MG_GOD_GIFT)) != -1)
+ you.pos(), 4, 0, GOD_XOM)) != -1)
{
success = true;
}