Fixed #10046
This commit is contained in:
@@ -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. */
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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 + ")";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user