Fixed Barbarian fishing spot issue preventing it from acquiring a new location
This commit is contained in:
+3
-2
@@ -53,8 +53,8 @@ fun getNewTTL(): Int{
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun getNewLoc(): Location {
|
fun getNewLoc(): Location {
|
||||||
val possibleLoc = locations.toTypedArray().toMutableList()
|
val possibleLoc = ArrayList<Location>()
|
||||||
possibleLoc.removeAll(usedLocations)
|
for(loc in locations) if(usedLocations.contains(loc)) continue else possibleLoc.add(loc)
|
||||||
val loc = possibleLoc.random()
|
val loc = possibleLoc.random()
|
||||||
usedLocations.add(loc)
|
usedLocations.add(loc)
|
||||||
return loc
|
return loc
|
||||||
@@ -76,6 +76,7 @@ class BarbFishingSpot(var loc: Location? = null, var ttl: Int) : NPC(1176){
|
|||||||
override fun handleTickActions() {
|
override fun handleTickActions() {
|
||||||
if(location != loc) properties.teleportLocation = loc.also { ttl = getNewTTL() }
|
if(location != loc) properties.teleportLocation = loc.also { ttl = getNewTTL() }
|
||||||
if(ttl-- <= 0){
|
if(ttl-- <= 0){
|
||||||
|
usedLocations.remove(location)
|
||||||
loc = getNewLoc()
|
loc = getNewLoc()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user