From: TheSaminator Date: Mon, 23 May 2022 20:17:59 +0000 (-0400) Subject: Some fixes X-Git-Url: https://gitweb.starshipfights.net/?a=commitdiff_plain;h=390b320c3efc7fe5ec1cad523b34f97648c160a3;p=starship-fights Some fixes --- diff --git a/src/commonMain/kotlin/starshipfights/game/game_ability.kt b/src/commonMain/kotlin/starshipfights/game/game_ability.kt index 727771a..1c32be6 100644 --- a/src/commonMain/kotlin/starshipfights/game/game_ability.kt +++ b/src/commonMain/kotlin/starshipfights/game/game_ability.kt @@ -236,7 +236,7 @@ sealed class PlayerAbilityType { if (shipInstance.isDoneCurrentPhase) return GameEvent.InvalidAction("Ships cannot be moved twice") val moveOrigin = shipInstance.position.location - val newFacingNormal = (data.newPosition.location - moveOrigin).normal + val newFacingNormal = normalDistance(data.newPosition.facing) val oldFacingNormal = normalDistance(shipInstance.position.facing) val angleDiff = (oldFacingNormal angleBetween newFacingNormal) diff --git a/src/commonMain/kotlin/starshipfights/game/util.kt b/src/commonMain/kotlin/starshipfights/game/util.kt index 7a04280..2e68696 100644 --- a/src/commonMain/kotlin/starshipfights/game/util.kt +++ b/src/commonMain/kotlin/starshipfights/game/util.kt @@ -37,10 +37,6 @@ inline fun pollFlow(intervalMs: Long = 50, crossinline poll: () -> T) = flow } } -operator fun List.times(multiplier: Int): List = if (multiplier <= 0) emptyList() -else if (multiplier == 1) this -else this + (this * (multiplier - 1)) - fun Double.toPercent() = "${(this * 100).roundToInt()}%" fun smoothMinus1To1(x: Double, exponent: Double = 1.0) = x / (1 + abs(x).pow(exponent)).pow(1 / exponent)