From e9f4b367a62c5a5bfad0364cbc2dfce67323f325 Mon Sep 17 00:00:00 2001 From: Matt Soucy Date: Sun, 24 Nov 2019 16:54:09 -0500 Subject: [PATCH] Fix invalid index --- core/src/me/msoucy/ptures/model/Engine.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/me/msoucy/ptures/model/Engine.kt b/core/src/me/msoucy/ptures/model/Engine.kt index 496ed28..729d0c7 100644 --- a/core/src/me/msoucy/ptures/model/Engine.kt +++ b/core/src/me/msoucy/ptures/model/Engine.kt @@ -58,7 +58,7 @@ class Engine(private vararg val creatures : Pair) { private fun getTargetList(target : Target, selected : Int) : List { return when(target) { Target.Self -> listOf(currentCreature) - Target.Selected -> listOf(selected) + Target.Selected -> if (selected == -1) { listOf() } else { listOf(selected) } Target.Others -> creatures.indices.filter { it != currentCreature } Target.Opponents -> creatures.indices.filter { creatures[it].second != creatures[currentCreature].second } Target.All -> creatures.indices.toList()