Skip to content

Commit

Permalink
Removed archived macros from packs
Browse files Browse the repository at this point in the history
  • Loading branch information
AnthonyVadala committed Apr 21, 2022
1 parent c9206ec commit c43b142
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 28 deletions.
18 changes: 10 additions & 8 deletions packs/macros-5e.db

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions packs/macros-age.db
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,8 @@
{"name":"Take Cover","permission":{"default":0,"y5gmtwxmW3A5ZuOP":3},"type":"script","flags":{"core":{"sourceId":"Macro.hdVKy6Y8gRg4Omlb"}},"scope":"global","command":"/* This macro is specific to the AGE System (unoffical) game system.\n *\n * In AGE system games such as Modern AGE, The Expanse, etc., a\n * character can improve their defense score by \"taking cover\",\n * which can either happen if the character uses their move to\n * do so, or applies the \"Take Cover\" stunt.\n * \n * This macro automates that process of applying a cover setting\n * to all the currently selected tokens based on a dialog box\n * used to select the cover value to be applied. The effect of\n * cover is implemented as an applied unique Active Effect - \n * meaning the actor can only have on \"Cover\" effect active, and\n * applying a new one will remove the old one so that there is\n * only ever one active.\n * \n * This macro requires that the game system be \"age-system\"\n * since the effect applied is specific to that system.\n * \n * Author: schlosrat\n */\n\n// define removeNamedEffect function\nasync function removeNamedEffect(ageSystemActor, effectData) {\n // Look to see if there's already a Cover effect\n const item = ageSystemActor.data.effects.find(i =>i.label === effectData.label);\n if (item != undefined) {\n // Delete it if there is one\n const deleted = await ageSystemActor.deleteEmbeddedEntity(\"ActiveEffect\", item._id); // Deletes one EmbeddedEntity\n }\n}\n\n// define applyUniqueEffect function\nasync function applyUniqueEffect(ageSystemActor, effectData) {\n // Look to see if there's already a Cover effect\n removeNamedEffect(ageSystemActor, effectData);\n\n // Create a new fresh one with the new settings\n await ageSystemActor.createEmbeddedEntity(\"ActiveEffect\", effectData); \n}\n\nasync function takeCover () {\n\n if (game.system.id === 'age-system') {\n // import applyUniqueEffect from './applyUniqueEffect.js';\n // import removeNamedEffect from './removeNamedEffect.js';\n\n let applyChanges = false;\n new Dialog({\n title: `Take Cover!`,\n content: `\n <form>\n <div class=\"form-group\">\n <label>Cover Rating:</label>\n <select id=\"cover-type\" name=\"cover-type\">\n <option value=\"nochange\">No Change</option>\n <option value=\"0\">No Cover</option>\n <option value=\"1\">1</option>\n <option value=\"2\">2</option>\n <option value=\"3\">3</option>\n </select>\n </div>\n </form>\n `,\n buttons: {\n yes: {\n icon: \"<i class='fas fa-check'></i>\",\n label: `Apply Changes`,\n callback: () => applyChanges = true\n },\n no: {\n icon: \"<i class='fas fa-times'></i>\",\n label: `Cancel Changes`\n },\n },\n default: \"yes\",\n close: html => {\n if (applyChanges) {\n // Chat message to announce this effect\n const flavor = \"Leta-go cover!\"; // LangBelta for \"Take cover!\"\n \n // const effect = 'icons/svg/blood.svg'; // path to effect img\n const state = false; // true if turn on , false if turn off\n \n let coverVal = 0;\n let coverType = html.find('[name=\"cover-type\"]')[0].value || \"none\";\n switch (coverType) {\n case \"0\":\n coverVal = 0;\n break;\n case \"1\":\n coverVal = 1;\n break;\n case \"2\":\n coverVal = 2;\n break;\n case \"3\":\n coverVal = 3;\n break;\n case \"nochange\":\n default:\n }\n \n // NOTE! Currently (4/11/21) the AGE System (unofficial) doesn't fully support Active effects\n // so at this time we need to to apply the effect in both .mod and .total so that it will both\n // show up on the character sheet and have an effect. Once VKDolea updates AGE System to handle\n // Active Effects correctly this (what we have below currently) will ilkely double the effect.\n // When that time comes we will most likely need to trim this down to only affecting the .mod\n const effectData = {\n label : \"Cover\",\n icon : \"icons/svg/shield.svg\",\n duration: {rounds: 10},\n changes: [{\n \"key\": \"data.defense.total\",\n \"mode\": 2, // Mode 2 is for ADD.\n \"value\": coverVal,\n \"priority\": 0\n },{\n \"key\": \"data.defense.mod\",\n \"mode\": 2, // Mode 2 is for ADD.\n \"value\": coverVal,\n \"priority\": 0\n }]\n };\n \n const selected = canvas.tokens.controlled;\n // console.log(selected)\n selected.forEach(token => {\n if (coverVal) {\n // Apply the cover effect\n applyUniqueEffect(token.actor, effectData);\n } else {\n removeNamedEffect(token.actor, effectData);\n }\n // Announce the reset in chat\n // let this_speaker = ChatMessage.getSpeaker(token);\n // ChatMessage.create({speaker: this_speaker, content: flavor}); // All set, boss!\n /**/\n })\n }\n }\n }).render(true);\n }\n}\n\ntakeCover();","author":"y5gmtwxmW3A5ZuOP","img":"icons/svg/dice-target.svg","actorIds":[],"_id":"KWQWBAqL4n7BIEc1"}
{"name":"Clear Conditions","permission":{"default":0,"y5gmtwxmW3A5ZuOP":3},"type":"script","flags":{"core":{"sourceId":"Macro.dMP1bnphJqD3PiOZ"}},"scope":"global","command":"/* This macro is specific to the AGE System (unoffical) game system.\n *\n * This macro requires that the game system be \"age-system\" so that\n * the actor will have the appropriate structure.\n * \n * Author: schlosrat\n */\n\nif (game.system.id === 'age-system') {\n\n // Get the list of all the selected tokens\n const selected = canvas.tokens.controlled;\n \n // For each selected token...\n selected.forEach(token => {\n\n // Get the actor for this token\n let ageSystemActor = token.actor;\n \n // Set the flavor to use in the chat message\n let flavor = \"All set, boss!\"\n if (ageSystemActor.data.data.ancestry === \"Belter\") flavor = \"Kowl set, bosmang!\";\n // Get the abilities for this actor\n // let abilities = ageSystemActor.data.data.abilities;\n \n // Record the actor's current CON value\n let conValue = ageSystemActor.data.data.abilities.cons.value;\n \n // Check for a baseConValue flag\n let baseCon = ageSystemActor.getFlag(\"world\", \"baseConValue\");\n \n // If there is a baseConValue flag set...\n if (baseCon != undefined) {\n // And if the current CON is less than the baseConValue\n if (conValue < baseCon) {\n conValue = baseCon;\n }\n }\n \n // Do all the updates in a single call to minimize trips to the backend\n ageSystemActor.update({\n \"data\": {\n \"conditions.blinded\": false,\n \"conditions.deafened\": false,\n \"conditions.dying\": false,\n \"conditions.exhausted\": false,\n \"conditions.fatigued\": false,\n \"conditions.freefalling\": false,\n \"conditions.helpless\": false,\n \"conditions.hindered\": false,\n \"conditions.injured\": false,\n \"conditions.prone\": false,\n \"conditions.restrained\": false,\n \"conditions.unconscious\": false,\n \"conditions.wounded\": false,\n \"abilities.cons.value\": conValue,\n }\n });\n\n // Get the speaker for this token\n let this_speaker = ChatMessage.getSpeaker({token: token});\n\n // Send a friendly chat message from this token\n ChatMessage.create({speaker: this_speaker, content: flavor}); // All set, boss!\n });\n}","author":"y5gmtwxmW3A5ZuOP","img":"icons/svg/dice-target.svg","actorIds":[],"_id":"Oq3LxXluV7FLKFuh"}
{"name":"Clear Cover","permission":{"default":0,"y5gmtwxmW3A5ZuOP":3},"type":"script","flags":{"core":{"sourceId":"Macro.WiPS6xoigBEISPou"}},"scope":"global","command":"/* This macro is specific to the AGE System (unoffical) game system.\n *\n * In AGE system games such as Modern AGE, The Expanse, etc., a\n * character can improve their defense score by \"taking cover\",\n * which can either happen if the character uses their move to\n * do so, or applies the \"Take Cover\" stunt.\n * \n * This macro makes it a one-button click to remove the cover\n * active effect from all selected tokens.\n * \n * This macro requires that the game system be \"age-system\"\n * since the effect applied is specific to that system.\n * \n * Author: schlosrat\n */\n\n// define removeNamedEffect function\nasync function removeNamedEffect(ageSystemActor, effectData) {\n // Look to see if there's already a Cover effect\n const item = ageSystemActor.data.effects.find(i =>i.label === effectData.label);\n if (item != undefined) {\n // Delete it if there is one\n const deleted = await ageSystemActor.deleteEmbeddedEntity(\"ActiveEffect\", item._id); // Deletes one EmbeddedEntity\n }\n}\n\nasync function clearCover () {\n if (game.system.id === 'age-system') {\n const effectData = {\n label : \"Cover\",\n icon : \"icons/svg/shield.svg\",\n duration: {rounds: 10},\n changes: [{\n \"key\": \"data.defense.total\",\n \"mode\": 2, // Mode 2 is for ADD.\n \"value\": 0,\n \"priority\": 0\n },{\n \"key\": \"data.defense.mod\",\n \"mode\": 2, // Mode 2 is for ADD.\n \"value\": 0,\n \"priority\": 0\n }]\n };\n const selected = canvas.tokens.controlled;\n // console.log(selected)\n selected.forEach(token => {\n removeNamedEffect(token.actor, effectData);\n })\n }\n}\n\nclearCover();","author":"y5gmtwxmW3A5ZuOP","img":"icons/svg/dice-target.svg","actorIds":[],"_id":"jMQVJVE4PqoyWCQC"}
{"$$deleted":true,"_id":"FSPF5OLBFgcgL0Bk"}
{"$$deleted":true,"_id":"Oq3LxXluV7FLKFuh"}
{"$$deleted":true,"_id":"jMQVJVE4PqoyWCQC"}
{"$$deleted":true,"_id":"8VxGi7VLd4TAY6Zc"}
{"$$deleted":true,"_id":"KWQWBAqL4n7BIEc1"}
Loading

0 comments on commit c43b142

Please sign in to comment.