Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.hjax.bodhisattva.analysis;
- import com.github.ocraft.s2client.protocol.data.Abilities;
- import com.github.ocraft.s2client.protocol.data.Units;
- import com.github.ocraft.s2client.protocol.debug.Color;
- import com.github.ocraft.s2client.protocol.spatial.Point2d;
- import com.github.ocraft.s2client.protocol.unit.Alliance;
- import com.hjax.bodhisattva.Vector2d;
- import com.hjax.kagamine.game.Game;
- import com.hjax.kagamine.game.GameInfoCache;
- import com.hjax.kagamine.game.HjaxUnit;
- public class WallFinder {
- //public static boolean done = false;
- public static void onFrame() {
- int count = 0;
- for (float x = Game.min_point().getX(); x < Game.max_point().getX(); x++ ) {
- for (float y = Game.min_point().getY(); y < Game.max_point().getY(); y++) {
- Vector2d current = new Vector2d(x, y);
- Vector2d pylon1 = current.add(new Vector2d(-0, -2));
- Vector2d pylon2 = current.add(new Vector2d(2, -1));
- Vector2d pylon3 = current.add(new Vector2d(-2, -1));
- if (canBuild(current)) {
- if (canBuild(pylon1) && canBuild(pylon2) && canBuild(pylon3)) {
- if (is_blocked(current.add(new Vector2d((float) 3, 0.5f))) && is_blocked(current.add(new Vector2d((float) -3, 0.5f)))) {
- count++;
- if (count > 0) {
- Game.draw_box(current.toPoint2d(), Color.YELLOW);
- Game.draw_box(pylon1.toPoint2d(), Color.GREEN);
- Game.draw_box(pylon2.toPoint2d(), Color.WHITE);
- Game.draw_box(pylon3.toPoint2d(), Color.PURPLE);
- }
- }
- }
- }
- }
- }
- System.out.println(count);
- }
- public static boolean canBuild(Vector2d point) {
- return Game.is_placeable(point.add(new Vector2d(0.9f, 0.9f)).toPoint2d()) &&
- Game.is_placeable(point.add(new Vector2d(-0.9f, 0.9f)).toPoint2d()) &&
- Game.is_placeable(point.add(new Vector2d(0.9f, -0.9f)).toPoint2d()) &&
- Game.is_placeable(point.add(new Vector2d(-0.9f, -0.9f)).toPoint2d());
- }
- public static boolean is_blocked(Vector2d point) {
- return !Game.is_placeable(point.toPoint2d()) && !Game.pathable(point.toPoint2d());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement