v3.3.0: force cubes now affect chars from far to close from thrower
This commit is contained in:
@@ -35,6 +35,8 @@ import com.watabou.noosa.audio.Sample;
|
|||||||
import com.watabou.utils.PathFinder;
|
import com.watabou.utils.PathFinder;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
|
|
||||||
public class ForceCube extends MissileWeapon {
|
public class ForceCube extends MissileWeapon {
|
||||||
|
|
||||||
@@ -83,6 +85,14 @@ public class ForceCube extends MissileWeapon {
|
|||||||
if (Actor.findChar(cell + i) != null) targets.add(Actor.findChar(cell + i));
|
if (Actor.findChar(cell + i) != null) targets.add(Actor.findChar(cell + i));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//furthest to closest, mainly for elastic
|
||||||
|
Collections.sort(targets, new Comparator<Char>() {
|
||||||
|
@Override
|
||||||
|
public int compare(Char a, Char b) {
|
||||||
|
return Float.compare(Dungeon.level.trueDistance(b.pos, curUser.pos), Dungeon.level.trueDistance(a.pos, curUser.pos));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
for (Char target : targets){
|
for (Char target : targets){
|
||||||
curUser.shoot(target, this);
|
curUser.shoot(target, this);
|
||||||
if (target == Dungeon.hero && !target.isAlive()){
|
if (target == Dungeon.hero && !target.isAlive()){
|
||||||
|
|||||||
Reference in New Issue
Block a user