v0.3.5: added support for longer reach weapons

This commit is contained in:
Evan Debenham
2016-03-04 23:48:34 -05:00
parent b03e40f46a
commit 346b4b78e6
5 changed files with 22 additions and 9 deletions
@@ -96,13 +96,15 @@ public class AttackIndicator extends Tag {
}
private void checkEnemies() {
int heroPos = Dungeon.hero.pos;
candidates.clear();
int v = Dungeon.hero.visibleEnemies();
for (int i=0; i < v; i++) {
Mob mob = Dungeon.hero.visibleEnemy( i );
if (Level.adjacent( heroPos, mob.pos )) {
if (Dungeon.hero.belongings.weapon != null ?
Level.distance( heroPos, mob.pos ) <= Dungeon.hero.belongings.weapon.reachFactor(Dungeon.hero)
: Level.adjacent( heroPos, mob.pos )) {
candidates.add( mob );
}
}