Misc bugfixes, AI hit retaliation

This commit is contained in:
Anuken 2022-05-06 23:33:22 -04:00
parent f6e68e91d0
commit 6740b60af2
4 changed files with 19 additions and 7 deletions

View File

@ -122,6 +122,13 @@ public class CommandAI extends AIController{
}
}
@Override
public void hit(Bullet bullet){
if(unit.team.isAI() && bullet.owner instanceof Teamc teamc && teamc.team() != unit.team && attackTarget == null){
commandTarget(teamc, true);
}
}
public static float cohesionScl = 0.3f;
public static float cohesionRad = 3f, separationRad = 1.1f, separationScl = 1f, flockMult = 0.5f;

View File

@ -39,7 +39,7 @@ public class UnitTypes{
//legs
public static @EntityDef({Unitc.class, Legsc.class}) UnitType corvus, atrax,
merui, cleroi, anthicus,
tecta, collaris; //TODO horrid name here
tecta, collaris;
//legs, legacy
public static @EntityDef(value = {Unitc.class, Legsc.class}, legacy = true) UnitType spiroct, arkyid, toxopid;
@ -2523,7 +2523,6 @@ public class UnitTypes{
spread = 3.5f;
}};
//TODO make this look nicer
bullet = new RailBulletType(){{
length = 160f;
damage = 48f;
@ -2699,7 +2698,6 @@ public class UnitTypes{
fragBullets = 5;
fragVelocityMin = 1f;
//TODO
fragBullet = new BasicBulletType(8f, 25){{
sprite = "missile-large";
width = 8f;
@ -3324,7 +3322,6 @@ public class UnitTypes{
weaveMag = 4;
weaveScale = 4;
lifetime = 55f;
//TODO better
shootEffect = Fx.shootBig2;
smokeEffect = Fx.shootSmokeTitan;
splashDamage = 60f;
@ -3454,7 +3451,6 @@ public class UnitTypes{
despawnEffect = Fx.none;
//TODO diff effect
hitEffect = despawnEffect = new ExplosionEffect(){{
lifetime = 30f;
waveStroke = 2f;
@ -3571,7 +3567,6 @@ public class UnitTypes{
mirror = false;
shoot = new ShootHelix();
//TODO cooler + balancing
bullet = new BasicBulletType(5f, 34){{
width = 7f;
height = 12f;
@ -3946,7 +3941,6 @@ public class UnitTypes{
float coreFleeRange = 500f;
//TODO bad name
evoke = new ErekirUnitType("evoke"){{
coreUnitDock = true;
controller = u -> new BuilderAI(true, coreFleeRange);

View File

@ -263,6 +263,13 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
return hittable();
}
@Override
public void collision(Hitboxc other, float x, float y){
if(other instanceof Bullet bullet){
controller.hit(bullet);
}
}
@Override
public int itemCapacity(){
return type.itemCapacity;

View File

@ -6,6 +6,10 @@ public interface UnitController{
void unit(Unit unit);
Unit unit();
default void hit(Bullet bullet){
}
default boolean isValidController(){
return true;
}