Merge pull request #985 from YumiWhellie/main
updated upkeep hotkey, removed upkeep (multihanded) hotkey
This commit is contained in:
commit
9806cd5bcb
@ -9,6 +9,8 @@ local searchLib = require("util/SearchLib")
|
|||||||
local tokenChecker = require("core/token/TokenChecker")
|
local tokenChecker = require("core/token/TokenChecker")
|
||||||
local victoryDisplayApi = require("core/VictoryDisplayApi")
|
local victoryDisplayApi = require("core/VictoryDisplayApi")
|
||||||
|
|
||||||
|
local sentMessage = false
|
||||||
|
|
||||||
function onLoad()
|
function onLoad()
|
||||||
addHotkey("Add doom to agenda", addDoomToAgenda)
|
addHotkey("Add doom to agenda", addDoomToAgenda)
|
||||||
addHotkey("Add Bless/Curse context menu", addBlurseSealingMenu)
|
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 (Green)", takeClueFromLocationGreen)
|
||||||
addHotkey("Take clue from location (Red)", takeClueFromLocationRed)
|
addHotkey("Take clue from location (Red)", takeClueFromLocationRed)
|
||||||
addHotkey("Upkeep", triggerUpkeep)
|
addHotkey("Upkeep", triggerUpkeep)
|
||||||
addHotkey("Upkeep (Multi-handed)", triggerUpkeepMultihanded)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- triggers the "Upkeep" function of the calling player's playermat
|
-- triggers the "Upkeep" function of the calling player's playermat
|
||||||
function triggerUpkeep(playerColor)
|
function triggerUpkeep(playerColor)
|
||||||
if playerColor == "Black" then
|
if playerColor == "Black" and not sentMessage then
|
||||||
broadcastToColor("Triggering 'Upkeep (Multihanded)' instead", playerColor, "Yellow")
|
broadcastToColor("It is recommended to sit on a player mat", playerColor, "Yellow")
|
||||||
triggerUpkeepMultihanded(playerColor)
|
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
|
return
|
||||||
end
|
end
|
||||||
local matColor = playermatApi.getMatColor(playerColor)
|
local matColor = playermatApi.getMatColor(playerColor)
|
||||||
playermatApi.doUpkeepFromHotkey(matColor, playerColor)
|
playermatApi.doUpkeepFromHotkey(matColor, playerColor)
|
||||||
end
|
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
|
-- adds 1 doom to the agenda
|
||||||
function addDoomToAgenda()
|
function addDoomToAgenda()
|
||||||
local doomCounter = guidReferenceApi.getObjectByOwnerAndType("Mythos", "DoomCounter")
|
local doomCounter = guidReferenceApi.getObjectByOwnerAndType("Mythos", "DoomCounter")
|
||||||
|
@ -514,7 +514,13 @@ end
|
|||||||
|
|
||||||
-- Readies all cards in the main playarea (both player cards, treacheries and enemies)
|
-- Readies all cards in the main playarea (both player cards, treacheries and enemies)
|
||||||
function readyCards(player, clickType)
|
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
|
-- when right-clicked
|
||||||
if clickType == "-2" then
|
if clickType == "-2" then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user