Skip to content

Commit 796b0e7

Browse files
committed
add whatever has been added
1 parent 022edfb commit 796b0e7

File tree

7 files changed

+60
-24
lines changed

7 files changed

+60
-24
lines changed

build.gradle

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ apply plugin: "java"
22

33
version '1.0'
44

5-
sourceSets.main.java.srcDirs = ["src"]
5+
sourceSets.main{
6+
java.srcDirs = ["src"]
7+
resources.srcDirs = ["src/resources"]
8+
}
69

710
repositories{
811
mavenCentral()

src/crawler_arena/ArenaAI.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public void updateUnit(){
2626

2727
if(!Units.invalidateTarget(target, unit, unit.range()) && unit.hasWeapons()){
2828
rotate = true;
29-
shoot = unit.within(target, unit.range() + (target instanceof Building ? 1.5f * Vars.tilesize / 2f : ((Hitboxc) target).hitSize() / 2f));
29+
shoot = unit.within(target, unit.type.range + (target instanceof Building ? 1.5f * Vars.tilesize / 2f : ((Hitboxc) target).hitSize() / 2f));
3030

3131
if(unit.type.hasWeapons())
3232
unit.aimLook(Predict.intercept(unit, target, unit.type.weapons.first().bullet.speed));

src/crawler_arena/Bundle.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import arc.struct.StringMap;
66
import arc.util.Strings;
77
import arc.util.Structs;
8+
import arc.util.Log;
89
import mindustry.Vars;
910
import mindustry.gen.Groups;
1011
import mindustry.gen.Iconc;
@@ -95,7 +96,6 @@ public static void sendToChat(String key, Object... values){
9596

9697
public static Locale findLocale(Player player){
9798
Locale locale = Structs.find(Bundle.supportedLocales, l -> l.toString().equals(player.locale) || player.locale.startsWith(l.toString()));
98-
return locale != null ? locale : Bundle.defaultLocale();
99+
return locale == null ? Bundle.defaultLocale() : locale;
99100
}
100101
}
101-

src/crawler_arena/CVars.java

+20-2
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public class CVars{
9090
unitCosts.putAll(UnitTypes.nova, 100,
9191
UnitTypes.pulsar, 300,
9292
UnitTypes.quasar, 2000,
93-
UnitTypes.vela, 15000,
93+
UnitTypes.vela, 18000,
9494
UnitTypes.corvus, 250000,
9595

9696
UnitTypes.dagger, 25,
@@ -99,6 +99,24 @@ public class CVars{
9999
UnitTypes.scepter, 20000,
100100
UnitTypes.reign, 250000,
101101

102+
UnitTypes.merui, 450,
103+
UnitTypes.cleroi, 1800,
104+
UnitTypes.anthicus, 12000,
105+
UnitTypes.tecta, 22000,
106+
UnitTypes.collaris, 325000,
107+
108+
UnitTypes.elude, 500,
109+
UnitTypes.avert, 1000,
110+
UnitTypes.obviate, 11000,
111+
UnitTypes.quell, 25000,
112+
UnitTypes.disrupt, 250000,
113+
114+
UnitTypes.stell, 400,
115+
UnitTypes.locus, 2500,
116+
UnitTypes.precept, 10000,
117+
UnitTypes.vanquish, 22000,
118+
UnitTypes.conquer, 250000,
119+
102120
UnitTypes.crawler, 7500,
103121
UnitTypes.atrax, 250,
104122
UnitTypes.spiroct, 1500,
@@ -123,7 +141,7 @@ public class CVars{
123141
UnitTypes.sei, 75000,
124142
UnitTypes.omura, 1500000,
125143

126-
UnitTypes.mono, 3750000,
144+
UnitTypes.mono, 10000000,
127145
UnitTypes.poly, 100000,
128146
UnitTypes.mega, 2500,
129147
UnitTypes.quad, 25000,

src/crawler_arena/CrawlerArenaMod.java

+25-13
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import arc.struct.*;
99
import arc.util.*;
1010
import arc.util.pooling.Pools;
11-
import mindustry.ai.types.FlyingAI;
11+
import mindustry.ai.types.*;
1212
import mindustry.content.*;
1313
import mindustry.entities.abilities.*;
1414
import mindustry.entities.bullet.SapBulletType;
@@ -43,18 +43,17 @@ public class CrawlerArenaMod extends Plugin {
4343

4444
@Override
4545
public void init(){
46-
content.units().each(un -> un.controller = u -> new FlyingAI());
47-
UnitTypes.crawler.controller = u -> new ArenaAI();
48-
UnitTypes.atrax.controller = u -> new ArenaAI();
49-
UnitTypes.spiroct.controller = u -> new ArenaAI();
50-
UnitTypes.arkyid.controller = u -> new ArenaAI();
51-
UnitTypes.toxopid.controller = u -> new ArenaAI();
46+
UnitTypes.crawler.controller = u -> !u.type.playerControllable || (u.team.isAI() && !u.team.rules().rtsAi) ? new ArenaAI() : new CommandAI();
47+
UnitTypes.atrax.controller = u -> !u.type.playerControllable || (u.team.isAI() && !u.team.rules().rtsAi) ? new ArenaAI() : new CommandAI();
48+
UnitTypes.spiroct.controller = u -> !u.type.playerControllable || (u.team.isAI() && !u.team.rules().rtsAi) ? new ArenaAI() : new CommandAI();
49+
UnitTypes.arkyid.controller = u -> !u.type.playerControllable || (u.team.isAI() && !u.team.rules().rtsAi) ? new ArenaAI() : new CommandAI();
50+
UnitTypes.toxopid.controller = u -> !u.type.playerControllable || (u.team.isAI() && !u.team.rules().rtsAi) ? new ArenaAI() : new CommandAI();
5251

5352
UnitTypes.poly.controller = u -> new SwarmAI();
54-
UnitTypes.mega.controller = u -> new ReinforcementAI();
53+
UnitTypes.mega.controller = u -> u.team == CVars.reinforcementTeam ? new ReinforcementAI() : !u.type.playerControllable || (u.team.isAI() && !u.team.rules().rtsAi) ? u.type.aiController.get() : new CommandAI();
5554

56-
UnitTypes.scepter.controller = u -> new ArenaAI();
57-
UnitTypes.reign.controller = u -> new ArenaAI();
55+
UnitTypes.scepter.controller = u -> !u.type.playerControllable || (u.team.isAI() && !u.team.rules().rtsAi) ? new ArenaAI() : new CommandAI();
56+
UnitTypes.reign.controller = u -> !u.type.playerControllable || (u.team.isAI() && !u.team.rules().rtsAi) ? new ArenaAI() : new CommandAI();
5857

5958
UnitTypes.risso.flying = true;
6059
UnitTypes.minke.flying = true;
@@ -488,7 +487,6 @@ public void setUnit(Unit unit, boolean ultraEligible){
488487
addUnitAbility(unit, new UnitSpawnAbility(UnitTypes.dagger, ultraDaggerCooldown, 0f, -1f));
489488
applyStatus(unit, Float.MAX_VALUE, 3, StatusEffects.overclock, StatusEffects.overdrive, StatusEffects.boss);
490489
}
491-
unit.controller(new FlyingAI());
492490
}
493491
public void setUnit(Unit unit){
494492
setUnit(unit, false);
@@ -512,7 +510,7 @@ public void reset(){
512510

513511
@Override
514512
public void registerClientCommands(CommandHandler handler){
515-
handler.<Player>register("upgrade", "<type> [amount]", "Upgrade to another unit", (args, player) -> {
513+
handler.<Player>register("upgrade", "<type> [amount]", "Upgrade to another unit. Specifying amount instead buys units to fight alongside you", (args, player) -> {
516514
UnitType newUnitType = Seq.with(unitCosts.keys()).find(u -> u.name.equalsIgnoreCase(args[0]));
517515
if(newUnitType == null){
518516
Bundle.bundled(player, "commands.upgrade.unit-not-found");
@@ -538,7 +536,7 @@ public void registerClientCommands(CommandHandler handler){
538536
}
539537

540538
if(money.get(player.uuid()) >= unitCosts.get(newUnitType) * amount){
541-
if(!player.dead() && player.unit().type == newUnitType || amount > 1){
539+
if(!player.dead() && player.unit().type == newUnitType || args.length == 2){
542540
for(int i = 0; i < amount; i++){
543541
Unit newUnit = newUnitType.spawn(player.x + Mathf.random(), player.y + Mathf.random());
544542
setUnit(newUnit);
@@ -605,6 +603,20 @@ public void registerClientCommands(CommandHandler handler){
605603
});
606604
player.sendMessage(upgrades.toString());
607605
});
606+
607+
handler.<Player>register("cost", "<type>", "Lookup the cost of a unit", (args, player) -> {
608+
int cost = -1;
609+
for(ObjectIntMap.Entry<UnitType> pair : unitCosts.entries()){
610+
if(pair.key.name.equalsIgnoreCase(args[0])){
611+
cost = pair.value;
612+
}
613+
}
614+
if(cost == -1){
615+
Bundle.bundled(player, "commands.upgrade.unit-not-found");
616+
return;
617+
}
618+
player.sendMessage(Integer.toString(cost));
619+
});
608620
}
609621

610622
public void registerServerCommands(CommandHandler handler){

src/resources/bundles/bundle_en.properties

+4-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ commands.upgrades.header = [accent]Available units to upgrade:\n[]
2828
2929
commands.give.player-not-found = [scarlet]Player not found! Note that you don't have to type the full name.
3030
commands.give.success = [yellow]{0} [green]coins given to {1}[green].
31-
commands.give.money-recieved = [yellow]{0} [green]coins recieved from {1}[green].
31+
commands.give.money-recieved = [yellow]{0} [green]coins received from {1}[green].
3232
commands.give.not-enough-money = [scarlet]You don't have enough money.
3333
3434
exceptions.invalid-amount = [scarlet]Invalid amount.
@@ -37,8 +37,9 @@ commands.info = [accent]Money is gained in equal amounts for every player after
3737
\nMoney can only decrease by buying units.\
3838
\nYour money is displayed at the top of the screen.\
3939
\n/upgrades - print available units and their prices.\
40-
\n/upgrade - upgrade to a unit type.\
41-
\n/give - give money to another player.\
40+
\n/cost <type> - lookup unit cost.\
41+
\n/upgrade <type> [amount] - upgrade to a unit type. Specifying amount instead buys units to fight alongside you.\
42+
\n/give <amount> <name> - give money to another player.\
4243
\nUpgrading while you are dead respawns you.\
4344
\nUpgrading to your own unit type buys an additional unit (does not respawn).\
4445
\nSurvive 25 waves and kill the boss to win.

src/resources/bundles/bundle_ru.properties

+4-2
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,11 @@ exceptions.invalid-amount = [scarlet]Неподходящее количеств
3636
commands.info = [accent]После каждой волны всем игрокам начисляется одинаковое количество монет.\
3737
\nМонеты можно потратить на прокачку юнитов.\
3838
\nТвой баланс отображается вверху экрана.\
39+
\nКоманды принимают типы юнитов на английском языке.\
3940
\n/upgrades - посмотреть всех доступных юнитов и их стоимость.\
40-
\n/upgrade - улучшить своего юнита за монеты.\
41-
\n/give - дать деньги другому игроку.\
41+
\n/cost <тип> - отобразить стоимость юнита.\
42+
\n/upgrade <тип> [количество] - улучшить своего юнита за монеты. Если указано количество, новые юниты будут куплены отдельно.\
43+
\n/give <количество> <имя> - дать деньги другому игроку.\
4244
\nПрокачка после смерти возрождает тебя.\
4345
\nПрокачка до своего же юнита покупает дополнительный юнит (не возрождается).\
4446
\nПродержись 25 волн и убей босса чтобы победить.

0 commit comments

Comments
 (0)