You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It assumes the caster is WIS-based rather than using the actual spellcasting attribute.
It does not set the "Magical" property on the empowered weapon.
This code fixes both of those issues. (It saves the pre-existing set of properties before forcibly setting Magical to true. Upon revert to normal, all the original props will be restored. So if the weapon was Magical pre-spell, it will remain Magical post-spell.)
constversion="10.0.13";try{constlastArg=args[args.length-1];letweapons=actor.items.filter(i=>i.type===`weapon`&&["club","quarterstaff"].includes(i.system.baseItem));letweapon_content=``;for(letweaponofweapons){weapon_content+=`<option value=${weapon.id}>${weapon.name}</option>`;}if(args[0]==="on"){letcontent=` <div class="form-group"> <label>Weapons : </label> <select name="weapons">${weapon_content} </select> </div>`;newDialog({title: "Choose a club or quarterstaff",
content,buttons:
{Ok:
{label: `Ok`,callback: (html)=>{letitemId=html.find('[name=weapons]')[0].value;letweaponItem=actor.items.get(itemId);letcopy_item=duplicate(weaponItem.toObject(false));DAE.setFlag(actor,`shillelagh`,{id : itemId,damage : copy_item.system.damage.parts[0][0],props: copy_item.system.properties});letdamage=copy_item.system.damage.parts[0][0];varnewdamage=damage.replace(/1d(4|6)/g,"1d8");copy_item.system.damage.parts[0][0]=newdamage;copy_item.system.ability=actor.system.attributes.spellcasting;copy_item.system.properties["mgc"]=true;actor.updateEmbeddedDocuments("Item",[copy_item]);ChatMessage.create({content: copy_item.name+" is empowered"});}},Cancel:
{label: `Cancel`}}}).render(true);}if(args[0]==="off"){letflag=DAE.getFlag(actor,`shillelagh`);letweaponItem=actor.items.get(flag.id);letcopy_item=duplicate(weaponItem.toObject(false));copy_item.system.damage.parts[0][0]=flag.damage;copy_item.system.properties=flag.props;copy_item.system.ability="";awaitactor.updateEmbeddedDocuments("Item",[copy_item]);DAE.unsetFlag(actor,`shillelagh`);ChatMessage.create({content: copy_item.name+" returns to normal"});}}catch(err){console.error(`Shillelagh ${version}`,err);}
The text was updated successfully, but these errors were encountered:
The Shillelagh macro v10.0.13 has two issues:
This code fixes both of those issues. (It saves the pre-existing set of properties before forcibly setting Magical to true. Upon revert to normal, all the original props will be restored. So if the weapon was Magical pre-spell, it will remain Magical post-spell.)
The text was updated successfully, but these errors were encountered: