Destroy units objective, WIP
This commit is contained in:
@@ -578,6 +578,7 @@ objective.item = [accent]Obtain: [][lightgray]{0}[]/{1}\n{2}[lightgray]{3}
|
|||||||
objective.coreitem = [accent]Move into Core:\n[][lightgray]{0}[]/{1}\n{2}[lightgray]{3}
|
objective.coreitem = [accent]Move into Core:\n[][lightgray]{0}[]/{1}\n{2}[lightgray]{3}
|
||||||
objective.build = [accent]Build: [][lightgray]{0}[]x\n{1}[lightgray]{2}
|
objective.build = [accent]Build: [][lightgray]{0}[]x\n{1}[lightgray]{2}
|
||||||
objective.buildunit = [accent]Build Unit: [][lightgray]{0}[]x\n{1}[lightgray]{2}
|
objective.buildunit = [accent]Build Unit: [][lightgray]{0}[]x\n{1}[lightgray]{2}
|
||||||
|
objective.destroyunits = [accent]Destroy: [][lightgray]{0}[]x Units
|
||||||
objective.destroycore = [accent]Destroy Enemy Core
|
objective.destroycore = [accent]Destroy Enemy Core
|
||||||
objective.command = [accent]Command Units
|
objective.command = [accent]Command Units
|
||||||
|
|
||||||
|
|||||||
@@ -161,34 +161,6 @@ public class Control implements ApplicationListener, Loadable{
|
|||||||
checkAutoUnlocks();
|
checkAutoUnlocks();
|
||||||
});
|
});
|
||||||
|
|
||||||
Events.on(BlockBuildEndEvent.class, e -> {
|
|
||||||
if(e.team == player.team()){
|
|
||||||
if(e.breaking){
|
|
||||||
state.stats.buildingsDeconstructed++;
|
|
||||||
}else{
|
|
||||||
state.stats.buildingsBuilt++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Events.on(BlockDestroyEvent.class, e -> {
|
|
||||||
if(e.tile.team() == player.team()){
|
|
||||||
state.stats.buildingsDestroyed ++;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Events.on(UnitDestroyEvent.class, e -> {
|
|
||||||
if(e.unit.team() != player.team()){
|
|
||||||
state.stats.enemyUnitsDestroyed ++;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Events.on(UnitCreateEvent.class, e -> {
|
|
||||||
if(e.unit.team == state.rules.defaultTeam){
|
|
||||||
state.stats.unitsCreated++;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
//delete save on campaign game over
|
//delete save on campaign game over
|
||||||
Events.on(GameOverEvent.class, e -> {
|
Events.on(GameOverEvent.class, e -> {
|
||||||
if(state.isCampaign() && !net.client() && !headless){
|
if(state.isCampaign() && !net.client() && !headless){
|
||||||
|
|||||||
@@ -187,6 +187,34 @@ public class Logic implements ApplicationListener{
|
|||||||
e.core.team.data().destroyToDerelict();
|
e.core.team.data().destroyToDerelict();
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
Events.on(BlockBuildEndEvent.class, e -> {
|
||||||
|
if(e.team == state.rules.defaultTeam){
|
||||||
|
if(e.breaking){
|
||||||
|
state.stats.buildingsDeconstructed++;
|
||||||
|
}else{
|
||||||
|
state.stats.buildingsBuilt++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Events.on(BlockDestroyEvent.class, e -> {
|
||||||
|
if(e.tile.team() == state.rules.defaultTeam){
|
||||||
|
state.stats.buildingsDestroyed ++;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Events.on(UnitDestroyEvent.class, e -> {
|
||||||
|
if(e.unit.team() != state.rules.defaultTeam){
|
||||||
|
state.stats.enemyUnitsDestroyed ++;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Events.on(UnitCreateEvent.class, e -> {
|
||||||
|
if(e.unit.team == state.rules.defaultTeam){
|
||||||
|
state.stats.unitsCreated++;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Adds starting items, resets wave time, and sets state to playing. */
|
/** Adds starting items, resets wave time, and sets state to playing. */
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import static mindustry.Vars.*;
|
|||||||
public class MapObjectives{
|
public class MapObjectives{
|
||||||
public static Prov<MapObjective>[] allObjectiveTypes = new Prov[]{
|
public static Prov<MapObjective>[] allObjectiveTypes = new Prov[]{
|
||||||
ResearchObjective::new, BuildCountObjective::new, UnitCountObjective::new, ItemObjective::new,
|
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[]{
|
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. */
|
/** Command any unit to do anything. Always compete in headless mode. */
|
||||||
public static class CommandModeObjective extends MapObjective{
|
public static class CommandModeObjective extends MapObjective{
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user