summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/evoke.cc
diff options
context:
space:
mode:
authorgammafunk <gammafunk@gmail.com>2014-06-07 02:59:47 -0500
committergammafunk <gammafunk@gmail.com>2014-06-08 02:32:28 -0500
commitcdebce73275bf2c9b5a00e845d1988b416960048 (patch)
tree366ffcc666c6a18d1d57bd8f81966ebe6d1043f5 /crawl-ref/source/evoke.cc
parentb0119f4bb604346a57d4d41e885d9fa9bbde0bf6 (diff)
downloadcrawl-ref-cdebce73275bf2c9b5a00e845d1988b416960048.tar.gz
crawl-ref-cdebce73275bf2c9b5a00e845d1988b416960048.zip
Rework the web effect of sack of spiders
Surrounding the player with webs requires the player to have a controlled form of blink to use the sack safely in many instances. Instead of placing nets everywhere within the radius, the item now only attempts to place them on monsters and then triggers the web. The chance that the monster will spend a turn trapped in a web and vulnerable is smaller now, since the web triggers on the turn the sack is used, instead of when the monster moves onto the web. This change doesn't seem to be a significant buff to the item overall, so leaving e.g. chance of web placement and number of uses unchanged for now.
Diffstat (limited to 'crawl-ref/source/evoke.cc')
-rw-r--r--crawl-ref/source/evoke.cc74
1 files changed, 47 insertions, 27 deletions
diff --git a/crawl-ref/source/evoke.cc b/crawl-ref/source/evoke.cc
index 9c0ffef60b..ed63e5bfb6 100644
--- a/crawl-ref/source/evoke.cc
+++ b/crawl-ref/source/evoke.cc
@@ -735,45 +735,65 @@ static bool _sack_of_spiders(item_def &sack)
return false;
}
- bool success = false;
+ if (one_chance_in(5))
+ {
+ mpr("...but nothing happens.");
+ return false;
+ }
- if (!one_chance_in(5))
+ bool success = false;
+ int count = 1 + random2(3)
+ + random2(div_rand_round(you.skill(SK_EVOCATIONS, 10), 40));
+ for (int n = 0; n < count; n++)
{
- int count = 1 + random2(3)
- + random2(div_rand_round(you.skill(SK_EVOCATIONS,10),40));
- for (int n = 0; n < count; n++)
- {
- // Invoke mon-pick with our custom list
- monster_type mon = pick_monster_from(pop_spiders,
- max(1, you.skill(SK_EVOCATIONS)),
- _box_of_beasts_veto_mon);
- mgen_data mg = mgen_data(mon,
- BEH_FRIENDLY, &you,
- 3 + random2(4), 0,
- you.pos(),
- MHITYOU, MG_AUTOFOE);
- if (create_monster(mg))
- success = true;
- }
+ // Invoke mon-pick with our custom list
+ monster_type mon = pick_monster_from(pop_spiders,
+ max(1, you.skill(SK_EVOCATIONS)),
+ _box_of_beasts_veto_mon);
+ mgen_data mg = mgen_data(mon,
+ BEH_FRIENDLY, &you,
+ 3 + random2(4), 0,
+ you.pos(),
+ MHITYOU, MG_AUTOFOE);
+ if (create_monster(mg))
+ success = true;
}
if (success)
{
- // Also generate webs
+ mpr("...and things crawl out!");
+ // Also generate webs on hostile monsters and trap them.
int rad = LOS_RADIUS / 2 + 2;
- for (radius_iterator ri(you.pos(), rad, C_ROUND, LOS_SOLID, true); ri; ++ri)
+ for (monster_near_iterator mi(you.pos(), LOS_SOLID); mi; ++mi)
{
- if (grd(*ri) == DNGN_FLOOR)
+ trap_def *trap = find_trap((*mi)->pos());
+ // Don't destroy non-web traps or try to trap monsters
+ // currently caught by something.
+ if (you.pos().range((*mi)->pos()) > rad
+ || (!trap && grd((*mi)->pos()) != DNGN_FLOOR)
+ || (trap && trap->type != TRAP_WEB)
+ || (*mi)->friendly()
+ || (*mi)->caught())
+ {
+ continue;
+ }
+
+ int chance = 100 - (100 * (you.pos().range((*mi)->pos()) - 1) / rad)
+ - 2 * (27 - you.skill(SK_EVOCATIONS));
+ if (x_chance_in_y(chance, 100))
{
- int chance = 100 - (100 * (you.pos().range(*ri) - 1) / rad)
- - 2 * (27 - you.skill(SK_EVOCATIONS));
- if (x_chance_in_y(chance,100) && place_specific_trap(*ri, TRAP_WEB))
+ if (trap && trap->type == TRAP_WEB)
+ destroy_trap((*mi)->pos());
+
+ if (place_specific_trap((*mi)->pos(), TRAP_WEB))
+ {
// Reveal the trap
- grd(*ri) = DNGN_TRAP_WEB;
+ grd((*mi)->pos()) = DNGN_TRAP_WEB;
+ trap = find_trap((*mi)->pos());
+ trap->trigger(**mi);
+ }
}
}
- mpr("...and things crawl out!");
- xom_is_stimulated(10);
// Decrease charges
sack.plus--;
sack.plus2++;