Skip to content

Commit

Permalink
Update BlastTower.java
Browse files Browse the repository at this point in the history
  • Loading branch information
uujuju1 authored Feb 3, 2025
1 parent 1ab6ad9 commit 2346a87
Showing 1 changed file with 1 addition and 71 deletions.
72 changes: 1 addition & 71 deletions src/omaloon/world/blocks/defense/BlastTower.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,67 +103,6 @@ public float efficiencyMultiplier() {
return val;
}

@Override
public void updateTile() {
updatePressure();
dumpPressure();
super.updateTile();

targets.clear();
Units.nearbyEnemies(team, x, y, range, u -> {
if(u.checkTarget(targetAir, targetGround)) {
targets.add(u);
}
});

indexer.allBuildings(x, y, range, b -> {
if(b.team != team){
targets.add(b);
}
});

float effMultiplier = efficiencyMultiplier();

if (targets.size > 0 && canConsume()) {
smoothProgress = Mathf.approach(smoothProgress, 1f, Time.delta / chargeTime * effMultiplier);

if (efficiency > 0 && (charge += Time.delta * effMultiplier) >= reload && smoothProgress >= 0.99f) {
shoot();
charge = 0f;
}
} else {
smoothProgress = Mathf.approach(smoothProgress, 0f, Time.delta / chargeTime * effMultiplier);
}
}

public void shoot() {
if (!canConsume()) return;

consume();
lastShootTime = Time.time;
Effect.shake(shake, shake, this);
shootSound.at(this);
waveEffect.layer(Layer.blockUnder).at(x, y, range, waveColor);
tile.getLinkedTiles(t -> OlFx.hammerHit.layer(Layer.blockUnder).at(
t.worldx(), t.worldy(),
angleTo(t.worldx(), t.worldy()) + Mathf.range(360f),
Tmp.c1.set(t.floor().mapColor).mul(1.5f + Mathf.range(0.15f)))
);

float damageMultiplier = efficiencyMultiplier();
for (Teamc target : targets) {
hitEffect.at(target.x(), target.y(), hitColor);
if(target instanceof Healthc){
((Healthc)target).damage(damage * damageMultiplier);
}
if(target instanceof Statusc){
((Statusc)target).apply(status, statusDuration);
}
}

smoothProgress = 0f;
}

@Override
public void draw() {
Draw.rect(region, x, y);
Expand All @@ -181,15 +120,6 @@ public void drawSelect(){
Drawf.dashCircle(x, y, range, Pal.accent);
}

public float efficiencyMultiplier() {
float val = 1f;
if (!useConsumerMultiplier) return val;
for (Consume consumer : consumers) {
val *= consumer.efficiencyMultiplier(this);
}
return val;
}

@Override
public void onProximityUpdate() {
super.onProximityUpdate();
Expand Down Expand Up @@ -285,4 +215,4 @@ public void write(Writes write) {
pressure.write(write);
}
}
}
}

0 comments on commit 2346a87

Please sign in to comment.