summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2007-09-19 22:54:50 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2007-09-19 22:54:50 +0000
commit5e4ca0912ae656b9e2a55b95027ebc6f483a01a6 (patch)
tree244cdb883d9dbb22695b4a8e13bde9bbb5a47046 /crawl-ref
parentbb7663ad4d03b1e36d1cbc28d797a19dfe39bbd0 (diff)
downloadcrawl-ref-5e4ca0912ae656b9e2a55b95027ebc6f483a01a6.tar.gz
crawl-ref-5e4ca0912ae656b9e2a55b95027ebc6f483a01a6.zip
Fixing a number of bugs on throwing nets, so it's all in
all a net improvement. ;) I'm reusing item.plus2 as a marker for trapping monsters or not. AFAIK, missiles don't need those, and it makes stacking so much easier. Gladiators start with Throwing skill 1, except for Kobolds (don't get a net) who get an additional level at Dodging. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2149 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/beam.cc2
-rw-r--r--crawl-ref/source/enum.h2
-rw-r--r--crawl-ref/source/itemprop.cc11
-rw-r--r--crawl-ref/source/mon-util.cc7
-rw-r--r--crawl-ref/source/monstuff.cc45
-rw-r--r--crawl-ref/source/newgame.cc12
-rw-r--r--crawl-ref/source/transfor.cc19
-rw-r--r--crawl-ref/source/traps.cc18
8 files changed, 85 insertions, 31 deletions
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index 16614b3cc5..7d41d5fbce 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -2406,7 +2406,7 @@ void beam_drop_object( bolt &beam, item_def *item, int x, int y )
copy_item_to_grid( *item, x, y, 1 );
// nobody there
- if (you.x_pos != x && you.y_pos != y && mgrd[x][y] == NON_MONSTER)
+ if ((you.x_pos != x || you.y_pos != y) && mgrd[x][y] == NON_MONSTER)
return;
// player or monster on position but hasn't been caught
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h
index 6a0f817ac8..bfbd7300ba 100644
--- a/crawl-ref/source/enum.h
+++ b/crawl-ref/source/enum.h
@@ -1234,7 +1234,7 @@ enum item_status_flag_type // per item flags: ie. ident status, cursed status
ISFLAG_EQ_JEWELLERY_MASK = 0x0000000F, // mask of flags for known jewellery
ISFLAG_CURSED = 0x00000100, // cursed
- ISFLAG_STATIONARY = 0x00000200, // cannot be picked up (traps)
+ ISFLAG_RESERVED_1 = 0x00000200, // reserved
ISFLAG_RESERVED_2 = 0x00000400, // reserved
ISFLAG_RESERVED_3 = 0x00000800, // reserved
ISFLAG_CURSE_MASK = 0x00000F00, // mask of all curse related flags
diff --git a/crawl-ref/source/itemprop.cc b/crawl-ref/source/itemprop.cc
index 5d09bf408d..625a89c337 100644
--- a/crawl-ref/source/itemprop.cc
+++ b/crawl-ref/source/itemprop.cc
@@ -458,17 +458,17 @@ void do_uncurse_item( item_def &item )
//
void set_item_stationary( item_def &item )
{
- item.flags |= ISFLAG_STATIONARY;
+ item.plus2 = 1;
}
void remove_item_stationary( item_def &item )
{
- item.flags &= (~ISFLAG_STATIONARY);
+ item.plus2 = 0;
}
bool item_is_stationary( const item_def &item )
{
- return (item.flags & ISFLAG_STATIONARY);
+ return (item.plus2);
}
//
@@ -619,8 +619,11 @@ void set_equip_race( item_def &item, unsigned long flags )
break;
case OBJ_MISSILES:
- if (item.sub_type == MI_STONE || item.sub_type == MI_LARGE_ROCK)
+ if (item.sub_type == MI_STONE || item.sub_type == MI_LARGE_ROCK
+ || item.sub_type == MI_THROWING_NET)
+ {
return;
+ }
break;
default:
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index c3260b93b8..fe555c2108 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -1907,7 +1907,7 @@ bool ms_low_hitpoint_cast( const monsters *mon, spell_type monspell )
// spells for a quick get-away
// currently only used to get out of a net
-bool ms_quick_get_away( const monsters *mon, spell_type monspell )
+bool ms_quick_get_away( const monsters *mon /*unused*/, spell_type monspell )
{
switch (monspell)
{
@@ -2900,8 +2900,11 @@ bool monsters::pickup_missile(item_def &item, int near, bool force)
const item_def *miss = missiles();
// monster may not pick up trapping net
- if (mons_is_caught(this) && item.sub_type == MI_THROWING_NET)
+ if (mons_is_caught(this) && item.sub_type == MI_THROWING_NET
+ && item_is_stationary(item))
+ {
return (false);
+ }
if (miss && items_stack(*miss, item))
return (pickup(item, MSLOT_MISSILE, near));
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index d0a8290703..225df481e0 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -405,6 +405,13 @@ void monster_die(monsters *monster, killer_type killer, int i, bool silent)
if (monster->type == -1)
return;
+ if (mons_is_caught(monster))
+ {
+ int net = get_trapping_net(monster->x,monster->y);
+ if (net != NON_ITEM)
+ remove_item_stationary(mitm[net]);
+ }
+
const int monster_killed = monster_index(monster);
const bool death_message =
!silent && mons_near(monster) && player_monster_visible(monster);
@@ -1212,6 +1219,18 @@ bool monster_polymorph( monsters *monster, monster_type targetc,
}
}
}
+ else if (mons_is_insubstantial(monster->type)
+ || monster->type == MONS_OOZE || monster->type == MONS_PULSATING_LUMP)
+ {
+ int net = get_trapping_net(monster->x, monster->y);
+ if (net != NON_ITEM)
+ remove_item_stationary(mitm[net]);
+
+ if (mons_is_insubstantial(monster->type))
+ simple_monster_message(monster, " drifts right through the net!");
+ else
+ simple_monster_message(monster, " oozes right through the net!");
+ }
else
monster->add_ench(ENCH_HELD);
}
@@ -1227,6 +1246,9 @@ bool monster_blink(monsters *monster)
false, false))
return (false);
+ if (monster->has_ench(ENCH_HELD))
+ monster->del_ench(ENCH_HELD, true);
+
mgrd[monster->x][monster->y] = NON_MONSTER;
const coord_def oldplace = monster->pos();
@@ -1241,9 +1263,6 @@ bool monster_blink(monsters *monster)
monster->check_redraw(oldplace);
monster->apply_location_effects();
- if (monster->has_ench(ENCH_HELD))
- monster->del_ench(ENCH_HELD, true);
-
return (true);
} // end monster_blink()
@@ -3378,17 +3397,16 @@ static bool handle_spell( monsters *monster, bolt & beem )
// monsters caught in a net try to get away
// this is only urgent if you are around
if (!finalAnswer && monsterNearby && mons_is_caught(monster)
- && one_chance_in(3))
+ && one_chance_in(4))
{
- if (ms_quick_get_away( monster, hspell_pass[6]))
- {
- spell_cast = hspell_pass[6];
- finalAnswer = true;
- }
- else if (ms_quick_get_away( monster, hspell_pass[5]))
+ for (int i = 0; i < 6; i++)
{
- spell_cast = hspell_pass[5];
- finalAnswer = true;
+ if (ms_quick_get_away( monster, hspell_pass[i] ))
+ {
+ spell_cast = hspell_pass[5];
+ finalAnswer = true;
+ break;
+ }
}
}
@@ -4269,7 +4287,8 @@ static bool handle_pickup(monsters *monster)
eaten += quant;
if (mons_is_caught(monster) && mitm[item].base_type == OBJ_MISSILES
- && mitm[item].sub_type == MI_THROWING_NET)
+ && mitm[item].sub_type == MI_THROWING_NET
+ && item_is_stationary(mitm[item]))
{
monster->del_ench(ENCH_HELD, true);
eaten_net = true;
diff --git a/crawl-ref/source/newgame.cc b/crawl-ref/source/newgame.cc
index 886f878219..1ec22646ee 100644
--- a/crawl-ref/source/newgame.cc
+++ b/crawl-ref/source/newgame.cc
@@ -3874,14 +3874,18 @@ bool give_items_skills()
you.inv[2].special = 0;
}
- if (you.species != SP_KOBOLD)
- {
+ if (you.species != SP_KOBOLD)
+ {
you.inv[3].quantity = 4;
you.inv[3].base_type = OBJ_MISSILES;
you.inv[3].sub_type = MI_THROWING_NET;
you.inv[3].plus = 0;
you.inv[3].special = 0;
- }
+ you.skills[SK_THROWING] = 1;
+ }
+ else
+ you.skills[SK_DODGING] = 1;
+
you.equip[EQ_WEAPON] = 0;
you.equip[EQ_BODY_ARMOUR] = 1;
you.equip[EQ_SHIELD] = 2;
@@ -3889,7 +3893,7 @@ bool give_items_skills()
you.skills[SK_FIGHTING] = 3;
weap_skill = 3;
- you.skills[SK_DODGING] = 2;
+ you.skills[SK_DODGING] += 2;
you.skills[SK_SHIELDS] = 1;
you.skills[SK_UNARMED_COMBAT] = 2;
break;
diff --git a/crawl-ref/source/transfor.cc b/crawl-ref/source/transfor.cc
index 26a17daca1..bed7d87ef8 100644
--- a/crawl-ref/source/transfor.cc
+++ b/crawl-ref/source/transfor.cc
@@ -29,6 +29,7 @@
#include "player.h"
#include "skills2.h"
#include "stuff.h"
+#include "traps.h"
void drop_everything(void);
void extra_hp(int amount_extra);
@@ -336,6 +337,15 @@ bool transform(int pow, transformation_type which_trans)
you.symbol = 'D';
you.colour = GREEN;
+
+ if (you.attribute[ATTR_HELD])
+ {
+ mpr("The net rips apart!");
+ you.attribute[ATTR_HELD] = 0;
+ int net = get_trapping_net(you.x_pos, you.y_pos);
+ if (net != NON_ITEM)
+ destroy_item(net);
+ }
return (true);
case TRAN_LICH:
@@ -401,6 +411,15 @@ bool transform(int pow, transformation_type which_trans)
modify_stat( STAT_DEXTERITY, 8, true );
you.symbol = '#';
you.colour = DARKGREY;
+
+ if (you.attribute[ATTR_HELD])
+ {
+ mpr("You drift through the net!");
+ you.attribute[ATTR_HELD] = 0;
+ int net = get_trapping_net(you.x_pos, you.y_pos);
+ if (net != NON_ITEM)
+ remove_item_stationary(mitm[net]);
+ }
return (true);
case TRAN_SERPENT_OF_HELL:
diff --git a/crawl-ref/source/traps.cc b/crawl-ref/source/traps.cc
index ba48940ffc..8f08fce842 100644
--- a/crawl-ref/source/traps.cc
+++ b/crawl-ref/source/traps.cc
@@ -31,6 +31,7 @@
#include "spl-cast.h"
#include "spl-util.h"
#include "terrain.h"
+#include "transfor.h"
#include "tutorial.h"
#include "view.h"
@@ -108,8 +109,8 @@ void monster_caught_in_net(monsters *mon, bolt &pbolt)
}
const monsters* mons = static_cast<const monsters*>(mon);
- bool mon_flies = mons->flies();
- if (mon_flies && !mons_is_confused(mons))
+ bool mon_flies = mons->flies() == FL_FLY;
+ if (mon_flies && (!mons_is_confused(mons) || one_chance_in(3)))
{
simple_monster_message(mon, " darts out from under the net!");
return;
@@ -141,7 +142,13 @@ void player_caught_in_net()
if (you.body_size(PSIZE_BODY) >= SIZE_GIANT)
return;
- if (you.flies() && !you.confused())
+ if (you.attribute[ATTR_TRANSFORMATION] == TRAN_AIR)
+ {
+ mpr("The net passes right through you!");
+ return;
+ }
+
+ if (you.flies() == FL_FLY && (!you.confused() || one_chance_in(3)))
{
mpr("You dart out from under the net!");
return;
@@ -154,13 +161,12 @@ void player_caught_in_net()
// I guess levitation works differently, keeping both you
// and the net hovering above the floor
- if (you.flies())
+ if (you.flies() == FL_FLY)
{
mpr("You fall like a stone!");
fall_into_a_pool(you.x_pos, you.y_pos, false, grd[you.x_pos][you.y_pos]);
}
}
-
}
static void dart_trap(bool trap_known, int trapped, bolt &pbolt, bool poison)
@@ -579,7 +585,7 @@ void free_self_from_net(bool damage_net)
if (mitm[net].plus < -7)
{
mpr("You rip the net and break free!");
- dec_mitm_item_quantity( net, 1 );
+ destroy_item(net);
you.attribute[ATTR_HELD] = 0;
return;