diff --git a/forge-gui-mobile/src/forge/adventure/character/EnemySprite.java b/forge-gui-mobile/src/forge/adventure/character/EnemySprite.java index c630f0e15c3..57dda00115b 100644 --- a/forge-gui-mobile/src/forge/adventure/character/EnemySprite.java +++ b/forge-gui-mobile/src/forge/adventure/character/EnemySprite.java @@ -380,7 +380,7 @@ public class EnemySprite extends CharacterSprite implements Steerable { // } // } //else - if (peek.getDuration() == 0 && peek.getNextTargetVector(pos()).dst(pos()) < 2){ + if (peek.getDuration() == 0 && peek.getNextTargetVector(objectId, pos()).dst(pos()) < 2){ //this is a location based behavior that has been completed. Move on to the next behavior MovementBehavior current = movementBehaviors.pop(); @@ -402,8 +402,8 @@ public class EnemySprite extends CharacterSprite implements Steerable { return new Vector2(pos()); } } - if (peek.getNextTargetVector(pos()).dst(pos()) > 0.3) { - target = new Vector2(peek.getNextTargetVector(pos())); + if (peek.getNextTargetVector(objectId, pos()).dst(pos()) > 0.3) { + target = new Vector2(peek.getNextTargetVector(objectId, pos())); } else target = new Vector2(pos()); } diff --git a/forge-gui-mobile/src/forge/adventure/util/pathfinding/MovementBehavior.java b/forge-gui-mobile/src/forge/adventure/util/pathfinding/MovementBehavior.java index a784b827c60..29521b259e5 100644 --- a/forge-gui-mobile/src/forge/adventure/util/pathfinding/MovementBehavior.java +++ b/forge-gui-mobile/src/forge/adventure/util/pathfinding/MovementBehavior.java @@ -21,7 +21,7 @@ public class MovementBehavior { return duration; } public Vector2 currentTargetVector; - public Vector2 getNextTargetVector(Vector2 currentPosition){ + public Vector2 getNextTargetVector(int objectID, Vector2 currentPosition){ if (currentTargetVector != null) { return currentTargetVector; } @@ -45,9 +45,13 @@ public class MovementBehavior { } else if (MapStage.getInstance().waypoints.containsKey(Integer.parseInt(destination))) { currentTargetVector = new Vector2(MapStage.getInstance().waypoints.get(Integer.parseInt(destination))); } + else { + System.err.println("Navigation error for object ID" + objectID + ", waypoint could not be parsed or does not exist: " + destination); + destination = ""; + } } - return currentTargetVector; + return currentTargetVector == null? currentPosition: currentTargetVector; } public void setX(float newVal){ diff --git a/forge-gui/res/adventure/common/maps/map/fort/fort_colorless_2_wizards.tmx b/forge-gui/res/adventure/common/maps/map/fort/fort_colorless_2_wizards.tmx index 7418145a325..14309a26f51 100644 --- a/forge-gui/res/adventure/common/maps/map/fort/fort_colorless_2_wizards.tmx +++ b/forge-gui/res/adventure/common/maps/map/fort/fort_colorless_2_wizards.tmx @@ -14,7 +14,7 @@ - eJzdl80NwjAMhateSsQFCSF1ATZghl5hiq7DDXHKOMzDCCgHC9d9jvOHhPokq1HU+rPjuE27btvq9+XPTs42zpFWw0uJA+VXwj0PXwt6XpdzZJ7F9d6145LG2zoeyT0NSx8tuHIecUl3h+tL9UD1Q/5zud4tmTRG+wLVDplke/CsZ/lOYlzKRQw0T7xW3IezLdyHehn15szGFgutvSb0DknhxngpbOvdRdxYrq24Ml/kn+ZQTClsWV/ODddZyed1tHONsX/VR5qRX20//xM3pZalXFp73se8PqhuOdzYfpb7GvnX4ijpKUuoh1Nz5so960gm9W+MG3Tp18zcbz/najFZa1tz3pBcxNZUc54cD9ifZa24qDdRj7Y4Qwchbqpq/he2oA9iD2gJ + eJzdl1EKwjAMhocvs/giiLALeJW96il2nb2JTz2O5/EI0odgFv80WVtB9kOwFJcvaZqRdd22tTuUPzsG2zhHWg3PEwfKr4R76T+W9Lgu98gii+u1b8clDbfveCT33C99tODKfcQlzQHXl+qB6of8r+XGsGTSGt0LVDtkkh3Bs5HlO4p1KRcx0D7xWnHvwbb0P9TLqDcntrZY6Ow1oXeIh5vjedjWu4u4uVxbcWW+yD/toZg8bFlfzk2/k5LP82TnmmP/qo80I7/aff4nrqeWpVw6e97HvD6obmu4ufss7zXyr8VR0lOWUA97c+ZaO+tIJvVvjitVOmNxrhaTdbY184bkIrammnlyOGJ/lrXiot5EPdpihk5CXK9qvhe2oDeqEmfT