diff --git a/src/core/GameKeyHandler.ttslua b/src/core/GameKeyHandler.ttslua index c045c928..761d86ed 100644 --- a/src/core/GameKeyHandler.ttslua +++ b/src/core/GameKeyHandler.ttslua @@ -9,6 +9,8 @@ local searchLib = require("util/SearchLib") local tokenChecker = require("core/token/TokenChecker") local victoryDisplayApi = require("core/VictoryDisplayApi") +local sentMessage = false + function onLoad() addHotkey("Add doom to agenda", addDoomToAgenda) addHotkey("Add Bless/Curse context menu", addBlurseSealingMenu) @@ -27,39 +29,26 @@ function onLoad() addHotkey("Take clue from location (Green)", takeClueFromLocationGreen) addHotkey("Take clue from location (Red)", takeClueFromLocationRed) addHotkey("Upkeep", triggerUpkeep) - addHotkey("Upkeep (Multi-handed)", triggerUpkeepMultihanded) end -- triggers the "Upkeep" function of the calling player's playermat function triggerUpkeep(playerColor) - if playerColor == "Black" then - broadcastToColor("Triggering 'Upkeep (Multihanded)' instead", playerColor, "Yellow") - triggerUpkeepMultihanded(playerColor) + if playerColor == "Black" and not sentMessage then + broadcastToColor("It is recommended to sit on a player mat", playerColor, "Yellow") + sentMessage = true + end + if #Player.getPlayers() == 1 then + local usedMats = playermatApi.getUsedMatColors() + for _, matColor in ipairs(usedMats) do + playermatApi.doUpkeepFromHotkey(matColor, playerColor) + end + playAreaApi.readyCards() return end local matColor = playermatApi.getMatColor(playerColor) playermatApi.doUpkeepFromHotkey(matColor, playerColor) end --- triggers the "Upkeep" function of the calling player's playermat AND --- for all playermats that don't have a seated player, but an investigator card -function triggerUpkeepMultihanded(playerColor) - if playerColor ~= "Black" then - triggerUpkeep(playerColor) - end - local colors = Player.getAvailableColors() - for _, handColor in ipairs(colors) do - local matColor = playermatApi.getMatColor(handColor) - local data = playermatApi.getActiveInvestigatorData(matColor) - if data.id ~= "00000" and Player[handColor].seated == false then - playermatApi.doUpkeepFromHotkey(matColor, playerColor) - end - end - - -- also trigger the PlayArea's "Ready Cards" function - playAreaApi.readyCards() -end - -- adds 1 doom to the agenda function addDoomToAgenda() local doomCounter = guidReferenceApi.getObjectByOwnerAndType("Mythos", "DoomCounter") diff --git a/src/core/PlayArea.ttslua b/src/core/PlayArea.ttslua index e80fceac..34f2778f 100644 --- a/src/core/PlayArea.ttslua +++ b/src/core/PlayArea.ttslua @@ -514,7 +514,13 @@ end -- Readies all cards in the main playarea (both player cards, treacheries and enemies) function readyCards(player, clickType) - local playerColor = player.color + local playerColor + if player ~= nil then + playerColor = player.color + else + local existingPlayer = Player.getPlayers()[1] + playerColor = existingPlayer.color + end -- when right-clicked if clickType == "-2" then