Files
foundry-Slamother/_macros/triggered_1e/starting_condition.js
T
2024-05-24 16:56:09 -07:00

27 lines
901 B
JavaScript

prepMaintenanceCheck();
//tell the actor to run the function
async function prepMaintenanceCheck() {
//determine who to run the macro for
if (game.settings.get('mosh','macroTarget') === 'character') {
//is there a selected character? warn if no
if (!game.user.character || !game.user.character.type === 'ship') {
//warn player
game.mosh.noShipSelected();
} else {
//run the function for the player's 'Selected Character'
game.user.character.maintenanceCheck();
}
} else if (game.settings.get('mosh','macroTarget') === 'token') {
//is there a selected character? warn if no
if (!canvas.tokens.controlled.length) {
//warn player
game.mosh.noShipSelected();
} else {
//run the function for all selected tokens
canvas.tokens.controlled.forEach(function(token){
token.actor.maintenanceCheck();
});
}
}
}