v0.9.3: fixed giant champions attacking over allies

This commit is contained in:
Evan Debenham 2021-05-08 20:57:43 -04:00
parent 3a13f59ebd
commit 96d8cd07b9

View File

@ -22,6 +22,7 @@
package com.shatteredpixel.shatteredpixeldungeon.actors.buffs;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Fire;
@ -29,6 +30,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
import com.shatteredpixel.shatteredpixeldungeon.utils.BArray;
import com.watabou.noosa.Image;
import com.watabou.utils.Bundle;
import com.watabou.utils.PathFinder;
@ -189,8 +191,18 @@ public abstract class ChampionEnemy extends Buff {
@Override
public boolean canAttackWithExtraReach(Char enemy) {
//attack range of 2
return target.fieldOfView[enemy.pos] && Dungeon.level.distance(target.pos, enemy.pos) <= 2;
if (Dungeon.level.distance( target.pos, enemy.pos ) > 2){
return false;
} else {
boolean[] passable = BArray.not(Dungeon.level.solid, null);
for (Char ch : Actor.chars()) {
if (ch != target) passable[ch.pos] = false;
}
PathFinder.buildDistanceMap(enemy.pos, passable, 2);
return PathFinder.distance[target.pos] <= 2;
}
}
}