From 8445c8e9741d9345686078b7324d3347ef925e87 Mon Sep 17 00:00:00 2001 From: Anuken Date: Tue, 3 Dec 2019 00:21:11 -0500 Subject: [PATCH] speed --- core/src/io/anuke/mindustry/content/Fx.java | 1 - .../src/io/anuke/mindustry/content/Mechs.java | 26 +++++++++++++++++++ .../mindustry/entities/type/TileEntity.java | 5 ++++ .../blocks/defense/OverdriveProjector.java | 5 +--- 4 files changed, 32 insertions(+), 5 deletions(-) diff --git a/core/src/io/anuke/mindustry/content/Fx.java b/core/src/io/anuke/mindustry/content/Fx.java index 27722ca9cc..a40d6f7bb2 100644 --- a/core/src/io/anuke/mindustry/content/Fx.java +++ b/core/src/io/anuke/mindustry/content/Fx.java @@ -176,7 +176,6 @@ public class Fx implements ContentList{ Draw.color(); }); - hitBulletSmall = new Effect(14, e -> { Draw.color(Color.white, Pal.lightOrange, e.fin()); diff --git a/core/src/io/anuke/mindustry/content/Mechs.java b/core/src/io/anuke/mindustry/content/Mechs.java index 049ffd0b72..3cc6887252 100644 --- a/core/src/io/anuke/mindustry/content/Mechs.java +++ b/core/src/io/anuke/mindustry/content/Mechs.java @@ -278,6 +278,10 @@ public class Mechs implements ContentList{ }; dart = new Mech("dart-ship", true){ + float effectRange = 60f; + float effectReload = 60f * 5; + float effectDuration = 60f * 10f; + { drillPower = 1; mineSpeed = 2f; @@ -297,6 +301,28 @@ public class Mechs implements ContentList{ bullet = Bullets.standardCopper; }}; } + + @Override + public void updateAlt(Player player){ + super.updateAlt(player); + + if(player.timer.get(Player.timerAbility, effectReload)){ + //wasHealed = false; + + Units.nearby(player.getTeam(), player.x, player.y, effectRange, unit -> { + unit.applyEffect(StatusEffects.overdrive, effectDuration); + }); + + indexer.eachBlock(player, effectRange, other -> other.entity.damaged(), other -> { + other.entity.applyBoost(1.5f, effectDuration); + Effects.effect(Fx.healBlockFull, Pal.heal, other.drawx(), other.drawy(), other.block().size); + }); + + //if(wasHealed){ + Effects.effect(Fx.overdriveWave, player); + //} + } + } }; javelin = new Mech("javelin-ship", true){ diff --git a/core/src/io/anuke/mindustry/entities/type/TileEntity.java b/core/src/io/anuke/mindustry/entities/type/TileEntity.java index 2c54495715..c518f01081 100644 --- a/core/src/io/anuke/mindustry/entities/type/TileEntity.java +++ b/core/src/io/anuke/mindustry/entities/type/TileEntity.java @@ -82,6 +82,11 @@ public class TileEntity extends BaseEntity implements TargetTrait, HealthTrait, return this; } + public void applyBoost(float intensity, float duration){ + timeScaleDuration = Math.max(timeScaleDuration, duration); + timeScale = Math.max(timeScale, intensity); + } + /** Scaled delta. */ public float delta(){ return Time.delta() * timeScale; diff --git a/core/src/io/anuke/mindustry/world/blocks/defense/OverdriveProjector.java b/core/src/io/anuke/mindustry/world/blocks/defense/OverdriveProjector.java index 04a52fd576..ebac090c96 100644 --- a/core/src/io/anuke/mindustry/world/blocks/defense/OverdriveProjector.java +++ b/core/src/io/anuke/mindustry/world/blocks/defense/OverdriveProjector.java @@ -89,10 +89,7 @@ public class OverdriveProjector extends Block{ float realBoost = (speedBoost + entity.phaseHeat * speedBoostPhase) * entity.efficiency(); entity.charge = 0f; - indexer.eachBlock(entity, realRange, other -> other.entity.timeScale <= realBoost, other -> { - other.entity.timeScaleDuration = Math.max(other.entity.timeScaleDuration, reload + 1f); - other.entity.timeScale = Math.max(other.entity.timeScale, realBoost); - }); + indexer.eachBlock(entity, realRange, other -> other.entity.timeScale <= realBoost, other -> other.entity.applyBoost(realBoost, reload + 1f)); } }