More misc cleanup

This commit is contained in:
Anuken
2021-03-17 17:39:50 -04:00
parent 786d638ad0
commit c7cbe50876
6 changed files with 17 additions and 13 deletions
+8 -5
View File
@@ -248,7 +248,7 @@ public class Damage{
tmpUnit = null;
Cons<Unit> cons = e -> {
Units.nearbyEnemies(hitter.team, rect, e -> {
if((tmpUnit != null && e.dst2(x, y) > tmpUnit.dst2(x, y)) || !e.checkTarget(hitter.type.collidesAir, hitter.type.collidesGround)) return;
e.hitbox(hitrect);
@@ -263,9 +263,7 @@ public class Damage{
if(vec != null){
tmpUnit = e;
}
};
Units.nearbyEnemies(hitter.team, rect, cons);
});
if(tmpBuilding != null && tmpUnit != null){
if(Mathf.dst2(x, y, tmpUnit.getX(), tmpUnit.getY()) <= Mathf.dst2(x, y, tmpBuilding.getX(), tmpBuilding.getY())){
@@ -339,7 +337,12 @@ public class Damage{
/** Damages all entities and blocks in a radius that are enemies of the team. */
public static void damage(Team team, float x, float y, float radius, float damage, boolean complete, boolean air, boolean ground){
Cons<Unit> cons = entity -> {
Cons<Unit> cons
= entity -> {
if(entity.team == team || !entity.within(x, y, radius) || (entity.isFlying() && !air) || (entity.isGrounded() && !ground)){
return;
}
+3 -1
View File
@@ -55,7 +55,9 @@ public class EntityGroup<T extends Entityc> implements Iterable<T>{
}
public void update(){
each(Entityc::update);
for(index = 0; index < array.size; index++){
array.items[index].update();
}
}
public Seq<T> copy(Seq<T> arr){