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, 31 insertions, 72 deletions
diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc
index ba189cf2ad..d9cd928d61 100644
--- a/crawl-ref/source/spells2.cc
+++ b/crawl-ref/source/spells2.cc
@@ -1,7 +1,6 @@
/*
* 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$
@@ -51,7 +50,6 @@
#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 );
@@ -156,8 +154,7 @@ 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)
- && mon->can_pass_through(grd[gx][gy]))
+ if (map_bounds(gx, gy) && !grid_is_solid(grd[gx][gy]))
{
found_good = true;
break;
@@ -251,7 +248,7 @@ int corpse_rot(int power)
{
for (ady = miny; ady != maxy; ady += yinc)
{
- if (see_grid_no_trans(adx, ady))
+ if (see_grid(adx, ady))
{
if (igrd[adx][ady] == NON_ITEM
|| env.cgrid[adx][ady] != EMPTY_CLOUD)
@@ -331,7 +328,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_no_trans(adx, ady))
+ if (see_grid(adx, ady))
{
if (igrd[adx][ady] != NON_ITEM)
{
@@ -382,16 +379,9 @@ 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;
@@ -535,7 +525,7 @@ void cast_twisted(int power, beh_type corps_beh, int corps_hit)
}
} // end cast_twisted()
-bool brand_weapon(brand_type which_brand, int power)
+bool brand_weapon(int which_brand, int power)
{
int temp_rand; // probability determination {dlb}
int duration_affected = 0; //jmf: NB: now HOW LONG, not WHICH BRAND.
@@ -621,7 +611,7 @@ bool brand_weapon(brand_type 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, "distortion branding");
+ // 9, 90, 100, "a distortion effect");
break;
case SPWPN_PAIN:
@@ -640,8 +630,6 @@ bool brand_weapon(brand_type 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 );
@@ -789,11 +777,10 @@ 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)
@@ -1108,12 +1095,6 @@ 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];
@@ -1139,7 +1120,7 @@ char burn_freeze(int pow, char flavour)
{
if (mons_friendly( monster ))
{
- did_god_conduct( DID_ATTACK_FRIEND, 5, true, monster );
+ did_god_conduct( DID_ATTACK_FRIEND, 5, monster );
}
if (mons_holiness( monster ) == MH_HOLY)
@@ -1188,7 +1169,7 @@ int summon_elemental(int pow, int restricted_type,
unsigned char unfriendly)
{
int type_summoned = MONS_PROGRAM_BUG; // error trapping {dlb}
- int summ_success = 0;
+ char summ_success = 0;
struct dist smove;
int dir_x;
@@ -1231,8 +1212,7 @@ int summon_elemental(int pow, int restricted_type,
break;
}
- if ((grd[ targ_x ][ targ_y ] == DNGN_ROCK_WALL
- || grd[ targ_x ][ targ_y ] == DNGN_CLEAR_ROCK_WALL)
+ if (grd[ targ_x ][ targ_y ] == DNGN_ROCK_WALL
&& (restricted_type == 0 || restricted_type == MONS_EARTH_ELEMENTAL))
{
type_summoned = MONS_EARTH_ELEMENTAL;
@@ -1296,8 +1276,7 @@ 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,
- false, false, false, true);
+ targ_x, targ_y, MHITYOU, 250 );
if (summ_success >= 0)
mpr( "The elemental doesn't seem to appreciate being summoned." );
@@ -1305,8 +1284,7 @@ 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,
- false, false, false, true);
+ targ_x, targ_y, you.pet_target, 250 );
}
return (summ_success >= 0);
@@ -1354,8 +1332,7 @@ void summon_small_mammals(int pow)
}
create_monster( thing_called, 3, BEH_FRIENDLY,
- you.x_pos, you.y_pos, you.pet_target, 250,
- false, false, false, true);
+ you.x_pos, you.y_pos, you.pet_target, 250 );
}
} // end summon_small_mammals()
@@ -1395,12 +1372,10 @@ 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,
- false, false, false, true);
+ you.x_pos, you.y_pos, MHITYOU, 250 );
else
create_monster( mon_chosen, 4, BEH_FRIENDLY,
- you.x_pos, you.y_pos, you.pet_target, 250,
- false, false, false, true);
+ you.x_pos, you.y_pos, you.pet_target, 250 );
}
}
@@ -1414,19 +1389,17 @@ void summon_scorpions(int pow)
{
if (random2(pow) <= 3)
{
- 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)
+ if (create_monster( MONS_SCORPION, 3, BEH_HOSTILE,
+ you.x_pos, you.y_pos, MHITYOU, 250 ) != -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,
- false, false, false, true) != -1)
+ you.pet_target, 250 ) != -1)
{
mpr("A scorpion appears.");
}
@@ -1476,17 +1449,16 @@ 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,
- false, false, false, true);
+ create_monster( ibc, numsc, beha, you.x_pos, you.y_pos, MHITYOU, 250 );
} // end summon_ice_beast_etc()
-// Trog sends some fighting buddies for his followers (or enemies if
-// god_gift is false)
-bool summon_berserker(int pow, bool god_gift)
+// Trog sends some fighting buddies for his followers
+void summon_berserker()
{
- beh_type beha = (god_gift) ? BEH_GOD_GIFT : BEH_HOSTILE;
+ beh_type beha = BEH_GOD_GIFT;
+ // randomize a bit to make things more interesting
+ int pow = you.piety + random2(30) - random2(30);
int numsc = std::min(2 + (random2(pow) / 4), 6);
- bool success = false;
monster_type mon = MONS_TROLL;
@@ -1541,8 +1513,6 @@ bool summon_berserker(int pow, bool god_gift)
if (mons != -1)
{
- success = true;
-
monsters *summon = &menv[mons];
summon->go_berserk(false);
mon_enchant berserk = summon->get_ench(ENCH_BERSERK);
@@ -1556,8 +1526,6 @@ bool summon_berserker(int pow, bool god_gift)
summon->update_ench(berserk);
summon->update_ench(abj);
}
-
- return success;
} // end summon_berserker()
bool summon_swarm( int pow, bool unfriendly, bool god_gift )
@@ -1628,8 +1596,7 @@ 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,
- false, false, false, true))
+ you.x_pos, you.y_pos, MHITYOU, 250 ))
{
summoned = true;
}
@@ -1659,8 +1626,7 @@ 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,
- false, false, false, true ) != -1)
+ you.x_pos, you.y_pos, MHITYOU, 250 ) != -1)
{
mpr("You sense a hostile presence.");
}
@@ -1668,8 +1634,7 @@ void summon_undead(int pow)
else
{
if (create_monster( thing_called, 5, BEH_FRIENDLY,
- you.x_pos, you.y_pos, you.pet_target, 250,
- false, false, false, true ) != -1)
+ you.x_pos, you.y_pos, you.pet_target, 250 ) != -1)
{
mpr("An insubstantial figure forms in the air.");
}
@@ -1693,12 +1658,8 @@ 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,
- "summoning horrible things" ))
- {
+ if (one_chance_in(3) && !lose_stat( STAT_INTELLIGENCE, 1, true ))
mpr("Your call goes unanswered.");
- }
else
{
numsc = stepdown_value( numsc, 2, 2, 6, -1 );
@@ -1720,16 +1681,14 @@ void summon_things( int pow )
{
create_monster( MONS_TENTACLED_MONSTROSITY, 6,
BEH_FRIENDLY,
- you.x_pos, you.y_pos, you.pet_target, 250,
- false, false, false, true );
+ you.x_pos, you.y_pos, you.pet_target, 250 );
big_things--;
}
while (numsc > 0)
{
create_monster( MONS_ABOMINATION_LARGE, 6, BEH_FRIENDLY,
- you.x_pos, you.y_pos, you.pet_target, 250,
- false, false, false, true );
+ you.x_pos, you.y_pos, you.pet_target, 250 );
numsc--;
}