All user data for FoundryVTT. Includes worlds, systems, modules, and any asset in the "foundryuserdata" directory. Does NOT include the FoundryVTT installation itself.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123 lines
4.2 KiB

1 year ago
  1. Hooks.once("ready", async function () {
  2. if (!game.automatedevocations) {
  3. game.automatedevocations = {};
  4. game.automatedevocations[game.system.id] = {};
  5. }
  6. if(game.system.id == "pf2e"){
  7. game.automatedevocations.pf2e = {
  8. "Forceful Hand":[
  9. {
  10. creature: "Forceful Hand",
  11. number: 1,
  12. animation: "magic1",
  13. },
  14. ],
  15. "Spiritual Weapon":[
  16. {
  17. creature: "Spiritual Weapon",
  18. number: 1,
  19. animation: "magic2",
  20. },
  21. ],
  22. "Summon Animal": (data) => {
  23. let multiplier = -1;
  24. if (data.spellLevel >= 2) multiplier = 1;
  25. if (data.spellLevel >= 3) multiplier = 2;
  26. if (data.spellLevel >= 4) multiplier = 3;
  27. if (data.spellLevel >= 5) multiplier = 5;
  28. if (data.spellLevel >= 6) multiplier = 7;
  29. if (data.spellLevel >= 7) multiplier = 9;
  30. if (data.spellLevel >= 8) multiplier = 11;
  31. if (data.spellLevel >= 9) multiplier = 13;
  32. if (data.spellLevel >= 10) multiplier = 15;
  33. let animals = game.actors
  34. .filter(
  35. (a) =>
  36. a.system.traits.traits.value.includes("animal") &&
  37. a.system.details.level.value <= multiplier
  38. )
  39. .sort((a, b) => {
  40. return a.system.details.level.value < b.system.details.level.value ? 1 : -1;
  41. });
  42. let creatures = [];
  43. for (let animal of animals) {
  44. creatures.push({
  45. creature: animal.name,
  46. number: 1,
  47. });
  48. }
  49. return creatures;
  50. },
  51. "Animate Dead": (data) => {
  52. let multiplier = -1;
  53. if (data.spellLevel >= 2) multiplier = 1;
  54. if (data.spellLevel >= 3) multiplier = 2;
  55. if (data.spellLevel >= 4) multiplier = 3;
  56. if (data.spellLevel >= 5) multiplier = 5;
  57. if (data.spellLevel >= 6) multiplier = 7;
  58. if (data.spellLevel >= 7) multiplier = 9;
  59. if (data.spellLevel >= 8) multiplier = 11;
  60. if (data.spellLevel >= 9) multiplier = 13;
  61. if (data.spellLevel >= 10) multiplier = 15;
  62. let undeads = game.actors
  63. .filter(
  64. (a) =>
  65. a.system.traits.traits.value.includes("undead") &&
  66. a.system.details.level.value <= multiplier
  67. )
  68. .sort((a, b) => {
  69. return a.system.details.level.value < b.system.details.level.value ? 1 : -1;
  70. });
  71. let creatures = [];
  72. for (let undead of undeads) {
  73. creatures.push({
  74. creature: undead.name,
  75. number: 1,
  76. animation: "darkness",
  77. });
  78. }
  79. return creatures;
  80. },
  81. "Summon Lesser Servitor": (data) => {
  82. let servitormultiplier = -1;
  83. if (data.spellLevel == 2) servitormultiplier = 1;
  84. if (data.spellLevel == 3) servitormultiplier = 2;
  85. if (data.spellLevel == 4) servitormultiplier = 3;
  86. let servitors = game.actors
  87. .filter(
  88. (a) =>
  89. (a.system.traits.traits.value.includes("fiend") ||
  90. a.system.traits.traits.value.includes("monitor") ||
  91. a.system.traits.traits.value.includes("celestial")) &&
  92. a.system.details.level.value <= servitormultiplier &&
  93. a.document.type == "npc"
  94. )
  95. .sort((a, b) => {
  96. return a.system.details.level.value < b.system.details.level.value ? 1 : -1;
  97. });
  98. let creatures = [];
  99. for (let servitor of servitors) {
  100. creatures.push({
  101. creature: servitor.name,
  102. number: 1,
  103. animation: "magic2",
  104. });
  105. }
  106. const extraCreatures = ["Raven", "Eagle", "Guard Dog", "Black Bear", "Giant Bat", "Leopard", "Great White Shark", "Tiger"]
  107. let arrayendpoint = 3;
  108. if(data.spellLevel == 2) arrayendpoint = 3;
  109. if(data.spellLevel == 3) arrayendpoint = 6;
  110. if(data.spellLevel >= 4) arrayendpoint = 8;
  111. for(let i=0; i < arrayendpoint;i++) {
  112. creatures.push({
  113. creature: extraCreatures[i],
  114. number: 1,
  115. animation: "magic2",
  116. });
  117. }
  118. return creatures;
  119. },
  120. };
  121. }
  122. game.automatedevocations[game.system.id] = mergeObject(game.automatedevocations[game.system.id],game.settings.get(AECONSTS.MN, "customautospells"))
  123. });