summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2008-07-30 23:12:21 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2008-07-30 23:12:21 +0000
commit54959c8ecce3dc814d03fd202f38ece80104f0db (patch)
treea67443814ae00bbe3060416f1b080eab01f7843d /crawl-ref
parenta3f51c4dbac537dfddbd90d4a8129fd82db8c9c5 (diff)
downloadcrawl-ref-54959c8ecce3dc814d03fd202f38ece80104f0db.tar.gz
crawl-ref-54959c8ecce3dc814d03fd202f38ece80104f0db.zip
Fix 2033055: only prompt for unsuitable weapons if you can see the target.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6735 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/fight.cc2
-rw-r--r--crawl-ref/source/religion.cc40
2 files changed, 19 insertions, 23 deletions
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc
index 8ae70f1a74..b5c480db48 100644
--- a/crawl-ref/source/fight.cc
+++ b/crawl-ref/source/fight.cc
@@ -4106,7 +4106,7 @@ bool you_attack(int monster_attacked, bool unarmed_attacks)
interrupt_activity(AI_HIT_MONSTER, defender);
// Check if the player is fighting with something unsuitable.
- if (!wielded_weapon_check(attk.weapon))
+ if (you.can_see(defender) && !wielded_weapon_check(attk.weapon))
{
you.turn_is_over = false;
return (false);
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
index c323c5b680..ae77428c3c 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -4938,39 +4938,39 @@ void excommunication(god_type new_god)
coord_def((int)new_god, old_piety));
}
-static bool _bless_weapon( god_type god, int brand, int colour )
+static bool _bless_weapon( god_type god, brand_type brand, int colour )
{
- const int wpn = get_player_wielded_weapon();
+ item_def& weap = *you.weapon();
// Only bless melee weapons.
- if (!is_artefact(you.inv[wpn]) && !is_range_weapon(you.inv[wpn]))
+ if (!is_artefact(weap) && !is_range_weapon(weap))
{
you.duration[DUR_WEAPON_BRAND] = 0; // just in case
- set_equip_desc( you.inv[wpn], ISFLAG_GLOWING );
- set_item_ego_type( you.inv[wpn], OBJ_WEAPONS, brand );
- you.inv[wpn].colour = colour;
+ set_equip_desc( weap, ISFLAG_GLOWING );
+ set_item_ego_type( weap, OBJ_WEAPONS, brand );
+ weap.colour = colour;
- do_uncurse_item( you.inv[wpn] );
+ do_uncurse_item( weap );
- enchant_weapon( ENCHANT_TO_HIT, true, you.inv[wpn] );
+ enchant_weapon( ENCHANT_TO_HIT, true, weap );
if (coinflip())
- enchant_weapon( ENCHANT_TO_HIT, true, you.inv[wpn] );
+ enchant_weapon( ENCHANT_TO_HIT, true, weap );
- enchant_weapon( ENCHANT_TO_DAM, true, you.inv[wpn] );
+ enchant_weapon( ENCHANT_TO_DAM, true, weap );
if (coinflip())
- enchant_weapon( ENCHANT_TO_DAM, true, you.inv[wpn] );
+ enchant_weapon( ENCHANT_TO_DAM, true, weap );
if ( god == GOD_SHINING_ONE )
{
- convert2good(you.inv[wpn]);
+ convert2good(weap);
- if (is_convertible(you.inv[wpn]))
+ if (is_convertible(weap))
{
- origin_acquired(you.inv[wpn], GOD_SHINING_ONE);
- make_item_blessed_blade(you.inv[wpn]);
+ origin_acquired(weap, GOD_SHINING_ONE);
+ make_item_blessed_blade(weap);
}
burden_change();
@@ -4991,13 +4991,9 @@ static bool _bless_weapon( god_type god, int brand, int colour )
holy_word(100, HOLY_WORD_SHINING_ONE, you.pos(), true);
// Un-bloodify surrounding squares.
- for (int i = -3; i <= 3; ++i)
- for (int j = -3; j <= 3; j++)
- {
- coord_def tmp = you.pos() + coord_def(i,j);
- if (is_bloodcovered(tmp))
- env.map(tmp).property = FPROP_NONE;
- }
+ for ( radius_iterator ri(you.pos(), 3, true, true); ri; ++ri )
+ if (is_bloodcovered(*ri))
+ env.map(*ri).property = FPROP_NONE;
}
delay(1000);