diff --git a/core/assets/version.properties b/core/assets/version.properties index 3efec62cc8..cf29fb38cf 100644 --- a/core/assets/version.properties +++ b/core/assets/version.properties @@ -1,5 +1,5 @@ #Autogenerated file. Do not modify. -#Sun Apr 15 16:57:12 EDT 2018 +#Sun Apr 15 19:58:39 EDT 2018 version=release androidBuildCode=927 name=Mindustry diff --git a/core/src/io/anuke/mindustry/content/blocks/LiquidBlocks.java b/core/src/io/anuke/mindustry/content/blocks/LiquidBlocks.java index 553b5efd10..9d5a286a3d 100644 --- a/core/src/io/anuke/mindustry/content/blocks/LiquidBlocks.java +++ b/core/src/io/anuke/mindustry/content/blocks/LiquidBlocks.java @@ -32,6 +32,7 @@ public class LiquidBlocks { liquidtank = new LiquidRouter("liquidtank") {{ size = 3; liquidCapacity = 1500f; + health = 500; }}, liquidjunction = new LiquidJunction("liquidjunction"), diff --git a/core/src/io/anuke/mindustry/content/fx/EnvironmentFx.java b/core/src/io/anuke/mindustry/content/fx/EnvironmentFx.java index e647d95d9b..383eaa534b 100644 --- a/core/src/io/anuke/mindustry/content/fx/EnvironmentFx.java +++ b/core/src/io/anuke/mindustry/content/fx/EnvironmentFx.java @@ -43,6 +43,26 @@ public class EnvironmentFx { Draw.color(); }), + fireballsmoke = new Effect(25f, e -> { + Draw.color(Color.GRAY); + + Angles.randLenVectors(e.id, 1, 2f + e.fin()*7f, (x, y) -> { + Fill.circle(e.x + x, e.y + y, 0.2f + e.fout() * 1.5f); + }); + + Draw.color(); + }), + + ballfire = new Effect(25f, e -> { + Draw.color(Palette.lightFlame, Palette.darkFlame, e.fin()); + + Angles.randLenVectors(e.id, 2, 2f + e.fin()*7f, (x, y) -> { + Fill.circle(e.x + x, e.y + y, 0.2f + e.fout() * 1.5f); + }); + + Draw.color(); + }), + freezing = new Effect(40f, e -> { Draw.color(Liquids.cryofluid.color); diff --git a/core/src/io/anuke/mindustry/content/fx/ExplosionFx.java b/core/src/io/anuke/mindustry/content/fx/ExplosionFx.java index 897ee98c3e..fa783b7536 100644 --- a/core/src/io/anuke/mindustry/content/fx/ExplosionFx.java +++ b/core/src/io/anuke/mindustry/content/fx/ExplosionFx.java @@ -19,6 +19,13 @@ public class ExplosionFx { Draw.reset(); }), + bigShockwave = new Effect(10f, 80f, e -> { + Draw.color(Color.WHITE, Color.LIGHT_GRAY, e.fin()); + Lines.stroke(e.fout()*3f); + Lines.circle(e.x, e.y, e.fin()*50f); + Draw.reset(); + }), + nuclearShockwave = new Effect(10f, 200f, e -> { Draw.color(Color.WHITE, Color.LIGHT_GRAY, e.fin()); Lines.stroke(e.fout()*3f + 0.2f); @@ -51,8 +58,8 @@ public class ExplosionFx { blockExplosion = new Effect(30, e -> { e.scaled(7, i -> { - Lines.stroke(3f * i.fout()); - Lines.circle(e.x, e.y, 3f + i.fin()*10f); + Lines.stroke(3.1f * i.fout()); + Lines.circle(e.x, e.y, 3f + i.fin()*14f); }); Draw.color(Color.GRAY); @@ -63,12 +70,23 @@ public class ExplosionFx { }); Draw.color(Palette.lighterOrange, Palette.lightOrange, Color.GRAY, e.fin()); - Lines.stroke(1.5f * e.fout()); + Lines.stroke(1.7f * e.fout()); - Angles.randLenVectors(e.id + 1, 8, 1f + 23f * e.finpow(), (x, y) -> { + Angles.randLenVectors(e.id + 1, 9, 1f + 23f * e.finpow(), (x, y) -> { Lines.lineAngle(e.x + x, e.y + y, Mathf.atan2(x, y), 1f + e.fout()*3f); }); + Draw.reset(); + }), + + blockExplosionSmoke = new Effect(30, e -> { + Draw.color(Color.GRAY); + + Angles.randLenVectors(e.id, 6, 4f + 30f * e.finpow(), (x, y) ->{ + Fill.circle(e.x + x, e.y + y, e.fout()*3f); + Fill.circle(e.x + x/2f, e.y + y/2f, e.fout()*1f); + }); + Draw.reset(); }); } diff --git a/core/src/io/anuke/mindustry/entities/Unit.java b/core/src/io/anuke/mindustry/entities/Unit.java index fee6d1ac44..af6506c5a2 100644 --- a/core/src/io/anuke/mindustry/entities/Unit.java +++ b/core/src/io/anuke/mindustry/entities/Unit.java @@ -98,6 +98,10 @@ public abstract class Unit extends SyncEntity { velocity.scl(Mathf.clamp(1f-drag* floor.dragMultiplier* Timers.delta())); } + public void applyEffect(StatusEffect effect, float intensity){ + status.handleApply(this, effect, intensity); + } + public void damagePeriodic(float amount){ damage(amount * Timers.delta(), Timers.get(this, "damageeffect", 20)); } diff --git a/core/src/io/anuke/mindustry/entities/effect/DamageArea.java b/core/src/io/anuke/mindustry/entities/effect/DamageArea.java index e8eebf6c68..7162047822 100644 --- a/core/src/io/anuke/mindustry/entities/effect/DamageArea.java +++ b/core/src/io/anuke/mindustry/entities/effect/DamageArea.java @@ -14,9 +14,7 @@ import io.anuke.ucore.util.Mathf; import io.anuke.ucore.util.Physics; import io.anuke.ucore.util.Translator; -import static io.anuke.mindustry.Vars.state; -import static io.anuke.mindustry.Vars.tilesize; -import static io.anuke.mindustry.Vars.world; +import static io.anuke.mindustry.Vars.*; public class DamageArea{ private static Rectangle rect = new Rectangle(); @@ -65,6 +63,24 @@ public class DamageArea{ Units.getNearbyEnemies(team, rect, cons); } + /**Damages all entities and blocks in a radius that are enemies of the team.*/ + public static void damageUnits(Team team, float x, float y, float size, float damage, Consumer acceptor) { + Consumer cons = entity -> { + if (!entity.hitbox.getRect(entity.x, entity.y).overlaps(rect)) { + return; + } + entity.damage(damage); + acceptor.accept(entity); + }; + + rect.setSize(size * 2).setCenter(x, y); + if (team != null) { + Units.getNearbyEnemies(team, rect, cons); + } else { + Units.getNearby(rect, cons); + } + } + /**Damages everything in a radius.*/ public static void damage(float x, float y, float radius, float damage){ damage(null, x, y, radius, damage); @@ -78,7 +94,8 @@ public class DamageArea{ } float amount = calculateDamage(x, y, entity.x, entity.y, radius, damage); entity.damage(amount); - entity.velocity.add(tr.set(entity.x - x, entity.y - y).setLength(Mathf.clamp(damage/2f, 0, 6))); + //TODO better velocity displacement + entity.velocity.add(tr.set(entity.x - x, entity.y - y).setLength(damage*2f)); }; rect.setSize(radius *2).setCenter(x, y); diff --git a/core/src/io/anuke/mindustry/entities/effect/Fire.java b/core/src/io/anuke/mindustry/entities/effect/Fire.java index a7dd7d6425..8811d231b8 100644 --- a/core/src/io/anuke/mindustry/entities/effect/Fire.java +++ b/core/src/io/anuke/mindustry/entities/effect/Fire.java @@ -1,6 +1,7 @@ package io.anuke.mindustry.entities.effect; import com.badlogic.gdx.math.GridPoint2; +import io.anuke.mindustry.content.StatusEffects; import io.anuke.mindustry.content.fx.EnvironmentFx; import io.anuke.mindustry.entities.TileEntity; import io.anuke.mindustry.world.Tile; @@ -11,6 +12,7 @@ import io.anuke.ucore.util.Geometry; import io.anuke.ucore.util.Mathf; import static io.anuke.mindustry.Vars.effectGroup; +import static io.anuke.mindustry.Vars.tilesize; import static io.anuke.mindustry.Vars.world; public class Fire extends TimedEntity { @@ -43,9 +45,6 @@ public class Fire extends TimedEntity { GridPoint2 p = Mathf.select(Geometry.d4); Tile other = world.tile(tile.x + p.x, tile.y + p.y); new Fire(other).add(); - //if(other != null && other.target().entity != null && !other.entity.hasFire()){ - //other.entity.setFire(); - //} } } @@ -55,6 +54,7 @@ public class Fire extends TimedEntity { if(damage){ entity.damage(0.4f); } + DamageArea.damageUnits(null, tile.worldx(), tile.worldy(), tilesize, 3f, unit -> unit.applyEffect(StatusEffects.burning, 0.8f)); } if(Mathf.chance(0.05 * Timers.delta())){ diff --git a/core/src/io/anuke/mindustry/entities/effect/Fireball.java b/core/src/io/anuke/mindustry/entities/effect/Fireball.java index 2d89fad3ed..ff0e0dde48 100644 --- a/core/src/io/anuke/mindustry/entities/effect/Fireball.java +++ b/core/src/io/anuke/mindustry/entities/effect/Fireball.java @@ -1,8 +1,10 @@ package io.anuke.mindustry.entities.effect; import com.badlogic.gdx.graphics.Color; +import io.anuke.mindustry.content.fx.EnvironmentFx; import io.anuke.mindustry.graphics.Palette; import io.anuke.mindustry.world.Tile; +import io.anuke.ucore.core.Effects; import io.anuke.ucore.core.Timers; import io.anuke.ucore.entities.TimedEntity; import io.anuke.ucore.graphics.Draw; @@ -22,8 +24,8 @@ public class Fireball extends TimedEntity { set(x, y); this.rotation = rotation; this.color = color; - lifetime = 40f + Mathf.random(40f); - speed = 0.3f + Mathf.random(2f); + lifetime = 30f + Mathf.random(40f); + speed = 0.6f + Mathf.random(2f); } @Override @@ -40,6 +42,14 @@ public class Fireball extends TimedEntity { new Fire(tile).add(); } } + + if(Mathf.chance(0.1 * Timers.delta())){ + Effects.effect(EnvironmentFx.fireballsmoke, x, y); + } + + if(Mathf.chance(0.1 * Timers.delta())){ + Effects.effect(EnvironmentFx.ballfire, x, y); + } } @Override diff --git a/core/src/io/anuke/mindustry/world/Block.java b/core/src/io/anuke/mindustry/world/Block.java index ba25a7bf38..e775e54704 100644 --- a/core/src/io/anuke/mindustry/world/Block.java +++ b/core/src/io/anuke/mindustry/world/Block.java @@ -264,15 +264,28 @@ public class Block extends BaseBlock { }); } + float e = explosiveness; + int waves = Mathf.clamp((int)(explosiveness / 4), 0, 30); + + for(int i = 0; i < waves; i ++){ + int f = i; + Timers.run(i*2f, () -> { + DamageArea.damage(x, y, Mathf.clamp(size * tilesize + e, 0, 50f) * ((f + 1f)/waves), e/2f); + Effects.effect(ExplosionFx.blockExplosionSmoke, x + Mathf.range(size * tilesize/2f), y + Mathf.range(size * tilesize/2f)); + }); + } + if(explosiveness > 15f){ Effects.effect(ExplosionFx.shockwave, x, y); } + if(explosiveness > 30f){ + Effects.effect(ExplosionFx.bigShockwave, x, y); + } + float shake = Math.min(explosiveness/4f + 3f, 9f); Effects.shake(shake, shake, x, y); Effects.effect(ExplosionFx.blockExplosion, x, y); - - DamageArea.damage(x, y, Mathf.clamp(size * tilesize + explosiveness, 0, 60f), 5 + explosiveness); } public float getFlammability(Tile tile){