From 1c7e145a0a082b50c22ce53b6db7fccfc6ad9e31 Mon Sep 17 00:00:00 2001 From: haranp Date: Thu, 9 Oct 2008 13:59:30 +0000 Subject: 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 --- crawl-ref/source/effects.cc | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'crawl-ref/source/effects.cc') diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc index 895fb4646f..798bf65a89 100644 --- a/crawl-ref/source/effects.cc +++ b/crawl-ref/source/effects.cc @@ -670,10 +670,10 @@ void random_uselessness(int scroll_slot) break; case 2: - if (you.equip[EQ_WEAPON] != -1) + if (you.weapon()) { mprf("%s glows %s for a moment.", - you.inv[you.equip[EQ_WEAPON]].name(DESC_CAP_YOUR).c_str(), + you.weapon()->name(DESC_CAP_YOUR).c_str(), weird_glowing_colour().c_str()); } else @@ -2524,14 +2524,14 @@ void handle_time(long time_delta) // Random chance to identify staff in hand based off of Spellcasting // and an appropriate other spell skill... is 1/20 too fast? - if (you.equip[EQ_WEAPON] != -1 - && you.inv[you.equip[EQ_WEAPON]].base_type == OBJ_STAVES - && !item_type_known( you.inv[you.equip[EQ_WEAPON]] ) + if (you.weapon() + && you.weapon()->base_type == OBJ_STAVES + && !item_type_known(*you.weapon()) && one_chance_in(20)) { int total_skill = you.skills[SK_SPELLCASTING]; - switch (you.inv[you.equip[EQ_WEAPON]].sub_type) + switch (you.weapon()->sub_type) { case STAFF_WIZARDRY: case STAFF_ENERGY: @@ -2580,10 +2580,10 @@ void handle_time(long time_delta) if (x_chance_in_y(total_skill, 100)) { - item_def& item = you.inv[you.equip[EQ_WEAPON]]; + item_def& item = *you.weapon(); - set_ident_type( OBJ_STAVES, item.sub_type, ID_KNOWN_TYPE ); - set_ident_flags( item, ISFLAG_IDENT_MASK ); + set_ident_type(OBJ_STAVES, item.sub_type, ID_KNOWN_TYPE); + set_ident_flags(item, ISFLAG_IDENT_MASK); mprf("You are wielding %s.", item.name(DESC_NOCAP_A).c_str()); more(); -- cgit v1.2.3-54-g00ecf