Implemented Strange Plant Random Event

This commit is contained in:
Zerken
2023-11-03 14:55:41 +00:00
committed by Ryan
parent 0eecab4057
commit dbb8b5a133
7 changed files with 190 additions and 2 deletions
+17
View File
@@ -2191,6 +2191,23 @@ fun getPathableRandomLocalCoordinate(target: Entity, radius: Int, center: Locati
return target.location
}
/**
* Returns a pathable cardinal location in a 1 tile radius in order of west, south, east, north.
* @param entity the entity used to check if the loc is pathable
* @param center the center location
*/
fun getPathableCardinal(target: Entity, center: Location) : Location {
var tiles = center.cardinalTiles
for (tile in tiles) {
val path = Pathfinder.find(center, tile, target.size())
if (path.isSuccessful && !path.isMoveNear)
return tile
}
return center
}
/**
* Returns the player's active slayer task.
* @author bushtail