Merge remote-tracking branch 'upstream/master' into ground-support-heal

This commit is contained in:
Leonwang4234
2020-10-16 08:49:55 -07:00
76 changed files with 968 additions and 476 deletions
@@ -94,7 +94,7 @@ public class ForceFieldAbility extends Ability{
}
}
private void checkRadius(Unit unit){
public void checkRadius(Unit unit){
//timer2 is used to store radius scale as an effect
realRad = radiusScale * radius;
}
@@ -139,6 +139,15 @@ public abstract class BulletType extends Content{
this(1f, 1f);
}
/** @return estimated damage per shot. this can be very inaccurate. */
public float estimateDPS(){
float sum = damage + splashDamage*0.75f;
if(fragBullet != null && fragBullet != this){
sum += fragBullet.estimateDPS() * fragBullets / 2f;
}
return sum;
}
/** Returns maximum distance the bullet this bullet type has can travel. */
public float range(){
return Math.max(speed * lifetime * (1f - drag), range);
@@ -44,6 +44,12 @@ public class ContinuousLaserBulletType extends BulletType{
this(0);
}
@Override
public float estimateDPS(){
//assume firing duration is about 100 by default, may not be accurate there's no way of knowing in this method
return damage * 100f / 5f;
}
@Override
public float range(){
return length;
@@ -766,9 +766,9 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
}
public void drawCracks(){
if(!damaged() || block.size > Block.maxCrackSize) return;
if(!damaged() || block.size > BlockRenderer.maxCrackSize) return;
int id = pos();
TextureRegion region = Block.cracks[block.size - 1][Mathf.clamp((int)((1f - healthf()) * Block.crackRegions), 0, Block.crackRegions-1)];
TextureRegion region = renderer.blocks.cracks[block.size - 1][Mathf.clamp((int)((1f - healthf()) * BlockRenderer.crackRegions), 0, BlockRenderer.crackRegions-1)];
Draw.colorl(0.2f, 0.1f + (1f - healthf())* 0.6f);
Draw.rect(region, x, y, (id%4)*90);
Draw.color();
@@ -88,6 +88,8 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
case rotation -> rotation;
case health -> health;
case maxHealth -> maxHealth;
case ammo -> state.rules.unitAmmo ? type.ammoCapacity : ammo;
case ammoCapacity -> type.ammoCapacity;
case x -> x;
case y -> y;
case team -> team.id;
@@ -284,7 +286,7 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
drag = type.drag * (isGrounded() ? (floorOn().dragMultiplier) : 1f);
//apply knockback based on spawns
if(team != state.rules.waveTeam){
if(team != state.rules.waveTeam && state.rules.waves){
float relativeSize = state.rules.dropZoneRadius + hitSize/2f + 1f;
for(Tile spawn : spawner.getSpawns()){
if(within(spawn.worldx(), spawn.worldy(), relativeSize)){
@@ -166,7 +166,7 @@ abstract class WeaponsComp implements Teamc, Posc, Rotc, Velc, Statusc{
Weapon weapon = mount.weapon;
float baseX = this.x, baseY = this.y;
boolean delay = weapon.firstShotDelay > 0f;
boolean delay = weapon.firstShotDelay + weapon.shotDelay > 0f;
(delay ? weapon.chargeSound : weapon.shootSound).at(x, y, Mathf.random(0.8f, 1.0f));