This commit is contained in:
Anuken
2024-07-26 23:29:28 -04:00
parent 3a1a06e57f
commit 0de1bec554
7 changed files with 32 additions and 10 deletions

View File

@@ -309,6 +309,8 @@ public class BulletType extends Content implements Cloneable{
/** Color of light emitted by this bullet. */
public Color lightColor = Pal.powerLight;
protected float cachedDps = -1;
public BulletType(float speed, float damage){
this.speed = speed;
this.damage = damage;
@@ -338,15 +340,20 @@ public class BulletType extends Content implements Cloneable{
/** @return estimated damage per shot. this can be very inaccurate. */
public float estimateDPS(){
if(cachedDps >= 0f) return cachedDps;
if(spawnUnit != null){
return spawnUnit.estimateDps();
}
float sum = damage + splashDamage*0.75f;
float sum = damage * (pierce ? pierceCap == -1 ? 2 : Mathf.clamp(pierceCap, 1, 2) : 1f) * splashDamage*0.75f;
if(fragBullet != null && fragBullet != this){
sum += fragBullet.estimateDPS() * fragBullets / 2f;
}
return sum;
for(var other : spawnBullets){
sum += other.estimateDPS();
}
return cachedDps = sum;
}
/** @return maximum distance the bullet this bullet type has can travel. */

View File

@@ -118,6 +118,7 @@ public class PointLaserBulletType extends BulletType{
}
}
@Override
public void updateBulletInterval(Bullet b){
if(intervalBullet != null && b.time >= intervalDelay && b.timer.get(2, bulletInterval)){
float ang = b.rotation();

View File

@@ -792,6 +792,6 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
@Override
@Replace
public String toString(){
return "Unit#" + id() + ":" + type;
return "Unit#" + id() + ":" + type + " (" + x + ", " + y + ")";
}
}