diff --git a/lang/en.json b/lang/en.json index 85fc0ce..f46638f 100644 --- a/lang/en.json +++ b/lang/en.json @@ -233,8 +233,6 @@ "AddInventory": "Loot", "AddConsumable": "Consumable", - "Recharge": "Recharge", - "NCharged": "Not charged", "Costs": "Costs", "ResourceRefresh": "Day", diff --git a/lang/fr.json b/lang/fr.json index ef6e2db..8342db5 100644 --- a/lang/fr.json +++ b/lang/fr.json @@ -233,8 +233,6 @@ "AddInventory": "Trésor", "AddConsumable": "Consommable", - "Recharge": "Recharge", - "NCharged": "Pas chargé", "Costs": "Coûts", "ResourceRefresh": "Jour", diff --git a/lang/ja.json b/lang/ja.json index 12f384d..713c076 100644 --- a/lang/ja.json +++ b/lang/ja.json @@ -233,8 +233,6 @@ "AddInventory": "戦利品", "AddConsumable": "消耗品", - "Recharge": "再チャージ", - "NCharged": "チャージ失敗", "Costs": "コスト", "ResourceRefresh": "日", diff --git a/lang/pt-BR.json b/lang/pt-BR.json index 5c9a27f..e7ca146 100644 --- a/lang/pt-BR.json +++ b/lang/pt-BR.json @@ -233,8 +233,6 @@ "AddInventory": "Inventário", "AddConsumable": "Consumível", - "Recharge": "Recarga", - "NCharged": "Não carregada", "Costs": "Custa", "ResourceRefresh": "Dia", diff --git a/monsterblock.css b/monsterblock.css index 8746726..4abe9c0 100644 --- a/monsterblock.css +++ b/monsterblock.css @@ -238,13 +238,13 @@ } .monsterblock .item-attackRoll:hover, .monsterblock .item-damageRoll:hover, +.monsterblock .item-recharge:hover, .monsterblock .ability:hover, .monsterblock .saving-throw:hover, .monsterblock .skill:hover, .monsterblock .item-name:hover, .monsterblock .spell:hover, .monsterblock a.inline-roll:hover, -.monsterblock [data-roll-formula]:hover, .monsterblock .window-content a:hover, .monsterblock .tweak-menu ul label:hover, .monsterblock .menu .menu-toggle:hover { @@ -706,6 +706,9 @@ li:nth-last-of-type(2):after { .monsterblock .spell .name-extension { font-weight: initial; } +.monsterblock .item-recharge { + color: var(--heading-color); +} .monsterblock .legendary-actions .feature-description { padding-left: 2ch; text-indent: -2ch; @@ -1120,4 +1123,4 @@ li:nth-last-of-type(2):after { } .monsterblock .flavor-text > p { padding: 0 1ch; -} +} \ No newline at end of file diff --git a/scripts/dnd5e/MonsterBlock5e.js b/scripts/dnd5e/MonsterBlock5e.js index 174283d..31a1fbe 100644 --- a/scripts/dnd5e/MonsterBlock5e.js +++ b/scripts/dnd5e/MonsterBlock5e.js @@ -703,42 +703,6 @@ export default class MonsterBlock5e extends ActorSheet5eNPC { }).render(true); }); - html.find("[data-roll-formula]").click(async (event) => { // Universal way to add an element that provides a roll, just add the data attribute "data-roll-formula" with a formula in it, and this applies. - event.preventDefault(); // This handler makes "quick rolls" possible, it just takes some data stored on the HTML element, and rolls dice directly. - event.stopPropagation(); - - const formula = event.currentTarget.dataset.rollFormula; - const target = event.currentTarget.dataset.rollTarget; - const success = event.currentTarget.dataset.rollSuccess; - const failure = event.currentTarget.dataset.rollFailure; - const handler = event.currentTarget.dataset.rollHandler; - let flavor = event.currentTarget.dataset.rollFlavor; // Optionally, you can include data-roll-flavor to add text to the message. - - let roll; - try { - roll = new Roll(formula); - await roll.roll({ async: true }); - } - catch (e) { - console.error(e); - ui.notifications.error(e); - roll = new Roll("0"); - await roll.roll({ async: true }); - } - - if (target) { - let s = roll.total >= parseInt(target, 10); - if (handler) this[handler](s, event); - - flavor += `${s ? success : failure}`; - } - - roll.toMessage({ // Creates a new Roll, rolls it, and sends the result as a message - flavor: flavor, // Including the text as defined - speaker: ChatMessage.getSpeaker({actor: this.actor})// And setting the speaker to the actor this sheet represents - }); - }); - // Special Roll Handlers html.find(".ability").click(async (event) => { event.preventDefault(); @@ -774,6 +738,13 @@ export default class MonsterBlock5e extends ActorSheet5eNPC { else return item.roll(); // Conveniently, items have all this logic built in already. }); + html.find(".item-recharge").click(async (event) => { + event.preventDefault(); + + const item = this.actor.items.get(event.currentTarget.dataset.itemId); + item.rollRecharge(); + }); + // uses the built in attack roll from the item html.find(".item-attackRoll").click(async (event) => { event.preventDefault(); @@ -1141,22 +1112,6 @@ export default class MonsterBlock5e extends ActorSheet5eNPC { await this.render(true); } - /** - * - * - * @param {boolean} success - Whether or not the roll was a success. - * @param {Event} event - The event object associated with this roll. - * @memberof MonsterBlock5e - */ - async setCharged(success, event) { - await this.actor.updateEmbeddedDocuments("Item", [{ - _id: event.currentTarget.dataset.itemId, - "data.recharge.charged": success - }]) - - super._onChangeInput(event); - } - static isMultiAttack(item) { // Checks if the item is the multiattack action. let name = item.name.toLowerCase().replace(/\s+/g, ""); // Convert the name of the item to all lower case, and remove whitespace. return getTranslationArray("MOBLOKS5E.MultiattackLocators").some(loc => name.includes(loc)); diff --git a/templates/dnd5e/parts/featureBlock.hbs b/templates/dnd5e/parts/featureBlock.hbs index 3eea6c4..60f9b7e 100644 --- a/templates/dnd5e/parts/featureBlock.hbs +++ b/templates/dnd5e/parts/featureBlock.hbs @@ -10,15 +10,8 @@ {{~item.name~}} {{~#if item.data.recharge.value~}} - - ({{localize "MOBLOKS5E.Recharge"}} {{item.data.recharge.value}}-6){{~" "~}} + + ({{localize "DND5E.Recharge"}} {{item.data.recharge.value}}-6){{~" "~}} {{~/if~}} {{~#if (and item.is.legendary (gt item.data.activation.cost 1))~}}