DestroyBlocksObjective
This commit is contained in:
@@ -577,6 +577,7 @@ configure = Configure Loadout
|
|||||||
objective.research = [accent]Research:\n[]{0}[lightgray]{1}
|
objective.research = [accent]Research:\n[]{0}[lightgray]{1}
|
||||||
objective.produce = [accent]Obtain:\n[]{0}[lightgray]{1}
|
objective.produce = [accent]Obtain:\n[]{0}[lightgray]{1}
|
||||||
objective.destroyblock = [accent]Destroy:\n[]{0}[lightgray]{1}
|
objective.destroyblock = [accent]Destroy:\n[]{0}[lightgray]{1}
|
||||||
|
objective.destroyblocks = [accent]Destroy: [lightgray]{0}[]/{1}\n{2}[lightgray]{3}
|
||||||
objective.item = [accent]Obtain: [][lightgray]{0}[]/{1}\n{2}[lightgray]{3}
|
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}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package mindustry.content;
|
package mindustry.content;
|
||||||
|
|
||||||
import mindustry.game.MapObjectives.*;
|
import mindustry.game.MapObjectives.*;
|
||||||
import mindustry.game.Team;
|
import mindustry.game.*;
|
||||||
import mindustry.graphics.*;
|
import mindustry.graphics.*;
|
||||||
import mindustry.type.*;
|
import mindustry.type.*;
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import arc.func.*;
|
|||||||
import arc.graphics.*;
|
import arc.graphics.*;
|
||||||
import arc.graphics.g2d.*;
|
import arc.graphics.g2d.*;
|
||||||
import arc.math.*;
|
import arc.math.*;
|
||||||
|
import arc.math.geom.*;
|
||||||
import arc.scene.ui.layout.*;
|
import arc.scene.ui.layout.*;
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
import mindustry.content.*;
|
import mindustry.content.*;
|
||||||
@@ -20,7 +21,8 @@ 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, DestroyUnitsObjective::new,
|
CommandModeObjective::new, CoreItemObjective::new, DestroyCoreObjective::new, DestroyUnitsObjective::new,
|
||||||
TimerObjective::new, FlagObjective::new, DestroyBlockObjective::new, ProduceObjective::new
|
TimerObjective::new, FlagObjective::new, DestroyBlockObjective::new, ProduceObjective::new,
|
||||||
|
DestroyBlocksObjective::new
|
||||||
};
|
};
|
||||||
|
|
||||||
public static Prov<ObjectiveMarker>[] allMarkerTypes = new Prov[]{
|
public static Prov<ObjectiveMarker>[] allMarkerTypes = new Prov[]{
|
||||||
@@ -270,7 +272,44 @@ public class MapObjectives{
|
|||||||
public String text(){
|
public String text(){
|
||||||
return Core.bundle.format("objective.destroyblock", block.emoji(), block.localizedName);
|
return Core.bundle.format("objective.destroyblock", block.emoji(), block.localizedName);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class DestroyBlocksObjective extends MapObjective{
|
||||||
|
public int[] positions = {};
|
||||||
|
public Team team = Team.crux;
|
||||||
|
public Block block = Blocks.router;
|
||||||
|
|
||||||
|
public DestroyBlocksObjective(Block block, Team team, int... positions){
|
||||||
|
this.block = block;
|
||||||
|
this.team = team;
|
||||||
|
this.positions = positions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DestroyBlocksObjective(){
|
||||||
|
}
|
||||||
|
|
||||||
|
public int progress(){
|
||||||
|
int count = 0;
|
||||||
|
for(var pos : positions){
|
||||||
|
int x = Point2.x(pos), y = Point2.y(pos);
|
||||||
|
|
||||||
|
var build = world.build(x, y);
|
||||||
|
if(build == null || build.team != team || build.block != block){
|
||||||
|
count ++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean complete(){
|
||||||
|
return progress() >= positions.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String text(){
|
||||||
|
return Core.bundle.format("objective.destroyblocks", positions, positions.length, block.emoji(), block.localizedName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Command any unit to do anything. Always compete in headless mode. */
|
/** Command any unit to do anything. Always compete in headless mode. */
|
||||||
|
|||||||
Reference in New Issue
Block a user