Skip to content

Commit

Permalink
commet
Browse files Browse the repository at this point in the history
  • Loading branch information
Otamamori917 committed Sep 10, 2024
1 parent 209dca7 commit a4f8e8a
Show file tree
Hide file tree
Showing 11 changed files with 280 additions and 113 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 6 additions & 1 deletion src/axthrix/content/AxthrixStatus.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import mindustry.world.meta.Stat;

public class AxthrixStatus {
public static StatusEffect vindicationI, vindicationII, vindicationIII, nanodiverge, precludedX, precludedA, repent, finalStand,excert,chainExcert,slivered,unrepair,grayRepair,repair,
public static StatusEffect vindicationI, vindicationII, vindicationIII, nanodiverge, precludedX, precludedA, repent, finalStand,excert,chainExcert,slivered,unrepair,grayRepair,repair,gravicalSlow,

//visual statuses
standFx,bFx
Expand Down Expand Up @@ -77,6 +77,11 @@ public static void load(){
healthMultiplier = .998f;
charges = 300;
}};
gravicalSlow = new StackStatusEffect("gravical-slow"){{
color = Color.purple;
speedMultiplier = .98f;
charges = 50;
}};

grayRepair = new StatusEffect("gray-repair"){
@Override
Expand Down
93 changes: 86 additions & 7 deletions src/axthrix/content/units/AxthrixUnits.java
Original file line number Diff line number Diff line change
Expand Up @@ -1363,10 +1363,10 @@ public static void load(){
constructor = MechUnit::create;
factions.add(AxFactions.axthrix);
abilities.add(new DroneSpawnAbility(){{
startAng = 180;
endAng = 0;
startY = -5;
endY = 5;
dRot = 180;
moveRot = 0;
dY = -5;
moveY = 5;
drone = AxthrixDrones.wattGround;
}});
parts.add(
Expand Down Expand Up @@ -2136,12 +2136,10 @@ public static void load(){
anagh = new AxUnitType("anagh") {{
localizedName = "[purple]Anagh";
description = """
[purple]Lead Engineers at [#de9458]Axthrix[purple] decided not to make anagh a weapon, but make anagh itself the weapon!
Lead Engineers at [#de9458]Axthrix[] decided not to make anagh a weapon, but make anagh itself the weapon!
Anagh contains an Miniature Blackhole on its back which pulls in any unit or bullet close to it.
get too close and it will rip nearby bullets, units, and buildings apart.
has a special field around Anagh preventing allies from being effected by its Blackhole.
[#800000]if 2 units on different teams with such ability meet they cancel each other's attraction but will still rip each other apart.
""";
treadPullOffset = 0;
itemCapacity = 0;
Expand Down Expand Up @@ -2185,6 +2183,87 @@ public static void load(){
color = Color.purple;
}});

}};
akshaj = new AxUnitType("akshaj") {{
localizedName = "[purple]Akshaj";
description = """
Lead Engineers at [#de9458]Axthrix[] decided not to make anagh a weapon, but make anagh itself the weapon!
Anagh contains an Miniature Blackhole on its back which pulls in any unit or bullet close to it.
get too close and it will rip nearby bullets, units, and buildings apart.
has a special field around Anagh preventing allies from being effected by its Blackhole.
""";
treadPullOffset = 0;
itemCapacity = 0;
treadRects = new Rect[]{new Rect(12 - 32f, 8 - 32f, 11, 50)};
factions.add(AxFactions.axthrix);
constructor = TankUnit::create;
outlines = false;
flying = false;
speed = 5.3f/7.5f;
drag = 0.13f;
hitSize = 10f;
health = 400;
armor = 8;
accel = 0.6f;
rotateSpeed = 3.3f;
faceTarget = false;
range = 160;
weapons.add(new Weapon("gravic"){{
shootSound = Sounds.none;
shootY = 0f;
x = 0f;
y = 0f;
mirror = false;
top = false;
reload = 200;
bullet = new AfterShockBulletType(10, 160){{
splashDelay = 10;
splashAmount = 2;
status = AxthrixStatus.gravicalSlow;
statusDuration = 300;
frontColor = Color.purple.cpy().a(0.4f);
particleColor = bottomColor = backColor = Color.purple;
}};
}});
abilities.add(new AttractionFieldAbility(){{
whenShooting = true;
damageRadius = 60;
suctionRadius = 160;
damage = 6f;
bulletDamage = 3f;
scaledBulletForce = 1;
bulletForce = 0.5f;
scaledForce = 300;
force = 20;

}},
new AttractionFieldAbility(){{
whenNotShooting = true;
damageRadius = suctionRadius = 120;
repel = true;
damage = 12f;
bulletDamage = 6f;
scaledBulletForce = 2;
bulletForce = 1f;
scaledForce = 600;
force = 40;
swirlEffect = AxthrixFfx.circleOut(40,120, 10,Color.purple);
}});
parts.add(

new BlackHolePart(){{
growProgress = PartProgress.recoil.add(p -> Mathf.cos(Time.time / 16) / 2 + 0.2f);
progress = PartProgress.warmup;
moveY = 6;
x = 0;
y = -3;
size = 1.4f;
sizeTo = 2.8f;
edge = 6.4f;
edgeTo = 12.8f;
color = Color.purple;
}});

}};
//assault helicopters
rai = new CopterUnitType("rai") {{
Expand Down
145 changes: 137 additions & 8 deletions src/axthrix/world/types/abilities/AttractionFieldAbility.java
Original file line number Diff line number Diff line change
@@ -1,32 +1,161 @@
package axthrix.world.types.abilities;

import arc.Core;
import arc.graphics.Color;
import arc.math.Mathf;
import arc.math.geom.Vec2;
import arc.scene.ui.layout.Table;
import arc.util.Nullable;
import arc.util.Strings;
import arc.util.Time;
import blackhole.entities.abilities.BlackHoleAbility;
import blackhole.entities.effect.SwirlEffect;
import blackhole.graphics.BHDrawf;
import blackhole.graphics.BlackHoleRenderer;
import blackhole.utils.BlackHoleUtils;
import mindustry.content.Fx;
import mindustry.entities.Effect;
import mindustry.entities.abilities.Ability;
import mindustry.gen.Unit;
import mindustry.type.UnitType;
import mindustry.world.meta.Stat;
import mindustry.world.meta.StatUnit;
import mindustry.world.meta.StatValues;

import static mindustry.Vars.tilesize;

public class AttractionFieldAbility extends BlackHoleAbility {
public class AttractionFieldAbility extends Ability {
protected static Vec2 vec = new Vec2();
public float x;
public float y;
public float damageInterval = 2.0F;
public boolean whenShooting = false;
public boolean whenNotShooting = false;
public float warmupSpeed = 0.06F;
public boolean drawBlackHole = true;
public float horizonRadius = -1.0F;
public float lensingRadius = -1.0F;
public float damageRadius = 6.0F;
public float suctionRadius = 160.0F;
public boolean repel = false;
public float force = 10.0F;
public float scaledForce = 800.0F;
public float bulletForce = 0.1F;
public float scaledBulletForce = 1.0F;
public float damage = 30.0F;
public float bulletDamage = 10.0F;
@Nullable
public Color color = null;
public float starWidth = -1.0F;
public float starHeight = -1.0F;
public float starAngle;
@Nullable
public Color starIn;
@Nullable
public Color starOut;
public Effect swirlEffect;
public float swirlInterval;
public int swirlEffects;
public boolean counterClockwise;
protected float effectTimer;
protected float suctionTimer;
protected float scl;

public AttractionFieldAbility(){
drawBlackHole = false;
swirlEffect = Fx.none;
drawBlackHole = false;
swirlEffect = Fx.none;
}
@Override
public String localized(){
return Core.bundle.format("ability.aj-attraction-field");
}
@Override
public void addStats(Table t){
t.add("[lightgray]" + Stat.damage.localized() + ": [white]" + Strings.autoFixed(30f * damage, 2) + " " + StatUnit.perSecond.localized());
t.add("[lightgray]" + Stat.damage.localized() + ": [white]" + Strings.autoFixed(30f * damage, 2) + " " + StatUnit.perSecond.localized());
t.row();
if (damageRadius != suctionRadius) {
t.add("[lightgray]Attack " + Stat.shootRange.localized() + ": [white]" + Strings.autoFixed(damageRadius / tilesize, 2) + " " + StatUnit.blocks.localized());
t.row();
t.add("[lightgray]Attraction " + Stat.shootRange.localized() + ": [white]" + Strings.autoFixed(suctionRadius / tilesize, 2) + " " + StatUnit.blocks.localized());
t.row();
}else{
t.add("[lightgray]" + Stat.shootRange.localized() + ": [white]" + Strings.autoFixed(suctionRadius / tilesize, 2) + " " + StatUnit.blocks.localized());
t.row();
}
if (!repel){
t.add("[lightgray] Attracting Force");
t.row();
} else {
t.add("[lightgray] Repelling Force");
t.row();
}
if (whenShooting){
t.add("[lightgray] Active only While Shooting");
t.row();
}
if (whenNotShooting){
t.add("[lightgray] Active only While Not Shooting");
t.row();
}
t.add("[#800000] Other units with the same ability will cancel out each-others Forces but take the Damage");
t.row();
t.add("[lightgray]Attack " + Stat.shootRange.localized() + ": [white]" + Strings.autoFixed(damageRadius / tilesize, 2) + " " + StatUnit.blocks.localized());
t.row();
t.add("[lightgray]Attraction " + Stat.shootRange.localized() + ": [white]" + Strings.autoFixed(suctionRadius / tilesize, 2) + " " + StatUnit.blocks.localized());
t.row();
}

public void init(UnitType type) {
if (this.horizonRadius < 0.0F) {
this.horizonRadius = this.damageRadius;
}

if (this.lensingRadius < 0.0F) {
this.lensingRadius = this.suctionRadius;
}

if (!this.whenShooting) {
this.scl = 1.0F;
}

if (this.starWidth > 0.0F && this.starHeight < 0.0F) {
this.starHeight = this.starWidth / 2.0F;
}

BlackHoleUtils.immuneUnits.add(type);
}

public void draw(Unit unit) {
if (this.drawBlackHole && !(this.scl < 0.01F)) {
vec.set(this.x, this.y).rotate(unit.rotation - 90.0F).add(unit);
BlackHoleRenderer.addBlackHole(vec.x, vec.y, this.horizonRadius * this.scl, this.lensingRadius * this.scl, BHDrawf.teamColor(unit, this.color));
if (this.starWidth > 0.0F) {
BlackHoleRenderer.addStar(vec.x, vec.y, this.starWidth * this.scl, this.starHeight * this.scl, this.starAngle, BHDrawf.teamColor(unit, this.starIn), BHDrawf.teamColor(unit, this.starOut));
}

}
}

public void update(Unit unit) {
if (!whenNotShooting && unit.isShooting || !whenShooting && !unit.isShooting) {
this.scl = Mathf.lerpDelta(this.scl, 1.0F, this.warmupSpeed);
} else {
this.scl = Mathf.lerpDelta(this.scl, 0.0F, this.warmupSpeed);
}

if (!(this.scl < 0.01F)) {
vec.set(this.x, this.y).rotate(unit.rotation - 90.0F);
if ((this.suctionTimer += Time.delta) >= this.damageInterval) {
BlackHoleUtils.blackHoleUpdate(unit.team, unit, vec.x, vec.y, this.damageRadius * this.scl, this.suctionRadius * this.scl, this.damage, this.bulletDamage, this.repel, this.force, this.scaledForce, this.bulletForce, this.scaledBulletForce);
this.suctionTimer %= this.damageInterval;
}

if ((this.effectTimer += Time.delta) >= this.swirlInterval) {
vec.add(unit);

for(int i = 0; i < this.swirlEffects; ++i) {
this.swirlEffect.at(vec.x, vec.y, this.suctionRadius * (this.counterClockwise ? -1.0F : 1.0F), BHDrawf.teamColor(unit, this.color), unit);
}

this.effectTimer %= this.swirlInterval;
}

}
}
}
Loading

0 comments on commit a4f8e8a

Please sign in to comment.