summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/spells2.cc
diff options
context:
space:
mode:
Diffstat (limited to 'crawl-ref/source/spells2.cc')
-rw-r--r--crawl-ref/source/spells2.cc103
1 files changed, 72 insertions, 31 deletions
diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc
index d9cd928d61..ba189cf2ad 100644
--- a/crawl-ref/source/spells2.cc
+++ b/crawl-ref/source/spells2.cc
@@ -1,6 +1,7 @@
/*
* File: spells2.cc
* Summary: Implementations of some additional spells.
+ * Mostly Necromancy and Summoning.
* Written by: Linley Henzell
*
* Modified for Crawl Reference by $Author$ on $Date$
@@ -50,6 +51,7 @@
#include "terrain.h"
#include "traps.h"
#include "view.h"
+#include "xom.h"
static int raise_corpse( int corps, int corx, int cory, beh_type corps_beh,
int corps_hit, int actual );
@@ -154,7 +156,8 @@ static void mark_detected_creature(int gridx, int gridy, const monsters *mon,
gx = gridx + random2(fuzz_diam) - fuzz_radius;
gy = gridy + random2(fuzz_diam) - fuzz_radius;
- if (map_bounds(gx, gy) && !grid_is_solid(grd[gx][gy]))
+ if (map_bounds(gx, gy)
+ && mon->can_pass_through(grd[gx][gy]))
{
found_good = true;
break;
@@ -248,7 +251,7 @@ int corpse_rot(int power)
{
for (ady = miny; ady != maxy; ady += yinc)
{
- if (see_grid(adx, ady))
+ if (see_grid_no_trans(adx, ady))
{
if (igrd[adx][ady] == NON_ITEM
|| env.cgrid[adx][ady] != EMPTY_CLOUD)
@@ -328,7 +331,7 @@ int animate_dead( int power, beh_type corps_beh, int corps_hit, int actual )
{
for (ady = miny; ady != maxy; ady += yinc)
{
- if (see_grid(adx, ady))
+ if (see_grid_no_trans(adx, ady))
{
if (igrd[adx][ady] != NON_ITEM)
{
@@ -379,9 +382,16 @@ int animate_a_corpse( int axps, int ayps, beh_type corps_beh, int corps_hit,
if (is_animatable_corpse(item) &&
(class_allowed == CORPSE_BODY || item.sub_type == CORPSE_SKELETON))
{
+ bool was_butchering = is_being_butchered(item);
+
rc = raise_corpse(objl, axps, ayps, corps_beh, corps_hit, 1);
if ( rc )
+ {
mpr("The dead are walking!");
+
+ if (was_butchering)
+ xom_is_stimulated(255);
+ }
break;
}
objl = item.link;
@@ -525,7 +535,7 @@ void cast_twisted(int power, beh_type corps_beh, int corps_hit)
}
} // end cast_twisted()
-bool brand_weapon(int which_brand, int power)
+bool brand_weapon(brand_type which_brand, int power)
{
int temp_rand; // probability determination {dlb}
int duration_affected = 0; //jmf: NB: now HOW LONG, not WHICH BRAND.
@@ -611,7 +621,7 @@ bool brand_weapon(int which_brand, int power)
// with removing the miscast effect. We may need to revise the spell
// to level 8 or 9. XXX.
// miscast_effect(SPTYP_TRANSLOCATION,
- // 9, 90, 100, "a distortion effect");
+ // 9, 90, 100, "distortion branding");
break;
case SPWPN_PAIN:
@@ -630,6 +640,8 @@ bool brand_weapon(int which_brand, int power)
msg += " glows silver and feels heavier.";
duration_affected = 7;
break;
+ default:
+ break;
}
set_item_ego_type( you.inv[wpn], OBJ_WEAPONS, which_brand );
@@ -777,10 +789,11 @@ void holy_word(int pow, bool silent)
continue;
if (mons_holiness(monster) == MH_UNDEAD
- || mons_holiness(monster) == MH_DEMONIC)
+ || mons_holiness(monster) == MH_DEMONIC)
{
simple_monster_message(monster, " convulses!");
+ behaviour_event( monster, ME_ANNOY, MHITYOU );
hurt_monster( monster, roll_dice( 2, 15 ) + (random2(pow) / 3) );
if (monster->hit_points < 1)
@@ -1095,6 +1108,12 @@ char burn_freeze(int pow, char flavour)
mpr("There isn't anything close enough!");
return 0;
}
+
+ if (trans_wall_blocking( bmove.tx, bmove.ty ))
+ {
+ mpr("A translucent wall is in the way.");
+ return 0;
+ }
}
monster = &menv[mgr];
@@ -1120,7 +1139,7 @@ char burn_freeze(int pow, char flavour)
{
if (mons_friendly( monster ))
{
- did_god_conduct( DID_ATTACK_FRIEND, 5, monster );
+ did_god_conduct( DID_ATTACK_FRIEND, 5, true, monster );
}
if (mons_holiness( monster ) == MH_HOLY)
@@ -1169,7 +1188,7 @@ int summon_elemental(int pow, int restricted_type,
unsigned char unfriendly)
{
int type_summoned = MONS_PROGRAM_BUG; // error trapping {dlb}
- char summ_success = 0;
+ int summ_success = 0;
struct dist smove;
int dir_x;
@@ -1212,7 +1231,8 @@ int summon_elemental(int pow, int restricted_type,
break;
}
- if (grd[ targ_x ][ targ_y ] == DNGN_ROCK_WALL
+ if ((grd[ targ_x ][ targ_y ] == DNGN_ROCK_WALL
+ || grd[ targ_x ][ targ_y ] == DNGN_CLEAR_ROCK_WALL)
&& (restricted_type == 0 || restricted_type == MONS_EARTH_ELEMENTAL))
{
type_summoned = MONS_EARTH_ELEMENTAL;
@@ -1276,7 +1296,8 @@ int summon_elemental(int pow, int restricted_type,
|| random2(100) < unfriendly)
{
summ_success = create_monster( type_summoned, numsc, BEH_HOSTILE,
- targ_x, targ_y, MHITYOU, 250 );
+ targ_x, targ_y, MHITYOU, 250,
+ false, false, false, true);
if (summ_success >= 0)
mpr( "The elemental doesn't seem to appreciate being summoned." );
@@ -1284,7 +1305,8 @@ int summon_elemental(int pow, int restricted_type,
else
{
summ_success = create_monster( type_summoned, numsc, BEH_FRIENDLY,
- targ_x, targ_y, you.pet_target, 250 );
+ targ_x, targ_y, you.pet_target, 250,
+ false, false, false, true);
}
return (summ_success >= 0);
@@ -1332,7 +1354,8 @@ void summon_small_mammals(int pow)
}
create_monster( thing_called, 3, BEH_FRIENDLY,
- you.x_pos, you.y_pos, you.pet_target, 250 );
+ you.x_pos, you.y_pos, you.pet_target, 250,
+ false, false, false, true);
}
} // end summon_small_mammals()
@@ -1372,10 +1395,12 @@ void summon_animals(int pow)
if ( random2(pow) < 5 ) // unfriendly
create_monster( mon_chosen, 4, BEH_HOSTILE,
- you.x_pos, you.y_pos, MHITYOU, 250 );
+ you.x_pos, you.y_pos, MHITYOU, 250,
+ false, false, false, true);
else
create_monster( mon_chosen, 4, BEH_FRIENDLY,
- you.x_pos, you.y_pos, you.pet_target, 250 );
+ you.x_pos, you.y_pos, you.pet_target, 250,
+ false, false, false, true);
}
}
@@ -1389,17 +1414,19 @@ void summon_scorpions(int pow)
{
if (random2(pow) <= 3)
{
- if (create_monster( MONS_SCORPION, 3, BEH_HOSTILE,
- you.x_pos, you.y_pos, MHITYOU, 250 ) != -1)
- {
+ const int mindex =
+ create_monster( MONS_SCORPION, 3, BEH_HOSTILE,
+ you.x_pos, you.y_pos, MHITYOU, 250,
+ false, false, false, true);
+ if (mindex != -1)
mpr("A scorpion appears. It doesn't look very happy.");
- }
}
else
{
if (create_monster( MONS_SCORPION, 3, BEH_FRIENDLY,
you.x_pos, you.y_pos,
- you.pet_target, 250 ) != -1)
+ you.pet_target, 250,
+ false, false, false, true) != -1)
{
mpr("A scorpion appears.");
}
@@ -1449,16 +1476,17 @@ void summon_ice_beast_etc(int pow, int ibc, bool divine_gift)
}
- create_monster( ibc, numsc, beha, you.x_pos, you.y_pos, MHITYOU, 250 );
+ create_monster( ibc, numsc, beha, you.x_pos, you.y_pos, MHITYOU, 250,
+ false, false, false, true);
} // end summon_ice_beast_etc()
-// Trog sends some fighting buddies for his followers
-void summon_berserker()
+// Trog sends some fighting buddies for his followers (or enemies if
+// god_gift is false)
+bool summon_berserker(int pow, bool god_gift)
{
- beh_type beha = BEH_GOD_GIFT;
- // randomize a bit to make things more interesting
- int pow = you.piety + random2(30) - random2(30);
+ beh_type beha = (god_gift) ? BEH_GOD_GIFT : BEH_HOSTILE;
int numsc = std::min(2 + (random2(pow) / 4), 6);
+ bool success = false;
monster_type mon = MONS_TROLL;
@@ -1513,6 +1541,8 @@ void summon_berserker()
if (mons != -1)
{
+ success = true;
+
monsters *summon = &menv[mons];
summon->go_berserk(false);
mon_enchant berserk = summon->get_ench(ENCH_BERSERK);
@@ -1526,6 +1556,8 @@ void summon_berserker()
summon->update_ench(berserk);
summon->update_ench(abj);
}
+
+ return success;
} // end summon_berserker()
bool summon_swarm( int pow, bool unfriendly, bool god_gift )
@@ -1596,7 +1628,8 @@ bool summon_swarm( int pow, bool unfriendly, bool god_gift )
behaviour = BEH_FRIENDLY;
if (create_monster( thing_called, 3, behaviour,
- you.x_pos, you.y_pos, MHITYOU, 250 ))
+ you.x_pos, you.y_pos, MHITYOU, 250,
+ false, false, false, true))
{
summoned = true;
}
@@ -1626,7 +1659,8 @@ void summon_undead(int pow)
if (random2(pow) < 6)
{
if (create_monster( thing_called, 5, BEH_HOSTILE,
- you.x_pos, you.y_pos, MHITYOU, 250 ) != -1)
+ you.x_pos, you.y_pos, MHITYOU, 250,
+ false, false, false, true ) != -1)
{
mpr("You sense a hostile presence.");
}
@@ -1634,7 +1668,8 @@ void summon_undead(int pow)
else
{
if (create_monster( thing_called, 5, BEH_FRIENDLY,
- you.x_pos, you.y_pos, you.pet_target, 250 ) != -1)
+ you.x_pos, you.y_pos, you.pet_target, 250,
+ false, false, false, true ) != -1)
{
mpr("An insubstantial figure forms in the air.");
}
@@ -1658,8 +1693,12 @@ void summon_things( int pow )
int numsc = 2 + (random2(pow) / 10) + (random2(pow) / 10);
- if (one_chance_in(3) && !lose_stat( STAT_INTELLIGENCE, 1, true ))
+ if (one_chance_in(3)
+ && !lose_stat( STAT_INTELLIGENCE, 1, true,
+ "summoning horrible things" ))
+ {
mpr("Your call goes unanswered.");
+ }
else
{
numsc = stepdown_value( numsc, 2, 2, 6, -1 );
@@ -1681,14 +1720,16 @@ void summon_things( int pow )
{
create_monster( MONS_TENTACLED_MONSTROSITY, 6,
BEH_FRIENDLY,
- you.x_pos, you.y_pos, you.pet_target, 250 );
+ you.x_pos, you.y_pos, you.pet_target, 250,
+ false, false, false, true );
big_things--;
}
while (numsc > 0)
{
create_monster( MONS_ABOMINATION_LARGE, 6, BEH_FRIENDLY,
- you.x_pos, you.y_pos, you.pet_target, 250 );
+ you.x_pos, you.y_pos, you.pet_target, 250,
+ false, false, false, true );
numsc--;
}