Skip to content

Commit

Permalink
Merge pull request #41 from napolitanod/1.2.7
Browse files Browse the repository at this point in the history
1.2.7
  • Loading branch information
napolitanod authored Jul 27, 2024
2 parents ad7abb7 + 6ce02cb commit 50d13b8
Show file tree
Hide file tree
Showing 8 changed files with 153 additions and 79 deletions.
1 change: 1 addition & 0 deletions languages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"relentless-endurance.label":"Relentless Endurance",
"short-rest.label": "Short Rest",
"taste-of-the-stones.label": "Taste of the Stones",
"voices-from-beyond.label": "Voices from Beyond",
"wild-surge.label": "Wild Surge (Barbarian)",
"witch-bolt.label": "Witch Bolt"
},
Expand Down
5 changes: 2 additions & 3 deletions module.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"author": "napolitanod",
"authors": [
{
"name": "napolitanod"
Expand Down Expand Up @@ -30,8 +29,8 @@
"styles/napolitano-scripts.css"
],
"title": "_Napolitano Scripts",
"version": "1.2.6",
"version": "1.2.7",
"url": "https://github.com/napolitanod/napolitano-scripts",
"manifest": "https://raw.githubusercontent.com/napolitanod/napolitano-scripts/master/module.json",
"download": "https://github.com/napolitanod/napolitano-scripts/releases/download/1.2.6/module.zip"
"download": "https://github.com/napolitanod/napolitano-scripts/releases/download/1.2.7/module.zip"
}
19 changes: 19 additions & 0 deletions scripts/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,11 @@ export const NAPOLITANOCONFIG = {
effects:{pre: {file: 'modules/jb2a_patreon/Library/1st_Level/Sleep/Cloud01_02_Regular_Pink_400x400.webm', scale: 1}},
name: "Sleep"
},
sneakAttack: {
effects: {pre: {file: 'modules/jb2a_patreon/Library/1st_Level/Sneak_Attack/Sneak_Attack_Regular_Blue_300x300.webm', scale: 1, wait: 100}},
name: "Sneak Attack",
prompt: "Use Sneak Attack?"
},
spikeGrowth: {
name: "Spike Growth",
killIn: {minutes: 10}
Expand Down Expand Up @@ -762,6 +767,14 @@ export const NAPOLITANOCONFIG = {
}
}
},
voicesFromBeyond: {
name: "Voices from Beyond",
table: {
compendium: "Napolitano Roll Table",
compendiumBackup: "DDB Roll Table",
name: "Voices from Beyond"
}
},
wardingFlare: {
effects:{pre: {file: 'modules/jb2a_patreon/Library/Generic/Energy/Shimmer01_01_Regular_Orange_400x400.webm', duration: 2000, scale: 2}},
name: "Warding Flare"
Expand Down Expand Up @@ -833,14 +846,18 @@ const LINKDATACATEGORIES = {

export const HOOKEDUSEITEMITEMS = {
'Accursed Specter': 'accursedSpecter',
'Booming Blade': 'boomingBlade',
'Divine Smite': 'divineSmite',
'Feather of Diatryma Summoning': 'featherOfDiatrymaSummoning',
'Figurine of Wondrous Power (Golden Lions)': 'figurineOfWonderousPowerLions',
'Figurine of Wondrous Power (Obsidian Steed)': 'figurineOfWonderousPowerObsidianSteed',
'Fog Cloud': 'fogCloud',
'Grease': 'grease',
'Halo of Spores': 'haloOfSpores',
'Hand Grenade': 'handGrenade',
"Maximilian's Earthen Grasp": 'maximiliansEarthenGrasp',
'Polymorph': 'polymorph',
'Silvery Barbs': 'silveryBarbs',
'Spare the Dying': 'spareTheDying',
'Spike Growth': 'spikeGrowth',
'Symbiotic Entity': 'symbioticEntity',
Expand Down Expand Up @@ -900,7 +917,9 @@ export const CONFIGS = [
{id:"relentless-endurance", name:"Relentless Endurence"},
{id:"shield", name:"Shield (spell)"},
{id:"silvery-barbs", name:"Silvery Barbs"},
{id:"sneak-attack", name:"Sneak Attack"},
{id:"taste-of-the-stones", name:"Taste of the Stones"},
{id:"voices-from-beyond", name:"Voices from Beyond"},
{id:"warding-flare", name:"Warding Flare"},
{id:"wild-surge", name:"Wild Surge"},
{id:"witch-bolt", name:"Witch Bolt"}
Expand Down
13 changes: 11 additions & 2 deletions scripts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ Hooks.once('init', async function() {
type: Boolean,
requiresReload: true
});
game.settings.register(module, "logging", {
name: "Debug",
scope: "world",
config: true,
default: true,
type: Boolean
});
game.settings.register(module, "marker", {
name: game.i18n.localize("Turn Marker"),
hint: game.i18n.localize("Choose turn marker."),
Expand Down Expand Up @@ -236,7 +243,7 @@ Hooks.once("midi-qol.midiReady", () => {
});

HOOKIDS['midi-qol.DamageRollComplete'] = Hooks.on("midi-qol.DamageRollComplete", async (data) => {
const hook = "midi-qol.DamageRollComplete";
const hook = "midi-qol.DamageRollComplete", results = [];;
if(data.item?.name !== "Armor of Agathys" && game.settings.get("napolitano-scripts", "armor-of-agathys")){
workflow.play('armorOfAgathys', data, {hook: hook})
}
Expand Down Expand Up @@ -264,10 +271,12 @@ Hooks.once("midi-qol.midiReady", () => {
if(game.settings.get("napolitano-scripts", "disarming-attack")){
workflow.play('disarmingAttack', data, {hook: hook});
}
if(game.settings.get("napolitano-scripts", "sneak-attack")) results.push(workflow.playAsync('sneakAttack', data, {hook: hook}))
switch(data.item?.name){
case 'Hungry Jaws': if(game.settings.get("napolitano-scripts", "hungry-jaws")) workflow.play('hungryJaws', data, {hook: hook}); break;
case 'Magic Missile': if(data.options?.notCast) await workflow.playAsync('magicMissile', data, {hook: hook}); break;
case 'Magic Missile': if(data.options?.notCast) results.push(workflow.playAsync('magicMissile', data, {hook: hook})); break;
}
await Promise.all(results)
});

HOOKIDS['midi-qol.preApplyDynamicEffects'] = Hooks.on('midi-qol.preApplyDynamicEffects', async function(data){
Expand Down
36 changes: 2 additions & 34 deletions scripts/macros.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ game.napolitano.macros(args, 'createBonfire', _napOps)
case 'bigbysHand': await macro._bigbysHand(); break;
case 'blight': await macro._blight(); break;
case 'blindnessDeafness': await macro._blindnessDeafness(); break;
case 'boomingBlade': await macro._boomingBlade(); break;
case 'brazierOfCommandingFireElementals': await macro._brazierOfCommandingFireElementals(); break;
case 'channelDivinityInvokeDuplicity': await macro._channelDivinityInvokeDuplicity(); break;
case 'chromaticOrb': await macro._chromaticOrb(); break;
Expand All @@ -61,7 +60,6 @@ game.napolitano.macros(args, 'createBonfire', _napOps)
case 'falseLife': await macro._falseLife(); break;
case 'findFamiliar': await macro._findFamiliar(); break;
case 'fireShield': await macro._fireShield(); break;
case 'fogCloud': await macro._fogCloud(); break;
case 'formOfDread': await macro._formOfDread(); break;
case 'gazerEyeRays': await macro._gazerEyeRays(); break;
case 'genericContest': await macro._genericContest(); break;
Expand Down Expand Up @@ -96,7 +94,6 @@ game.napolitano.macros(args, 'createBonfire', _napOps)
case 'shoveToSide': await macro._shove(); break;
case 'shoveBack': await macro._shove(); break;
case 'shoveProne': await macro._shove(); break;
case 'silveryBarbs': await macro._silveryBarbs(); break;
case 'spiritualWeapon': await macro._spiritualWeapon(); break;
case 'stormSphere': await macro._stormSphere(); break;
case 'summonAberration': await macro._summonAberration(); break;
Expand Down Expand Up @@ -268,7 +265,7 @@ game.napolitano.macros(args, 'createBonfire', _napOps)
if(!this.hasHitTargets) return
this.generateEffect(this.firstTarget, {source: this.source.token})
const type = this.getActorType(this.firstTarget)
this.roll = await new Roll(`${type==='plant' ? `${((this.spellLevel+4) * 8)}d1` : `${this.spellLevel+4}d8`}`).evaluate({async: true});
this.roll = await new Roll(`${type==='plant' ? `${((this.spellLevel+4) * 8)}d1` : `${this.spellLevel+4}d8`}`).evaluate();
const saveRoll = await this.firstTarget.actor.rollAbilitySave("con", {flavor: `${CONFIG.DND5E.abilities["con"].label} DC ${this.sourceData.spelldc} Blight`, fastforward: true, disadvantage: type==='plant' ? true : false })
if (["undead", "construct"].includes(type)) return this.message(`${this.firstTarget.name} resists the blight because they are a ${type}`, {title: 'Blight Resisted', whisper: "GM"});
await this.damage({type: "necrotic", targets: [this.firstTarget], half: saveRoll.total >= this.sourceData.spelldc ? true : false})
Expand All @@ -280,19 +277,6 @@ game.napolitano.macros(args, 'createBonfire', _napOps)
if(choice) await this.addActiveEffect({effectName: `${choice}ed Spell`, uuid: this.firstTarget.actor.uuid, origin: this.source.actor.uuid})
}

async _boomingBlade(){
const weapons = this.source.actor.items.filter(i => i.type === 'weapon' && i.system.actionType === 'mwak')
const choice = await this.choose(weapons.map(w => [w.id, w.name]), 'Choose the weapon to make the booming blade attack with.', `${this.name} choose weapon`)
const item = weapons.find(w => w.id === choice)
let result
if(item) result = await this.useItem(item)
if(result.hitTargets.size){
const target = result.hitTargets.values().next().value
if(target && this.cantripScale > 1) await this.damage({targets: [target], dice: `${this.cantripScale - 1}d8`, type: 'thunder'})
await this.addActiveEffect({effectName: 'Booming Blade', uuid: target.actor.uuid, origin: this.source.actor.uuid})
}
}

async _brazierOfCommandingFireElementals(){
await this.summon();
this.message( `${this.name} speaks the brazier’s command word and summons a fire elemental.`, {title: this.item.name})
Expand Down Expand Up @@ -765,16 +749,6 @@ game.napolitano.macros(args, 'createBonfire', _napOps)
const choice = await this.choose(['Warm', 'Chill'], 'Choose shield type.', 'Fire Shield', {owner: this.sourceData.owner, img: this.item.img})
if(choice) await this.addActiveEffect({effectName: `Fire Shield - ${choice}`, uuid: this.source.actor.uuid, origin: this.source.actor.uuid})
}

async _fogCloud(){
this.summonData.updates = {
token: {
height: 8 * this.spellLevel,
width: 8 * this.spellLevel
}
}
await this.summon();
}

async _formOfDread(){
const tempHp = 10 + this.sourceData.warlockLevel
Expand Down Expand Up @@ -1315,12 +1289,6 @@ game.napolitano.macros(args, 'createBonfire', _napOps)
}
}

async _silveryBarbs(){
const response = await this.promptTarget({title: 'Silvery Barbs Advantage', origin: this.source.actor.uuid, owner: this.sourceData.owner, event: 'Grant Silvery Barbs Advantage', prompt: `Select a target to grant advantage to on their next attack roll, saving throw or ability check.`})
const target = this.scene.tokens.find(t => t.id === response.targets[0])
if(target) this.addActiveEffect({effectName: 'Silvery Barbs Advantage', origin: response.origin, uuid: target.actor.uuid})
}

async _spiritualWeapon(){//tested v10
const weapon = await this.choose([['sword', 'Sword'], ['mace', 'Mace'], ['scythe', 'Scythe'], ['maul', 'Maul']] , 'Choose the form the spectral weapon takes:', 'Weapon Type')
const color = await this.choose([['blue', 'Blue'], ['green', 'Green'], ['orange', 'Orange'], ['purple', 'Purple'], ['red', 'Red']], 'Choose the color of the weapon', 'Weapon Color')
Expand Down Expand Up @@ -1600,7 +1568,7 @@ game.napolitano.macros(args, 'createBonfire', _napOps)

async _tollTheDead(){
if (!this.failedSaves.size) return
this.roll = await new Roll(`${this.cantripScale}d${this.hasMaxHP(this.firstFailedSave) ? 8 : 12}[${"necrotic"}]`).evaluate({async: true});
this.roll = await new Roll(`${this.cantripScale}d${this.hasMaxHP(this.firstFailedSave) ? 8 : 12}[${"necrotic"}]`).evaluate();
await this.damage({type: "necrotic", critical: this.isCritical})
}

Expand Down
5 changes: 2 additions & 3 deletions scripts/napolitano-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ export class napolitano {
* @param {...any} args - what to log
*/
static log(force, ...args) {
const shouldLog = true//force || game.modules.get('_dev-mode')?.api?.getPackageDebugValue(this.ID);

if (shouldLog) {

if (force || (game.user.isGM && game.settings.get(napolitano.ID, 'logging'))) {
console.log(this.ID, '|', ...args);
}
}
Expand Down
1 change: 1 addition & 0 deletions scripts/tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ const OVERRIDES = {
,'Form of Dread: Transform': 'Roll this item to apply the effect to your token. You will be prompted automatically when saving throw opportunity arises during an attack.'
,'Green-Flame Blade': 'Roll this item before making a melee weapon attack. On your next melee attack you will then gain the benefits of this spell and you will be prompted for any spreading damage.'
,'Halo of Spores': "No roll required. You will be prompted to use this ability when the opportunity arises and if you haven't yet used this reaction since your last turn."
,"Hand Grenade": "Roll this item to place template within 30 feet range."
,"Hexblade's Curse": "Target a creature and then roll this item. The curse will be automatically accounted for when you roll attacks and damage."
,'Improved Flare': 'For each attack made against a friendly create not you, you will be prompted as to whether or not you wish to use your warding flare. Confirming that you wish to use will apply the disadvantage to the attack roll. Disable or enable the prompt by toggling the active effect for this item.' ,'Maneuvers: Disarming Attack': 'Roll item to indicate your desire to use disarming attack on your next hit. This will mark your token. On your next damage roll disarming attack will be invoked and at that time your superiority die will be used.'
,'Magic Missile': 'Target a creature then roll item. You will then be prompted to select the remainder of the available targets (based on spell level) one at a time.'
Expand Down
Loading

0 comments on commit 50d13b8

Please sign in to comment.