Lots of balancing/tweaks
This commit is contained in:
@@ -169,7 +169,7 @@ public class Damage{
|
||||
});
|
||||
|
||||
Units.nearbyEnemies(b.team, rect, u -> {
|
||||
if(u.checkTarget(b.type.collidesAir, b.type.collidesGround) && u.type.hittable){
|
||||
if(u.checkTarget(b.type.collidesAir, b.type.collidesGround) && u.hittable()){
|
||||
distances.add(u.dst(b));
|
||||
}
|
||||
});
|
||||
@@ -269,7 +269,7 @@ public class Damage{
|
||||
float x2 = vec.x + x, y2 = vec.y + y;
|
||||
|
||||
Cons<Unit> cons = e -> {
|
||||
if(!e.type.hittable) return;
|
||||
if(!e.hittable()) return;
|
||||
//the peirce cap works for units, but really terribly, I'm just disabling it for now.
|
||||
//if(pierceCap > 0 && pierceCount > pierceCap) return;
|
||||
|
||||
@@ -369,7 +369,7 @@ public class Damage{
|
||||
/** Damages all entities and blocks in a radius that are enemies of the team. */
|
||||
public static void damageUnits(Team team, float x, float y, float size, float damage, Boolf<Unit> predicate, Cons<Unit> acceptor){
|
||||
Cons<Unit> cons = entity -> {
|
||||
if(!predicate.get(entity) || !entity.type.hittable) return;
|
||||
if(!predicate.get(entity) || !entity.hittable()) return;
|
||||
|
||||
entity.hitbox(hitrect);
|
||||
if(!hitrect.overlaps(rect)){
|
||||
@@ -433,7 +433,7 @@ 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, boolean scaled, Bullet source){
|
||||
Cons<Unit> cons = entity -> {
|
||||
if(entity.team == team || !entity.type.hittable || !entity.within(x, y, radius + (scaled ? entity.hitSize / 2f : 0f)) || (entity.isFlying() && !air) || (entity.isGrounded() && !ground)){
|
||||
if(entity.team == team || !entity.hittable() || !entity.within(x, y, radius + (scaled ? entity.hitSize / 2f : 0f)) || (entity.isFlying() && !air) || (entity.isGrounded() && !ground)){
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ public class Units{
|
||||
(range != Float.MAX_VALUE && !target.within(x, y, range + (target instanceof Sized hb ? hb.hitSize()/2f : 0f))) ||
|
||||
(target instanceof Teamc t && t.team() == team) ||
|
||||
(target instanceof Healthc h && !h.isValid()) ||
|
||||
(target instanceof Unit u && !u.type.targetable);
|
||||
(target instanceof Unit u && !u.targetable());
|
||||
}
|
||||
|
||||
/** See {@link #invalidateTarget(Posc, Team, float, float, float)} */
|
||||
@@ -274,7 +274,7 @@ public class Units{
|
||||
cpriority = -99999f;
|
||||
|
||||
nearbyEnemies(team, x - range, y - range, range*2f, range*2f, e -> {
|
||||
if(e.dead() || !predicate.get(e) || e.team == Team.derelict || !e.type.targetable) return;
|
||||
if(e.dead() || !predicate.get(e) || e.team == Team.derelict || !e.targetable()) return;
|
||||
|
||||
float dst2 = e.dst2(x, y) - (e.hitSize * e.hitSize);
|
||||
if(dst2 < range*range && (result == null || dst2 < cdist || e.type.targetPriority > cpriority) && e.type.targetPriority >= cpriority){
|
||||
@@ -296,7 +296,7 @@ public class Units{
|
||||
cpriority = -99999f;
|
||||
|
||||
nearbyEnemies(team, x - range, y - range, range*2f, range*2f, e -> {
|
||||
if(e.dead() || !predicate.get(e) || e.team == Team.derelict || !e.within(x, y, range + e.hitSize/2f) || !e.type.targetable) return;
|
||||
if(e.dead() || !predicate.get(e) || e.team == Team.derelict || !e.within(x, y, range + e.hitSize/2f) || !e.targetable()) return;
|
||||
|
||||
float cost = sort.cost(e, x, y);
|
||||
if((result == null || cost < cdist || e.type.targetPriority > cpriority) && e.type.targetPriority >= cpriority){
|
||||
|
||||
@@ -27,10 +27,6 @@ abstract class PayloadComp implements Posc, Rotc, Hitboxc, Unitc{
|
||||
|
||||
Seq<Payload> payloads = new Seq<>();
|
||||
|
||||
//uncomment for insanity
|
||||
|
||||
|
||||
|
||||
private transient @Nullable PowerGraph payloadPower;
|
||||
|
||||
@Override
|
||||
@@ -65,12 +61,24 @@ abstract class PayloadComp implements Posc, Rotc, Hitboxc, Unitc{
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Replace
|
||||
public boolean targetable(){
|
||||
return type.targetable || (type.vulnerableWithPayloads && hasPayload());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Replace
|
||||
public boolean hittable(){
|
||||
return type.hittable || (type.vulnerableWithPayloads && hasPayload());
|
||||
}
|
||||
|
||||
float payloadUsed(){
|
||||
return payloads.sumf(p -> p.size() * p.size());
|
||||
}
|
||||
|
||||
boolean canPickup(Unit unit){
|
||||
return payloadUsed() + unit.hitSize * unit.hitSize <= type.payloadCapacity + 0.001f && unit.team == team() && unit.isAI();
|
||||
return unit.type.pickupUnits && payloadUsed() + unit.hitSize * unit.hitSize <= type.payloadCapacity + 0.001f && unit.team == team() && unit.isAI();
|
||||
}
|
||||
|
||||
boolean canPickup(Building build){
|
||||
|
||||
@@ -260,7 +260,7 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
|
||||
@Override
|
||||
@Replace
|
||||
public boolean collides(Hitboxc other){
|
||||
return type.hittable;
|
||||
return hittable();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -355,6 +355,14 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
|
||||
}
|
||||
}
|
||||
|
||||
public boolean targetable(){
|
||||
return type.targetable;
|
||||
}
|
||||
|
||||
public boolean hittable(){
|
||||
return type.hittable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterSync(){
|
||||
//set up type info after reading
|
||||
|
||||
Reference in New Issue
Block a user