v0.6.3: fixed boomerang taking an accuracy penalty when used as melee

This commit is contained in:
Evan Debenham 2018-02-01 21:30:45 -05:00 committed by Evan Debenham
parent e4a3d3ff10
commit 0fb0f9ce2a

View File

@ -281,14 +281,19 @@ public class Hero extends Char {
return belongings.armor == null ? 0 : belongings.armor.tier;
}
//this variable is only needed because of the boomerang, remove if/when it is no longer equippable
boolean rangedAttack = false;
public boolean shoot( Char enemy, MissileWeapon wep ) {
//temporarily set the hero's weapon to the missile weapon being used
KindOfWeapon equipped = belongings.weapon;
belongings.weapon = wep;
rangedAttack = true;
boolean result = attack( enemy );
Invisibility.dispel();
belongings.weapon = equipped;
rangedAttack = false;
return result;
}
@ -298,7 +303,7 @@ public class Hero extends Char {
KindOfWeapon wep = belongings.weapon;
float accuracy = 1;
if (wep instanceof MissileWeapon
if (wep instanceof MissileWeapon && rangedAttack
&& Dungeon.level.distance( pos, target.pos ) == 1) {
accuracy *= 0.5f;
}