summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2007-11-05 14:03:44 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2007-11-05 14:03:44 +0000
commit2b2677e1c414e486fe7aea9eb5c39c173bdfc239 (patch)
tree1ce0668a3f44257dd225d80cda18b0cc0879b74c
parentcc387e25c2f28449894231041e213f1512d6a1f2 (diff)
downloadcrawl-ref-2b2677e1c414e486fe7aea9eb5c39c173bdfc239.tar.gz
crawl-ref-2b2677e1c414e486fe7aea9eb5c39c173bdfc239.zip
Further net tweaking.
Characters are now entrapped significantly shorter, on average about 4 turns rather than 8. As before, this depends strongly on size and wielded weapon. Also finally fix a bug that was responsible for sometimes choosing the wrong (topmost) net out of a stash to hold the player. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/branches/stone_soup-0.3@2768 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/beam.cc19
-rw-r--r--crawl-ref/source/traps.cc48
2 files changed, 41 insertions, 26 deletions
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index 6de61f0906..157c288499 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -2407,21 +2407,16 @@ void beam_drop_object( bolt &beam, item_def *item, int x, int y )
// doesn't get destroyed by throwing
if (item->sub_type == MI_THROWING_NET)
{
- copy_item_to_grid( *item, x, y, 1 );
-
- // nobody there
- 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
- if (you.x_pos == x && you.y_pos == y && !you.attribute[ATTR_HELD]
- || mgrd[x][y] != NON_MONSTER && !mons_is_caught(&menv[mgrd[x][y]]))
+ // player or monster on position is caught in net
+ if (you.x_pos == x && you.y_pos == y && you.attribute[ATTR_HELD]
+ || mgrd[x][y] != NON_MONSTER && mons_is_caught(&menv[mgrd[x][y]]))
{
- return;
+ // if no trapping net found mark this one
+ if (get_trapping_net(x,y, true) == NON_ITEM)
+ set_item_stationary(*item);
}
- // somebody on square who HAS been caught, maybe by this net?
- mark_net_trapping(x,y);
+ copy_item_to_grid( *item, x, y, 1 );
return;
}
diff --git a/crawl-ref/source/traps.cc b/crawl-ref/source/traps.cc
index 2e54eb13b3..3fa830702a 100644
--- a/crawl-ref/source/traps.cc
+++ b/crawl-ref/source/traps.cc
@@ -558,12 +558,19 @@ static int damage_or_escape_net(int hold)
{
// Spriggan: little (+2)
// Halfling, Kobold, Gnome: small (+1)
+ // Human, Elf, ...: medium (0)
// Ogre, Troll, Centaur, Naga: large (-1)
// transformations: spider, bat: tiny (+3); ice beast: large (-1)
int escape = SIZE_MEDIUM - you.body_size(PSIZE_BODY);
int damage = -escape;
+ if (escape == 0) // middle-sized creatures are at a disadvantage
+ {
+ escape += coinflip();
+ damage -= coinflip();
+ }
+
// your weapon may damage the net, max. bonus of 2
if (you.equip[EQ_WEAPON] != -1)
{
@@ -577,8 +584,13 @@ static int damage_or_escape_net(int hold)
else if (you.attribute[ATTR_TRANSFORMATION] == TRAN_BLADE_HANDS)
damage += 2;
else if (you.mutation[MUT_CLAWS])
- damage += random2(you.mutation[MUT_CLAWS]);
-
+ {
+ if (you.mutation[MUT_CLAWS] == 1)
+ damage += coinflip();
+ else
+ damage += you.mutation[MUT_CLAWS] - 1;
+ }
+
// Berserkers get a fighting bonus
if (you.duration[DUR_BERSERKER])
damage += 2;
@@ -587,7 +599,7 @@ static int damage_or_escape_net(int hold)
if (hold < 0)
{
escape += random2(-hold/2) + 1;
- damage += random2(-hold/3 + 1); // ... and easier to destroy
+ damage += random2(-hold/3) + 1; // ... and easier to destroy
}
// check stats
@@ -635,10 +647,11 @@ void free_self_from_net()
return;
}
- int do_what = damage_or_escape_net(mitm[net].plus);
+ int hold = mitm[net].plus;
+ int do_what = damage_or_escape_net(hold);
#ifdef DEBUG_DIAGNOSTICS
mprf(MSGCH_DIAGNOSTICS, "net.plus: %d, ATTR_HELD: %d, do_what: %d",
- mitm[net].plus, you.attribute[ATTR_HELD], do_what);
+ hold, you.attribute[ATTR_HELD], do_what);
#endif
if (do_what <= 0) // you try to destroy the net
@@ -647,19 +660,21 @@ void free_self_from_net()
bool can_slice = you.attribute[ATTR_TRANSFORMATION] == TRAN_BLADE_HANDS
|| you.equip[EQ_WEAPON] != -1
&& can_cut_meat(you.inv[you.equip[EQ_WEAPON]]);
-
- int damage = 1;
- damage += random2(-do_what);
-
+
+ int damage = -do_what;
+ if (damage < 1)
+ damage = 1;
+
if (you.duration[DUR_BERSERKER])
damage *= 2;
if (damage > 5)
damage = 5;
- mitm[net].plus -= damage;
+ hold -= damage;
+ mitm[net].plus = hold;
- if (mitm[net].plus < -7)
+ if (hold < -7)
{
mprf("You %s the net and break free!",
can_slice ? (damage >= 4? "slice" : "cut") :
@@ -681,13 +696,18 @@ void free_self_from_net()
// occasionally decrease duration a bit
// (this is so switching from damage to escape does not hurt as much)
- if (you.attribute[ATTR_HELD] > 1 && one_chance_in(3))
+ if (you.attribute[ATTR_HELD] > 1 && coinflip())
+ {
you.attribute[ATTR_HELD]--;
+
+ if (you.attribute[ATTR_HELD] > 1 && hold < -random2(5))
+ you.attribute[ATTR_HELD]--;
+ }
}
else // you try to escape (takes at least 3 turns, and at most 10)
{
- int escape = random2(do_what);
-
+ int escape = do_what;
+
if (you.duration[DUR_HASTE]) // extra bonus, also Berserk
escape++;