v0.3.5: fixed spears being able to attack through walls

This commit is contained in:
Evan Debenham
2016-04-22 02:30:52 -04:00
parent b731569f85
commit 6e1bab6e89
3 changed files with 26 additions and 14 deletions
@@ -23,7 +23,6 @@ package com.shatteredpixel.shatteredpixeldungeon.ui;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
import com.watabou.noosa.Game;
@@ -97,14 +96,11 @@ 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 (Dungeon.hero.belongings.weapon != null ?
Level.distance( heroPos, mob.pos ) <= Dungeon.hero.belongings.weapon.reachFactor(Dungeon.hero)
: Level.adjacent( heroPos, mob.pos )) {
if ( Dungeon.hero.canAttack( mob) ) {
candidates.add( mob );
}
}