AI bugfixes / Balance

This commit is contained in:
Anuken
2020-07-29 21:09:58 -04:00
parent 1e7aaac3d4
commit 9bf3074aee
7 changed files with 42 additions and 49 deletions

View File

@@ -33,7 +33,12 @@ public class FlyingAI extends AIController{
boolean shoot = false; boolean shoot = false;
if(target != null && unit.hasWeapons()){ if(target != null && unit.hasWeapons()){
attack(80f); if(unit.type().weapons.first().rotate){
moveTo(unit.range() * 0.85f);
unit.lookAt(target);
}else{
attack(80f);
}
shoot = unit.inRange(target); shoot = unit.inRange(target);

View File

@@ -37,10 +37,7 @@ public class Bullets implements ContentList{
waterShot, cryoShot, slagShot, oilShot, waterShot, cryoShot, slagShot, oilShot,
//environment, misc. //environment, misc.
damageLightning, damageLightningGround, fireball, basicFlame, pyraFlame, driverBolt, healBullet, healBulletBig, frag, damageLightning, damageLightningGround, fireball, basicFlame, pyraFlame, driverBolt, healBullet, healBulletBig, frag;
//bombs
bombExplosive, bombIncendiary, bombOil;
@Override @Override
public void load(){ public void load(){
@@ -495,47 +492,5 @@ public class Bullets implements ContentList{
lifetime = 50f; lifetime = 50f;
drag = 0.04f; drag = 0.04f;
}}; }};
bombExplosive = new BombBulletType(18f, 25f, "shell"){{
width = 10f;
height = 14f;
hitEffect = Fx.flakExplosion;
shootEffect = Fx.none;
smokeEffect = Fx.none;
status = StatusEffects.blasted;
statusDuration = 60f;
}};
bombIncendiary = new BombBulletType(7f, 10f, "shell"){{
width = 8f;
height = 12f;
hitEffect = Fx.flakExplosion;
backColor = Pal.lightOrange;
frontColor = Pal.lightishOrange;
incendChance = 1f;
incendAmount = 3;
incendSpread = 10f;
}};
bombOil = new BombBulletType(2f, 3f, "shell"){
{
width = 8f;
height = 12f;
hitEffect = Fx.pulverize;
backColor = new Color(0x4f4f4fff);
frontColor = Color.gray;
}
@Override
public void hit(Bullet b, float x, float y){
super.hit(b, x, y);
for(int i = 0; i < 3; i++){
Tile tile = world.tileWorld(x + Mathf.range(8f), y + Mathf.range(8f));
Puddles.deposit(tile, Liquids.oil, 5f);
}
}
};
} }
} }

View File

@@ -460,6 +460,7 @@ public class UnitTypes implements ContentList{
armor = 2f; armor = 2f;
weapons.add(new Weapon(){{ weapons.add(new Weapon(){{
minShootVelocity = 0.75f;
x = 3f; x = 3f;
shootY = 0f; shootY = 0f;
reload = 12f; reload = 12f;
@@ -467,8 +468,17 @@ public class UnitTypes implements ContentList{
ejectEffect = Fx.none; ejectEffect = Fx.none;
inaccuracy = 15f; inaccuracy = 15f;
ignoreRotation = true; ignoreRotation = true;
bullet = Bullets.bombExplosive;
shootSound = Sounds.none; shootSound = Sounds.none;
bullet = new BombBulletType(23f, 25f){{
width = 10f;
height = 14f;
hitEffect = Fx.flakExplosion;
shootEffect = Fx.none;
smokeEffect = Fx.none;
status = StatusEffects.blasted;
statusDuration = 60f;
}};
}}); }});
}}; }};

View File

@@ -18,6 +18,10 @@ public class BombBulletType extends BasicBulletType{
hitSound = Sounds.explosion; hitSound = Sounds.explosion;
} }
public BombBulletType(float damage, float radius){
this(damage, radius, "shell");
}
public BombBulletType(){ public BombBulletType(){
this(1f, 1f, "shell"); this(1f, 1f, "shell");
} }

View File

@@ -13,6 +13,9 @@ import mindustry.game.*;
import mindustry.gen.*; import mindustry.gen.*;
import mindustry.graphics.*; import mindustry.graphics.*;
import mindustry.type.*; import mindustry.type.*;
import mindustry.world.*;
import static mindustry.Vars.*;
public abstract class BulletType extends Content{ public abstract class BulletType extends Content{
public float lifetime = 40f; public float lifetime = 40f;
@@ -98,6 +101,11 @@ public abstract class BulletType extends Content{
public float weaveMag = -1f; public float weaveMag = -1f;
public float hitShake = 0f; public float hitShake = 0f;
public int puddles;
public float puddleRange;
public float puddleAmount = 5f;
public Liquid puddleLiquid = Liquids.water;
public float lightRadius = 16f; public float lightRadius = 16f;
public float lightOpacity = 0.3f; public float lightOpacity = 0.3f;
public Color lightColor = Pal.powerLight; public Color lightColor = Pal.powerLight;
@@ -144,6 +152,13 @@ public abstract class BulletType extends Content{
} }
} }
if(puddleLiquid != null && puddles > 0){
for(int i = 0; i < puddles; i++){
Tile tile = world.tileWorld(x + Mathf.range(puddleRange), y + Mathf.range(puddleRange));
Puddles.deposit(tile, puddleLiquid, puddleAmount);
}
}
if(Mathf.chance(incendChance)){ if(Mathf.chance(incendChance)){
Damage.createIncend(x, y, incendSpread, incendAmount); Damage.createIncend(x, y, incendSpread, incendAmount);
} }

View File

@@ -13,8 +13,9 @@ import mindustry.type.*;
import static mindustry.Vars.*; import static mindustry.Vars.*;
@Component @Component
abstract class WeaponsComp implements Teamc, Posc, Rotc{ abstract class WeaponsComp implements Teamc, Posc, Rotc, Velc{
@Import float x, y, rotation, reloadMultiplier; @Import float x, y, rotation, reloadMultiplier;
@Import Vec2 vel;
/** minimum cursor distance from unit, fixes 'cross-eyed' shooting */ /** minimum cursor distance from unit, fixes 'cross-eyed' shooting */
static final float minAimDst = 18f; static final float minAimDst = 18f;
@@ -111,6 +112,7 @@ abstract class WeaponsComp implements Teamc, Posc, Rotc{
if(mount.shoot && //must be shooting if(mount.shoot && //must be shooting
(ammo > 0 || !state.rules.unitAmmo || team().rules().infiniteAmmo) && //check ammo (ammo > 0 || !state.rules.unitAmmo || team().rules().infiniteAmmo) && //check ammo
(!weapon.alternate || mount.side == weapon.flipSprite) && (!weapon.alternate || mount.side == weapon.flipSprite) &&
vel.len() >= mount.weapon.minShootVelocity && //check velocity requirements
mount.reload <= 0.0001f && //reload has to be 0 mount.reload <= 0.0001f && //reload has to be 0
Angles.within(weapon.rotate ? mount.rotation : this.rotation, mount.targetRotation, mount.weapon.shootCone) //has to be within the cone Angles.within(weapon.rotate ? mount.rotation : this.rotation, mount.targetRotation, mount.weapon.shootCone) //has to be within the cone
){ ){

View File

@@ -53,6 +53,8 @@ public class Weapon{
public float shootCone = 5f; public float shootCone = 5f;
/** whether shooter rotation is ignored when shooting. */ /** whether shooter rotation is ignored when shooting. */
public boolean ignoreRotation = false; public boolean ignoreRotation = false;
/** min velocity required for this weapon to shoot */
public float minShootVelocity = -1f;
/** internal value used for alternation - do not change! */ /** internal value used for alternation - do not change! */
public int otherSide = -1; public int otherSide = -1;
/** sound used for shooting */ /** sound used for shooting */