summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/spl-cast.cc
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2008-10-09 13:59:30 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2008-10-09 13:59:30 +0000
commit1c7e145a0a082b50c22ce53b6db7fccfc6ad9e31 (patch)
tree8ab3a0be1e727a6584d4727c0df5ff5a10c17918 /crawl-ref/source/spl-cast.cc
parentcd08ab62d681ee480339a2f26d833bf9d4104dda (diff)
downloadcrawl-ref-1c7e145a0a082b50c22ce53b6db7fccfc6ad9e31.tar.gz
crawl-ref-1c7e145a0a082b50c22ce53b6db7fccfc6ad9e31.zip
Rewrite of beam.cc: put all beam data in one place. Might be buggy.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7201 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/spl-cast.cc')
-rw-r--r--crawl-ref/source/spl-cast.cc21
1 files changed, 8 insertions, 13 deletions
diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc
index 70856ff07b..82a451f88e 100644
--- a/crawl-ref/source/spl-cast.cc
+++ b/crawl-ref/source/spl-cast.cc
@@ -340,18 +340,17 @@ int spell_fail(spell_type spell)
chance += armour;
}
- if (you.equip[EQ_WEAPON] != -1
- && you.inv[you.equip[EQ_WEAPON]].base_type == OBJ_WEAPONS)
+ if (you.weapon() && you.weapon()->base_type == OBJ_WEAPONS)
{
- int wpn_penalty = (3 * (property( you.inv[you.equip[EQ_WEAPON]], PWPN_SPEED ) - 12)) / 2;
+ int wpn_penalty = (3 * (property(*you.weapon(), PWPN_SPEED) - 12))/2;
if (wpn_penalty > 0)
chance += wpn_penalty;
}
- if (you.equip[EQ_SHIELD] != -1)
+ if (you.shield())
{
- switch (you.inv[you.equip[EQ_SHIELD]].sub_type)
+ switch (you.shield()->sub_type)
{
case ARM_BUCKLER:
chance += 5;
@@ -764,9 +763,8 @@ bool maybe_identify_staff(item_def &item, spell_type spell)
if (id_staff)
{
- item_def& wpn = you.inv[you.equip[EQ_WEAPON]];
- // changed from ISFLAG_KNOW_TYPE
- set_ident_type( wpn, ID_KNOWN_TYPE );
+ item_def& wpn = *you.weapon();
+ set_ident_type(wpn, ID_KNOWN_TYPE);
set_ident_flags( wpn, ISFLAG_IDENT_MASK);
mprf("You are wielding %s.", wpn.name(DESC_NOCAP_A).c_str());
more();
@@ -778,11 +776,8 @@ bool maybe_identify_staff(item_def &item, spell_type spell)
static void _spellcasting_side_effects(spell_type spell, bool idonly = false)
{
- if (you.equip[EQ_WEAPON] != -1
- && item_is_staff( you.inv[you.equip[EQ_WEAPON]] ))
- {
- maybe_identify_staff(you.inv[you.equip[EQ_WEAPON]], spell);
- }
+ if (you.weapon() && item_is_staff(*you.weapon()))
+ maybe_identify_staff(*you.weapon(), spell);
if (idonly)
return;