Skip to content

Commit 29f5bec

Browse files
fix fight against non active agent bug.
1 parent 1b12643 commit 29f5bec

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/main/kotlin/org/openbase/planetsudo/level/AbstractLevel.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ abstract class AbstractLevel : AbstractGameObject, Runnable {
320320
}
321321

322322
fun getAdversaryAgent(agent: Agent): Agent? = motherships
323-
.firstOrNull { mothership -> mothership?.team != agent.team }
323+
.find { mothership -> mothership?.team != agent.team }
324324
?.agents
325325
?.filter { enemyAgent -> enemyAgent.isVisible || agent.isCommander }
326326
?.filter { enemyAgent -> enemyAgent.hasFuel && enemyAgent.isAlive }

src/main/kotlin/org/openbase/planetsudo/level/levelobjects/Agent.kt

+3-1
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,9 @@ class Agent(
463463
}
464464

465465
override fun releaseResource() {
466-
performAction(1) {
466+
// this should never consume APs since an agent that has no fuel does not get APs but still needs to be able
467+
// to release the resource
468+
performAction {
467469
if (isCarryingResource || resource != null) {
468470
resource?.release()
469471
resource = null

0 commit comments

Comments
 (0)