mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-20 20:57:59 +07:00
Test cleanup / Artillery fixes
This commit is contained in:
@ -106,6 +106,7 @@ public class ArtilleryBullets extends BulletList implements ContentList{
|
|||||||
lifetime = 90f;
|
lifetime = 90f;
|
||||||
bulletWidth = bulletHeight = 14f;
|
bulletWidth = bulletHeight = 14f;
|
||||||
collides = true;
|
collides = true;
|
||||||
|
collidesTiles = true;
|
||||||
splashDamageRadius = 45f;
|
splashDamageRadius = 45f;
|
||||||
splashDamage = 50f;
|
splashDamage = 50f;
|
||||||
backColor = Palette.bulletYellowBack;
|
backColor = Palette.bulletYellowBack;
|
||||||
|
@ -27,7 +27,6 @@ public class BasicBulletType extends BulletType{
|
|||||||
|
|
||||||
/**Use a negative value to disable splash damage.*/
|
/**Use a negative value to disable splash damage.*/
|
||||||
public float splashDamageRadius = -1f;
|
public float splashDamageRadius = -1f;
|
||||||
public float splashDamage = 6f;
|
|
||||||
|
|
||||||
public int incendAmount = 0;
|
public int incendAmount = 0;
|
||||||
public float incendSpread = 8f;
|
public float incendSpread = 8f;
|
||||||
|
@ -171,6 +171,11 @@ public class Bullet extends BulletEntity<BulletType> implements TeamTrait, SyncT
|
|||||||
type.draw(this);
|
type.draw(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getShieldDamage(){
|
||||||
|
return Math.max(getDamage(), type.splashDamage);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean collides(SolidTrait other){
|
public boolean collides(SolidTrait other){
|
||||||
return type.collides && super.collides(other) && !supressCollision && !(other instanceof Unit && ((Unit) other).isFlying() && !type.collidesAir);
|
return type.collides && super.collides(other) && !supressCollision && !(other instanceof Unit && ((Unit) other).isFlying() && !type.collidesAir);
|
||||||
|
@ -21,6 +21,7 @@ public abstract class BulletType extends Content implements BaseBulletType<Bulle
|
|||||||
public boolean pierce;
|
public boolean pierce;
|
||||||
public Effect hiteffect, despawneffect;
|
public Effect hiteffect, despawneffect;
|
||||||
|
|
||||||
|
public float splashDamage = 0f;
|
||||||
/**Knockback in velocity.*/
|
/**Knockback in velocity.*/
|
||||||
public float knockback;
|
public float knockback;
|
||||||
/**Whether this bullet hits tiles.*/
|
/**Whether this bullet hits tiles.*/
|
||||||
|
@ -9,4 +9,8 @@ public interface AbsorbTrait extends Entity, TeamTrait, DamageTrait{
|
|||||||
default boolean canBeAbsorbed(){
|
default boolean canBeAbsorbed(){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default float getShieldDamage(){
|
||||||
|
return getDamage();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -132,10 +132,10 @@ public class ForceProjector extends Block {
|
|||||||
if(trait.canBeAbsorbed() && trait.getTeam() != tile.getTeam() && isInsideHexagon(trait.getX(), trait.getY(), realRadius * 2f, tile.drawx(), tile.drawy())){
|
if(trait.canBeAbsorbed() && trait.getTeam() != tile.getTeam() && isInsideHexagon(trait.getX(), trait.getY(), realRadius * 2f, tile.drawx(), tile.drawy())){
|
||||||
trait.absorb();
|
trait.absorb();
|
||||||
Effects.effect(BulletFx.absorb, trait);
|
Effects.effect(BulletFx.absorb, trait);
|
||||||
float hit = trait.getDamage()*powerDamage;
|
float hit = trait.getShieldDamage()*powerDamage;
|
||||||
entity.hit = 1f;
|
entity.hit = 1f;
|
||||||
entity.power.amount -= Math.min(hit, entity.power.amount);
|
entity.power.amount -= Math.min(hit, entity.power.amount);
|
||||||
entity.buildup += trait.getDamage() * entity.warmup;
|
entity.buildup += trait.getShieldDamage() * entity.warmup;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -98,8 +98,8 @@ public class ApplicationTests{
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void initialization(){
|
void initialization(){
|
||||||
assertTrue(logic != null);
|
assertNotNull(logic);
|
||||||
assertTrue(world != null);
|
assertNotNull(world);
|
||||||
assertTrue(content.getContentMap().length > 0);
|
assertTrue(content.getContentMap().length > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,11 +145,11 @@ public class ApplicationTests{
|
|||||||
int bx = 4;
|
int bx = 4;
|
||||||
int by = 4;
|
int by = 4;
|
||||||
world.setBlock(world.tile(bx, by), StorageBlocks.core, Team.blue);
|
world.setBlock(world.tile(bx, by), StorageBlocks.core, Team.blue);
|
||||||
assertTrue(world.tile(bx, by).getTeam() == Team.blue);
|
assertEquals(world.tile(bx, by).getTeam(), Team.blue);
|
||||||
for(int x = bx-1; x <= bx + 1; x++){
|
for(int x = bx-1; x <= bx + 1; x++){
|
||||||
for(int y = by-1; y <= by + 1; y++){
|
for(int y = by-1; y <= by + 1; y++){
|
||||||
if(x == bx && by == y){
|
if(x == bx && by == y){
|
||||||
assertTrue(world.tile(x, y).block() == StorageBlocks.core);
|
assertEquals(world.tile(x, y).block(), StorageBlocks.core);
|
||||||
}else{
|
}else{
|
||||||
assertTrue(world.tile(x, y).block() == Blocks.blockpart && world.tile(x, y).getLinked() == world.tile(bx, by));
|
assertTrue(world.tile(x, y).block() == Blocks.blockpart && world.tile(x, y).getLinked() == world.tile(bx, by));
|
||||||
}
|
}
|
||||||
@ -163,10 +163,10 @@ public class ApplicationTests{
|
|||||||
Tile tile = world.tile(4, 4);
|
Tile tile = world.tile(4, 4);
|
||||||
tile.entity.items.add(Items.coal, 5);
|
tile.entity.items.add(Items.coal, 5);
|
||||||
tile.entity.items.add(Items.titanium, 50);
|
tile.entity.items.add(Items.titanium, 50);
|
||||||
assertTrue(tile.entity.items.total() == 55);
|
assertEquals(tile.entity.items.total(), 55);
|
||||||
tile.entity.items.remove(Items.phasematter, 10);
|
tile.entity.items.remove(Items.phasematter, 10);
|
||||||
tile.entity.items.remove(Items.titanium, 10);
|
tile.entity.items.remove(Items.titanium, 10);
|
||||||
assertTrue(tile.entity.items.total() == 45);
|
assertEquals(tile.entity.items.total(), 45);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -199,20 +199,20 @@ public class ApplicationTests{
|
|||||||
resetWorld();
|
resetWorld();
|
||||||
SaveIO.loadFromSlot(0);
|
SaveIO.loadFromSlot(0);
|
||||||
|
|
||||||
assertTrue(world.getMap() == map);
|
assertEquals(world.getMap(), map);
|
||||||
assertTrue(world.width() == map.meta.width);
|
assertEquals(world.width(), map.meta.width);
|
||||||
assertTrue(world.height() == map.meta.height);
|
assertEquals(world.height(), map.meta.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void edgeTest(){
|
void edgeTest(){
|
||||||
GridPoint2[] edges = Edges.getEdges(1);
|
GridPoint2[] edges = Edges.getEdges(1);
|
||||||
assertTrue(edges[0].equals(new GridPoint2(1, 0)));
|
assertEquals(edges[0], new GridPoint2(1, 0));
|
||||||
assertTrue(edges[1].equals(new GridPoint2(0, 1)));
|
assertEquals(edges[1], new GridPoint2(0, 1));
|
||||||
assertTrue(edges[2].equals(new GridPoint2(-1, 0)));
|
assertEquals(edges[2], new GridPoint2(-1, 0));
|
||||||
assertTrue(edges[3].equals(new GridPoint2(0, -1)));
|
assertEquals(edges[3], new GridPoint2(0, -1));
|
||||||
|
|
||||||
GridPoint2[] edges2 = Edges.getEdges(2);
|
GridPoint2[] edges2 = Edges.getEdges(2);
|
||||||
assertTrue(edges2.length == 8);
|
assertEquals(8, edges2.length);
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user