From 13ac48b9c3e932054733bf4a871e486ebb4145fc Mon Sep 17 00:00:00 2001 From: bb46003 <109553236+bb46003@users.noreply.github.com> Date: Sat, 24 Feb 2024 16:39:04 +0100 Subject: [PATCH 01/11] Update system.json --- system/system.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/system.json b/system/system.json index 3b1d0df2..16a46267 100644 --- a/system/system.json +++ b/system/system.json @@ -218,7 +218,7 @@ ], "socket": true, "url": "https://github.com/Muttley/foundryvtt-fallout", - "manifest": "https://raw.githubusercontent.com/Muttley/foundryvtt-fallout/main/system/system.json", - "download": "https://github.com/Muttley/foundryvtt-fallout/releases/latest/download/fallout.zip", + "manifest": "https://raw.githubusercontent.com/bb46003/foundryvtt-fallout/develop/system/system.json", + "download": "https://github.com/bb46003/foundryvtt-fallout/archive/refs/heads/develop.zip", "background": "systems/fallout/assets/images/please-stand-by.webp" } From ddb0fb3e5b61a41d25f96f34d8e9bf6e45372d12 Mon Sep 17 00:00:00 2001 From: BartlomiejBielecki Date: Tue, 14 May 2024 12:18:27 +0200 Subject: [PATCH 02/11] upadte 2d20 roll and damage roll change for 2d20 roll : - add automatization for buing d20 dice including PC and GM, allow to buy dice for GM AP - add button for assistance, always will roll 1d20 - reduce ammo for GM (option i settings) - reduce 10 amo for gatling guns change for damage roll : - for guns fire rate can be add at begining of rolling, read weapon property and chcek if we have enough amo to shoot more bullet - for mele/unarmed can spend max 3 AP for PC and GM - reduce AP if avaliable for both PC and GM - for PC buy from GM, with notification, add to GM AP automaticaly - add button from chat read weapon fire rate and chcek avaliable amo --- i18n/en.yaml | 17 + i18n/pl.yaml | 19 +- scss/global/_window.scss | 32 +- system/src/roller/Dialog2d20.mjs | 427 +++++++++++++++++++- system/src/roller/DialogD6.mjs | 336 ++++++++++++--- system/src/roller/Roller2D20.mjs | 18 +- system/src/settings.mjs | 8 + system/src/sheets/FalloutBaseActorSheet.mjs | 47 ++- system/src/system/FalloutChat.mjs | 2 +- system/templates/dialogs/dialog2d20.hbs | 67 +-- 10 files changed, 860 insertions(+), 113 deletions(-) diff --git a/i18n/en.yaml b/i18n/en.yaml index 60ec1713..8ac6e83f 100644 --- a/i18n/en.yaml +++ b/i18n/en.yaml @@ -474,10 +474,16 @@ FALLOUT.TOOLTIPS.WeaponQuality.unreliable: When you make an attack with an Unrel FALLOUT.TOOLTIPS.WeaponQuality.unstable_radiation: This was never designed to be used as a handheld weapon. When attacking with a weapon, each complication you inflicts 2DC Radiation damage from radioactive feedback. A weapon may not have both Reliable and Unstable Radiation. FALLOUT.UI.Add: Add FALLOUT.UI.Addictions: Addictions +FALLOUT.UI.Additionalamo: Additional damage dice from firerate +FALLOUT.UI.Additionalmeledmg: Additional damage dice for party AP +FALLOUT.UI.AdditionalmeledmgOverseer: Additional damage dice for overseer AP FALLOUT.UI.APPAREL_MODS: Apparel Mods FALLOUT.UI.AreYouSure: Are You Sure? +FALLOUT.UI.ASSISTANCE: Assistance FALLOUT.UI.BaseDamage: Base Damage +FALLOUT.UI.Bonusdmg: Additionad damage dice FALLOUT.UI.BOOKS_AND_MAGZS: Books and Magazines +FALLOUT.UI.Buy_from_Overseer: Buy from Overseer FALLOUT.UI.Cancel: Cancel FALLOUT.UI.CAPS: Caps FALLOUT.UI.CarryWeight: Carry Weight @@ -491,23 +497,34 @@ FALLOUT.UI.Cost: Cost FALLOUT.UI.Damage: Damage FALLOUT.UI.DISEASES: Diseases FALLOUT.UI.favorite: Favorite +FALLOUT.UI.FREED20: Free additional dice FALLOUT.UI.INVENTORY: Inventory FALLOUT.UI.MISCELLANY: Miscellany FALLOUT.UI.Name: Name +FALLOUT.UI.Not_Enough: Not Enough FALLOUT.UI.OTHER: Other FALLOUT.UI.Perks: Perks FALLOUT.UI.Qty: Qty FALLOUT.UI.Quantity: Quantity FALLOUT.UI.Rarity: Rarity +FALLOUT.UI.REGULAR: Regular +FALLOUT.UI.PAYAP1: Pay 1AP +FALLOUT.UI.PAYAP3: Pay 3AP +FALLOUT.UI.PAYAP6: Pay 6AP FALLOUT.UI.ROBOT_MODULES: Robot Modules +FALLOUT.UI.Roll: Roll FALLOUT.UI.SaveChanges: Save Changes FALLOUT.UI.Special_Abilities: Special Abilities FALLOUT.UI.SPECIAL_ABILITY: Special Ability +FALLOUT.UI.Spend_AP: Spend AP +FALLOUT.UI.Spend_Overseer_AP: Spend Overseer AP FALLOUT.UI.stashed: Stashed FALLOUT.UI.Type: Type FALLOUT.UI.UNSORTED: Unsorted +FALLOUT.UI.Weapondamagedice: Damage dice from weapon FALLOUT.UI.WEAPON_MODS: Weapon Mods FALLOUT.UI.Weight: Weight +FALLOUT.UI.With: With FALLOUT.UI.Yes: Yes FALLOUT.WEAPONS.damageEffect.arc: Arc FALLOUT.WEAPONS.damageEffect.breaking: Breaking diff --git a/i18n/pl.yaml b/i18n/pl.yaml index ca10295c..0f332ec8 100644 --- a/i18n/pl.yaml +++ b/i18n/pl.yaml @@ -474,10 +474,16 @@ FALLOUT.TOOLTIPS.WeaponQuality.unreliable: Kiedy wykonujesz atak taką bronią, FALLOUT.TOOLTIPS.WeaponQuality.unstable_radiation: To nigdy nie było przeznaczone do użycia jako broń ręczna. Kiedy atakujesz bronią, każda komplikacja, którą zadajesz, zadaje 2KW obrażeń od promieniowania w wyniku radioaktywnego sprzężenia zwrotnego. Broń nie może posiadać zarówno stabilnego, jak i niestabilnego promieniowania. FALLOUT.UI.Add: Dodaj FALLOUT.UI.Addictions: Uzależnienia +FALLOUT.UI.Additionalamo: Dodatkowe kości obrażeń z szybkoszczelność +FALLOUT.UI.Additionalmeledmg: Dodatkowe kości obrażeń za PA Drużyny +FALLOUT.UI.AdditionalmeledmgOverseer: Dodatkowe kości obrażeń za PA Nadzorcy FALLOUT.UI.APPAREL_MODS: Modyfikacje Odzieży FALLOUT.UI.AreYouSure: Jesteś pewien? -FALLOUT.UI.BaseDamage: Base Damage +FALLOUT.UI.ASSISTANCE: Pomoc +FALLOUT.UI.BaseDamage: Kośći obrażeń broni +FALLOUT.UI.Bonusdmg: Dodatkowe kości obrażeń FALLOUT.UI.BOOKS_AND_MAGZS: Książki i Czasopisma +FALLOUT.UI.Buy_from_Overseer: Kup PA od Nadzordy FALLOUT.UI.Cancel: Anuluj FALLOUT.UI.CAPS: Kapsle FALLOUT.UI.CarryWeight: Noszony ciężar @@ -491,23 +497,34 @@ FALLOUT.UI.Cost: Cena FALLOUT.UI.Damage: Obrażenia FALLOUT.UI.DISEASES: Choroby FALLOUT.UI.favorite: Ulubiony +FALLOUT.UI.FREED20: Darmowa dodatkowa kość FALLOUT.UI.INVENTORY: Ekwipunek FALLOUT.UI.MISCELLANY: Rozmaitości FALLOUT.UI.Name: Nazwa +FALLOUT.UI.Not_Enough: Nie wystarczająco FALLOUT.UI.OTHER: Inne FALLOUT.UI.Perks: Profity FALLOUT.UI.Qty: Ilość FALLOUT.UI.Quantity: Ilość FALLOUT.UI.Rarity: Rzadkość +FALLOUT.UI.REGULAR: Podstawowy +FALLOUT.UI.PAYAP1: Wydaj 1 PA +FALLOUT.UI.PAYAP3: Wydaj 3 PA +FALLOUT.UI.PAYAP6: Wydaj 6 PA FALLOUT.UI.ROBOT_MODULES: Modyfikacje Robotów +FALLOUT.UI.Roll: Rzuć FALLOUT.UI.SaveChanges: Zapisz zmiany FALLOUT.UI.Special_Abilities: Zdolności Specjalne FALLOUT.UI.SPECIAL_ABILITY: Zdolności Specjalne +FALLOUT.UI.Spend_AP: Wydaj PA +FALLOUT.UI.Spend_Overseer_AP: Wydaj PA Nazorcy FALLOUT.UI.stashed: Schowane FALLOUT.UI.Type: Typ FALLOUT.UI.UNSORTED: Nieposortowane +FALLOUT.UI.Weapondamagedice: Kości obrażeń z bronii FALLOUT.UI.WEAPON_MODS: Modyfikacje Broni FALLOUT.UI.Weight: Waga +FALLOUT.UI.With: Z FALLOUT.UI.Yes: Yes FALLOUT.WEAPONS.damageEffect.arc: Łuk FALLOUT.WEAPONS.damageEffect.breaking: Niszczące diff --git a/scss/global/_window.scss b/scss/global/_window.scss index f9e11ced..9bd569b9 100644 --- a/scss/global/_window.scss +++ b/scss/global/_window.scss @@ -1,7 +1,11 @@ .window-app { font-family: $font-primary; -} +} +.window-app .flexrow.fallout-dialog { + overflow-y: visible; + overflow-x: visible; +} .font-primary { font-family: $font-primary; } @@ -146,6 +150,9 @@ margin: 0 2px 5px; padding: 0 5px 0 0; background-color: $f-blue; + display: grid; + grid-template-rows: auto auto; + grid-template-columns: repeat(6, auto); &.tile { background-color: $f-tile; } @@ -342,3 +349,26 @@ cursor: pointer; } } +select.fire-rate-select { + background: beige; + } + .pulsing-text { + animation: pulse 1s infinite alternate; + color: red; + padding: 5px; + font-family: "Lobster", cursive; + text-align: center; +} + +@keyframes pulse { + from { + opacity: 1; + } + to { + opacity: 0.5; + } +} +.flexrow.resource.pulsing { + grid-column: 1 / -1; + place-self: center; +} diff --git a/system/src/roller/Dialog2d20.mjs b/system/src/roller/Dialog2d20.mjs index e19aac83..91239da7 100644 --- a/system/src/roller/Dialog2d20.mjs +++ b/system/src/roller/Dialog2d20.mjs @@ -10,6 +10,8 @@ export class Dialog2d20 extends Dialog { rollLocation, actor, item, + ap, + apcost, dialogData={}, options={} ) { @@ -23,6 +25,8 @@ export class Dialog2d20 extends Dialog { this.rollLocation = rollLocation; this.actor = actor; this.item = item; + this.ap = ap; + this.apcost = apcost; this.options.classes = ["dice-icon"]; this.deferred = new Deferred(); } @@ -32,14 +36,72 @@ export class Dialog2d20 extends Dialog { html.ready(e => { this.markDiceNumber(html, this.diceNum); + if (this.actor.type !== "character" && this.actor.type !== "robot") { + this.gmroll(html); + } + this.freed20(html); }); html.on("click", ".dice-icon", (e, i, a) => { let index = e.currentTarget.dataset.index; this.diceNum = parseInt(index); this.markDiceNumber(html, this.diceNum); + if (this.actor.type === ("character" || "robot")) { + this.apmanagment(html); + } + else { + this.gmapmanagment(html); + } + }); - this.data.buttons.roll.callback=this.rollButton.bind(this); + html.on("click", '[name="freed20"]', () => { + this.freed20(html); + let numberofdice = 0; + for (let i = 2; i <= 5; i++) { + const diceElement =this.element.find(`[data-index="${i}"]`); + const containsMarked = diceElement.hasClass("marked"); + if (containsMarked) { + numberofdice = i; + } + } + if (this.actor.type === ("character" || "robot")) { + this.apmanagment(html, numberofdice); + } + else { + this.gmapmanagment(html, numberofdice); + } + + }); + html.on("click", () => { + if (this.actor.type === ("character" || "robot")) { + let ap = game.settings.get("fallout", "partyAP"); + this.element.find('[name="current_ap"]').val(ap); + this.apmanagment(html); + } + else { + let ap = game.settings.get("fallout", "gmAP"); + this.element.find('[name="current_ap"]').val(ap); + this.gmapmanagment(html); + } + }); + + + this.data.buttons.roll.callback = () => { + if (this.actor.type === ("character" || "robot")) { + let ap = game.settings.get("fallout", "partyAP"); + this.element.find('[name="current_ap"]').val(ap); + this.apmanagment(html); + } + else { + let ap = game.settings.get("fallout", "gmAP"); + this.element.find('[name="current_ap"]').val(ap); + this.gmapmanagment(html); + } + + this.rollButton(this); + }; + + this.data.buttons.help.callback=this.AssistanceButton.bind(this); } rollButton() { @@ -47,11 +109,20 @@ export class Dialog2d20 extends Dialog { let skill = this.element.find('[name="skill"]').val(); let complication = this.element.find('[name="complication"]').val(); let isTag = this.element.find('[name="tag"]').is(":checked"); - + let apspend = this.element.find('[name="spend_ap"]').val(); + let apbuy = parseInt(this.element.find('[name="by_from_gm"]').val()); this.rolling = true; + let numberofdice = 0; + for (let i = 2; i <= 5; i++) { + const diceElement =this.element.find(`[data-index="${i}"]`); + const containsMarked = diceElement.hasClass("marked"); + if (containsMarked) { + numberofdice = i; + } + } fallout.Roller2D20.rollD20({ rollname: this.rollName, - dicenum: this.diceNum, + dicenum: numberofdice, attribute: attr, skill: skill, tag: isTag, @@ -59,19 +130,104 @@ export class Dialog2d20 extends Dialog { rollLocation: this.rollLocation, item: this.item, actor: this.actor, + apspend: apspend, + apbuy: apbuy, + }).then(result => this.deferred.resolve(result)); + + let ap = game.settings.get("fallout", "partyAP"); + let gmap = parseInt(game.settings.get("fallout", "gmAP")); + + if (apbuy>0) { + ap = 0; + fallout.APTracker.setAP("partyAP", ap); + let givegmap = apbuy + gmap; + fallout.APTracker.setAP("gmAP", givegmap); + } + else { + // eslint-disable-next-line no-lonely-if + if (this.actor.type === ("character" || "robot")) { + let leftpartyap = ap - apspend; + fallout.APTracker.setAP("partyAP", leftpartyap); + } + else { + let leftpartyap = gmap - apspend; + fallout.APTracker.setAP("gmAP", leftpartyap); + } + + } + if (game.settings.get("fallout", "automaticAmmunitionCalculation")) { + + // REDUCE AMMO + if (this.actor && this.item?.system.ammo !== "" ) { + try { + if (this.item.system.damage.weaponQuality.gatling.value === true) { + this.actor.reduceAmmo( + this.item.system.ammo, + this.item.system.ammoPerShot*10 + ); + + } + else { + this.actor.reduceAmmo( + this.item.system.ammo, + this.item.system.ammoPerShot + ); + } + } + catch(er) { + console.warn(er); + } + } + } + } + + AssistanceButton() { + let attr = this.element.find('[name="attribute"]').val(); + let skill = this.element.find('[name="skill"]').val(); + let complication = this.element.find('[name="complication"]').val(); + let apbuy = this.element.find('[name="by_from_gm"]').val(); + let apspend = this.element.find('[name="spend_ap"]').val(); + let isTag = this.element.find('[name="tag"]').is(":checked"); + this.rolling = true; + let nameroll = ""; + if (this.item !== null) { + nameroll = `${game.i18n.localize("FALLOUT.UI.ASSISTANCE")} ${game.i18n.localize("FALLOUT.UI.With")} ${game.i18n.localize("TYPES.Item.weapon").toLowerCase()} ${this.rollName}`; + } + else { + nameroll = `${game.i18n.localize("FALLOUT.UI.ASSISTANCE")} ${game.i18n.localize("FALLOUT.UI.With")} ${game.i18n.localize("TYPES.Item.skill").toLowerCase()} ${this.rollName}`; + } + fallout.Roller2D20.rollD20({ + rollname: nameroll, + dicenum: 1, + attribute: attr, + skill: skill, + tag: isTag, + complication: complication, + rollLocation: this.rollLocation, + item: this.item, + actor: this.actor, + apspend: apspend, + apbuy: apbuy, }).then(result => this.deferred.resolve(result)); if (game.settings.get("fallout", "automaticAmmunitionCalculation")) { - const actorType = this.actor?.type; - if (actorType !== "character" && actorType !== "robot") return; // REDUCE AMMO if (this.actor && this.item?.system.ammo !== "") { try { - this.actor.reduceAmmo( - this.item.system.ammo, - this.item.system.ammoPerShot - ); + if (this.item.system.damage.weaponQuality.gatling.value === true) { + this.actor.reduceAmmo( + this.item.system.ammo, + this.item.system.ammoPerShot*10 + ); + + } + else { + this.actor.reduceAmmo( + this.item.system.ammo, + this.item.system.ammoPerShot + ); + } } catch(er) { console.warn(er); @@ -87,12 +243,240 @@ export class Dialog2d20 extends Dialog { } } - markDiceNumber(html) { - $(html).find(".dice-icon").removeClass("marked"); - $(html).find(`[data-index="${this.diceNum}"]`).addClass("marked"); + markDiceNumber(html, numberofdice, gmerror) { + let nextdice; + let markeddice = 0; + for (let i = 2; i <= 5; i++) { + const diceElement =this.element.find(`[data-index="${i}"]`); + const containsMarked = diceElement.hasClass("marked"); + if (containsMarked) { + markeddice = i; + } + } + if ((numberofdice === 2 || ($(html).find('[name="freed20"]').is(":checked") && numberofdice === 3)) && markeddice === numberofdice) { + const diceElement = $(html).find(`[data-index="${numberofdice}"]`); + diceElement.addClass("marked"); + } + else { + const currentdice = $(html).find(`[data-index="${numberofdice}"]`).hasClass("marked"); + if (numberofdice+1 >5) { + nextdice = false; + } + else { + nextdice = $(html).find(`[data-index="${numberofdice + 1}"]`).hasClass("marked"); + } + for (let i = 2; i <= 5; i++) { + const diceElement = $(html).find(`[data-index="${i}"]`); + if (i<=this.diceNum && currentdice === false) { + diceElement.addClass("marked"); + } + if (i> this.diceNum && nextdice === true) { + diceElement.removeClass("marked"); + } + if (i === this.diceNum && nextdice === false && currentdice === true) { + diceElement.removeClass("marked"); + } + } + } + if (gmerror) { + let i = 0; + if ($(html).find('[name="freed20"]').is(":checked") ) { + i = 4; + } + else { + i = 3; + } + for (i; i <= 5; i++) { + const diceElement = $(html).find(`[data-index="${i}"]`); + diceElement.removeClass("marked"); + } + + } + } + + + freed20(html) { + const regular = game.i18n.localize("FALLOUT.UI.REGULAR"); + const pay1ap = game.i18n.localize("FALLOUT.UI.PAYAP1"); + const pay3ap = game.i18n.localize("FALLOUT.UI.PAYAP3"); + const pay6ap = game.i18n.localize("FALLOUT.UI.PAYAP6"); + const li2d20 = document.querySelector('[name="2d20"]'); + let numberofdice = 0; + for (let i = 2; i <= 5; i++) { + const diceElement =this.element.find(`[data-index="${i}"]`); + const containsMarked = diceElement.hasClass("marked"); + if (containsMarked) { + numberofdice = i; + } + } + + if ($(html).find('[name="freed20"]').is(":checked")) { + li2d20.style.display = "none"; + $(html).find("ul[name='currentap'] li:nth-child(2) label").text(regular); + if (numberofdice === 2) { + $(html).find("[data-index= 3]").addClass("marked"); + } + $(html).find("ul[name='currentap'] li:nth-child(3) label").text(pay1ap); + $(html).find("ul[name='currentap'] li:nth-child(4) label").text(pay3ap); + } + else { + li2d20.style.display = ""; + $(html).find("ul[name='currentap'] li:nth-child(1) label").text(regular); + $(html).find("ul[name='currentap'] li:nth-child(2) label").text(pay1ap); + $(html).find("ul[name='currentap'] li:nth-child(3) label").text(pay3ap); + $(html).find("ul[name='currentap'] li:nth-child(4) label").text(pay6ap); + if (numberofdice === 3) { + $(html).find("[data-index= 3]").removeClass("marked"); + } + + } + } + + apmanagment(html) { + let apcostd = 0; + let left = 0; + let numberofdice = 0; + let ap =this.element.find('[name="current_ap"]').val(); + for (let i = 2; i <= 5; i++) { + const diceElement = $(html).find(`[data-index="${i}"]`); + const containsMarked = diceElement.hasClass("marked"); + if (containsMarked) { + numberofdice = i; + } + } + if ($(html).find('[name="freed20"]').is(":checked")) { + switch (numberofdice) { + case 2: + apcostd = 0; + $(html).find('[name="by_from_gm"]').val(0); + break; + case 3: + apcostd = 0; + $(html).find('[name="by_from_gm"]').val(0); + break; + case 4: + apcostd = 1; + left = ap - apcostd; + break; + case 5: + apcostd = 3; + left = ap - apcostd; + break; + } + } + else { + switch (numberofdice) { + case 2: + apcostd = 0; + $(html).find('[name="by_from_gm"]').val(0); + break; + case 3: + apcostd = 1; + left = ap - apcostd; + break; + case 4: + apcostd = 3; + left = ap - apcostd; + break; + case 5: + apcostd = 6; + left = ap - apcostd; + break; + } + } + if (left<0) { + const part1 = game.i18n.localize("FALLOUT.UI.Not_Enough"); + const part2 = game.i18n.localize("FALLOUT.TEMPLATES.PARTY_AP"); + const warexist =ui.notifications.active.length; + if (warexist === 0) { + ui.notifications.warn(`${part1} ${part2}`); + } + $(html).find('[name="spend_ap"]').val(ap); + $(html).find('[name="by_from_gm"]').val(-1*left); + } + else { + $(html).find('[name="spend_ap"]').val(apcostd); + $(html).find('[name="by_from_gm"]').val(0); + } } - static async createDialog({ rollName = "Roll D20", diceNum = 2, attribute = 0, skill = 0, tag = false, complication = 20, rollLocation=false, actor=null, item=null } = {}) { + gmapmanagment(html) { + let apcostd = 0; + let left = 0; + let numberofdice = 0; + let ap =this.element.find('[name="current_ap"]').val(); + for (let i = 2; i <= 5; i++) { + const diceElement = $(html).find(`[data-index="${i}"]`); + const containsMarked = diceElement.hasClass("marked"); + if (containsMarked) { + numberofdice = i; + } + } + if ($(html).find('[name="freed20"]').is(":checked")) { + switch (numberofdice) { + case 2: + apcostd = 0; + break; + case 3: + apcostd = 0; + break; + case 4: + apcostd = 1; + left = ap - apcostd; + break; + case 5: + apcostd = 3; + left = ap - apcostd; + break; + } + } + else { + switch (numberofdice) { + case 2: + apcostd = 0; + break; + case 3: + apcostd = 1; + left = ap - apcostd; + break; + case 4: + apcostd = 3; + left = ap - apcostd; + break; + case 5: + apcostd = 6; + left = ap - apcostd; + break; + } + } + if (left<0) { + const part1 = game.i18n.localize("FALLOUT.UI.Not_Enough"); + const part2 = game.i18n.localize("FALLOUT.TEMPLATES.OVERSEER_AP"); + const warexist =ui.notifications.active.length; + if (warexist === 0) { + ui.notifications.warn(`${part1} ${part2}`); + } + let numberofdice = 2; + let gmerror = true; + this.markDiceNumber(html, numberofdice, gmerror); + } + else { + $(html).find('[name="spend_ap"]').val(apcostd); + } + + } + + gmroll(html) { + const divbuy = document.querySelector('[name="buy_from_gm"]'); + divbuy.style.display = "none"; + let gmap = game.settings.get("fallout", "gmAP"); + this.element.find('[name="current_ap"]').val(gmap); + $(html).find('[name="party_ap"] .title-label').text(game.i18n.localize("FALLOUT.TEMPLATES.OVERSEER_AP")); + $(html).find('[name="spend_ap"] .title-label').text(game.i18n.localize("FALLOUT.UI.Spend_Overseer_AP")); + } + + + static async createDialog({ rollName = "Roll D20", diceNum = 2, attribute = 0, skill = 0, tag = false, complication = 20, rollLocation=false, actor=null, item=null, ap = 0, apcost = 0 } = {}) { let dialogData = {}; dialogData.rollName = rollName; @@ -104,7 +488,8 @@ export class Dialog2d20 extends Dialog { dialogData.rollLocation = rollLocation; dialogData.actor = actor; dialogData.item = item; - + dialogData.ap = ap; + dialogData.apcost = apcost; const html = await renderTemplate("systems/fallout/templates/dialogs/dialog2d20.hbs", dialogData); let d = new Dialog2d20( @@ -117,22 +502,32 @@ export class Dialog2d20 extends Dialog { rollLocation, actor, item, + ap, + apcost, { title: rollName, content: html, buttons: { roll: { icon: '', - label: "ROLL", + label: game.i18n.localize("FALLOUT.UI.Roll"), + }, + help: { + icon: '', + label: game.i18n.localize("FALLOUT.UI.ASSISTANCE"), }, + }, } ); - d.render(true); + d.render(true, {width: 550, height: 290}); return d.deferred.promise; } + + } + class Deferred { constructor() { this.promise = new Promise((resolve, reject) => { diff --git a/system/src/roller/DialogD6.mjs b/system/src/roller/DialogD6.mjs index d8677e72..a115b92a 100644 --- a/system/src/roller/DialogD6.mjs +++ b/system/src/roller/DialogD6.mjs @@ -1,12 +1,16 @@ +/* eslint-disable no-lonely-if */ +/* eslint-disable max-len */ export class DialogD6 extends Dialog { - - constructor(rollName, diceNum, actor, weapon, falloutRoll, dialogData = {}, options = {}) { + // eslint-disable-next-line max-len + constructor(rollName, diceNum, actor, weapon, falloutRoll, otherdmgdice, firerateamo, dialogData = {}, options = {}) { super(dialogData, options); this.rollName = rollName; this.diceNum = diceNum; this.actor = actor; this.weapon = weapon; this.falloutRoll = falloutRoll; + this.otherdmgdice = otherdmgdice; + this.firerateamo = firerateamo; this.options.classes = ["dice-icon"]; } @@ -17,40 +21,37 @@ export class DialogD6 extends Dialog { // await this.checkAmmo(html) // }) - html.on("click", ".roll", async event => { - let diceNum = html.find(".d-number")[0].value; - let additionalAmmo = 0; - // CHECK IF THERE IS ENOUGH AMMO TO TRIGGER THE ROLL - if (game.settings.get("fallout", "automaticAmmunitionCalculation")) { - if (this.weapon?.system.ammo) { - let initDmg = this.falloutRoll - ? 0 - : this.weapon.system.damage.rating; - - additionalAmmo = await this.checkAmmo(diceNum, initDmg); - - if (additionalAmmo < 0) return; - } + html.on("click", ".rolldamage", async event => { + let CDnumber = 0; + const isadd =html.find(".d-number"); + const isaddl = isadd.length; + if (isaddl !== 0) { + CDnumber = html.find(".d-number")[0].value; } - + let otherdmgdice = html.find(".otherd-number")[0].value; + let firerateamo =html.find('[name="firerateamo"] option:selected').val(); if (!this.falloutRoll) { fallout.Roller2D20.rollD6({ rollname: this.rollName, - dicenum: parseInt(diceNum), + diceNum: parseInt(CDnumber), weapon: this.weapon, actor: this.actor, + otherdmgdice: parseInt(otherdmgdice), + firerateamo: parseInt(firerateamo), + }); } else { fallout.Roller2D20.addD6({ rollname: this.rollName, - dicenum: parseInt(diceNum), + diceNum: parseInt(CDnumber), weapon: this.weapon, actor: this.actor, falloutRoll: this.falloutRoll, + otherdmgdice: parseInt(otherdmgdice), + firerateamo: parseInt(firerateamo), }); } - // REDUCE AMMO FOR CHARACTER AND ROBOT if (game.settings.get("fallout", "automaticAmmunitionCalculation")) { if (!this.actor) return; @@ -62,46 +63,235 @@ export class DialogD6 extends Dialog { else if (this.actor.startsWith("Scene")) { _actor = fromUuidSync(this.actor).actor; } - if (_actor.type === "character" || _actor.type === "robot") { - if (additionalAmmo > 0) { - await _actor.reduceAmmo(this.weapon.system.ammo, additionalAmmo); + + // eslint-disable-next-line eqeqeq + // reduce party AP when use to increase damage in melee + if (this.weapon.system.weaponType === "meleeWeapons" || this.weapon.system.weaponType === "unarmed") { + const currentpartyap= game.settings.get("fallout", "partyAP"); + const newpartyap=currentpartyap-parseInt(firerateamo); + const overseerap = game.settings.get("fallout", "gmAP"); + if (newpartyap<0) { + fallout.APTracker.setAP("partyAP", 0); + const newoverseerap = overseerap - newpartyap; + fallout.APTracker.setAP("gmAP", newoverseerap); + } + else { + fallout.APTracker.setAP("partyAP", newpartyap); + } + } + + // reduce amo wehn firrerate is used + else { + if (firerateamo > 0) { + this.reduceadditionalAmmo(firerateamo, this.weapon, _actor); + } + } + + } + else { + // eslint-disable-next-line eqeqeq + // reduce party AP when use to increase damage in melee + if (this.weapon.system.weaponType === "meleeWeapons" || this.weapon.system.weaponType === "unarmed") { + const currentoverseerap= game.settings.get("fallout", "gmAP"); + const newoverseerap=currentoverseerap-parseInt(firerateamo); + fallout.APTracker.setAP("gmAP", newoverseerap); + } + + else { + if (firerateamo > 0) { + this.reduceadditionalAmmo(firerateamo, this.weapon, _actor); + } + } + } } + }); + html.on("change", ".fire-rate-select", async event => { + const actorId = this.actor.split(".")[1]; + const actortype= game.actors.get(actorId).type; + const weapontype = this.weapon.system.weaponType; + let firerateamo = html.find('[name="firerateamo"] option:selected').val(); + if (weapontype === "meleeWeapons" || weapontype === "unarmed") { + if (actortype !== "character" && actortype !== "robot") { + const part1 = game.i18n.localize("FALLOUT.UI.Not_Enough"); + const part2 = game.i18n.localize("FALLOUT.TEMPLATES.OVERSEER_AP"); + const pulsingContainer = document.querySelector(".flexrow.resource.pulsing"); + const currentoverseerap = game.settings.get("fallout", "gmAP"); + if (firerateamo > currentoverseerap) { + if (!pulsingContainer) { + const pulsingHTML = `
+
+ ${part1} ${part2} +
+
`; + html.find(".otherd-number").after(pulsingHTML); + html.find(".fire-rate-select")[0].selectedIndex = 0; + } + } + else if (pulsingContainer) { + pulsingContainer.remove(); + } + } + else { + const currentpartyap = game.settings.get("fallout", "partyAP"); + const part1 = game.i18n.localize("FALLOUT.UI.Not_Enough"); + const part2 = game.i18n.localize("FALLOUT.TEMPLATES.PARTY_AP"); + const part3 = game.i18n.localize("FALLOUT.UI.Buy_from_Overseer"); + const pulsingContainer = document.querySelector(".flexrow.resource.pulsing"); + + if (firerateamo > currentpartyap) { + const buyap = parseInt(firerateamo) - currentpartyap; + if (!pulsingContainer) { + const pulsingHTML = `
+
+ ${part1} ${part2}, ${part3} ${buyap} +
+
`; + html.find(".otherd-number").after(pulsingHTML); + } + else { + pulsingContainer.remove(); + const pulsingHTML = `
+
+ ${part1} ${part2}, ${part3} ${buyap} +
+
`; + html.find(".otherd-number").after(pulsingHTML); + } + } + else if (pulsingContainer) { + pulsingContainer.remove(); + } + } + } + else { + const usedamo = await this.checkfirerate(this.weapon, game.actors.get(actorId), firerateamo); + if (usedamo === 1) { + const part1 = game.i18n.localize("FALLOUT.UI.Not_Enough"); + const part2 = game.i18n.localize("TYPES.Item.ammo"); + ui.notifications.warn(`${part1} ${part2}`); + html.find(".fire-rate-select")[0].selectedIndex = 0; + } + } + }); + } async rollD6() { - } async addD6() { } - static async createDialog({ rollName = "DC Roll", diceNum = 2, falloutRoll = null, actor= null, weapon = null } = {}) { + static async createDialog({ rollName = "DC Roll", diceNum = 2, falloutRoll = null, actor= null, weapon = null, otherdmgdice = 0, firerateamo = 0} = {}) { let dialogData = {}; - dialogData.rollName = rollName; dialogData.diceNum = diceNum; dialogData.falloutRoll = falloutRoll; dialogData.weapon = weapon; dialogData.actor = actor; - + const actorId = dialogData.actor.split(".")[1]; + const actortype= game.actors.get(actorId).type; + let firerate=weapon.system.fireRate; + const weapondmgdice = game.i18n.localize("FALLOUT.UI.Weapondamagedice"); + const bonusdmg=game.i18n.localize("FALLOUT.UI.Bonusdmg"); + let additionaludesamo=""; + if ((actortype!== "character" && actortype !== "robot") && (weapon.system.weaponType === "meleeWeapons" || weapon.system.weaponType === "unarmed")) { + firerate= 3; + additionaludesamo=game.i18n.localize("FALLOUT.UI.AdditionalmeledmgOverseer"); + } + else if (weapon.system.weaponType === "meleeWeapons" || weapon.system.weaponType === "unarmed") { + firerate= 3; + additionaludesamo=game.i18n.localize("FALLOUT.UI.Additionalmeledmg"); + } + else { + additionaludesamo=game.i18n.localize("FALLOUT.UI.Additionalamo"); + } + let optionsHtml = ""; + for (let i = 0; i <= firerate; i++) { + if (i===0) { + optionsHtml += ``; + } + else { + optionsHtml += ``; + } + } const html = `
- -
+ + + +
`; + // eslint-disable-next-line max-len + let d = new DialogD6(rollName, diceNum, actor, weapon, falloutRoll, otherdmgdice, firerateamo, { + title: rollName, + content: html, + buttons: { + rolldamage: { + icon: '', + label: game.i18n.localize("FALLOUT.UI.Roll"), + }, + }, + close: () => { }, + }); + d.render(true); + } - let d = new DialogD6(rollName, diceNum, actor, weapon, falloutRoll, { + static async addcreateDialog({ rollName = "DC Roll", diceNum = 2, falloutRoll = null, actor= null, weapon = null, otherdmgdice = 0, firerateamo = 0} = {}) { + let dialogData = {}; + dialogData.rollName = rollName; + dialogData.diceNum = diceNum; + dialogData.falloutRoll = falloutRoll; + dialogData.weapon = weapon; + dialogData.actor = actor; + const actorId = dialogData.actor.split(".")[1]; + const actortype= game.actors.get(actorId).type; + let firerate=weapon.system.fireRate; + const bonusdmg=game.i18n.localize("FALLOUT.UI.Bonusdmg"); + let additionaludesamo=""; + if ((actortype!== "character" && actortype !== "robot") && (weapon.system.weaponType === "meleeWeapons" || weapon.system.weaponType === "unarmed")) { + firerate= 3; + additionaludesamo=game.i18n.localize("FALLOUT.UI.AdditionalmeledmgOverseer"); + } + else if (weapon.system.weaponType === "meleeWeapons" || weapon.system.weaponType === "unarmed") { + firerate= 3; + additionaludesamo=game.i18n.localize("FALLOUT.UI.Additionalmeledmg"); + } + else { + additionaludesamo=game.i18n.localize("FALLOUT.UI.Additionalamo"); + } + let optionsHtml = ""; + for (let i = 0; i <= firerate; i++) { + if (i===0) { + optionsHtml += ``; + } + else { + optionsHtml += ``; + } + } + const html = `
+
+ + + +
`; + // eslint-disable-next-line max-len + let d = new DialogD6(rollName, diceNum, actor, weapon, falloutRoll, otherdmgdice, firerateamo, { title: rollName, content: html, buttons: { - roll: { + rolldamage: { icon: '', - label: "ROLL", + label: game.i18n.localize("FALLOUT.UI.Roll"), }, }, close: () => { }, @@ -111,13 +301,9 @@ export class DialogD6 extends Dialog { async checkAmmo(diceNum, initDmg) { if (!game.settings.get("fallout", "automaticAmmunitionCalculation")) return 0; - if (!this.actor) return 0; - if (!this.weapon) return 0; - if (this.weapon.system.ammo === "") return 0; - // Check if there is ammo at all let _actor; if (this.actor.startsWith("Actor")) { @@ -126,37 +312,71 @@ export class DialogD6 extends Dialog { else if (this.actor.startsWith("Scene")) { _actor = fromUuidSync(this.actor).actor; } - if (!_actor) return 0; - + // eslint-disable-next-line eqeqeq if (_actor.type !== "character" && _actor.type !== "robot") return 0; + let additionalAmmo = "0"; + if (this.weapon.system.weaponType !== "meleeWeapons" && this.weapon.system.weaponType !== "unarmed") { + // eslint-disable-next-line linebreak-style + const [ammoItems, shotsAvailable] = await _actor._getAvailableAmmoType(this.weapon.system.ammo); + if (!ammoItems) { + ui.notifications.warn(`Ammo ${this.weapon.system.ammo} not found`); + return -1; + } + // Check if there is enough ammo + const totalDice = parseInt(diceNum); - const [ammoItems, shotsAvailable] = - await _actor._getAvailableAmmoType( - this.weapon.system.ammo - ); + // eslint-disable-next-line semi + const weaponDmg = parseInt(initDmg); + additionalAmmo = Math.max(0, totalDice - weaponDmg) * this.weapon.system.ammoPerShot; + // Gatling weird shit where you need to add 2DC and spend 10 ammmo... + if (this.weapon.system.damage.weaponQuality.gatling.value) { + additionalAmmo = Math.floor(additionalAmmo * 0.5); + } + if (this.weapon.system.damage.weaponQuality.gatling.value === true) { + additionalAmmo = additionalAmmo*10; + } - if (!ammoItems) { - ui.notifications.warn(`Ammo ${this.weapon.system.ammo} not found`); - return -1; + if (shotsAvailable < additionalAmmo) { + ui.notifications.warn(`Not enough ${this.weapon.system.ammo} ammo`); + return -1; + } + return additionalAmmo; } + } - // Check if there is enough ammo - const totalDice = parseInt(diceNum); - const weaponDmg = parseInt(initDmg); - - let additionalAmmo = Math.max(0, totalDice - weaponDmg) * this.weapon.system.ammoPerShot; - - // Gatling weird shit where you need to add 2DC and spend 10 ammmo... - if (this.weapon.system.damage.weaponQuality.gatling.value) { - additionalAmmo = Math.floor(additionalAmmo * 0.5); + async checkfirerate(weapon, actor, firerate) { + const ammoPerShot = weapon.system.ammoPerShot; + const isgatling = weapon.system.damage.weaponQuality.gatling.value; + const ammountofamo = await actor._getAvailableAmmoType(weapon.system.ammo); + let usedammo = ammoPerShot*parseInt(firerate); + if (isgatling === true) { + usedammo = 10*usedammo; + } + if (usedammo <= ammountofamo[1]) { + return 0; + } + else { + return 1; } + } - if (shotsAvailable < additionalAmmo) { - ui.notifications.warn(`Not enough ${this.weapon.system.ammo} ammo`); - return -1; + async reduceadditionalAmmo(firarateamo, weapon, actor) { + const [ammoItem, shotsAvailable] = await actor._getAvailableAmmoType(weapon.system.ammo); + const ammoPerShot = weapon.system.ammoPerShot; + const isgatling = weapon.system.damage.weaponQuality.gatling.value; + let usedammo = ammoPerShot*parseInt(firarateamo); + if (isgatling === true) { + usedammo = 10*usedammo; } + const ammo = ammoItem[0]; + const itemid = ammo._id; + const leftammo = shotsAvailable - usedammo; + await actor.updateEmbeddedDocuments("Item", [{ + "_id": itemid, + "system.quantity": leftammo, + }]); + - return additionalAmmo; } } diff --git a/system/src/roller/Roller2D20.mjs b/system/src/roller/Roller2D20.mjs index d51dc6f8..25c4859d 100644 --- a/system/src/roller/Roller2D20.mjs +++ b/system/src/roller/Roller2D20.mjs @@ -246,11 +246,18 @@ export class Roller2D20 { static async rollD6({ actor = null, - dicenum = 2, + diceNum = 2, rollname = "Roll D6", weapon = null, + otherdmgdice = 0, + firerateamo = 0, }={}) { - let formula = `${dicenum}dc`; + const isgatling = weapon.system.damage.weaponQuality.gatling.value; + if (isgatling === true) { + firerateamo = firerateamo *2; + } + const totalCD = firerateamo+ otherdmgdice+diceNum; + let formula = `${totalCD}dc`; let roll = new Roll(formula); await roll.evaluate(); @@ -343,13 +350,14 @@ export class Roller2D20 { }); } - static async addD6({ rollname = "Roll D6", dicenum = 2, falloutRoll = null, dicesRolled = [], weapon = null, actor = null } = {}) { - let formula = `${dicenum}dc`; + static async addD6({ rollname = "Roll D6", dicenum = 2, falloutRoll = null, dicesRolled = [], weapon = null, actor = null, otherdmgdice = 0, firerateamo = 0} = {}) { + const totalCD = firerateamo+ otherdmgdice; + let formula = `${totalCD}dc`; let _roll = new Roll(formula); await _roll.evaluate({ async: true }); - let newRollName = `${falloutRoll.rollname} [+ ${dicenum} DC]`; + let newRollName = `${falloutRoll.rollname} [+ ${totalCD} DC]`; let oldDiceRolled = falloutRoll.dicesRolled; return Roller2D20.parseD6Roll({ diff --git a/system/src/settings.mjs b/system/src/settings.mjs index 5dc5686e..d72563de 100644 --- a/system/src/settings.mjs +++ b/system/src/settings.mjs @@ -85,6 +85,14 @@ export default function registerSettings() { default: true, type: Boolean, }); + game.settings.register(SYSTEM_ID, "automaticAmmunitionCalculationGM", { + name: "Ammunition Calculation for GM", + hint: "Same like Ammunition Calculation but for NPC", + scope: "world", + config: true, + default: true, + type: Boolean, + }); game.settings.register(SYSTEM_ID, "applyWearAndTearToWeaponDamage", { name: "Apply Wear and Tear to Weapon Damage", diff --git a/system/src/sheets/FalloutBaseActorSheet.mjs b/system/src/sheets/FalloutBaseActorSheet.mjs index 62399d55..ee96acca 100644 --- a/system/src/sheets/FalloutBaseActorSheet.mjs +++ b/system/src/sheets/FalloutBaseActorSheet.mjs @@ -218,11 +218,25 @@ export default class FalloutBaseActorSheet extends ActorSheet { html.find(".skill .item-name").click(ev => { const li = $(ev.currentTarget).parents(".item"); const item = this.actor.items.get(li.data("itemId")); + let ap = 0; + let gmap = 0; + let apcost=0; + if (this.actor.type === "creature" && this.actor.type === "npc") { + ap = game.settings.get("fallout", "gmAP"); + } + else { + ap = parseInt(game.settings.get("fallout", "partyAP")); + gmap = parseInt(game.settings.get("fallout", "gmAP")); + } this._onRollSkill( item.localizedName, item.system.value, this.actor.system.attributes[item.system.defaultAttribute].value, - item.system.tag + item.system.tag, + ap, + gmap, + apcost, + this.actor ); }); @@ -426,13 +440,17 @@ export default class FalloutBaseActorSheet extends ActorSheet { ); } - _onRollSkill(skillName, rank, attribute, tag) { + _onRollSkill(skillName, rank, attribute, tag, ap, gmap, apcost) { fallout.Dialog2d20.createDialog({ rollName: skillName, diceNum: 2, attribute: attribute, skill: rank, tag: tag, + ap: ap, + gmap: gmap, + apcost: apcost, + actor: this.actor, complication: parseInt(this.actor.system.complication), }); } @@ -492,12 +510,13 @@ export default class FalloutBaseActorSheet extends ActorSheet { else actorUUID = this.actor.uuid; // console.warn(fromUuidSync(actorUUID).actor) - fallout.DialogD6.createDialog({ rollName: rollName, diceNum: numOfDice, actor: actorUUID, weapon: item, + otherdmgdice: 0, + firerateamo: 0, }); } @@ -580,9 +599,17 @@ export default class FalloutBaseActorSheet extends ActorSheet { "fallout", "automaticAmmunitionCalculation" ); - const actorCanUseAmmo = - ["character", "robot"].includes(this.actor.type); + let actorCanUseAmmo = true; + const autoCalculateAmmoGM = game.settings.get( + "fallout", "automaticAmmunitionCalculationGM" + ); + if (autoCalculateAmmoGM === true) { + actorCanUseAmmo = true; + } + else { + actorCanUseAmmo = ["character", "robot"].includes(this.actor.type); + } const ammoPopulated = item.system.ammo !== ""; if (autoCalculateAmmo && actorCanUseAmmo && ammoPopulated) { @@ -594,8 +621,14 @@ export default class FalloutBaseActorSheet extends ActorSheet { ui.notifications.warn(`Ammo ${item.system.ammo} not found`); return; } - - if (shotsAvailable < item.system.ammoPerShot) { + let usedammo = 0; + if (item.system.damage.weaponQuality.gatling.value === true) { + usedammo = item.system.ammoPerShot*10; + } + else { + usedammo = item.system.ammoPerShot; + } + if (shotsAvailable < usedammo ) { ui.notifications.warn(`Not enough ${item.system.ammo} ammo`); return; } diff --git a/system/src/system/FalloutChat.mjs b/system/src/system/FalloutChat.mjs index a2ed74b1..db17ccc4 100644 --- a/system/src/system/FalloutChat.mjs +++ b/system/src/system/FalloutChat.mjs @@ -132,7 +132,7 @@ export default class FalloutChat { const falloutRoll = message.flags.falloutroll; const weapon = message.flags.weapon; - fallout.DialogD6.createDialog({ + fallout.DialogD6.addcreateDialog({ rollname: falloutRoll.rollname, diceNum: 1, falloutRoll: falloutRoll, diff --git a/system/templates/dialogs/dialog2d20.hbs b/system/templates/dialogs/dialog2d20.hbs index 1607cbe5..8826837d 100644 --- a/system/templates/dialogs/dialog2d20.hbs +++ b/system/templates/dialogs/dialog2d20.hbs @@ -1,28 +1,47 @@
-
-
-

{{localize "FALLOUT.TEMPLATES.Attribute"}}

- -
-
-

{{localize "TYPES.Item.skill"}}

- -
-
-

{{localize "FALLOUT.TEMPLATES.Tag"}}

- -
-
-

{{localize "FALLOUT.TEMPLATES.Compl"}}

- -
+
+
+

{{localize "FALLOUT.TEMPLATES.Attribute"}}

+ +
+
+

{{localize "TYPES.Item.skill"}}

+ +
+
+

{{localize "FALLOUT.TEMPLATES.Tag"}}

+ +
+
+

{{localize "FALLOUT.TEMPLATES.Compl"}}

+ +
+
+

{{localize "FALLOUT.UI.FREED20"}}

+ +
+
+ + + +
+
+

{{localize "FALLOUT.TEMPLATES.PARTY_AP"}}

+ +
+
+

{{localize "FALLOUT.UI.Spend_AP"}}

+ +
+
+

{{localize "FALLOUT.UI.Buy_from_Overseer"}}

+ +
-
From d5ef3b67061a09c7493714fb9166c0af89226b84 Mon Sep 17 00:00:00 2001 From: bb46003 <109553236+bb46003@users.noreply.github.com> Date: Tue, 14 May 2024 12:32:38 +0200 Subject: [PATCH 03/11] Update system.json --- system/system.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/system.json b/system/system.json index 949871af..279132cf 100644 --- a/system/system.json +++ b/system/system.json @@ -248,7 +248,7 @@ ], "socket": true, "url": "https://github.com/Muttley/foundryvtt-fallout", - "manifest": "https://raw.githubusercontent.com/bb46003/foundryvtt-fallout/develop/system/system.json", - "download": "https://github.com/bb46003/foundryvtt-fallout/archive/refs/heads/develop.zip", + "https":"//raw.githubusercontent.com/Muttley/foundryvtt-fallout/main/system/system.json", + "download": "https://github.com/Muttley/foundryvtt-fallout/releases/latest/download/fallout.zip", "background": "systems/fallout/assets/images/please-stand-by.webp" } From e290233026800b983c1a4ba4fd005d9e60102d8c Mon Sep 17 00:00:00 2001 From: BartlomiejBielecki Date: Wed, 15 May 2024 13:28:20 +0200 Subject: [PATCH 04/11] finaly fix conflict i hope --- system/src/roller/DialogD6.mjs | 59 ++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 27 deletions(-) diff --git a/system/src/roller/DialogD6.mjs b/system/src/roller/DialogD6.mjs index a115b92a..05d477d7 100644 --- a/system/src/roller/DialogD6.mjs +++ b/system/src/roller/DialogD6.mjs @@ -301,9 +301,13 @@ export class DialogD6 extends Dialog { async checkAmmo(diceNum, initDmg) { if (!game.settings.get("fallout", "automaticAmmunitionCalculation")) return 0; + if (!this.actor) return 0; + if (!this.weapon) return 0; + if (this.weapon.system.ammo === "") return 0; + // Check if there is ammo at all let _actor; if (this.actor.startsWith("Actor")) { @@ -312,37 +316,38 @@ export class DialogD6 extends Dialog { else if (this.actor.startsWith("Scene")) { _actor = fromUuidSync(this.actor).actor; } + if (!_actor) return 0; - // eslint-disable-next-line eqeqeq + if (_actor.type !== "character" && _actor.type !== "robot") return 0; - let additionalAmmo = "0"; - if (this.weapon.system.weaponType !== "meleeWeapons" && this.weapon.system.weaponType !== "unarmed") { - // eslint-disable-next-line linebreak-style - const [ammoItems, shotsAvailable] = await _actor._getAvailableAmmoType(this.weapon.system.ammo); - if (!ammoItems) { - ui.notifications.warn(`Ammo ${this.weapon.system.ammo} not found`); - return -1; - } - // Check if there is enough ammo - const totalDice = parseInt(diceNum); - - // eslint-disable-next-line semi - const weaponDmg = parseInt(initDmg); - additionalAmmo = Math.max(0, totalDice - weaponDmg) * this.weapon.system.ammoPerShot; - // Gatling weird shit where you need to add 2DC and spend 10 ammmo... - if (this.weapon.system.damage.weaponQuality.gatling.value) { - additionalAmmo = Math.floor(additionalAmmo * 0.5); - } - if (this.weapon.system.damage.weaponQuality.gatling.value === true) { - additionalAmmo = additionalAmmo*10; - } - if (shotsAvailable < additionalAmmo) { - ui.notifications.warn(`Not enough ${this.weapon.system.ammo} ammo`); - return -1; - } - return additionalAmmo; + const [ammoItems, shotsAvailable] = + _actor._getAvailableAmmoType( + this.weapon.system.ammo + ); + + if (!ammoItems) { + ui.notifications.warn(`Ammo ${this.weapon.system.ammo} not found`); + return -1; } + + // Check if there is enough ammo + const totalDice = parseInt(diceNum); + const weaponDmg = parseInt(initDmg); + + let additionalAmmo = Math.max(0, totalDice - weaponDmg) * this.weapon.system.ammoPerShot; + + // Gatling weird shit where you need to add 2DC and spend 10 ammmo... + if (this.weapon.system.damage.weaponQuality.gatling.value) { + additionalAmmo = Math.floor(additionalAmmo * 0.5); + } + + if (shotsAvailable < additionalAmmo) { + ui.notifications.warn(`Not enough ${this.weapon.system.ammo} ammo`); + return -1; + } + + return additionalAmmo; } async checkfirerate(weapon, actor, firerate) { From 0911e9cbe804a0a53318cc6e29e59c0c65e2e9fe Mon Sep 17 00:00:00 2001 From: BartlomiejBielecki Date: Wed, 15 May 2024 13:28:49 +0200 Subject: [PATCH 05/11] Revert "finaly fix conflict" This reverts commit e290233026800b983c1a4ba4fd005d9e60102d8c. --- system/src/roller/DialogD6.mjs | 59 ++++++++++++++++------------------ 1 file changed, 27 insertions(+), 32 deletions(-) diff --git a/system/src/roller/DialogD6.mjs b/system/src/roller/DialogD6.mjs index 05d477d7..a115b92a 100644 --- a/system/src/roller/DialogD6.mjs +++ b/system/src/roller/DialogD6.mjs @@ -301,13 +301,9 @@ export class DialogD6 extends Dialog { async checkAmmo(diceNum, initDmg) { if (!game.settings.get("fallout", "automaticAmmunitionCalculation")) return 0; - if (!this.actor) return 0; - if (!this.weapon) return 0; - if (this.weapon.system.ammo === "") return 0; - // Check if there is ammo at all let _actor; if (this.actor.startsWith("Actor")) { @@ -316,38 +312,37 @@ export class DialogD6 extends Dialog { else if (this.actor.startsWith("Scene")) { _actor = fromUuidSync(this.actor).actor; } - if (!_actor) return 0; - + // eslint-disable-next-line eqeqeq if (_actor.type !== "character" && _actor.type !== "robot") return 0; + let additionalAmmo = "0"; + if (this.weapon.system.weaponType !== "meleeWeapons" && this.weapon.system.weaponType !== "unarmed") { + // eslint-disable-next-line linebreak-style + const [ammoItems, shotsAvailable] = await _actor._getAvailableAmmoType(this.weapon.system.ammo); + if (!ammoItems) { + ui.notifications.warn(`Ammo ${this.weapon.system.ammo} not found`); + return -1; + } + // Check if there is enough ammo + const totalDice = parseInt(diceNum); + + // eslint-disable-next-line semi + const weaponDmg = parseInt(initDmg); + additionalAmmo = Math.max(0, totalDice - weaponDmg) * this.weapon.system.ammoPerShot; + // Gatling weird shit where you need to add 2DC and spend 10 ammmo... + if (this.weapon.system.damage.weaponQuality.gatling.value) { + additionalAmmo = Math.floor(additionalAmmo * 0.5); + } + if (this.weapon.system.damage.weaponQuality.gatling.value === true) { + additionalAmmo = additionalAmmo*10; + } - const [ammoItems, shotsAvailable] = - _actor._getAvailableAmmoType( - this.weapon.system.ammo - ); - - if (!ammoItems) { - ui.notifications.warn(`Ammo ${this.weapon.system.ammo} not found`); - return -1; - } - - // Check if there is enough ammo - const totalDice = parseInt(diceNum); - const weaponDmg = parseInt(initDmg); - - let additionalAmmo = Math.max(0, totalDice - weaponDmg) * this.weapon.system.ammoPerShot; - - // Gatling weird shit where you need to add 2DC and spend 10 ammmo... - if (this.weapon.system.damage.weaponQuality.gatling.value) { - additionalAmmo = Math.floor(additionalAmmo * 0.5); - } - - if (shotsAvailable < additionalAmmo) { - ui.notifications.warn(`Not enough ${this.weapon.system.ammo} ammo`); - return -1; + if (shotsAvailable < additionalAmmo) { + ui.notifications.warn(`Not enough ${this.weapon.system.ammo} ammo`); + return -1; + } + return additionalAmmo; } - - return additionalAmmo; } async checkfirerate(weapon, actor, firerate) { From b6f1805ad94ba0b04588fd24e65b3aca53ce8d45 Mon Sep 17 00:00:00 2001 From: BartlomiejBielecki Date: Wed, 15 May 2024 13:35:26 +0200 Subject: [PATCH 06/11] Auto stash before revert of "finaly fix conflict" --- system/src/roller/DialogD6.mjs | 1 + 1 file changed, 1 insertion(+) diff --git a/system/src/roller/DialogD6.mjs b/system/src/roller/DialogD6.mjs index a115b92a..166b9b1d 100644 --- a/system/src/roller/DialogD6.mjs +++ b/system/src/roller/DialogD6.mjs @@ -300,6 +300,7 @@ export class DialogD6 extends Dialog { } async checkAmmo(diceNum, initDmg) { + if (!game.settings.get("fallout", "automaticAmmunitionCalculation")) return 0; if (!this.actor) return 0; if (!this.weapon) return 0; From 1b153d852fdc3c32d7507c08278e7f8e853aa536 Mon Sep 17 00:00:00 2001 From: BartlomiejBielecki Date: Wed, 15 May 2024 16:38:50 +0200 Subject: [PATCH 07/11] fix error causing conflict --- system/src/roller/DialogD6.mjs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/system/src/roller/DialogD6.mjs b/system/src/roller/DialogD6.mjs index 166b9b1d..d9ac5bd0 100644 --- a/system/src/roller/DialogD6.mjs +++ b/system/src/roller/DialogD6.mjs @@ -300,11 +300,14 @@ export class DialogD6 extends Dialog { } async checkAmmo(diceNum, initDmg) { - if (!game.settings.get("fallout", "automaticAmmunitionCalculation")) return 0; + if (!this.actor) return 0; + if (!this.weapon) return 0; + if (this.weapon.system.ammo === "") return 0; + // Check if there is ammo at all let _actor; if (this.actor.startsWith("Actor")) { @@ -313,8 +316,9 @@ export class DialogD6 extends Dialog { else if (this.actor.startsWith("Scene")) { _actor = fromUuidSync(this.actor).actor; } + if (!_actor) return 0; - // eslint-disable-next-line eqeqeq + if (_actor.type !== "character" && _actor.type !== "robot") return 0; let additionalAmmo = "0"; if (this.weapon.system.weaponType !== "meleeWeapons" && this.weapon.system.weaponType !== "unarmed") { @@ -326,7 +330,6 @@ export class DialogD6 extends Dialog { } // Check if there is enough ammo const totalDice = parseInt(diceNum); - // eslint-disable-next-line semi const weaponDmg = parseInt(initDmg); additionalAmmo = Math.max(0, totalDice - weaponDmg) * this.weapon.system.ammoPerShot; @@ -337,7 +340,6 @@ export class DialogD6 extends Dialog { if (this.weapon.system.damage.weaponQuality.gatling.value === true) { additionalAmmo = additionalAmmo*10; } - if (shotsAvailable < additionalAmmo) { ui.notifications.warn(`Not enough ${this.weapon.system.ammo} ammo`); return -1; From 48d3c0f4a1849c0418b7af668aec7430806c5a17 Mon Sep 17 00:00:00 2001 From: BartlomiejBielecki Date: Thu, 6 Jun 2024 00:23:28 +0200 Subject: [PATCH 08/11] appy required changes in pl.yaml I delete added elements --- i18n/en.yaml | 17 +- i18n/pl.yaml | 147 ++++++++--------- scss/global/_window.scss | 20 ++- system/src/roller/Dialog2d20.mjs | 208 ++++++++++++------------ system/src/roller/Roller2D20.mjs | 28 +++- system/templates/chat/roll2d20.hbs | 4 + system/templates/dialogs/dialog2d20.hbs | 2 +- 7 files changed, 228 insertions(+), 198 deletions(-) diff --git a/i18n/en.yaml b/i18n/en.yaml index 063db64b..2f33ca0c 100644 --- a/i18n/en.yaml +++ b/i18n/en.yaml @@ -491,14 +491,14 @@ FALLOUT.TOOLTIPS.WeaponQuality.unreliable: When you make an attack with an Unrel FALLOUT.TOOLTIPS.WeaponQuality.unstable_radiation: This was never designed to be used as a handheld weapon. When attacking with a weapon, each complication you inflicts 2DC Radiation damage from radioactive feedback. A weapon may not have both Reliable and Unstable Radiation. FALLOUT.UI.Add: Add FALLOUT.UI.Addictions: Addictions -FALLOUT.UI.Additionalamo: Additional damage dice from firerate -FALLOUT.UI.Additionalmeledmg: Additional damage dice for party AP -FALLOUT.UI.AdditionalmeledmgOverseer: Additional damage dice for overseer AP +FALLOUT.UI.Additional_amo: Additional damage dice from firerate +FALLOUT.UI.Additional_mele_dmg: Additional damage dice for party AP +FALLOUT.UI.Additional_mele_dmg_overseer: Additional damage dice for overseer AP FALLOUT.UI.APPAREL_MODS: Apparel Mods -FALLOUT.UI.AreYouSure: Are You Sure? +FALLOUT.UI.Are_You_Sure: Are You Sure? FALLOUT.UI.ASSISTANCE: Assistance -FALLOUT.UI.BaseDamage: Base Damage -FALLOUT.UI.Bonusdmg: Additionad damage dice +FALLOUT.UI.Base_damage: Base Damage +FALLOUT.UI.Bonus_dmg: Additionad damage dice FALLOUT.UI.BOOKS_AND_MAGZS: Books and Magazines FALLOUT.UI.Buy_from_Overseer: Buy from Overseer FALLOUT.UI.Cancel: Cancel @@ -530,15 +530,16 @@ FALLOUT.UI.PAYAP3: Pay 3AP FALLOUT.UI.PAYAP6: Pay 6AP FALLOUT.UI.ROBOT_MODULES: Robot Modules FALLOUT.UI.Roll: Roll -FALLOUT.UI.SaveChanges: Save Changes +FALLOUT.UI.Save_SChanges: Save Changes FALLOUT.UI.Special_Abilities: Special Abilities FALLOUT.UI.SPECIAL_ABILITY: Special Ability +FALLOUT.UI.SPENT: Spent FALLOUT.UI.Spend_AP: Spend AP FALLOUT.UI.Spend_Overseer_AP: Spend Overseer AP FALLOUT.UI.stashed: Stashed FALLOUT.UI.Type: Type FALLOUT.UI.UNSORTED: Unsorted -FALLOUT.UI.Weapondamagedice: Damage dice from weapon +FALLOUT.UI.Weapon_damage_dice: Damage dice from weapon FALLOUT.UI.WEAPON_MODS: Weapon Mods FALLOUT.UI.Weight: Weight FALLOUT.UI.With: With diff --git a/i18n/pl.yaml b/i18n/pl.yaml index bc01cb2e..868cbe98 100644 --- a/i18n/pl.yaml +++ b/i18n/pl.yaml @@ -14,7 +14,7 @@ FALLOUT.AbilityPer: Percepcja FALLOUT.AbilityStr: Siła FALLOUT.actor.inventory.materials.common: Pospolity FALLOUT.actor.inventory.materials.junk: Złom -FALLOUT.actor.inventory.materials.junkSalvageControl: Salvage Junk +FALLOUT.actor.inventory.materials.junkSalvageControl: Odzyskaj śmieci FALLOUT.actor.inventory.materials.label: Materiały FALLOUT.actor.inventory.materials.rare: Bardzo rzadki FALLOUT.actor.inventory.materials.uncommon: Rzadki @@ -26,9 +26,9 @@ FALLOUT.Add: Dodaj FALLOUT.APP.ChemDoseManager.ResetAllButton: Resetuj wszystko FALLOUT.APP.ChemDoseManager.ResetAllHeader: Zresetuj wszystkie dawki środków chemicznych FALLOUT.APP.ChemDoseManager.title: Dawki środków chemicznych -FALLOUT.APP.ItemTypeMenu.title: Select Item Type -FALLOUT.APP.Loading.body: Searching the Wastelands... -FALLOUT.APP.Loading.title: Loading +FALLOUT.APP.ItemTypeMenu.title: Wybierz typ przedmiotu +FALLOUT.APP.Loading.body: Przeszukiwanie pustkowi... +FALLOUT.APP.Loading.title: Wczytywanie FALLOUT.APP.ModuleArtConfig.items: Przedmioty FALLOUT.APP.ModuleArtConfig.title: Ustaw obrazy FALLOUT.APP.PartySleep.chat_message: Drużyna śpi przez {duration}. @@ -37,22 +37,22 @@ FALLOUT.APP.PartySleep.hour: 1 godzina FALLOUT.APP.PartySleep.hours: "{length} godzin" FALLOUT.APP.PartySleep.safe_location: Bezpieczna lokacja? FALLOUT.APP.PartySleep.title: Drużyna Śpi -FALLOUT.APP.SalvageJunk.AdvanceGameTime: Advance Game Time -FALLOUT.APP.SalvageJunk.error.noJunkToSalvage: You don't have any junk to salvage -FALLOUT.APP.SalvageJunk.gameTimeAdvanced: Game time advanced by {time} -FALLOUT.APP.SalvageJunk.selectedAmount: Salvaging {amount} Junk -FALLOUT.APP.SalvageJunk.start: Start Salvaging -FALLOUT.APP.SalvageJunk.time: This will take {time} -FALLOUT.APP.SalvageJunk.title: Salvage Junk +FALLOUT.APP.SalvageJunk.AdvanceGameTime: Przyspiesz Czas Gry +FALLOUT.APP.SalvageJunk.error.noJunkToSalvage: Nie masz żadnych śmieci do odzyskania +FALLOUT.APP.SalvageJunk.gameTimeAdvanced: Czas gry przyśpieszony o {time} +FALLOUT.APP.SalvageJunk.selectedAmount: Odzyskano {amount} Śmieci +FALLOUT.APP.SalvageJunk.start: Rozpocznij odzyskiwanie +FALLOUT.APP.SalvageJunk.time: Zajmie Ci to {time} +FALLOUT.APP.SalvageJunk.title: Odzyskaj śmieci FALLOUT.APPAREL.armor: Pancerz FALLOUT.APPAREL.clothing: Odzież FALLOUT.APPAREL.headgear: Nakrycie głowy FALLOUT.APPAREL.outfit: Strój FALLOUT.APPAREL.plating: Poszycie FALLOUT.APPAREL.powerArmor: Pancerz wspomagany -FALLOUT.AvailabilityRoll.result.body: The maximum rarity available is {rarity} -FALLOUT.AvailabilityRoll.result.title: Availability Roll -FALLOUT.AvailabilityRoll.tooltip: Roll for Availability +FALLOUT.AvailabilityRoll.result.body: Maksymalna dostępna rzadkość to {rarity} +FALLOUT.AvailabilityRoll.result.title: Rzut na dostępność +FALLOUT.AvailabilityRoll.tooltip: Rzut w celu ustalenia dostępności FALLOUT.BEVERAGE: Napoje FALLOUT.BODYLOCATION_ABBR.character.armL: LR FALLOUT.BODYLOCATION_ABBR.character.armR: PR @@ -130,11 +130,11 @@ FALLOUT.CHAT_MESSAGE.consumed.chem.title: Zużyte środki chemiczne FALLOUT.CHAT_MESSAGE.consumed.food.title: Zjedzone jedzenie FALLOUT.CHAT_MESSAGE.consumed.food.warn_full: Jesteś już pełen i nie możesz zjeść więcej FALLOUT.CHAT_MESSAGE.consumed.other.title: Zużyte inne -FALLOUT.CHAT_MESSAGE.radiation_from_consumable_resisted.body: "{actorName} resisted the {baseRadDamage} radiation damage from consuming {itemName}" -FALLOUT.CHAT_MESSAGE.radiation_from_consumable_resisted.title: Radiation Resisted -FALLOUT.CHAT_MESSAGE.radiation_from_consumable.body: "{actorName} takes {radsTaken} radiation damage from consuming {itemName}" +FALLOUT.CHAT_MESSAGE.radiation_from_consumable_resisted.body: "{actorName} oparł się {baseRadDamage} obrażeniom od promieniowania po spożyciu {itemName}" +FALLOUT.CHAT_MESSAGE.radiation_from_consumable_resisted.title: Radiacja odparta +FALLOUT.CHAT_MESSAGE.radiation_from_consumable.body: "{actorName} otrzymuje {radsTaken} obrażeń od radiacji po spożyciu {itemName}" FALLOUT.CHAT_MESSAGE.radiation_from_consumable.title: Obrażenia Radiacyjne -FALLOUT.CHAT_MESSAGE.SalvageJunk.Scrapper: Scrapper +FALLOUT.CHAT_MESSAGE.SalvageJunk.Scrapper: Złomiarz FALLOUT.CHEM: Chemikalia FALLOUT.ChemDuration.brief: Krótkotrwały FALLOUT.ChemDuration.instant: Natychmiastowy @@ -157,31 +157,31 @@ FALLOUT.EffectDelete: Usuń Efekt FALLOUT.EffectEdit: Edytuj Efekt FALLOUT.EffectToggle: Zaznacz Efekt FALLOUT.equipped: Wyposażone -FALLOUT.ERRORS.ThisWeaponIsBroken: This weapon is broken and can no longer be used. -FALLOUT.ERRORS.UnableToDetermineWeaponAttribute: Unable to determine the attribute to use for this weapon. -FALLOUT.ERRORS.UnableToDetermineWeaponSkill: Unable to determine the skill to use for this weapon. -FALLOUT.ERRORS.WeaponHasMissingCreatureConfiguration: This weapon does not have a Creature Attribute and/or Creature Skill specified. +FALLOUT.ERRORS.ThisWeaponIsBroken: Ta broń jest uszkodzona i nie może być już używana. +FALLOUT.ERRORS.UnableToDetermineWeaponAttribute: Nie można określić atrybutu używanego dla tej broni. +FALLOUT.ERRORS.UnableToDetermineWeaponSkill: Nie można określić atrybutu używanego dla tej broni. +FALLOUT.ERRORS.WeaponHasMissingCreatureConfiguration: Ta broń nie posiada Atrybutu Stworzenia i/lub Umiejętności Stworzenia. FALLOUT.FOOD: Jedzenie -FALLOUT.Form.SelectCompendiumItem.Error.MaxChoicesReached: You can only select a maximum of {maxChoices} of this Item type. -FALLOUT.Form.SelectCompendiumItem.Error.NoItemsFound: Unable to find items of the correct type in the available compendiums. -FALLOUT.Form.SelectCompendiumItem.prompt: Select Item... -FALLOUT.Form.SelectCompendiumItem.title: Choose Items -FALLOUT.Form.SelectCompendiumItem.tooltip: Add From Compendiums -FALLOUT.Form.SelectItem.title: Choose {type} -FALLOUT.Form.SourceFilters.AllUsed: All sources are currently allowed -FALLOUT.Form.SourceFilters.hint: If populated, only sources included in this list will be used by any part of the system which automatically pulls items from Compendiums. -FALLOUT.Form.SourceFilters.prompt: Select Source... -FALLOUT.Form.SourceFilters.TheseUsed: Only the following sources will be allowed -FALLOUT.Form.SourceFilters.title: Source Filters +FALLOUT.Form.SelectCompendiumItem.Error.MaxChoicesReached: Możesz wybrać maksymalnie {maxChoices} przedmiotów tego typu. +FALLOUT.Form.SelectCompendiumItem.Error.NoItemsFound: Nie można znaleźć przedmiotów odpowiedniego typu w dostępnych kompendiach. +FALLOUT.Form.SelectCompendiumItem.prompt: Wybierz Przedmiot... +FALLOUT.Form.SelectCompendiumItem.title: Wybierz Przedmioty +FALLOUT.Form.SelectCompendiumItem.tooltip: Dodaj z Kompendiów +FALLOUT.Form.SelectItem.title: Wybierz {type} +FALLOUT.Form.SourceFilters.AllUsed: Wszystkie źródła są obecnie dozwolone +FALLOUT.Form.SourceFilters.hint: Jeśli lista jest wypełniona, tylko źródła z tej listy będą używane przez jakąkolwiek część systemu, która automatycznie pobiera przedmioty z kompendiów. +FALLOUT.Form.SourceFilters.prompt: Wybierz Źródło... +FALLOUT.Form.SourceFilters.TheseUsed: Dozwolone będą tylko następujące źródła +FALLOUT.Form.SourceFilters.title: Filtry źródeł FALLOUT.HEALTH.current: Obecne zdrowie FALLOUT.HEALTH.health: Zdrowie FALLOUT.HEALTH.max: Maksymalne Zdrowie -FALLOUT.Item.PowerArmor.Attach: Attach -FALLOUT.Item.PowerArmor.Attached: Attached -FALLOUT.Item.PowerArmor.AttachedToFrame: Attached to Frame -FALLOUT.Item.PowerArmor.Frame: Frame -FALLOUT.Item.PowerArmor.IsFrame: Is Frame -FALLOUT.Item.PowerArmor.Pieces: Power Armor Pieces +FALLOUT.Item.PowerArmor.Attach: Dołącz +FALLOUT.Item.PowerArmor.Attached: Dołączone +FALLOUT.Item.PowerArmor.AttachedToFrame: Dołączone do Ramy +FALLOUT.Item.PowerArmor.Frame: Rama +FALLOUT.Item.PowerArmor.IsFrame: Jest Ramą +FALLOUT.Item.PowerArmor.Pieces: Elementy Pancerza Wspomaganego FALLOUT.LEVEL.CurrentXP: Obecne PD FALLOUT.LEVEL.Level: Poziom FALLOUT.LEVEL.NextXP: PD na następny poziom @@ -257,14 +257,14 @@ FALLOUT.SKILL.Speech: Retoryka FALLOUT.SKILL.Survival: Przetrwanie FALLOUT.SKILL.Throwing: Rzucanie FALLOUT.SKILL.Unarmed: Bijatyka -FALLOUT.SOURCE_TITLE.aat_fully_operational: "Astoundingly Awesome Tales #2: Fully Operational" -FALLOUT.SOURCE_TITLE.aat_hunted: "Astoundingly Awesome Tales #4: Hunted!" -FALLOUT.SOURCE_TITLE.aat_orange_sky: "Astoundingly Awesome Tales #1: Orange Colored Sky" -FALLOUT.SOURCE_TITLE.aat_skull_canyon: "Astoundingly Awesome Tales #3: Showdown in Skull Canyon" +FALLOUT.SOURCE_TITLE.aat_fully_operational: "Showdown in Skull Canyon #2: W Pełni Operacyjny" +FALLOUT.SOURCE_TITLE.aat_hunted: "Niesamowicie Niesłychane Opowieści #: Polowanie!" +FALLOUT.SOURCE_TITLE.aat_orange_sky: "Niesamowicie Niesłychane Opowieści #1: Pomarańczowe Niebo" +FALLOUT.SOURCE_TITLE.aat_skull_canyon: "Niesamowicie Niesłychane Opowieści #3: Pojedynek w Kanionie Czaszek" FALLOUT.SOURCE_TITLE.core_rulebook: Podręcznik Główny FALLOUT.SOURCE_TITLE.enclave_remnants: "Pakiet BN #2: Pozostałości Enklawy" -FALLOUT.SOURCE_TITLE.gm_toolkit: "Gamemaster's Toolkit" -FALLOUT.SOURCE_TITLE.map_pack_vault: "Map Pack #1: Vault" +FALLOUT.SOURCE_TITLE.gm_toolkit: "Zestaw Narzędzi Mistrza Gry" +FALLOUT.SOURCE_TITLE.map_pack_vault: "Paczka Map #1: Krypta" FALLOUT.SOURCE_TITLE.rust_devils: "Pakiet BN #1: Rdzawe Diabły" FALLOUT.SOURCE_TITLE.settlers_guide: Przewodnik Osadnika FALLOUT.SOURCE_TITLE.wanderers_guide: Przewodnik Wędrowca @@ -289,7 +289,7 @@ FALLOUT.TEMPLATES.Attack: Atak FALLOUT.TEMPLATES.ATTACKS: Ataki FALLOUT.TEMPLATES.Attribute: Cecha FALLOUT.TEMPLATES.Attributes: Cechy -FALLOUT.TEMPLATES.Base_Damage: Base Damage +FALLOUT.TEMPLATES.Base_Damage: Obrażenia Podstawowe FALLOUT.TEMPLATES.Butchery: Mięso FALLOUT.TEMPLATES.ButcheryTooltip: PT testu rzeźnictwa FALLOUT.TEMPLATES.Compl: Komp. @@ -334,8 +334,8 @@ FALLOUT.TEMPLATES.Creature_Attribute: Cechy Stwora FALLOUT.TEMPLATES.Creature_Skill: Umiejętności Stworzenia FALLOUT.TEMPLATES.current: obecny FALLOUT.TEMPLATES.CurrentLeader: Aktualny Lider -FALLOUT.TEMPLATES.CustomAttribute: Custom Attribute -FALLOUT.TEMPLATES.CustomSkill: Custom Skill +FALLOUT.TEMPLATES.CustomAttribute: Atrybut niestandardowy +FALLOUT.TEMPLATES.CustomSkill: Umiejętność niestandardowy FALLOUT.TEMPLATES.Damage_Effects: Efekty obrażeń FALLOUT.TEMPLATES.DAMAGE_EFFECTS: Efekty Obrażeń FALLOUT.TEMPLATES.DAMAGE_TYPE: Typy Obrażeń @@ -354,7 +354,7 @@ FALLOUT.TEMPLATES.Effects: Efekty FALLOUT.TEMPLATES.Encumbrance_Level: Poziom Przeciążenia FALLOUT.TEMPLATES.ENG: ENERGETYCZNE FALLOUT.TEMPLATES.FAVORITE_WEAPONS: Ulubiona Broń -FALLOUT.TEMPLATES.Fire_Rate: Fire Rate +FALLOUT.TEMPLATES.Fire_Rate: Szybkostrzelność FALLOUT.TEMPLATES.FIRE_RATE: Szybkostrzelność FALLOUT.TEMPLATES.Gear: Sprzęt FALLOUT.TEMPLATES.GENERAL: Ogólny @@ -367,7 +367,7 @@ FALLOUT.TEMPLATES.Injuries: Urazy FALLOUT.TEMPLATES.INJURIES: RANY FALLOUT.TEMPLATES.Injury_Left_Click: Rana (kliknij lewym) FALLOUT.TEMPLATES.Irradiated: Skażony -FALLOUT.TEMPLATES.IrradiatedDamageDice: Irradiated Damage Dice +FALLOUT.TEMPLATES.IrradiatedDamageDice: Kości obrażeń od radiacji FALLOUT.TEMPLATES.Issue: Problem FALLOUT.TEMPLATES.kgs: Kg FALLOUT.TEMPLATES.lbs: Lb @@ -375,13 +375,13 @@ FALLOUT.TEMPLATES.Learned: Nauczony FALLOUT.TEMPLATES.LOCATIONS_INJURIES: Lokalizacje i rany FALLOUT.TEMPLATES.Locations: Lokalizacja FALLOUT.TEMPLATES.Luck: Szczęście -FALLOUT.TEMPLATES.MaterialsRecoverd: Materials Recovered +FALLOUT.TEMPLATES.MaterialsRecoverd: Odzyskane materiały FALLOUT.TEMPLATES.MaterialsRequired: Wymagane materiały FALLOUT.TEMPLATES.MAX_PARTY_AP: Maksymalne PA Drużyny FALLOUT.TEMPLATES.max: maks FALLOUT.TEMPLATES.MAX: MAKS -FALLOUT.TEMPLATES.Melee_Bonus: Melee Bonus -FALLOUT.TEMPLATES.Melee_Damage: Melee Damage +FALLOUT.TEMPLATES.Melee_Bonus: Bonus do walki wręcz +FALLOUT.TEMPLATES.Melee_Damage: Obrażenia Wręcz FALLOUT.TEMPLATES.Mod_Type: Typ Modyfikacji FALLOUT.TEMPLATES.MODULES: Modyfikacje FALLOUT.TEMPLATES.Name_Prefix: Element nazwy @@ -401,7 +401,7 @@ FALLOUT.TEMPLATES.Qualities: Jakość FALLOUT.TEMPLATES.RAD: RADIACYJNE FALLOUT.TEMPLATES.Radiation_Healed: Wyleczone napromieniowanie FALLOUT.TEMPLATES.RADIATION: RADIACJA -FALLOUT.TEMPLATES.Range: Range +FALLOUT.TEMPLATES.Range: Zasięg FALLOUT.TEMPLATES.RANGE: Zasięg FALLOUT.TEMPLATES.Rank: Rangi FALLOUT.TEMPLATES.Ranks_current_maximum: Rangi [obecne/maksymalne] @@ -427,7 +427,7 @@ FALLOUT.TEMPLATES.Successes: Sukcesy FALLOUT.TEMPLATES.Tag: Specjalizacja FALLOUT.TEMPLATES.Tear: Zużycie i ścieranie FALLOUT.TEMPLATES.Thirst_Reduction: Redukcja pragnienia -FALLOUT.TEMPLATES.TimeTaken: Time Taken +FALLOUT.TEMPLATES.TimeTaken: Czas wykonania FALLOUT.TEMPLATES.TN: CEL FALLOUT.TEMPLATES.TRAIT: ATUT FALLOUT.TEMPLATES.Treated_injury_Right_Click: Wylecz Ranę (Kliknij Prawym) @@ -448,12 +448,12 @@ FALLOUT.TEMPLATES.Weapon: Broń FALLOUT.TEMPLATES.WeaponName: Nazwa Broni FALLOUT.TEMPLATES.Weapons: Bronie FALLOUT.TEMPLATES.WellRested: Dobrze Wypoczęty -FALLOUT.TIME.DAYS_PLURAL: "{days} Days" -FALLOUT.TIME.DAYS_SINGULAR: "{days} Day" -FALLOUT.TIME.HOURS_PLURAL: "{hours} Hours" -FALLOUT.TIME.HOURS_SINGULAR: "{hours} Hour" -FALLOUT.TIME.MINUTES_PLURAL: "{mins} Minutes" -FALLOUT.TIME.MINUTES_SINGULAR: "{mins} Minute" +FALLOUT.TIME.DAYS_PLURAL: "{days} Dni" +FALLOUT.TIME.DAYS_SINGULAR: "{days} Dzień" +FALLOUT.TIME.HOURS_PLURAL: "{hours} Godziny" +FALLOUT.TIME.HOURS_SINGULAR: "{hours} Godzina" +FALLOUT.TIME.MINUTES_PLURAL: "{mins} Minut" +FALLOUT.TIME.MINUTES_SINGULAR: "{mins} Minuta" FALLOUT.TOOLTIPS.DamageEffect.arc: Każdy efekt automatycznie uderza w jeden dodatkowy cel w bliskim zasięgu głównego celu. Każdy dodatkowy cel traci o połowę więcej uszkodzeń (zaokrąglonych w górę). W przeciwieństwie do Rozrzutu nie kosztuje to dodatkowej amunicji. FALLOUT.TOOLTIPS.DamageEffect.breaking: Za każdy uzyskany na kościach Efekt zmniejsz na stałe o –1 liczbę @fos[DC], jaką zapewnia celowi osłona. Jeśli wróg jej nie posiada, zmniejsz o 1 Odporność trafionej lokalizacji zgodnie z rodzajem zadanych obrażeń – fizyczne obrażenia zmniejszają Odporność fizyczną i tak dalej. FALLOUT.TOOLTIPS.DamageEffect.burst: Atak uderza o jeden dodatkowy cel w bliskim dystansie podstawowego celu dla każdego z wprowadzonych efektów. Każdy dodatkowy cel zużywa 1 dodatkową jednostkę amunicji z broni. @@ -491,16 +491,10 @@ FALLOUT.TOOLTIPS.WeaponQuality.unreliable: Kiedy wykonujesz atak taką bronią, FALLOUT.TOOLTIPS.WeaponQuality.unstable_radiation: To nigdy nie było przeznaczone do użycia jako broń ręczna. Kiedy atakujesz bronią, każda komplikacja, którą zadajesz, zadaje 2KW obrażeń od promieniowania w wyniku radioaktywnego sprzężenia zwrotnego. Broń nie może posiadać zarówno stabilnego, jak i niestabilnego promieniowania. FALLOUT.UI.Add: Dodaj FALLOUT.UI.Addictions: Uzależnienia -FALLOUT.UI.Additionalamo: Dodatkowe kości obrażeń z szybkoszczelność -FALLOUT.UI.Additionalmeledmg: Dodatkowe kości obrażeń za PA Drużyny -FALLOUT.UI.AdditionalmeledmgOverseer: Dodatkowe kości obrażeń za PA Nadzorcy FALLOUT.UI.APPAREL_MODS: Modyfikacje Odzieży FALLOUT.UI.AreYouSure: Jesteś pewien? -FALLOUT.UI.ASSISTANCE: Pomoc -FALLOUT.UI.BaseDamage: Kośći obrażeń broni -FALLOUT.UI.Bonusdmg: Dodatkowe kości obrażeń +FALLOUT.UI.BaseDamage: Obrażenia Podstawowe FALLOUT.UI.BOOKS_AND_MAGZS: Książki i Czasopisma -FALLOUT.UI.Buy_from_Overseer: Kup PA od Nadzordy FALLOUT.UI.Cancel: Anuluj FALLOUT.UI.CAPS: Kapsle FALLOUT.UI.CarryWeight: Noszony ciężar @@ -514,34 +508,23 @@ FALLOUT.UI.Cost: Cena FALLOUT.UI.Damage: Obrażenia FALLOUT.UI.DISEASES: Choroby FALLOUT.UI.favorite: Ulubiony -FALLOUT.UI.FREED20: Darmowa dodatkowa kość FALLOUT.UI.INVENTORY: Ekwipunek FALLOUT.UI.MISCELLANY: Rozmaitości FALLOUT.UI.Name: Nazwa -FALLOUT.UI.Not_Enough: Nie wystarczająco FALLOUT.UI.OTHER: Inne FALLOUT.UI.Perks: Profity FALLOUT.UI.Qty: Ilość FALLOUT.UI.Quantity: Ilość FALLOUT.UI.Rarity: Rzadkość -FALLOUT.UI.REGULAR: Podstawowy -FALLOUT.UI.PAYAP1: Wydaj 1 PA -FALLOUT.UI.PAYAP3: Wydaj 3 PA -FALLOUT.UI.PAYAP6: Wydaj 6 PA FALLOUT.UI.ROBOT_MODULES: Modyfikacje Robotów -FALLOUT.UI.Roll: Rzuć FALLOUT.UI.SaveChanges: Zapisz zmiany FALLOUT.UI.Special_Abilities: Zdolności Specjalne FALLOUT.UI.SPECIAL_ABILITY: Zdolności Specjalne -FALLOUT.UI.Spend_AP: Wydaj PA -FALLOUT.UI.Spend_Overseer_AP: Wydaj PA Nazorcy FALLOUT.UI.stashed: Schowane FALLOUT.UI.Type: Typ FALLOUT.UI.UNSORTED: Nieposortowane -FALLOUT.UI.Weapondamagedice: Kości obrażeń z bronii FALLOUT.UI.WEAPON_MODS: Modyfikacje Broni FALLOUT.UI.Weight: Waga -FALLOUT.UI.With: Z FALLOUT.UI.Yes: Yes FALLOUT.WEAPONS.damageEffect.arc: Łuk FALLOUT.WEAPONS.damageEffect.breaking: Niszczące @@ -571,13 +554,13 @@ FALLOUT.WEAPONS.weaponQuality.limited: Z ograniczeniem FALLOUT.WEAPONS.weaponQuality.mine: Mina FALLOUT.WEAPONS.weaponQuality.night_vision: Noktowizja FALLOUT.WEAPONS.weaponQuality.parry: Parująca -FALLOUT.WEAPONS.weaponQuality.placed: Placed +FALLOUT.WEAPONS.weaponQuality.placed: Umieszczona FALLOUT.WEAPONS.weaponQuality.recoil_x: Odrzut FALLOUT.WEAPONS.weaponQuality.recon: Zwiadowcza FALLOUT.WEAPONS.weaponQuality.reliable: Niezawodna FALLOUT.WEAPONS.weaponQuality.slow_load: Wolne przeładowanie FALLOUT.WEAPONS.weaponQuality.suppressed: Wytłumiona -FALLOUT.WEAPONS.weaponQuality.surge: Surge +FALLOUT.WEAPONS.weaponQuality.surge: Zryw FALLOUT.WEAPONS.weaponQuality.thrown: Rzucana FALLOUT.WEAPONS.weaponQuality.two_handed: Dwuręczna FALLOUT.WEAPONS.weaponQuality.unreliable: Zawodna @@ -585,7 +568,7 @@ FALLOUT.WEAPONS.weaponQuality.unstable_radiation: Niestabilne promieniowanie FALLOUT.WEAPONS.weaponType.bigGuns: Broń ciężka FALLOUT.WEAPONS.weaponType.bows: Łuki FALLOUT.WEAPONS.weaponType.creatureAttack: Atak Stwora -FALLOUT.WEAPONS.weaponType.custom: Custom +FALLOUT.WEAPONS.weaponType.custom: Niestandardowy FALLOUT.WEAPONS.weaponType.energyWeapons: Broń Energetyczna FALLOUT.WEAPONS.weaponType.explosives: Materiały wybuchowe FALLOUT.WEAPONS.weaponType.meleeWeapons: Broń Biała diff --git a/scss/global/_window.scss b/scss/global/_window.scss index 9bd569b9..c399a055 100644 --- a/scss/global/_window.scss +++ b/scss/global/_window.scss @@ -141,6 +141,17 @@ &.dice-selected { opacity: 0.45; } + + } + .flavor-text { + margin: 0 0 0 0; + font-family: "Lobster", cursive, cursive; + padding: 8px; + font-size: 15px; + background-image: url(../assets/chat/yellow-placq.webp); + background-size: 100% 100%; + background-repeat: no-repeat; + display: flex; } } } @@ -149,10 +160,14 @@ .resource { margin: 0 2px 5px; padding: 0 5px 0 0; - background-color: $f-blue; + background-color: #729eb2; display: grid; grid-template-rows: auto auto; - grid-template-columns: repeat(6, auto); + grid-template-columns: repeat(2,auto); + justify-content: space-evenly; + align-content: center; + align-items: center; + justify-items: center; &.tile { background-color: $f-tile; } @@ -174,6 +189,7 @@ input[type="number"] { text-align: center; background-color: beige; + width: 30px; } } ul { diff --git a/system/src/roller/Dialog2d20.mjs b/system/src/roller/Dialog2d20.mjs index 91239da7..32edf5ac 100644 --- a/system/src/roller/Dialog2d20.mjs +++ b/system/src/roller/Dialog2d20.mjs @@ -11,7 +11,7 @@ export class Dialog2d20 extends Dialog { actor, item, ap, - apcost, + apCost, dialogData={}, options={} ) { @@ -26,7 +26,7 @@ export class Dialog2d20 extends Dialog { this.actor = actor; this.item = item; this.ap = ap; - this.apcost = apcost; + this.apCost = apCost; this.options.classes = ["dice-icon"]; this.deferred = new Deferred(); } @@ -37,9 +37,9 @@ export class Dialog2d20 extends Dialog { html.ready(e => { this.markDiceNumber(html, this.diceNum); if (this.actor.type !== "character" && this.actor.type !== "robot") { - this.gmroll(html); + this.gmRoll(html); } - this.freed20(html); + this.freeD20(html); }); html.on("click", ".dice-icon", (e, i, a) => { @@ -47,28 +47,28 @@ export class Dialog2d20 extends Dialog { this.diceNum = parseInt(index); this.markDiceNumber(html, this.diceNum); if (this.actor.type === ("character" || "robot")) { - this.apmanagment(html); + this.apManagment(html); } else { - this.gmapmanagment(html); + this.gmApManagment(html); } }); html.on("click", '[name="freed20"]', () => { - this.freed20(html); - let numberofdice = 0; + this.freeD20(html); + let numberOfDice = 0; for (let i = 2; i <= 5; i++) { const diceElement =this.element.find(`[data-index="${i}"]`); const containsMarked = diceElement.hasClass("marked"); if (containsMarked) { - numberofdice = i; + numberOfDice = i; } } if (this.actor.type === ("character" || "robot")) { - this.apmanagment(html, numberofdice); + this.apManagment(html, numberOfDice); } else { - this.gmapmanagment(html, numberofdice); + this.gmApManagment(html, numberOfDice); } }); @@ -76,12 +76,12 @@ export class Dialog2d20 extends Dialog { if (this.actor.type === ("character" || "robot")) { let ap = game.settings.get("fallout", "partyAP"); this.element.find('[name="current_ap"]').val(ap); - this.apmanagment(html); + this.apManagment(html); } else { let ap = game.settings.get("fallout", "gmAP"); this.element.find('[name="current_ap"]').val(ap); - this.gmapmanagment(html); + this.gmApManagment(html); } }); @@ -90,12 +90,12 @@ export class Dialog2d20 extends Dialog { if (this.actor.type === ("character" || "robot")) { let ap = game.settings.get("fallout", "partyAP"); this.element.find('[name="current_ap"]').val(ap); - this.apmanagment(html); + this.apManagment(html); } else { let ap = game.settings.get("fallout", "gmAP"); this.element.find('[name="current_ap"]').val(ap); - this.gmapmanagment(html); + this.gmApManagment(html); } this.rollButton(this); @@ -109,20 +109,20 @@ export class Dialog2d20 extends Dialog { let skill = this.element.find('[name="skill"]').val(); let complication = this.element.find('[name="complication"]').val(); let isTag = this.element.find('[name="tag"]').is(":checked"); - let apspend = this.element.find('[name="spend_ap"]').val(); - let apbuy = parseInt(this.element.find('[name="by_from_gm"]').val()); + let apSpend = this.element.find('[name="spend_ap"]').val(); + let apBuy = parseInt(this.element.find('[name="by_from_gm"]').val()); this.rolling = true; - let numberofdice = 0; + let numberOfDice = 0; for (let i = 2; i <= 5; i++) { const diceElement =this.element.find(`[data-index="${i}"]`); const containsMarked = diceElement.hasClass("marked"); if (containsMarked) { - numberofdice = i; + numberOfDice = i; } } fallout.Roller2D20.rollD20({ rollname: this.rollName, - dicenum: numberofdice, + dicenum: numberOfDice, attribute: attr, skill: skill, tag: isTag, @@ -130,28 +130,28 @@ export class Dialog2d20 extends Dialog { rollLocation: this.rollLocation, item: this.item, actor: this.actor, - apspend: apspend, - apbuy: apbuy, + apSpend: apSpend, + apBuy: apBuy, }).then(result => this.deferred.resolve(result)); let ap = game.settings.get("fallout", "partyAP"); - let gmap = parseInt(game.settings.get("fallout", "gmAP")); + let gmAP = parseInt(game.settings.get("fallout", "gmAP")); - if (apbuy>0) { + if (apBuy>0) { ap = 0; fallout.APTracker.setAP("partyAP", ap); - let givegmap = apbuy + gmap; - fallout.APTracker.setAP("gmAP", givegmap); + let giveGmAP = apBuy + gmAP; + fallout.APTracker.setAP("gmAP", giveGmAP); } else { // eslint-disable-next-line no-lonely-if if (this.actor.type === ("character" || "robot")) { - let leftpartyap = ap - apspend; - fallout.APTracker.setAP("partyAP", leftpartyap); + let leftPartyAp = ap - apSpend; + fallout.APTracker.setAP("partyAP", leftPartyAp); } else { - let leftpartyap = gmap - apspend; - fallout.APTracker.setAP("gmAP", leftpartyap); + let leftPartyAp = gmAP - apSpend; + fallout.APTracker.setAP("gmAP", leftPartyAp); } } @@ -185,8 +185,8 @@ export class Dialog2d20 extends Dialog { let attr = this.element.find('[name="attribute"]').val(); let skill = this.element.find('[name="skill"]').val(); let complication = this.element.find('[name="complication"]').val(); - let apbuy = this.element.find('[name="by_from_gm"]').val(); - let apspend = this.element.find('[name="spend_ap"]').val(); + let apBuy = 0; + let apSpend = 0; let isTag = this.element.find('[name="tag"]').is(":checked"); this.rolling = true; let nameroll = ""; @@ -206,8 +206,8 @@ export class Dialog2d20 extends Dialog { rollLocation: this.rollLocation, item: this.item, actor: this.actor, - apspend: apspend, - apbuy: apbuy, + apSpend: apSpend, + apBuy: apBuy, }).then(result => this.deferred.resolve(result)); if (game.settings.get("fallout", "automaticAmmunitionCalculation")) { @@ -243,42 +243,42 @@ export class Dialog2d20 extends Dialog { } } - markDiceNumber(html, numberofdice, gmerror) { - let nextdice; - let markeddice = 0; + markDiceNumber(html, numberOfDice, gmError) { + let nextDice; + let markedDice = 0; for (let i = 2; i <= 5; i++) { const diceElement =this.element.find(`[data-index="${i}"]`); const containsMarked = diceElement.hasClass("marked"); if (containsMarked) { - markeddice = i; + markedDice = i; } } - if ((numberofdice === 2 || ($(html).find('[name="freed20"]').is(":checked") && numberofdice === 3)) && markeddice === numberofdice) { - const diceElement = $(html).find(`[data-index="${numberofdice}"]`); + if ((numberOfDice === 2 || ($(html).find('[name="freed20"]').is(":checked") && numberOfDice === 3)) && markedDice === numberOfDice) { + const diceElement = $(html).find(`[data-index="${numberOfDice}"]`); diceElement.addClass("marked"); } else { - const currentdice = $(html).find(`[data-index="${numberofdice}"]`).hasClass("marked"); - if (numberofdice+1 >5) { - nextdice = false; + const currentdice = $(html).find(`[data-index="${numberOfDice}"]`).hasClass("marked"); + if (numberOfDice+1 >5) { + nextDice = false; } else { - nextdice = $(html).find(`[data-index="${numberofdice + 1}"]`).hasClass("marked"); + nextDice = $(html).find(`[data-index="${numberOfDice + 1}"]`).hasClass("marked"); } for (let i = 2; i <= 5; i++) { const diceElement = $(html).find(`[data-index="${i}"]`); if (i<=this.diceNum && currentdice === false) { diceElement.addClass("marked"); } - if (i> this.diceNum && nextdice === true) { + if (i> this.diceNum && nextDice === true) { diceElement.removeClass("marked"); } - if (i === this.diceNum && nextdice === false && currentdice === true) { + if (i === this.diceNum && nextDice === false && currentdice === true) { diceElement.removeClass("marked"); } } } - if (gmerror) { + if (gmError) { let i = 0; if ($(html).find('[name="freed20"]').is(":checked") ) { i = 4; @@ -295,25 +295,25 @@ export class Dialog2d20 extends Dialog { } - freed20(html) { + freeD20(html) { const regular = game.i18n.localize("FALLOUT.UI.REGULAR"); const pay1ap = game.i18n.localize("FALLOUT.UI.PAYAP1"); const pay3ap = game.i18n.localize("FALLOUT.UI.PAYAP3"); const pay6ap = game.i18n.localize("FALLOUT.UI.PAYAP6"); const li2d20 = document.querySelector('[name="2d20"]'); - let numberofdice = 0; + let numberOfDice = 0; for (let i = 2; i <= 5; i++) { const diceElement =this.element.find(`[data-index="${i}"]`); const containsMarked = diceElement.hasClass("marked"); if (containsMarked) { - numberofdice = i; + numberOfDice = i; } } if ($(html).find('[name="freed20"]').is(":checked")) { li2d20.style.display = "none"; $(html).find("ul[name='currentap'] li:nth-child(2) label").text(regular); - if (numberofdice === 2) { + if (numberOfDice === 2) { $(html).find("[data-index= 3]").addClass("marked"); } $(html).find("ul[name='currentap'] li:nth-child(3) label").text(pay1ap); @@ -325,62 +325,62 @@ export class Dialog2d20 extends Dialog { $(html).find("ul[name='currentap'] li:nth-child(2) label").text(pay1ap); $(html).find("ul[name='currentap'] li:nth-child(3) label").text(pay3ap); $(html).find("ul[name='currentap'] li:nth-child(4) label").text(pay6ap); - if (numberofdice === 3) { + if (numberOfDice === 3) { $(html).find("[data-index= 3]").removeClass("marked"); } } } - apmanagment(html) { - let apcostd = 0; + apManagment(html) { + let apCost = 0; let left = 0; - let numberofdice = 0; + let numberOfDice = 0; let ap =this.element.find('[name="current_ap"]').val(); for (let i = 2; i <= 5; i++) { const diceElement = $(html).find(`[data-index="${i}"]`); const containsMarked = diceElement.hasClass("marked"); if (containsMarked) { - numberofdice = i; + numberOfDice = i; } } if ($(html).find('[name="freed20"]').is(":checked")) { - switch (numberofdice) { + switch (numberOfDice) { case 2: - apcostd = 0; + apCost = 0; $(html).find('[name="by_from_gm"]').val(0); break; case 3: - apcostd = 0; + apCost = 0; $(html).find('[name="by_from_gm"]').val(0); break; case 4: - apcostd = 1; - left = ap - apcostd; + apCost = 1; + left = ap - apCost; break; case 5: - apcostd = 3; - left = ap - apcostd; + apCost = 3; + left = ap - apCost; break; } } else { - switch (numberofdice) { + switch (numberOfDice) { case 2: - apcostd = 0; + apCost = 0; $(html).find('[name="by_from_gm"]').val(0); break; case 3: - apcostd = 1; - left = ap - apcostd; + apCost = 1; + left = ap - apCost; break; case 4: - apcostd = 3; - left = ap - apcostd; + apCost = 3; + left = ap - apCost; break; case 5: - apcostd = 6; - left = ap - apcostd; + apCost = 6; + left = ap - apCost; break; } } @@ -395,88 +395,88 @@ export class Dialog2d20 extends Dialog { $(html).find('[name="by_from_gm"]').val(-1*left); } else { - $(html).find('[name="spend_ap"]').val(apcostd); + $(html).find('[name="spend_ap"]').val(apCost); $(html).find('[name="by_from_gm"]').val(0); } } - gmapmanagment(html) { - let apcostd = 0; + gmApManagment(html) { + let apCost = 0; let left = 0; - let numberofdice = 0; + let numberOfDice = 0; let ap =this.element.find('[name="current_ap"]').val(); for (let i = 2; i <= 5; i++) { const diceElement = $(html).find(`[data-index="${i}"]`); const containsMarked = diceElement.hasClass("marked"); if (containsMarked) { - numberofdice = i; + numberOfDice = i; } } if ($(html).find('[name="freed20"]').is(":checked")) { - switch (numberofdice) { + switch (numberOfDice) { case 2: - apcostd = 0; + apCost = 0; break; case 3: - apcostd = 0; + apCost = 0; break; case 4: - apcostd = 1; - left = ap - apcostd; + apCost = 1; + left = ap - apCost; break; case 5: - apcostd = 3; - left = ap - apcostd; + apCost = 3; + left = ap - apCost; break; } } else { - switch (numberofdice) { + switch (numberOfDice) { case 2: - apcostd = 0; + apCost = 0; break; case 3: - apcostd = 1; - left = ap - apcostd; + apCost = 1; + left = ap - apCost; break; case 4: - apcostd = 3; - left = ap - apcostd; + apCost = 3; + left = ap - apCost; break; case 5: - apcostd = 6; - left = ap - apcostd; + apCost = 6; + left = ap - apCost; break; } } if (left<0) { const part1 = game.i18n.localize("FALLOUT.UI.Not_Enough"); const part2 = game.i18n.localize("FALLOUT.TEMPLATES.OVERSEER_AP"); - const warexist =ui.notifications.active.length; - if (warexist === 0) { + const warExist =ui.notifications.active.length; + if (warExist === 0) { ui.notifications.warn(`${part1} ${part2}`); } - let numberofdice = 2; - let gmerror = true; - this.markDiceNumber(html, numberofdice, gmerror); + let numberOfDice = 2; + let gmError = true; + this.markDiceNumber(html, numberOfDice, gmError); } else { - $(html).find('[name="spend_ap"]').val(apcostd); + $(html).find('[name="spend_ap"]').val(apCost); } } - gmroll(html) { + gmRoll(html) { const divbuy = document.querySelector('[name="buy_from_gm"]'); divbuy.style.display = "none"; - let gmap = game.settings.get("fallout", "gmAP"); - this.element.find('[name="current_ap"]').val(gmap); + let gmAP = game.settings.get("fallout", "gmAP"); + this.element.find('[name="current_ap"]').val(gmAP); $(html).find('[name="party_ap"] .title-label').text(game.i18n.localize("FALLOUT.TEMPLATES.OVERSEER_AP")); $(html).find('[name="spend_ap"] .title-label').text(game.i18n.localize("FALLOUT.UI.Spend_Overseer_AP")); } - static async createDialog({ rollName = "Roll D20", diceNum = 2, attribute = 0, skill = 0, tag = false, complication = 20, rollLocation=false, actor=null, item=null, ap = 0, apcost = 0 } = {}) { + static async createDialog({ rollName = "Roll D20", diceNum = 2, attribute = 0, skill = 0, tag = false, complication = 20, rollLocation=false, actor=null, item=null, ap = 0, apCost = 0 } = {}) { let dialogData = {}; dialogData.rollName = rollName; @@ -489,7 +489,7 @@ export class Dialog2d20 extends Dialog { dialogData.actor = actor; dialogData.item = item; dialogData.ap = ap; - dialogData.apcost = apcost; + dialogData.apCost = apCost; const html = await renderTemplate("systems/fallout/templates/dialogs/dialog2d20.hbs", dialogData); let d = new Dialog2d20( @@ -503,7 +503,7 @@ export class Dialog2d20 extends Dialog { actor, item, ap, - apcost, + apCost, { title: rollName, content: html, @@ -520,7 +520,7 @@ export class Dialog2d20 extends Dialog { }, } ); - d.render(true, {width: 550, height: 290}); + d.render(true, {width: 620, height: 320}); return d.deferred.promise; } diff --git a/system/src/roller/Roller2D20.mjs b/system/src/roller/Roller2D20.mjs index 372962d0..ee12e520 100644 --- a/system/src/roller/Roller2D20.mjs +++ b/system/src/roller/Roller2D20.mjs @@ -20,6 +20,8 @@ export class Roller2D20 { rollname = "Roll xD20", skill = 0, tag = false, + apSpend = 0, + apBuy = 0, }={}) { // let dicesRolled = []; let successTreshold = parseInt(attribute) + parseInt(skill); @@ -27,7 +29,9 @@ export class Roller2D20 { let complicationTreshold = parseInt(complication); let formula = `${dicenum}d20`; let roll = new Roll(formula); - + apSpend = parseInt(apSpend); + apBuy = parseInt(apBuy); + let flavor = ""; await roll.evaluate(); try { @@ -52,6 +56,21 @@ export class Roller2D20 { hitLocationResult = hitLocationRoll.total; } + if (apSpend !== 0 || apBuy !== 0) { + let part1 = game.i18n.localize("FALLOUT.UI.SPENT"); + let part2 =game.i18n.localize("FALLOUT.TEMPLATES.PARTY_AP"); + let part3 = ""; + let part4= ""; + + if (actor.type !== "character" && actor.type !== "robot") { + part2 = game.i18n.localize("FALLOUT.TEMPLATES.OVERSEER_AP"); + } + if (apBuy !== 0) { + part3 = `\n ${game.i18n.localize("FALLOUT.UI.Buy_from_Overseer")}`; + part4 = apBuy; + } + flavor = `${part1} ${apSpend} ${part2} ${part3} ${part4}`; + } const dicesRolled = await Roller2D20.parseD20Roll({ actor: actor, @@ -62,6 +81,7 @@ export class Roller2D20 { item: item, roll: roll, rollname: rollname, + flavor: flavor, successTreshold, }); return {roll: roll, dicesRolled: dicesRolled}; @@ -79,6 +99,7 @@ export class Roller2D20 { roll = null, rollname = "Roll xD20", successTreshold = 0, + flavor = "", }={}) { let i = 0; roll.dice.forEach(d => { @@ -136,6 +157,7 @@ export class Roller2D20 { roll: roll, rollname: rollname, successTreshold: successTreshold, + flavor: flavor, }); return dicesRolled; } @@ -188,6 +210,7 @@ export class Roller2D20 { roll = null, rollname = "Roll xD20", successTreshold = 0, + flavor = "", }={}) { let successesNum = Roller2D20.getNumOfSuccesses(dicesRolled); let complicationsNum = Roller2D20.getNumOfComplications(dicesRolled); @@ -202,6 +225,7 @@ export class Roller2D20 { hitLocationResult: hitLocationResult, item: item, actor: actor, + flavor: flavor, }; const html = await renderTemplate("systems/fallout/templates/chat/roll2d20.hbs", rollData); @@ -216,6 +240,7 @@ export class Roller2D20 { falloutRoll.rerollIndexes = rerollIndexes; falloutRoll.rollname = rollname; falloutRoll.successTreshold = successTreshold; + falloutRoll.flavor = flavor; let chatData = { content: html, @@ -224,6 +249,7 @@ export class Roller2D20 { rollMode: game.settings.get("core", "rollMode"), speaker: ChatMessage.getSpeaker({actor: actor}), user: game.user.id, + }; ChatMessage.applyRollMode(chatData, game.settings.get("core", "rollMode")); diff --git a/system/templates/chat/roll2d20.hbs b/system/templates/chat/roll2d20.hbs index 7c6bf1be..59ba18bb 100644 --- a/system/templates/chat/roll2d20.hbs +++ b/system/templates/chat/roll2d20.hbs @@ -1,6 +1,10 @@

{{rollname}}

+ {{#ifCond flavor "===" ""}} + {{else}} + {{flavor}} + {{/ifCond}}

{{localize "FALLOUT.TEMPLATES.Successes"}}: {{successes}} diff --git a/system/templates/dialogs/dialog2d20.hbs b/system/templates/dialogs/dialog2d20.hbs index 8826837d..178e982b 100644 --- a/system/templates/dialogs/dialog2d20.hbs +++ b/system/templates/dialogs/dialog2d20.hbs @@ -36,7 +36,7 @@

{{localize "FALLOUT.UI.Spend_AP"}}

- +

{{localize "FALLOUT.UI.Buy_from_Overseer"}}

From a2341dccb507975712fdbff77f73f38575e08a5e Mon Sep 17 00:00:00 2001 From: BartlomiejBielecki Date: Thu, 6 Jun 2024 01:40:24 +0200 Subject: [PATCH 09/11] add required changes to dmg roll --- system/src/handlebars.mjs | 5 + system/src/roller/DialogD6.mjs | 162 +++++++++----------- system/src/roller/Roller2D20.mjs | 12 +- system/templates/dialogs/damage-options.hbs | 11 ++ 4 files changed, 95 insertions(+), 95 deletions(-) create mode 100644 system/templates/dialogs/damage-options.hbs diff --git a/system/src/handlebars.mjs b/system/src/handlebars.mjs index 6a4a6592..cb10a7c4 100644 --- a/system/src/handlebars.mjs +++ b/system/src/handlebars.mjs @@ -246,5 +246,10 @@ export default function registerHandlebarsHelpers() { const html = options.fn(this); return html.replace(rgx, "$& selected"); }); + Handlebars.registerHelper("for", function(n, block) { + let additionalAmmo = ""; + for (let i = 0; i <= n; ++i) additionalAmmo += block.fn(i); + return additionalAmmo; + }); } diff --git a/system/src/roller/DialogD6.mjs b/system/src/roller/DialogD6.mjs index cb44b270..9dbdbb7d 100644 --- a/system/src/roller/DialogD6.mjs +++ b/system/src/roller/DialogD6.mjs @@ -2,15 +2,15 @@ /* eslint-disable max-len */ export class DialogD6 extends Dialog { // eslint-disable-next-line max-len - constructor(rollName, diceNum, actor, weapon, falloutRoll, otherdmgdice, firerateamo, dialogData = {}, options = {}) { + constructor(rollName, diceNum, actor, weapon, falloutRoll, otherDmgDice, fireRateAmo, dialogData = {}, options = {}) { super(dialogData, options); this.rollName = rollName; this.diceNum = diceNum; this.actor = actor; this.weapon = weapon; this.falloutRoll = falloutRoll; - this.otherdmgdice = otherdmgdice; - this.firerateamo = firerateamo; + this.otherDmgDice = otherDmgDice; + this.fireRateAmo = fireRateAmo; this.options.classes = ["dice-icon"]; } @@ -28,16 +28,16 @@ export class DialogD6 extends Dialog { if (isaddl !== 0) { CDnumber = html.find(".d-number")[0].value; } - let otherdmgdice = html.find(".otherd-number")[0].value; - let firerateamo =html.find('[name="firerateamo"] option:selected').val(); + let otherDmgDice = html.find(".otherd-number")[0].value; + let fireRateAmo =html.find('[name="fireRateAmo"] option:selected').val(); if (!this.falloutRoll) { fallout.Roller2D20.rollD6({ rollname: this.rollName, diceNum: parseInt(CDnumber), weapon: this.weapon, actor: this.actor, - otherdmgdice: parseInt(otherdmgdice), - firerateamo: parseInt(firerateamo), + otherDmgDice: parseInt(otherDmgDice), + fireRateAmo: parseInt(fireRateAmo), }); } @@ -48,8 +48,8 @@ export class DialogD6 extends Dialog { weapon: this.weapon, actor: this.actor, falloutRoll: this.falloutRoll, - otherdmgdice: parseInt(otherdmgdice), - firerateamo: parseInt(firerateamo), + otherDmgDice: parseInt(otherDmgDice), + fireRateAmo: parseInt(fireRateAmo), }); } // REDUCE AMMO FOR CHARACTER AND ROBOT @@ -68,24 +68,24 @@ export class DialogD6 extends Dialog { // eslint-disable-next-line eqeqeq // reduce party AP when use to increase damage in melee if (this.weapon.system.weaponType === "meleeWeapons" || this.weapon.system.weaponType === "unarmed") { - const currentpartyap= game.settings.get("fallout", "partyAP"); - const newpartyap=currentpartyap-parseInt(firerateamo); - const overseerap = game.settings.get("fallout", "gmAP"); - if (newpartyap<0) { + const currentPartyAp= game.settings.get("fallout", "partyAP"); + const newPartyAp=currentPartyAp-parseInt(fireRateAmo); + const overseerAp = game.settings.get("fallout", "gmAP"); + if (newPartyAp<0) { fallout.APTracker.setAP("partyAP", 0); - const newoverseerap = overseerap - newpartyap; - fallout.APTracker.setAP("gmAP", newoverseerap); + const newoverseerAp = overseerAp - newPartyAp; + fallout.APTracker.setAP("gmAP", newoverseerAp); } else { - fallout.APTracker.setAP("partyAP", newpartyap); + fallout.APTracker.setAP("partyAP", newPartyAp); } } // reduce amo wehn firrerate is used else { - if (firerateamo > 0) { - this.reduceadditionalAmmo(firerateamo, this.weapon, _actor); + if (fireRateAmo > 0) { + this.reduceAdditionalAmmo(fireRateAmo, this.weapon, _actor); } } @@ -94,14 +94,14 @@ export class DialogD6 extends Dialog { // eslint-disable-next-line eqeqeq // reduce party AP when use to increase damage in melee if (this.weapon.system.weaponType === "meleeWeapons" || this.weapon.system.weaponType === "unarmed") { - const currentoverseerap= game.settings.get("fallout", "gmAP"); - const newoverseerap=currentoverseerap-parseInt(firerateamo); - fallout.APTracker.setAP("gmAP", newoverseerap); + const currentoverseerAp= game.settings.get("fallout", "gmAP"); + const newoverseerAp=currentoverseerAp-parseInt(fireRateAmo); + fallout.APTracker.setAP("gmAP", newoverseerAp); } else { - if (firerateamo > 0) { - this.reduceadditionalAmmo(firerateamo, this.weapon, _actor); + if (fireRateAmo > 0) { + this.reduceAdditionalAmmo(fireRateAmo, this.weapon, _actor); } } @@ -113,14 +113,14 @@ export class DialogD6 extends Dialog { const actorId = this.actor.split(".")[1]; const actortype= game.actors.get(actorId).type; const weapontype = this.weapon.system.weaponType; - let firerateamo = html.find('[name="firerateamo"] option:selected').val(); + let fireRateAmo = html.find('[name="fireRateAmo"] option:selected').val(); if (weapontype === "meleeWeapons" || weapontype === "unarmed") { if (actortype !== "character" && actortype !== "robot") { const part1 = game.i18n.localize("FALLOUT.UI.Not_Enough"); const part2 = game.i18n.localize("FALLOUT.TEMPLATES.OVERSEER_AP"); const pulsingContainer = document.querySelector(".flexrow.resource.pulsing"); - const currentoverseerap = game.settings.get("fallout", "gmAP"); - if (firerateamo > currentoverseerap) { + const currentoverseerAp = game.settings.get("fallout", "gmAP"); + if (fireRateAmo > currentoverseerAp) { if (!pulsingContainer) { const pulsingHTML = `
@@ -136,14 +136,14 @@ export class DialogD6 extends Dialog { } } else { - const currentpartyap = game.settings.get("fallout", "partyAP"); + const currentPartyAp = game.settings.get("fallout", "partyAP"); const part1 = game.i18n.localize("FALLOUT.UI.Not_Enough"); const part2 = game.i18n.localize("FALLOUT.TEMPLATES.PARTY_AP"); const part3 = game.i18n.localize("FALLOUT.UI.Buy_from_Overseer"); const pulsingContainer = document.querySelector(".flexrow.resource.pulsing"); - if (firerateamo > currentpartyap) { - const buyap = parseInt(firerateamo) - currentpartyap; + if (fireRateAmo > currentPartyAp) { + const buyap = parseInt(fireRateAmo) - currentPartyAp; if (!pulsingContainer) { const pulsingHTML = `
@@ -151,6 +151,9 @@ export class DialogD6 extends Dialog {
`; html.find(".otherd-number").after(pulsingHTML); + const selector = `.app.window-app.dice-icon[data-appid="${this.appId}"]`; + const element = document.querySelector(selector); + element.style.height = "230px"; } else { pulsingContainer.remove(); @@ -160,15 +163,21 @@ export class DialogD6 extends Dialog {
`; html.find(".otherd-number").after(pulsingHTML); + const selector = `.app.window-app.dice-icon[data-appid="${this.appId}"]`; + const element = document.querySelector(selector); + element.style.height = "230px"; } } else if (pulsingContainer) { pulsingContainer.remove(); + const selector = `.app.window-app.dice-icon[data-appid="${this.appId}"]`; + const element = document.querySelector(selector); + element.style.height = "184px"; } } } else { - const usedamo = await this.checkfirerate(this.weapon, game.actors.get(actorId), firerateamo); + const usedamo = await this.checkfireRate(this.weapon, game.actors.get(actorId), fireRateAmo); if (usedamo === 1) { const part1 = game.i18n.localize("FALLOUT.UI.Not_Enough"); const part2 = game.i18n.localize("TYPES.Item.ammo"); @@ -187,7 +196,7 @@ export class DialogD6 extends Dialog { } - static async createDialog({ rollName = "DC Roll", diceNum = 2, falloutRoll = null, actor= null, weapon = null, otherdmgdice = 0, firerateamo = 0} = {}) { + static async createDialog({ rollName = "DC Roll", diceNum = 2, falloutRoll = null, actor= null, weapon = null, otherDmgDice = 0, fireRateAmo = 0} = {}) { let dialogData = {}; dialogData.rollName = rollName; dialogData.diceNum = diceNum; @@ -196,41 +205,28 @@ export class DialogD6 extends Dialog { dialogData.actor = actor; const actorId = dialogData.actor.split(".")[1]; const actortype= game.actors.get(actorId).type; - let firerate=weapon.system.fireRate; - const weapondmgdice = game.i18n.localize("FALLOUT.UI.Weapondamagedice"); - const bonusdmg=game.i18n.localize("FALLOUT.UI.Bonusdmg"); - let additionaludesamo=""; + let fireRate=weapon.system.fireRate; + let additionalUdesAmo=""; if ((actortype!== "character" && actortype !== "robot") && (weapon.system.weaponType === "meleeWeapons" || weapon.system.weaponType === "unarmed")) { - firerate= 3; - additionaludesamo=game.i18n.localize("FALLOUT.UI.AdditionalmeledmgOverseer"); + fireRate= 3; + additionalUdesAmo=game.i18n.localize("FALLOUT.UI.Additional_mele_dmg_overseer"); } else if (weapon.system.weaponType === "meleeWeapons" || weapon.system.weaponType === "unarmed") { - firerate= 3; - additionaludesamo=game.i18n.localize("FALLOUT.UI.Additionalmeledmg"); + fireRate= 3; + additionalUdesAmo=game.i18n.localize("FALLOUT.UI.Additional_mele_dmg"); } else { - additionaludesamo=game.i18n.localize("FALLOUT.UI.Additionalamo"); + additionalUdesAmo=game.i18n.localize("FALLOUT.UI.Additional_amo"); } - let optionsHtml = ""; - for (let i = 0; i <= firerate; i++) { - if (i===0) { - optionsHtml += ``; - } - else { - optionsHtml += ``; - } - } - const html = `
-
- - - - -
`; + let dialogDataDmg ={}; + dialogDataDmg.additionalUdesAmo = additionalUdesAmo; + dialogDataDmg.fireRate = fireRate; + dialogDataDmg.diceNum = diceNum; + dialogDataDmg.otherDmgDice = 0; + const html = await renderTemplate("systems/fallout/templates/dialogs/damage-options.hbs", dialogDataDmg); + // eslint-disable-next-line max-len - let d = new DialogD6(rollName, diceNum, actor, weapon, falloutRoll, otherdmgdice, firerateamo, { + let d = new DialogD6(rollName, diceNum, actor, weapon, falloutRoll, otherDmgDice, fireRateAmo, { title: rollName, content: html, buttons: { @@ -244,7 +240,7 @@ export class DialogD6 extends Dialog { d.render(true); } - static async addcreateDialog({ rollName = "DC Roll", diceNum = 2, falloutRoll = null, actor= null, weapon = null, otherdmgdice = 0, firerateamo = 0} = {}) { + static async addcreateDialog({ rollName = "DC Roll", diceNum = 2, falloutRoll = null, actor= null, weapon = null, otherDmgDice = 0, fireRateAmo = 0} = {}) { let dialogData = {}; dialogData.rollName = rollName; dialogData.diceNum = diceNum; @@ -253,39 +249,27 @@ export class DialogD6 extends Dialog { dialogData.actor = actor; const actorId = dialogData.actor.split(".")[1]; const actortype= game.actors.get(actorId).type; - let firerate=weapon.system.fireRate; - const bonusdmg=game.i18n.localize("FALLOUT.UI.Bonusdmg"); - let additionaludesamo=""; + let fireRate=weapon.system.fireRate; + let additionalUdesAmo=""; if ((actortype!== "character" && actortype !== "robot") && (weapon.system.weaponType === "meleeWeapons" || weapon.system.weaponType === "unarmed")) { - firerate= 3; - additionaludesamo=game.i18n.localize("FALLOUT.UI.AdditionalmeledmgOverseer"); + fireRate= 3; + additionalUdesAmo=game.i18n.localize("FALLOUT.UI.Additional_mele_dmg_overseer"); } else if (weapon.system.weaponType === "meleeWeapons" || weapon.system.weaponType === "unarmed") { - firerate= 3; - additionaludesamo=game.i18n.localize("FALLOUT.UI.Additionalmeledmg"); + fireRate= 3; + additionalUdesAmo=game.i18n.localize("FALLOUT.UI.Additional_mele_dmg"); } else { - additionaludesamo=game.i18n.localize("FALLOUT.UI.Additionalamo"); + additionalUdesAmo=game.i18n.localize("FALLOUT.UI.Additional_amo"); } - let optionsHtml = ""; - for (let i = 0; i <= firerate; i++) { - if (i===0) { - optionsHtml += ``; - } - else { - optionsHtml += ``; - } - } - const html = `
-
- - - -
`; + let dialogDataDmg ={}; + dialogDataDmg.additionalUdesAmo = additionalUdesAmo; + dialogDataDmg.fireRate = fireRate; + dialogDataDmg.diceNum = diceNum; + const html = await renderTemplate("systems/fallout/templates/dialogs/damage-options.hbs", dialogDataDmg); + // eslint-disable-next-line max-len - let d = new DialogD6(rollName, diceNum, actor, weapon, falloutRoll, otherdmgdice, firerateamo, { + let d = new DialogD6(rollName, diceNum, actor, weapon, falloutRoll, otherDmgDice, fireRateAmo, { title: rollName, content: html, buttons: { @@ -349,11 +333,11 @@ export class DialogD6 extends Dialog { } } - async checkfirerate(weapon, actor, firerate) { + async checkfireRate(weapon, actor, fireRate) { const ammoPerShot = weapon.system.ammoPerShot; const isgatling = weapon.system.damage.weaponQuality.gatling.value; const ammountofamo = await actor._getAvailableAmmoType(weapon.system.ammo); - let usedammo = ammoPerShot*parseInt(firerate); + let usedammo = ammoPerShot*parseInt(fireRate); if (isgatling === true) { usedammo = 10*usedammo; } @@ -365,7 +349,7 @@ export class DialogD6 extends Dialog { } } - async reduceadditionalAmmo(firarateamo, weapon, actor) { + async reduceAdditionalAmmo(firarateamo, weapon, actor) { const [ammoItem, shotsAvailable] = await actor._getAvailableAmmoType(weapon.system.ammo); const ammoPerShot = weapon.system.ammoPerShot; const isgatling = weapon.system.damage.weaponQuality.gatling.value; diff --git a/system/src/roller/Roller2D20.mjs b/system/src/roller/Roller2D20.mjs index ee12e520..2663c48e 100644 --- a/system/src/roller/Roller2D20.mjs +++ b/system/src/roller/Roller2D20.mjs @@ -285,14 +285,14 @@ export class Roller2D20 { diceNum = 2, rollname = "Roll D6", weapon = null, - otherdmgdice = 0, - firerateamo = 0, + otherDmgDice = 0, + fireRateAmo = 0, }={}) { const isgatling = weapon.system.damage.weaponQuality.gatling.value; if (isgatling === true) { - firerateamo = firerateamo *2; + fireRateAmo = fireRateAmo *2; } - const totalCD = firerateamo+ otherdmgdice+diceNum; + const totalCD = fireRateAmo+ otherDmgDice+diceNum; let formula = `${totalCD}dc`; let roll = new Roll(formula); @@ -396,8 +396,8 @@ export class Roller2D20 { }); } - static async addD6({ rollname = "Roll D6", dicenum = 2, falloutRoll = null, dicesRolled = [], weapon = null, actor = null, otherdmgdice = 0, firerateamo = 0} = {}) { - const totalCD = firerateamo+ otherdmgdice; + static async addD6({ rollname = "Roll D6", dicenum = 2, falloutRoll = null, dicesRolled = [], weapon = null, actor = null, otherDmgDice = 0, fireRateAmo = 0} = {}) { + const totalCD = fireRateAmo+ otherDmgDice; let formula = `${totalCD}dc`; let _roll = new Roll(formula); diff --git a/system/templates/dialogs/damage-options.hbs b/system/templates/dialogs/damage-options.hbs new file mode 100644 index 00000000..9ce05233 --- /dev/null +++ b/system/templates/dialogs/damage-options.hbs @@ -0,0 +1,11 @@ +
+
+ + + + +
` From 6c0613797c88825e79b2abb9c1db7bc067dc92e4 Mon Sep 17 00:00:00 2001 From: BartlomiejBielecki Date: Thu, 6 Jun 2024 01:42:57 +0200 Subject: [PATCH 10/11] cleaning --- system/src/roller/DialogD6.mjs | 10 ---------- system/src/roller/Roller2D20.mjs | 1 - 2 files changed, 11 deletions(-) diff --git a/system/src/roller/DialogD6.mjs b/system/src/roller/DialogD6.mjs index 9dbdbb7d..2e969e30 100644 --- a/system/src/roller/DialogD6.mjs +++ b/system/src/roller/DialogD6.mjs @@ -1,7 +1,6 @@ /* eslint-disable no-lonely-if */ /* eslint-disable max-len */ export class DialogD6 extends Dialog { - // eslint-disable-next-line max-len constructor(rollName, diceNum, actor, weapon, falloutRoll, otherDmgDice, fireRateAmo, dialogData = {}, options = {}) { super(dialogData, options); this.rollName = rollName; @@ -64,8 +63,6 @@ export class DialogD6 extends Dialog { _actor = fromUuidSync(this.actor).actor; } if (_actor.type === "character" || _actor.type === "robot") { - - // eslint-disable-next-line eqeqeq // reduce party AP when use to increase damage in melee if (this.weapon.system.weaponType === "meleeWeapons" || this.weapon.system.weaponType === "unarmed") { const currentPartyAp= game.settings.get("fallout", "partyAP"); @@ -91,7 +88,6 @@ export class DialogD6 extends Dialog { } else { - // eslint-disable-next-line eqeqeq // reduce party AP when use to increase damage in melee if (this.weapon.system.weaponType === "meleeWeapons" || this.weapon.system.weaponType === "unarmed") { const currentoverseerAp= game.settings.get("fallout", "gmAP"); @@ -224,8 +220,6 @@ export class DialogD6 extends Dialog { dialogDataDmg.diceNum = diceNum; dialogDataDmg.otherDmgDice = 0; const html = await renderTemplate("systems/fallout/templates/dialogs/damage-options.hbs", dialogDataDmg); - - // eslint-disable-next-line max-len let d = new DialogD6(rollName, diceNum, actor, weapon, falloutRoll, otherDmgDice, fireRateAmo, { title: rollName, content: html, @@ -267,8 +261,6 @@ export class DialogD6 extends Dialog { dialogDataDmg.fireRate = fireRate; dialogDataDmg.diceNum = diceNum; const html = await renderTemplate("systems/fallout/templates/dialogs/damage-options.hbs", dialogDataDmg); - - // eslint-disable-next-line max-len let d = new DialogD6(rollName, diceNum, actor, weapon, falloutRoll, otherDmgDice, fireRateAmo, { title: rollName, content: html, @@ -306,7 +298,6 @@ export class DialogD6 extends Dialog { if (_actor.type !== "character" && _actor.type !== "robot") return 0; let additionalAmmo = "0"; if (this.weapon.system.weaponType !== "meleeWeapons" && this.weapon.system.weaponType !== "unarmed") { - // eslint-disable-next-line linebreak-style const [ammoItems, shotsAvailable] = await _actor._getAvailableAmmoType(this.weapon.system.ammo); if (!ammoItems) { ui.notifications.warn(`Ammo ${this.weapon.system.ammo} not found`); @@ -314,7 +305,6 @@ export class DialogD6 extends Dialog { } // Check if there is enough ammo const totalDice = parseInt(diceNum); - // eslint-disable-next-line semi const weaponDmg = parseInt(initDmg); additionalAmmo = Math.max(0, totalDice - weaponDmg) * this.weapon.system.ammoPerShot; // Gatling weird shit where you need to add 2DC and spend 10 ammmo... diff --git a/system/src/roller/Roller2D20.mjs b/system/src/roller/Roller2D20.mjs index c8f8ad60..c906f1df 100644 --- a/system/src/roller/Roller2D20.mjs +++ b/system/src/roller/Roller2D20.mjs @@ -211,7 +211,6 @@ export class Roller2D20 { hitLocation: hitLocation, hitLocationResult: hitLocationResult, item: item, - actor: actor, flavor: flavor, results: dicesRolled, rollname, From 00b8ebe2259b023c3738717134fc95d94f1a3c64 Mon Sep 17 00:00:00 2001 From: BartlomiejBielecki Date: Thu, 6 Jun 2024 11:20:57 +0200 Subject: [PATCH 11/11] add old functions for macro and fix last issue wirh ne rolls dialog --- scss/global/_window.scss | 23 ++ system/src/roller/Dialog2d20.mjs | 342 +++++++++++------- system/src/roller/DialogD6.mjs | 76 ++-- system/src/roller/Roller2D20.mjs | 8 +- system/src/system/FalloutChat.mjs | 2 + system/templates/dialogs/dialog2d20.hbs | 2 +- system/templates/dialogs/dialogd6.hbs | 4 +- .../templates/dialogs/simple-dialog2d20.hbs | 28 ++ 8 files changed, 314 insertions(+), 171 deletions(-) create mode 100644 system/templates/dialogs/simple-dialog2d20.hbs diff --git a/scss/global/_window.scss b/scss/global/_window.scss index bcc6363c..318e8fb7 100644 --- a/scss/global/_window.scss +++ b/scss/global/_window.scss @@ -365,6 +365,29 @@ cursor: pointer; } } +select.fire-rate-select { + background: beige; + } + .pulsing-text { + animation: pulse 1s infinite alternate; + color: red; + padding: 5px; + font-family: "Lobster", cursive; + text-align: center; +} + +@keyframes pulse { + from { + opacity: 1; + } + to { + opacity: 0.5; + } +} +.flexrow.resource.pulsing { + grid-column: 1 / -1; + place-self: center; +} .encumbrance { diff --git a/system/src/roller/Dialog2d20.mjs b/system/src/roller/Dialog2d20.mjs index 32edf5ac..a025b77c 100644 --- a/system/src/roller/Dialog2d20.mjs +++ b/system/src/roller/Dialog2d20.mjs @@ -1,3 +1,5 @@ +import { SYSTEM_ID } from "../config.mjs"; + export class Dialog2d20 extends Dialog { constructor( @@ -35,22 +37,34 @@ export class Dialog2d20 extends Dialog { super.activateListeners(html); html.ready(e => { - this.markDiceNumber(html, this.diceNum); - if (this.actor.type !== "character" && this.actor.type !== "robot") { - this.gmRoll(html); + this.markDiceNumber(html, this.diceNum, this.actor); + if (this.actor !== null) { + if (this.actor.type !== "character" && this.actor.type !== "robot") { + this.gmRoll(html); + } + this.freeD20(html); } - this.freeD20(html); }); html.on("click", ".dice-icon", (e, i, a) => { let index = e.currentTarget.dataset.index; this.diceNum = parseInt(index); - this.markDiceNumber(html, this.diceNum); - if (this.actor.type === ("character" || "robot")) { - this.apManagment(html); + const gmError = false; + if (this.actor !== null) { + this.markDiceNumber(html, this.diceNum, gmError, this.actor); + if (this.actor.type === ("character" || "robot")) { + this.apManagment(html); + } + else { + this.gmApManagment(html); + } + } else { - this.gmApManagment(html); + let index = e.currentTarget.dataset.index; + this.diceNum = parseInt(index); + const gmError = false; + this.markDiceNumber(html, this.diceNum, gmError, this.actor); } }); @@ -73,35 +87,38 @@ export class Dialog2d20 extends Dialog { }); html.on("click", () => { - if (this.actor.type === ("character" || "robot")) { - let ap = game.settings.get("fallout", "partyAP"); - this.element.find('[name="current_ap"]').val(ap); - this.apManagment(html); - } - else { - let ap = game.settings.get("fallout", "gmAP"); - this.element.find('[name="current_ap"]').val(ap); - this.gmApManagment(html); + if (this.actor !== null) { + if (this.actor.type === ("character" || "robot")) { + let ap = game.settings.get(SYSTEM_ID, "partyAP"); + this.element.find('[name="current_ap"]').val(ap); + this.apManagment(html); + } + else { + let ap = game.settings.get(SYSTEM_ID, "gmAP"); + this.element.find('[name="current_ap"]').val(ap); + this.gmApManagment(html); + } } }); this.data.buttons.roll.callback = () => { - if (this.actor.type === ("character" || "robot")) { - let ap = game.settings.get("fallout", "partyAP"); - this.element.find('[name="current_ap"]').val(ap); - this.apManagment(html); - } - else { - let ap = game.settings.get("fallout", "gmAP"); - this.element.find('[name="current_ap"]').val(ap); - this.gmApManagment(html); + if (this.actor !== null) { + if (this.actor.type === ("character" || "robot")) { + let ap = game.settings.get(SYSTEM_ID, "partyAP"); + this.element.find('[name="current_ap"]').val(ap); + this.apManagment(html); + } + else { + let ap = game.settings.get(SYSTEM_ID, "gmAP"); + this.element.find('[name="current_ap"]').val(ap); + this.gmApManagment(html); + } + this.rollButton(this); + this.data.buttons.help.callback=this.AssistanceButton.bind(this); } - this.rollButton(this); }; - - this.data.buttons.help.callback=this.AssistanceButton.bind(this); } rollButton() { @@ -109,11 +126,18 @@ export class Dialog2d20 extends Dialog { let skill = this.element.find('[name="skill"]').val(); let complication = this.element.find('[name="complication"]').val(); let isTag = this.element.find('[name="tag"]').is(":checked"); - let apSpend = this.element.find('[name="spend_ap"]').val(); - let apBuy = parseInt(this.element.find('[name="by_from_gm"]').val()); + let apSpend = this.element.find('[name="spend_ap"]').val() || 0; + let apBuy = parseInt(this.element.find('[name="by_from_gm"]').val()) || 0; this.rolling = true; let numberOfDice = 0; - for (let i = 2; i <= 5; i++) { + let i = 0; + if (this.actor === null) { + i = 1; + } + else { + i = 2; + } + for (i; i <= 5; i++) { const diceElement =this.element.find(`[data-index="${i}"]`); const containsMarked = diceElement.hasClass("marked"); if (containsMarked) { @@ -133,49 +157,50 @@ export class Dialog2d20 extends Dialog { apSpend: apSpend, apBuy: apBuy, }).then(result => this.deferred.resolve(result)); + if (this.actor !== null) { + let ap = game.settings.get(SYSTEM_ID, "partyAP"); + let gmAP = parseInt(game.settings.get(SYSTEM_ID, "gmAP")); - let ap = game.settings.get("fallout", "partyAP"); - let gmAP = parseInt(game.settings.get("fallout", "gmAP")); - - if (apBuy>0) { - ap = 0; - fallout.APTracker.setAP("partyAP", ap); - let giveGmAP = apBuy + gmAP; - fallout.APTracker.setAP("gmAP", giveGmAP); - } - else { - // eslint-disable-next-line no-lonely-if - if (this.actor.type === ("character" || "robot")) { - let leftPartyAp = ap - apSpend; - fallout.APTracker.setAP("partyAP", leftPartyAp); + if (apBuy>0) { + ap = 0; + fallout.APTracker.setAP("partyAP", ap); + let giveGmAP = apBuy + gmAP; + fallout.APTracker.setAP("gmAP", giveGmAP); } else { - let leftPartyAp = gmAP - apSpend; - fallout.APTracker.setAP("gmAP", leftPartyAp); - } - - } - if (game.settings.get("fallout", "automaticAmmunitionCalculation")) { + // eslint-disable-next-line no-lonely-if + if (this.actor.type === ("character" || "robot")) { + let leftPartyAp = ap - apSpend; + fallout.APTracker.setAP("partyAP", leftPartyAp); + } + else { + let leftPartyAp = gmAP - apSpend; + fallout.APTracker.setAP("gmAP", leftPartyAp); + } + } + if (game.settings.get(SYSTEM_ID, "automaticAmmunitionCalculation")) { // REDUCE AMMO - if (this.actor && this.item?.system.ammo !== "" ) { - try { - if (this.item.system.damage.weaponQuality.gatling.value === true) { - this.actor.reduceAmmo( - this.item.system.ammo, - this.item.system.ammoPerShot*10 - ); - + if (this.actor && this.item?.system.ammo !== "" ) { + try { + if (this.item.system.damage.weaponQuality.gatling.value === true) { + this.actor.reduceAmmo( + this.item.system.ammo, + this.item.system.ammoPerShot*10 + ); + + } + else { + this.actor.reduceAmmo( + this.item.system.ammo, + this.item.system.ammoPerShot + ); + } } - else { - this.actor.reduceAmmo( - this.item.system.ammo, - this.item.system.ammoPerShot - ); + catch(er) { + console.warn(er); } - } - catch(er) { - console.warn(er); + } } } @@ -210,7 +235,7 @@ export class Dialog2d20 extends Dialog { apBuy: apBuy, }).then(result => this.deferred.resolve(result)); - if (game.settings.get("fallout", "automaticAmmunitionCalculation")) { + if (game.settings.get(SYSTEM_ID, "automaticAmmunitionCalculation")) { // REDUCE AMMO if (this.actor && this.item?.system.ammo !== "") { @@ -243,54 +268,61 @@ export class Dialog2d20 extends Dialog { } } - markDiceNumber(html, numberOfDice, gmError) { - let nextDice; - let markedDice = 0; - for (let i = 2; i <= 5; i++) { - const diceElement =this.element.find(`[data-index="${i}"]`); - const containsMarked = diceElement.hasClass("marked"); - if (containsMarked) { - markedDice = i; + markDiceNumber(html, numberOfDice, gmError, actor) { + if (actor !== null) { + let nextDice; + let markedDice = 0; + for (let i = 2; i <= 5; i++) { + const diceElement =this.element.find(`[data-index="${i}"]`); + const containsMarked = diceElement.hasClass("marked"); + if (containsMarked) { + markedDice = i; + } } - } - if ((numberOfDice === 2 || ($(html).find('[name="freed20"]').is(":checked") && numberOfDice === 3)) && markedDice === numberOfDice) { - const diceElement = $(html).find(`[data-index="${numberOfDice}"]`); - diceElement.addClass("marked"); + if ((numberOfDice === 2 || ($(html).find('[name="freed20"]').is(":checked") && numberOfDice === 3)) && markedDice === numberOfDice) { + const diceElement = $(html).find(`[data-index="${numberOfDice}"]`); + diceElement.addClass("marked"); } - else { - const currentdice = $(html).find(`[data-index="${numberOfDice}"]`).hasClass("marked"); - if (numberOfDice+1 >5) { - nextDice = false; - } else { - nextDice = $(html).find(`[data-index="${numberOfDice + 1}"]`).hasClass("marked"); + const currentdice = $(html).find(`[data-index="${numberOfDice}"]`).hasClass("marked"); + if (numberOfDice+1 >5) { + nextDice = false; + } + else { + nextDice = $(html).find(`[data-index="${numberOfDice + 1}"]`).hasClass("marked"); + } + for (let i = 2; i <= 5; i++) { + const diceElement = $(html).find(`[data-index="${i}"]`); + if (i<=this.diceNum && currentdice === false) { + diceElement.addClass("marked"); + } + if (i> this.diceNum && nextDice === true) { + diceElement.removeClass("marked"); + } + if (i === this.diceNum && nextDice === false && currentdice === true) { + diceElement.removeClass("marked"); + } + } } - for (let i = 2; i <= 5; i++) { - const diceElement = $(html).find(`[data-index="${i}"]`); - if (i<=this.diceNum && currentdice === false) { - diceElement.addClass("marked"); + + if (gmError) { + let i = 0; + if ($(html).find('[name="freed20"]').is(":checked") ) { + i = 4; } - if (i> this.diceNum && nextDice === true) { - diceElement.removeClass("marked"); + else { + i = 3; } - if (i === this.diceNum && nextDice === false && currentdice === true) { + for (i; i <= 5; i++) { + const diceElement = $(html).find(`[data-index="${i}"]`); diceElement.removeClass("marked"); } + } } - if (gmError) { - let i = 0; - if ($(html).find('[name="freed20"]').is(":checked") ) { - i = 4; - } - else { - i = 3; - } - for (i; i <= 5; i++) { - const diceElement = $(html).find(`[data-index="${i}"]`); - diceElement.removeClass("marked"); - } - + else { + $(html).find(".dice-icon").removeClass("marked"); + $(html).find(`[data-index="${this.diceNum}"]`).addClass("marked"); } } @@ -456,9 +488,6 @@ export class Dialog2d20 extends Dialog { if (warExist === 0) { ui.notifications.warn(`${part1} ${part2}`); } - let numberOfDice = 2; - let gmError = true; - this.markDiceNumber(html, numberOfDice, gmError); } else { $(html).find('[name="spend_ap"]').val(apCost); @@ -469,7 +498,7 @@ export class Dialog2d20 extends Dialog { gmRoll(html) { const divbuy = document.querySelector('[name="buy_from_gm"]'); divbuy.style.display = "none"; - let gmAP = game.settings.get("fallout", "gmAP"); + let gmAP = game.settings.get(SYSTEM_ID, "gmAP"); this.element.find('[name="current_ap"]').val(gmAP); $(html).find('[name="party_ap"] .title-label').text(game.i18n.localize("FALLOUT.TEMPLATES.OVERSEER_AP")); $(html).find('[name="spend_ap"] .title-label').text(game.i18n.localize("FALLOUT.UI.Spend_Overseer_AP")); @@ -490,37 +519,72 @@ export class Dialog2d20 extends Dialog { dialogData.item = item; dialogData.ap = ap; dialogData.apCost = apCost; - const html = await renderTemplate("systems/fallout/templates/dialogs/dialog2d20.hbs", dialogData); - - let d = new Dialog2d20( - rollName, - diceNum, - attribute, - skill, - tag, - complication, - rollLocation, - actor, - item, - ap, - apCost, - { - title: rollName, - content: html, - buttons: { - roll: { - icon: '', - label: game.i18n.localize("FALLOUT.UI.Roll"), + let html; + let dialogWidth; + let dialogHeight; + let d; + if (actor !== null) { + html = await renderTemplate("systems/fallout/templates/dialogs/dialog2d20.hbs", dialogData); + dialogWidth = 620; + dialogHeight = 320; + d = new Dialog2d20( + rollName, + diceNum, + attribute, + skill, + tag, + complication, + rollLocation, + actor, + item, + ap, + apCost, + { + title: rollName, + content: html, + buttons: { + roll: { + icon: '', + label: game.i18n.localize("FALLOUT.UI.Roll"), + }, + help: { + icon: '', + label: game.i18n.localize("FALLOUT.UI.ASSISTANCE"), + }, }, - help: { - icon: '', - label: game.i18n.localize("FALLOUT.UI.ASSISTANCE"), + } + ); + } + else { + html = await renderTemplate("systems/fallout/templates/dialogs/simple-dialog2d20.hbs", dialogData); + dialogWidth = 500; + dialogHeight = 180; + d = new Dialog2d20( + rollName, + diceNum, + attribute, + skill, + tag, + complication, + rollLocation, + actor, + item, + ap, + apCost, + { + title: rollName, + content: html, + buttons: { + roll: { + icon: '', + label: game.i18n.localize("FALLOUT.UI.Roll"), + }, }, + } + ); + } - }, - } - ); - d.render(true, {width: 620, height: 320}); + d.render(true, {width: dialogWidth, height: dialogHeight}); return d.deferred.promise; } diff --git a/system/src/roller/DialogD6.mjs b/system/src/roller/DialogD6.mjs index 2e969e30..eaee9727 100644 --- a/system/src/roller/DialogD6.mjs +++ b/system/src/roller/DialogD6.mjs @@ -27,8 +27,15 @@ export class DialogD6 extends Dialog { if (isaddl !== 0) { CDnumber = html.find(".d-number")[0].value; } - let otherDmgDice = html.find(".otherd-number")[0].value; - let fireRateAmo =html.find('[name="fireRateAmo"] option:selected').val(); + const isMacor = html.find(".otherd-number").length; + let fireRateAmo = 0; + let otherDmgDice = 0; + + if (isMacor !== 0) { + otherDmgDice = html.find(".otherd-number")[0].value; + fireRateAmo =html.find('[name="fireRateAmo"] option:selected').val(); + } + if (!this.falloutRoll) { fallout.Roller2D20.rollD6({ rollname: this.rollName, @@ -110,6 +117,7 @@ export class DialogD6 extends Dialog { const actortype= game.actors.get(actorId).type; const weapontype = this.weapon.system.weaponType; let fireRateAmo = html.find('[name="fireRateAmo"] option:selected').val(); + if (weapontype === "meleeWeapons" || weapontype === "unarmed") { if (actortype !== "character" && actortype !== "robot") { const part1 = game.i18n.localize("FALLOUT.UI.Not_Enough"); @@ -125,10 +133,16 @@ export class DialogD6 extends Dialog {
`; html.find(".otherd-number").after(pulsingHTML); html.find(".fire-rate-select")[0].selectedIndex = 0; + const selector = `.app.window-app.dice-icon[data-appid="${this.appId}"]`; + const element = document.querySelector(selector); + element.style.height = "230px"; } } else if (pulsingContainer) { pulsingContainer.remove(); + const selector = `.app.window-app.dice-icon[data-appid="${this.appId}"]`; + const element = document.querySelector(selector); + element.style.height = "184px"; } } else { @@ -172,13 +186,16 @@ export class DialogD6 extends Dialog { } } } + else { - const usedamo = await this.checkfireRate(this.weapon, game.actors.get(actorId), fireRateAmo); - if (usedamo === 1) { - const part1 = game.i18n.localize("FALLOUT.UI.Not_Enough"); - const part2 = game.i18n.localize("TYPES.Item.ammo"); - ui.notifications.warn(`${part1} ${part2}`); - html.find(".fire-rate-select")[0].selectedIndex = 0; + if ((game.settings.get(SYSTEM_ID, "automaticAmmunitionCalculationGM") && (actortype !== "character" && actortype !== "robot")) || (game.settings.get(SYSTEM_ID, "automaticAmmunitionCalculation") && (actortype === "character" || actortype === "robot"))) { + const usedamo = await this.checkfireRate(this.weapon, game.actors.get(actorId), fireRateAmo); + if (usedamo === 1) { + const part1 = game.i18n.localize("FALLOUT.UI.Not_Enough"); + const part2 = game.i18n.localize("TYPES.Item.ammo"); + ui.notifications.warn(`${part1} ${part2}`); + html.find(".fire-rate-select")[0].selectedIndex = 0; + } } } }); @@ -199,27 +216,33 @@ export class DialogD6 extends Dialog { dialogData.falloutRoll = falloutRoll; dialogData.weapon = weapon; dialogData.actor = actor; - const actorId = dialogData.actor.split(".")[1]; - const actortype= game.actors.get(actorId).type; - let fireRate=weapon.system.fireRate; - let additionalUdesAmo=""; - if ((actortype!== "character" && actortype !== "robot") && (weapon.system.weaponType === "meleeWeapons" || weapon.system.weaponType === "unarmed")) { - fireRate= 3; - additionalUdesAmo=game.i18n.localize("FALLOUT.UI.Additional_mele_dmg_overseer"); - } - else if (weapon.system.weaponType === "meleeWeapons" || weapon.system.weaponType === "unarmed") { - fireRate= 3; - additionalUdesAmo=game.i18n.localize("FALLOUT.UI.Additional_mele_dmg"); + let html; + if (actor !== null) { + const actorId = dialogData.actor.split(".")[1]; + const actortype= game.actors.get(actorId).type; + let fireRate=weapon.system.fireRate; + let additionalUdesAmo=""; + if ((actortype!== "character" && actortype !== "robot") && (weapon.system.weaponType === "meleeWeapons" || weapon.system.weaponType === "unarmed")) { + fireRate= 3; + additionalUdesAmo=game.i18n.localize("FALLOUT.UI.Additional_mele_dmg_overseer"); + } + else if (weapon.system.weaponType === "meleeWeapons" || weapon.system.weaponType === "unarmed") { + fireRate= 3; + additionalUdesAmo=game.i18n.localize("FALLOUT.UI.Additional_mele_dmg"); + } + else { + additionalUdesAmo=game.i18n.localize("FALLOUT.UI.Additional_amo"); + } + let dialogDataDmg ={}; + dialogDataDmg.additionalUdesAmo = additionalUdesAmo; + dialogDataDmg.fireRate = fireRate; + dialogDataDmg.diceNum = diceNum; + dialogDataDmg.otherDmgDice = 0; + html = await renderTemplate("systems/fallout/templates/dialogs/damage-options.hbs", dialogDataDmg); } else { - additionalUdesAmo=game.i18n.localize("FALLOUT.UI.Additional_amo"); + html = await renderTemplate("systems/fallout/templates/dialogs/dialogd6.hbs", dialogData); } - let dialogDataDmg ={}; - dialogDataDmg.additionalUdesAmo = additionalUdesAmo; - dialogDataDmg.fireRate = fireRate; - dialogDataDmg.diceNum = diceNum; - dialogDataDmg.otherDmgDice = 0; - const html = await renderTemplate("systems/fallout/templates/dialogs/damage-options.hbs", dialogDataDmg); let d = new DialogD6(rollName, diceNum, actor, weapon, falloutRoll, otherDmgDice, fireRateAmo, { title: rollName, content: html, @@ -260,6 +283,7 @@ export class DialogD6 extends Dialog { dialogDataDmg.additionalUdesAmo = additionalUdesAmo; dialogDataDmg.fireRate = fireRate; dialogDataDmg.diceNum = diceNum; + dialogDataDmg.otherDmgDice = otherDmgDice; const html = await renderTemplate("systems/fallout/templates/dialogs/damage-options.hbs", dialogDataDmg); let d = new DialogD6(rollName, diceNum, actor, weapon, falloutRoll, otherDmgDice, fireRateAmo, { title: rollName, diff --git a/system/src/roller/Roller2D20.mjs b/system/src/roller/Roller2D20.mjs index c906f1df..0bd1f6a5 100644 --- a/system/src/roller/Roller2D20.mjs +++ b/system/src/roller/Roller2D20.mjs @@ -272,9 +272,11 @@ export class Roller2D20 { otherDmgDice = 0, fireRateAmo = 0, }={}) { - const isgatling = weapon.system.damage.weaponQuality.gatling.value; - if (isgatling === true) { - fireRateAmo = fireRateAmo *2; + if (actor !== null) { + const isGatling = weapon.system.damage.weaponQuality.gatling.value; + if (isGatling === true) { + fireRateAmo = fireRateAmo *2; + } } const totalCD = fireRateAmo+ otherDmgDice+diceNum; let formula = `${totalCD}dc`; diff --git a/system/src/system/FalloutChat.mjs b/system/src/system/FalloutChat.mjs index db17ccc4..905445c5 100644 --- a/system/src/system/FalloutChat.mjs +++ b/system/src/system/FalloutChat.mjs @@ -131,6 +131,7 @@ export default class FalloutChat { const actor = message.flags.actor; const falloutRoll = message.flags.falloutroll; const weapon = message.flags.weapon; + const otherDmgDice = 0; fallout.DialogD6.addcreateDialog({ rollname: falloutRoll.rollname, @@ -138,6 +139,7 @@ export default class FalloutChat { falloutRoll: falloutRoll, weapon: weapon, actor: actor, + otherDmgDice: otherDmgDice, }); }); } diff --git a/system/templates/dialogs/dialog2d20.hbs b/system/templates/dialogs/dialog2d20.hbs index 178e982b..9f12365b 100644 --- a/system/templates/dialogs/dialog2d20.hbs +++ b/system/templates/dialogs/dialog2d20.hbs @@ -36,7 +36,7 @@

{{localize "FALLOUT.UI.Spend_AP"}}

- +

{{localize "FALLOUT.UI.Buy_from_Overseer"}}

diff --git a/system/templates/dialogs/dialogd6.hbs b/system/templates/dialogs/dialogd6.hbs index a28515ae..84b1e8af 100644 --- a/system/templates/dialogs/dialogd6.hbs +++ b/system/templates/dialogs/dialogd6.hbs @@ -1,5 +1,5 @@
- +
-
\ No newline at end of file +
diff --git a/system/templates/dialogs/simple-dialog2d20.hbs b/system/templates/dialogs/simple-dialog2d20.hbs new file mode 100644 index 00000000..1607cbe5 --- /dev/null +++ b/system/templates/dialogs/simple-dialog2d20.hbs @@ -0,0 +1,28 @@ +
+
+
+

{{localize "FALLOUT.TEMPLATES.Attribute"}}

+ +
+
+

{{localize "TYPES.Item.skill"}}

+ +
+
+

{{localize "FALLOUT.TEMPLATES.Tag"}}

+ +
+
+

{{localize "FALLOUT.TEMPLATES.Compl"}}

+ +
+
+ + +