diff --git a/src/core/GameKeyHandler.ttslua b/src/core/GameKeyHandler.ttslua index 5a1ff71d..bfa5d381 100644 --- a/src/core/GameKeyHandler.ttslua +++ b/src/core/GameKeyHandler.ttslua @@ -85,7 +85,7 @@ function takeCardIntoThreatArea(playerColor, hoveredObject) -- work out the new rotation local matRotation = playermatApi.returnRotation(matColor) - local newCardRot = cardRot:setAt("y", matRotation.y + cardRot.y - ownerRotation.y) + local newCardRot = cardRot:setAt("y", roundToMultiple(matRotation.y + cardRot.y - ownerRotation.y, 45)) -- move the main card to threat area GlobalApi.moveCardWithTokens(hoveredObject, threatAreaPos, newCardRot) diff --git a/src/core/Global.ttslua b/src/core/Global.ttslua index 8d9fe461..8bb6ac04 100644 --- a/src/core/Global.ttslua +++ b/src/core/Global.ttslua @@ -2856,9 +2856,6 @@ function moveCardWithTokens(params) if rotation then card.setRotation(rotation) - else - local rot = card.getRotation() - card.setRotation(rot:setAt("y", roundToMultiple(rot.y, 45))) end if position then @@ -2964,7 +2961,3 @@ function removeTokensFromObject(params) end end end - -function roundToMultiple(num, mult) - return math.floor((num + mult / 2) / mult) * mult -end