Skip to content

Commit

Permalink
A lot of Legion-related stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Slotterleet committed Jan 5, 2024
1 parent c6507fd commit 680e6e3
Show file tree
Hide file tree
Showing 12 changed files with 114 additions and 10 deletions.
3 changes: 3 additions & 0 deletions core/res/bundles/bundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,11 @@ status.fos-standard4.name = Rifle Mk. IV
status.fos-standard5.name = Rifle Mk. V
status.fos-shotgun1.name = Sawed-off Shotgun Mount
status.fos-shotgun1.description = A shotgun with poor range but decent damage.
status.fos-legion-fabricator.name = Legion's Mini-Fabricator Replica
status.fos-legion-fabricator.description = Periodically fabricates Legionnaire replicas that follow the player; each one gives +5% damage resistance to the bearer.

unit.fos-legionnaire.name = Legionnaire
unit.fos-legionnaire-replica.name = Legionnaire Replica
unit.fos-legion.name = Legion
unit.fos-legion.description = Does not fight by itself, but summons a bunch of weaker drones on its side. [red]EXPERIMENTAL BOSS ENEMY[]
unit.fos-legion.details = Produces [accent]Legionnaires[] on its side to attack targets while being supported by the Legion. Each Legionnaire currently functioning gives the Legion resistance to all damage. It's advised to deal with the Legionnaires first before attacking the Legion itself.
Expand Down
3 changes: 3 additions & 0 deletions core/res/bundles/bundle_ru.properties
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,11 @@ status.fos-standard4.name = Винтовка Mk. IV
status.fos-standard5.name = Винтовка Mk. V
status.fos-shotgun1.name = Обрез
status.fos-shotgun1.description = Дробовик с малой дальностью, но неплохим уроном.
status.fos-legion-fabricator.name = Мини-фабрика Легиона (реплика)
status.fos-legion-fabricator.description = Периодически производит реплики Легионеров, которые следуют за игроком; каждый из них дает +5% устойчивости к урону носителю.

unit.fos-legionnaire.name = Легионер
unit.fos-legionnaire-replica.name = Легионер (реплика)
unit.fos-legion.name = Легион
unit.fos-legion.description = Не сражается напрямую, но конструирует множество более слабых дронов на своей стороне. [red]ЭКСПЕРИМЕНТАЛЬНЫЙ БОСС[]
unit.fos-legion.details = Производит [accent]Легионеров[] на своей стороне, которые атакуют цели, будучи под поддержкой Легиона. Каждый функционирующий Легионер дает Легиону устойчивость ко всему урону. Рекомендуется сначала уничтожить Легионеров перед сражением с Легионом.
Expand Down
Binary file modified core/res/sprites/units/bosses/legion.png
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.
Binary file added core/res/sprites/units/core/legionnaire-replica.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 11 additions & 2 deletions core/src/fos/ai/ProtectorAI.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class ProtectorAI extends AIController {
public void updateUnit() {
super.updateUnit();

if (protectTarget == null) {
if (protectTarget == null || protectTarget.dead()) {
protectTarget = Units.closest(unit.team, unit.x, unit.y, u -> u.isPlayer() || u.type == FOSUnitTypes.legion);
}
}
Expand All @@ -24,7 +24,16 @@ public void updateMovement() {
if (protectTarget == null) return;

// Just circle around the unit. That's the entire move set of this AI.
circle(protectTarget, protectTarget.hitSize * 2);
circle(protectTarget, protectTarget.hitSize * 2 + unit.hitSize);

// Ok, I lied. A player has to somehow control their shooting.
if (protectTarget.isPlayer()) {
for (var wm : unit.mounts()) {
wm.aimX = protectTarget.aimX;
wm.aimY = protectTarget.aimY;
wm.shoot = protectTarget.isShooting();
}
}

faceTarget();
}
Expand Down
47 changes: 43 additions & 4 deletions core/src/fos/content/FOSUnitTypes.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import mindustry.entities.abilities.*;
import mindustry.entities.bullet.*;
import mindustry.entities.part.*;
import mindustry.entities.pattern.ShootSpread;
import mindustry.entities.pattern.*;
import mindustry.gen.*;
import mindustry.graphics.*;
import mindustry.type.*;
Expand All @@ -33,7 +33,7 @@ public class FOSUnitTypes {
public static @Annotations.EntityDef({Unitc.class}) UnitType
sergeant, lieutenant, captain, general, marshal,
smoke, cloud,
legionnaire;
legionnaire, legionnaireReplica;

public static @Annotations.EntityDef({ElevationMovec.class, Unitc.class}) UnitType assault;

Expand All @@ -56,12 +56,14 @@ public static void load(){
legionnaire = new UnitType("legionnaire"){{
health = 200;
hitSize = 8;
rotateSpeed = 6f;
speed = 2.5f;
accel = 0.08f;
drag = 0.04f;
isEnemy = false;
flying = true;
targetPriority = -2f;
playerControllable = false;
outlineColor = Color.valueOf("2b2f36");
weapons.add(
new Weapon(){{
Expand All @@ -83,7 +85,40 @@ public static void load(){
}};
}}
);
aiController = ProtectorAI::new;
controller = u -> new ProtectorAI();
}};
legionnaireReplica = new UnitType("legionnaire-replica"){{
health = 150;
hitSize = 12;
rotateSpeed = 6f;
speed = 2f;
accel = 0.08f;
drag = 0.04f;
isEnemy = false;
flying = true;
targetPriority = -2f;
playerControllable = false;
outlineColor = Color.valueOf("2b2f36");
weapons.add(
new Weapon(){{
x = 0f; y = 3f;
mirror = false;
top = false;
rotate = false;
reload = 30f;
bullet = new BasicBulletType(2.5f, 55){{
width = 7f;
height = 9f;
lifetime = 45f;
shootEffect = Fx.shootSmall;
smokeEffect = Fx.shootSmallSmoke;
ammoMultiplier = 2;
trailWidth = 3;
trailLength = 8;
}};
}}
);
controller = u -> new ProtectorAI();
}};
//TODO: campaign boss
legion = new UnitType("legion"){{
Expand All @@ -105,14 +140,18 @@ public static void load(){
}};
}},
new Weapon("legion-sapper"){{
x = 8f; y = 9f;
x = 0f; y = 6f;
mirror = true;
alternate = true;
reload = 40f;
top = false;
rotate = false;
shootCone = 25f;
shootSound = Sounds.sap;
shoot = new ShootAlternate(){{
barrels = 2;
spread = 4f;
}};
bullet = new SapBulletType(){{
length = 80f;
damage = 60;
Expand Down
29 changes: 28 additions & 1 deletion core/src/fos/content/FOSWeaponModules.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
package fos.content;

import arc.Events;
import arc.struct.Seq;
import fos.type.abilities.UnitResistanceAbility;
import fos.type.bullets.SmartBulletType;
import fos.type.content.WeaponSet;
import mindustry.content.Fx;
import mindustry.entities.abilities.UnitSpawnAbility;
import mindustry.entities.bullet.*;
import mindustry.game.EventType;
import mindustry.gen.Sounds;
import mindustry.graphics.Pal;
import mindustry.type.Weapon;
import mindustry.type.weapons.RepairBeamWeapon;

import static fos.content.FOSItems.*;
import static mindustry.content.Items.*;
Expand All @@ -17,9 +23,11 @@
public class FOSWeaponModules {
public static WeaponSet
standard1, standard2, standard3, standard4, standard5,
shotgun1, shotgun2, shotgun3, shotgun4, shotgun5;
shotgun1, shotgun2, shotgun3, shotgun4, shotgun5,
legionFabricator;

public static void load() {
// BASIC / ASSAULT RIFLES
standard1 = new WeaponSet("standard1", new Weapon("fos-standard-weapon1"){{
x = 0; y = 0;
alternate = mirror = false;
Expand Down Expand Up @@ -113,6 +121,7 @@ public static void load() {
}};
}}).reqs(with(tin, 500, silver, 500, vanadium, 300, nickel, 250, luminium, 200));

// SHOTGUNS
shotgun1 = new WeaponSet("shotgun1", new Weapon("fos-shotgun-mount1"){{
x = y = 0;
alternate = mirror = false;
Expand All @@ -139,5 +148,23 @@ public static void load() {
shotgun3 = new WeaponSet("shotgun3", new Weapon()).reqs(with(lead, 1));
shotgun4 = new WeaponSet("shotgun4", new Weapon()).reqs(with(lead, 1));
shotgun5 = new WeaponSet("shotgun5", new Weapon()).reqs(with(lead, 1));

// BOSS WEAPONS
legionFabricator = new WeaponSet("legion-fabricator",
new RepairBeamWeapon("legion-beam-replica"){{
x = 0; y = 0;
mirror = false;
bullet = new BulletType(){{
maxRange = 40f;
}};
}}
){{
Events.on(EventType.ContentInitEvent.class, e -> {
abilities = Seq.with(
new UnitResistanceAbility(FOSUnitTypes.legionnaireReplica, 0.05f),
new UnitSpawnAbility(FOSUnitTypes.legionnaireReplica, 600, -16, 0)
);
});
}}.reqs(with(tin, 200, silver, 125, silicon, 150));
}
}
4 changes: 3 additions & 1 deletion core/src/fos/type/abilities/UnitResistanceAbility.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ public void draw(Unit unit) {

int units = countUnits(unit);

if (units == 0) return;

Draw.color(unit.team.color);
Draw.alpha(Math.max(resistance * units, 0.5f));
Draw.alpha(Math.min(resistance * units, 0.5f));

Fill.circle(unit.x, unit.y, unit.hitSize);
Lines.stroke(2f);
Expand Down
18 changes: 16 additions & 2 deletions core/src/fos/type/content/WeaponSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,24 @@

import arc.struct.Seq;
import fos.gen.LumoniPlayerUnitc;
import mindustry.entities.abilities.Ability;
import mindustry.entities.units.WeaponMount;
import mindustry.gen.Unit;
import mindustry.type.*;

//YES, this looks very cursed lmao
/**
* FOR MODDERS: applying this "status effect" will have no effect whatsoever
**/
*/
public class WeaponSet extends StatusEffect {
public static Seq<WeaponSet> sets = new Seq<>();

public int id;
public Seq<Weapon> weapons;
public ItemStack[] reqs;

public Seq<Ability> abilities = new Seq<>();

public WeaponSet(String name, Weapon... weapons) {
super(name);
id = sets.size;
Expand All @@ -25,6 +28,15 @@ public WeaponSet(String name, Weapon... weapons) {
this.weapons = new Seq<>(weapons);
}

public WeaponSet(String name, Seq<Ability> abilities, Weapon... weapons) {
this(name, weapons);
this.abilities = abilities;
}

public WeaponSet(String name, Seq<Ability> abilities) {
this(name, abilities, new Weapon());
}

@Override
public void init() {
super.init();
Expand Down Expand Up @@ -52,11 +64,13 @@ public void applyToUnit(LumoniPlayerUnitc lpc) {
lpc.isEditedWeapons(true);
lpc.weaponSet(this);
lpc.mounts(getMounts());
if (!abilities.isEmpty())
lpc.abilities(abilities.toArray());
}

/**
* Applies weapons to unit.
**/
*/
public WeaponMount[] getMounts() {
WeaponMount[] mounts = new WeaponMount[weapons.size];

Expand Down
7 changes: 7 additions & 0 deletions core/src/fos/type/units/comp/LumoniPlayerUnitComp.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,26 @@
import fos.FOSTypeIO;
import fos.type.content.WeaponSet;
import mindustry.annotations.Annotations;
import mindustry.entities.abilities.Ability;
import mindustry.entities.units.WeaponMount;
import mindustry.gen.*;
import mindustry.io.TypeIO;

// FIXME mounts
@Annotations.Component
public abstract class LumoniPlayerUnitComp implements Weaponsc, Entityc, Syncc, Unitc {
transient boolean isEditedWeapons = false;
transient WeaponSet weaponSet = null;
@Annotations.Import WeaponMount[] mounts;
@Annotations.Import Ability[] abilities;

@Override
public void write(Writes write) {
write.bool(isEditedWeapons);
write.i(weaponSet == null ? -1 : weaponSet.id);
FOSTypeIO.writeMounts2(write, this);
// FIXME
TypeIO.writeAbilities(write, abilities);
}

@Override
Expand All @@ -27,5 +32,7 @@ public void read(Reads read) {
int weaponSetId = read.i();
weaponSet = weaponSetId == -1 ? null : WeaponSet.sets.get(weaponSetId);
mounts = FOSTypeIO.readMounts2(read, type());
// FIXME
TypeIO.readAbilities(read, abilities);
}
}

0 comments on commit 680e6e3

Please sign in to comment.