summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/throw.cc
diff options
context:
space:
mode:
authorChris Campbell <chriscampbell89@gmail.com>2014-02-09 19:34:03 +0000
committerChris Campbell <chriscampbell89@gmail.com>2014-02-09 19:38:06 +0000
commit592e02136c47e88eb86883d7d2ac7a41165b8dc3 (patch)
tree66bdf6912f58ca5da4a2188a9e20973daecff4e7 /crawl-ref/source/throw.cc
parent0aaafda4745bf8746b71579557fd0c927d8c3601 (diff)
downloadcrawl-ref-592e02136c47e88eb86883d7d2ac7a41165b8dc3.tar.gz
crawl-ref-592e02136c47e88eb86883d7d2ac7a41165b8dc3.zip
Turn Portal Projectile into a duration
While active, all shots are portalled at the cost of 1MP per shot.
Diffstat (limited to 'crawl-ref/source/throw.cc')
-rw-r--r--crawl-ref/source/throw.cc20
1 files changed, 17 insertions, 3 deletions
diff --git a/crawl-ref/source/throw.cc b/crawl-ref/source/throw.cc
index 01dc9634fc..516866e19a 100644
--- a/crawl-ref/source/throw.cc
+++ b/crawl-ref/source/throw.cc
@@ -284,6 +284,12 @@ static bool _fire_choose_item_and_target(int& slot, dist& target,
canned_msg(MSG_OK);
return false;
}
+ if (teleport && cell_is_solid(target.target))
+ {
+ const char *feat = feat_type_name(grd(target.target));
+ mprf("There is %s there.", article_a(feat).c_str());
+ return false;
+ }
you.m_quiver->on_item_fired(*beh.active_item(), beh.chosen_ammo);
you.redraw_quiver = true;
@@ -433,15 +439,21 @@ int get_ammo_to_shoot(int item, dist &target, bool teleport)
void fire_thing(int item)
{
dist target;
- item = get_ammo_to_shoot(item, target);
+ // Portal Projectile, requires MP per shot.
+ bool teleport = !you.confused()
+ && you.duration[DUR_PORTAL_PROJECTILE]
+ && enough_mp(1, true, false);
+ int acc_bonus = 0;
+ item = get_ammo_to_shoot(item, target, teleport);
if (item == -1)
return;
if (check_warning_inscriptions(you.inv[item], OPER_FIRE))
{
bolt beam;
- throw_it(beam, item, false, 0, &target);
-
+ if (teleport)
+ acc_bonus = random2(you.attribute[ATTR_PORTAL_PROJECTILE] / 4);
+ throw_it(beam, item, teleport, acc_bonus, &target);
}
}
@@ -2008,6 +2020,8 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus,
pbolt.affect_endpoint();
if (!did_return && acc_bonus != DEBUG_COOKIE)
pbolt.drop_object();
+ // Costs 1 MP per shot.
+ dec_mp(1);
}
else
{