Destroy units objective, WIP

This commit is contained in:
Anuken
2022-04-17 19:13:29 -04:00
parent d1cf1e2aba
commit 8364a6ac78
4 changed files with 52 additions and 29 deletions

View File

@@ -17,7 +17,7 @@ import static mindustry.Vars.*;
public class MapObjectives{
public static Prov<MapObjective>[] allObjectiveTypes = new Prov[]{
ResearchObjective::new, BuildCountObjective::new, UnitCountObjective::new, ItemObjective::new,
CommandModeObjective::new, CoreItemObjective::new, DestroyCoreObjective::new
CommandModeObjective::new, CoreItemObjective::new, DestroyCoreObjective::new, DestroyUnitsObjective::new
};
public static Prov<ObjectiveMarker>[] allMarkerTypes = new Prov[]{
@@ -142,6 +142,28 @@ public class MapObjectives{
}
}
/** Produce a certain amount of units. */
public static class DestroyUnitsObjective extends MapObjective{
public int count = 1;
public DestroyUnitsObjective(int count){
this.count = count;
}
public DestroyUnitsObjective(){
}
@Override
public String text(){
return Core.bundle.format("objective.destroyunits", count);
}
@Override
public boolean complete(){
return state.stats.enemyUnitsDestroyed >= count;
}
}
/** Command any unit to do anything. Always compete in headless mode. */
public static class CommandModeObjective extends MapObjective{