diff --git a/images/dice/PR2207-1063.pdf b/images/dice/PR2207-1063.pdf new file mode 100644 index 0000000..7f3a930 Binary files /dev/null and b/images/dice/PR2207-1063.pdf differ diff --git a/images/dice/d10.webp b/images/dice/d10.webp new file mode 100644 index 0000000..180b7f7 Binary files /dev/null and b/images/dice/d10.webp differ diff --git a/images/dice/d12.webp b/images/dice/d12.webp new file mode 100644 index 0000000..6031789 Binary files /dev/null and b/images/dice/d12.webp differ diff --git a/images/dice/d4.webp b/images/dice/d4.webp new file mode 100644 index 0000000..199e9e4 Binary files /dev/null and b/images/dice/d4.webp differ diff --git a/images/dice/d6.webp b/images/dice/d6.webp new file mode 100644 index 0000000..5617d1a Binary files /dev/null and b/images/dice/d6.webp differ diff --git a/images/dice/d6_1.webp b/images/dice/d6_1.webp new file mode 100644 index 0000000..fe80bf6 Binary files /dev/null and b/images/dice/d6_1.webp differ diff --git a/images/dice/d6_2.webp b/images/dice/d6_2.webp new file mode 100644 index 0000000..9a37e70 Binary files /dev/null and b/images/dice/d6_2.webp differ diff --git a/images/dice/d6_3.webp b/images/dice/d6_3.webp new file mode 100644 index 0000000..69f91b1 Binary files /dev/null and b/images/dice/d6_3.webp differ diff --git a/images/dice/d6_4.webp b/images/dice/d6_4.webp new file mode 100644 index 0000000..1261381 Binary files /dev/null and b/images/dice/d6_4.webp differ diff --git a/images/dice/d6_5.webp b/images/dice/d6_5.webp new file mode 100644 index 0000000..ac3c34a Binary files /dev/null and b/images/dice/d6_5.webp differ diff --git a/images/dice/d6_6.webp b/images/dice/d6_6.webp new file mode 100644 index 0000000..62a230b Binary files /dev/null and b/images/dice/d6_6.webp differ diff --git a/images/dice/d8.webp b/images/dice/d8.webp new file mode 100644 index 0000000..5bae7ef Binary files /dev/null and b/images/dice/d8.webp differ diff --git a/modules/pegasus-actor-sheet.js b/modules/pegasus-actor-sheet.js index 334d276..1edefea 100644 --- a/modules/pegasus-actor-sheet.js +++ b/modules/pegasus-actor-sheet.js @@ -15,7 +15,7 @@ export class PegasusActorSheet extends ActorSheet { return mergeObject(super.defaultOptions, { classes: ["fvtt-pegasus-rpg", "sheet", "actor"], template: "systems/fvtt-pegasus-rpg/templates/actor-sheet.html", - width: 920, + width: 960, height: 720, tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "combat" }], dragDrop: [{ dragSelector: ".item-list .item", dropSelector: null }], @@ -38,6 +38,7 @@ export class PegasusActorSheet extends ActorSheet { editable: this.isEditable, cssClass: this.isEditable ? "editable" : "locked", data: actorData, + traumaState: this.actor.getTraumaState(), effects: this.object.effects.map(e => foundry.utils.deepClone(e.data)), limited: this.object.limited, specs: this.actor.getSpecs( ), @@ -210,6 +211,14 @@ export class PegasusActorSheet extends ActorSheet { this.actor.incDecAmmo( li.data("item-id"), +1 ) } ); + html.find('.stun-minus').click(event => { + this.actor.modifyStun( -1 ) + } ) + html.find('.stun-plus').click(event => { + this.actor.modifyStun( 1 ) + } ) + + html.find('.momentum-minus').click(event => { this.actor.modifyMomentum( -1 ) } ) @@ -224,22 +233,22 @@ export class PegasusActorSheet extends ActorSheet { this.openGenericRoll() } ); html.find('.attack-melee').click((event) => { - this.actor.rollPool( 'com'); + this.actor.rollPool( 'com', false, "melee-atk"); }); html.find('.attack-ranged').click((event) => { - this.actor.rollPool( 'agi'); + this.actor.rollPool( 'agi', false, "ranged-atk"); }); html.find('.defense-roll').click((event) => { this.actor.rollPool( 'def', true); }); html.find('.damage-melee').click((event) => { - this.actor.rollPool( 'str'); + this.actor.rollPool( 'str', false, "melee-dmg"); }); html.find('.damage-ranged').click((event) => { - this.actor.rollPool( 'per'); + this.actor.rollPool( 'per', false, "ranged-dmg"); }); html.find('.damage-resistance').click((event) => { - this.actor.rollPool( 'phy'); + this.actor.rollPool( 'phy', false, "dmg-res"); }); html.find('.roll-stat').click((event) => { diff --git a/modules/pegasus-actor.js b/modules/pegasus-actor.js index 655b991..4232f89 100644 --- a/modules/pegasus-actor.js +++ b/modules/pegasus-actor.js @@ -4,7 +4,7 @@ import { PegasusRollDialog } from "./pegasus-roll-dialog.js"; /* -------------------------------------------- */ const coverBonusTable = { "nocover": 0, "lightcover": 2, "heavycover": 4, "entrenchedcover": 6 }; -const statThreatLevel = [ "agi", "str", "phy", "com", "def", "per" ] +const statThreatLevel = ["agi", "str", "phy", "com", "def", "per"] /* -------------------------------------------- */ /* -------------------------------------------- */ /** @@ -129,16 +129,16 @@ export class PegasusActor extends Actor { } /* -------------------------------------------- */ checkAndPrepareEquipment(item) { - if ( item.data.resistance ) { + if (item.data.resistance) { item.data.resistanceDice = PegasusUtility.getDiceFromLevel(item.data.resistance) } - if ( item.data.idr ) { + if (item.data.idr) { item.data.idrDice = PegasusUtility.getDiceFromLevel(item.data.idr) } - if ( item.data.damage) { + if (item.data.damage) { item.data.damageDice = PegasusUtility.getDiceFromLevel(item.data.damage) } - if( item.data.level) { + if (item.data.level) { item.data.levelDice = PegasusUtility.getDiceFromLevel(item.data.level) } } @@ -298,32 +298,32 @@ export class PegasusActor extends Actor { /* ------------------------------------------- */ computeThreatLevel() { let tl = 0 - for(let key of statThreatLevel) { // Init with concerned stats - tl += PegasusUtility.getDiceValue( this.data.data.statistics[key].value ) + for (let key of statThreatLevel) { // Init with concerned stats + tl += PegasusUtility.getDiceValue(this.data.data.statistics[key].value) } - let powers = duplicate( this.getPowers() || []) - if ( powers.length > 0 ) { // Then add some mental ones of powers - tl += PegasusUtility.getDiceValue( this.data.data.statistics.foc.value ) - tl += PegasusUtility.getDiceValue( this.data.data.statistics.mnd.value ) + let powers = duplicate(this.getPowers() || []) + if (powers.length > 0) { // Then add some mental ones of powers + tl += PegasusUtility.getDiceValue(this.data.data.statistics.foc.value) + tl += PegasusUtility.getDiceValue(this.data.data.statistics.mnd.value) } - tl += PegasusUtility.getDiceValue( this.data.data.mr.value ) - let specThreat = this.data.items.filter( it => it.type == "specialisation" && it.data.data.isthreatlevel) || [] + tl += PegasusUtility.getDiceValue(this.data.data.mr.value) + let specThreat = this.data.items.filter(it => it.type == "specialisation" && it.data.data.isthreatlevel) || [] for (let spec of specThreat) { - tl += PegasusUtility.getDiceValue( spec.data.data.level ) + tl += PegasusUtility.getDiceValue(spec.data.data.level) } tl += this.data.data.nrg.absolutemax + this.data.data.secondary.health.max + this.data.data.secondary.delirium.max tl += this.getPerks().length * 5 let weapons = this.getWeapons() - for(let weapon of weapons) { + for (let weapon of weapons) { tl += PegasusUtility.getDiceValue(weapon.data.damage) } let armors = this.getArmors() - for(let armor of armors) { + for (let armor of armors) { tl += PegasusUtility.getDiceValue(armor.data.resistance) } let shields = duplicate(this.getShields()) - for(let shield of shields) { + for (let shield of shields) { tl += PegasusUtility.getDiceValue(shield.data.level) } let abilities = duplicate(this.getAbilities()) @@ -334,8 +334,8 @@ export class PegasusActor extends Actor { for (let equip of equipments) { tl += equip.data.threatlevel } - if ( tl != this.data.data.biodata.threatlevel) { - this.update( {'data.biodata.threatlevel': tl} ) + if (tl != this.data.data.biodata.threatlevel) { + this.update({ 'data.biodata.threatlevel': tl }) } } @@ -350,7 +350,7 @@ export class PegasusActor extends Actor { if (equip1._id != equip2._id && equip2.data.containerid == equip1._id) { equip1.data.contents.push(equip2) let q = equip2.data.quantity ?? 1 - equip1.data.contentsEnc += q *equip2.data.weight + equip1.data.contentsEnc += q * equip2.data.weight } } } @@ -359,7 +359,7 @@ export class PegasusActor extends Actor { // Compute whole enc let enc = 0 for (let item of equipments) { - item.data.idrDice = PegasusUtility.getDiceFromLevel( Number(item.data.idr)) + item.data.idrDice = PegasusUtility.getDiceFromLevel(Number(item.data.idr)) if (item.data.equipped) { if (item.data.iscontainer) { enc += item.data.contentsEnc @@ -399,11 +399,39 @@ export class PegasusActor extends Actor { } } + /* -------------------------------------------- */ + modifyStun(incDec) { + let combat = duplicate(this.data.data.combat) + combat.stunlevel += incDec + if (combat.stunlevel >= 0) { + this.update({ 'data.combat': combat }) + let chatData = { + user: game.user.id, + rollMode: game.settings.get("core", "rollMode"), + whisper: [game.user.id].concat(ChatMessage.getWhisperRecipients('GM')) + } + if (incDec > 0) { + chatData.content = `
${this.name} suffered a Stun level.${this.name} recovered a Stun level. 0 && stunAbove > 0) { + let delirium = duplicate(this.data.data.secondary.delirium) + delirium.value -= incDec + this.update({ 'data.secondary.delirium': delirium }) + } + } + /* -------------------------------------------- */ modifyMomentum(incDec) { let momentum = duplicate(this.data.data.momentum) momentum.value += incDec - if (momentum.value >= 0 ) { + if (momentum.value >= 0) { this.update({ 'data.momentum': momentum }) let chatData = { user: game.user.id, @@ -416,7 +444,7 @@ export class PegasusActor extends Actor { chatData.content = `
${this.name} has used a Momentum${this.name} is suffering from Severe Trauma and cannot use Perks at this time.= 0 && this.data.data.secondary.delirium.value <= Math.floor((this.data.data.secondary.delirium.max + 1) / 2)) { + this.traumaState = "trauma" + } + if (this.data.data.secondary.delirium.value < 0) { + this.traumaState = "severetrauma" + } + } + return this.traumaState + } + /* -------------------------------------------- */ async computeNRGHealth() { if (this.isToken) return @@ -883,12 +937,15 @@ export class PegasusActor extends Actor { // Update current hindrance level let hindrance = this.data.data.combat.hindrancedice if (this.data.data.secondary.health.value < 0) { - hindrance += Math.abs(this.data.data.secondary.health.value) - } - if (this.data.data.secondary.delirium.value < 0) { - hindrance += Math.abs(this.data.data.secondary.delirium.value) + if (this.data.data.secondary.health.value < -Math.floor((this.data.data.secondary.health.value + 1) / 2)) { // Severe wounded + hindrance += 3 + } else { + hindrance += 1 + + } } this.data.data.combat.hindrancedice = hindrance + this.getTraumaState() } } @@ -937,7 +994,7 @@ export class PegasusActor extends Actor { let objetQ = this.data.items.get(objetId) if (objetQ) { let newQ = objetQ.data.data.ammocurrent + incDec; - if ( newQ >= 0 && newQ <= objetQ.data.data.ammomax) { + if (newQ >= 0 && newQ <= objetQ.data.data.ammomax) { const updated = await this.updateEmbeddedDocuments('Item', [{ _id: objetQ.id, 'data.ammocurrent': newQ }]); // pdates one EmbeddedEntity } } @@ -1044,9 +1101,9 @@ export class PegasusActor extends Actor { this.getIncreaseStatValue(updates, role.data.statincrease1) this.getIncreaseStatValue(updates, role.data.statincrease2) - if ( role.data.specialability.length > 0) { + if (role.data.specialability.length > 0) { console.log("Adding ability", role.data.specialability) - newItems = newItems.concat( duplicate(role.data.specialability) ) // Add new ability + newItems = newItems.concat(duplicate(role.data.specialability)) // Add new ability this.applyAbility(role.data.specialability[0], newItems) } await this.update(updates) @@ -1091,7 +1148,13 @@ export class PegasusActor extends Actor { if (effect.data.effectstatlevel) { effect.data.effectlevel = this.data.data.statistics[effect.data.effectstat].value } - rollData.effectsList.push({ label: effect.name, type: "effect", applied: false, effect: effect, value: effect.data.effectlevel }) + if (this.getTraumaState() == "none") { + rollData.effectsList.push({ label: effect.name, type: "effect", applied: false, effect: effect, value: effect.data.effectlevel }) + } else { + if (!effect.data.bonusdice) { // Do not push bonus dice effect when TraumaState is activated + rollData.effectsList.push({ label: effect.name, type: "effect", applied: false, effect: effect, value: effect.data.effectlevel }) + } + } } } } @@ -1141,8 +1204,11 @@ export class PegasusActor extends Actor { rollData.actorImg = this.img rollData.actorId = this.id rollData.img = this.img + rollData.traumaState = this.getTraumaState() rollData.activePerks = duplicate(this.getActivePerks()) - + rollData.diceList = PegasusUtility.getDiceList() + rollData.dicePool = [] + if (statKey) { rollData.statKey = statKey rollData.stat = this.getStat(statKey) @@ -1153,8 +1219,13 @@ export class PegasusActor extends Actor { if (statKey.toLowerCase() == "mr") { rollData.img = "systems/fvtt-pegasus-rpg/images/icons/MR.webp" } else { - rollData.img = `systems/fvtt-pegasus-rpg/images/icons/${rollData.stat.abbrev}.webp` + rollData.img = `systems/fvtt-pegasus-rpg/images/icons/${rollData.stat.abbrev}.webp` } + let diceKey = PegasusUtility.getDiceFromLevel(rollData.stat.value) + rollData.dicePool.push({ + name: "stat", key: diceKey, + img: `systems/fvtt-pegasus-rpg/images/dice/${diceKey}.webp` + }) } this.addEffects(rollData) @@ -1185,11 +1256,12 @@ export class PegasusActor extends Actor { } /* -------------------------------------------- */ - rollPool(statKey, useShield = false) { + rollPool(statKey, useShield = false, subKey = "none") { let stat = this.getStat(statKey) if (stat) { let rollData = this.getCommonRollData(statKey, useShield) rollData.mode = "stat" + rollData.subKey = subKey rollData.title = `Roll : ${stat.label} ` rollData.img = "icons/dice/d12black.svg" @@ -1259,6 +1331,9 @@ export class PegasusActor extends Actor { rollData.combatId = combatId rollData.combatantId = combatantId console.log("MR ROLL", rollData) + if (isInit) { + rollData.title = "MR / Initiative" + } this.startRoll(rollData); } else { ui.notifications.warn("MR not found !"); diff --git a/modules/pegasus-commands.js b/modules/pegasus-commands.js index 54995cb..4965c39 100644 --- a/modules/pegasus-commands.js +++ b/modules/pegasus-commands.js @@ -90,7 +90,7 @@ export class PegasusCommands { if (command && command.func) { const result = command.func(content, msg, params); if (result == false) { - RdDCommands._chatAnswer(msg, command.descr); + PegasusCommands._chatAnswer(msg, command.descr); } return true; } diff --git a/modules/pegasus-roll-dialog.js b/modules/pegasus-roll-dialog.js index 6b7cbb3..a07483b 100644 --- a/modules/pegasus-roll-dialog.js +++ b/modules/pegasus-roll-dialog.js @@ -3,12 +3,12 @@ import { PegasusUtility } from "./pegasus-utility.js"; export class PegasusRollDialog extends Dialog { /* -------------------------------------------- */ - static async create(actor, rollData ) { + static async create(actor, rollData) { let options = { classes: ["PegasusDialog"], width: 620, height: 380, 'z-index': 99999 }; let html = await renderTemplate('systems/fvtt-pegasus-rpg/templates/roll-dialog-generic.html', rollData); - return new PegasusRollDialog(actor, rollData, html, options ); + return new PegasusRollDialog(actor, rollData, html, options); } /* -------------------------------------------- */ @@ -16,17 +16,18 @@ export class PegasusRollDialog extends Dialog { let conf = { title: (rollData.mode == "skill") ? "Skill" : "Roll", content: html, - buttons: { + buttons: { roll: { - icon: '', - label: "Roll !", - callback: () => { this.roll() } - }, - cancel: { - icon: '', - label: "Cancel", - callback: () => { this.close() } - } }, + icon: '', + label: "Roll !", + callback: () => { this.roll() } + }, + cancel: { + icon: '', + label: "Cancel", + callback: () => { this.close() } + } + }, close: close } @@ -37,89 +38,89 @@ export class PegasusRollDialog extends Dialog { } /* -------------------------------------------- */ - roll () { - PegasusUtility.rollPegasus( this.rollData ) + roll() { + PegasusUtility.rollPegasus(this.rollData) } - /* -------------------------------------------- */ - manageEffects( effectIdx, toggled) { + manageEffects(effectIdx, toggled) { let effect = this.rollData.effectsList[effectIdx] if (effect) { effect.applied = toggled let level, genre, idVal - if (effect.type == 'hindrance' ) { + if (effect.type == 'hindrance') { level = effect.value genre = 'positive' - idVal = "#hindranceDicesLevel" + idVal = "#hindranceDicesLevel" } - if (effect.type == 'effect' ) { - let effectData = effect.effect + if (effect.type == 'effect') { + let effectData = effect.effect level = effectData.data.effectlevel genre = effectData.data.genre effectData.data.isUsed = toggled - if (effectData.data.bonusdice) { - idVal = "#bonusDicesLevel" - } if (effectData.data.reducedicevalue || effectData.data.statdice) { - idVal = "#statDicesLevel" + idVal = "#statDicesLevel" } if (effectData.data.otherdice) { - idVal = "#otherDicesLevel" + idVal = "#otherDicesLevel" } if (effectData.data.hindrance) { - idVal = "#hindranceDicesLevel" + idVal = "#hindranceDicesLevel" genre = 'positive' // Dynamic fix } } // Now process the dice level update - let newLevel = Number($(idVal).val()) - console.log("Ongoing", newLevel, toggled, idVal ) - if (toggled) { - if ( genre == 'positive') { - newLevel += Number(level) - }else { - newLevel -= Number(level) - } - }else { - if ( genre == 'positive') { - newLevel -= Number(level) - }else { - newLevel += Number(level) + if (idVal) { + if (toggled) { + let newLevel = Number($(idVal).val()) + console.log("Ongoing", newLevel, toggled, idVal) + if (genre == 'positive') { + newLevel += Number(level) + } else { + newLevel -= Number(level) + } + } else { + if (genre == 'positive') { + newLevel -= Number(level) + } else { + newLevel += Number(level) + } } + newLevel = (newLevel < 0) ? 0 : newLevel + $(idVal).val(newLevel) } - newLevel = (newLevel<0) ? 0 : newLevel - $(idVal).val(newLevel) } //console.log("Effect", effect, toggled) this.rollData.statDicesLevel = Number($('#statDicesLevel').val()) this.rollData.specDicesLevel = Number($('#specDicesLevel').val()) - this.rollData.bonusDicesLevel = Number($('#bonusDicesLevel').val()) - this.rollData.hindranceDicesLevel = Number($('#hindranceDicesLevel').val()) + //this.rollData.bonusDicesLevel = Number($('#bonusDicesLevel').val()) + //this.rollData.hindranceDicesLevel = Number($('#hindranceDicesLevel').val()) this.rollData.otherDicesLevel = Number($('#otherDicesLevel').val()) + PegasusUtility.updateSpecDicePool(this.rollData) + PegasusUtility.updateEffectsBonusDice(this.rollData) } /* -------------------------------------------- */ - manageArmors( armorIdx, toggled) { + manageArmors(armorIdx, toggled) { let armor = this.rollData.armorsList[armorIdx] if (armor) { armor.applied = toggled - if (armor.type == 'other' ) { + if (armor.type == 'other') { if (toggled) { this.rollData.otherDicesLevel += Number(armor.value) } else { this.rollData.otherDicesLevel -= Number(armor.value) - this.rollData.otherDicesLevel = (this.rollData.otherDicesLevel<0) ? 0 : this.rollData.otherDicesLevel + this.rollData.otherDicesLevel = (this.rollData.otherDicesLevel < 0) ? 0 : this.rollData.otherDicesLevel } $("#otherDicesLevel").val(this.rollData.otherDicesLevel) } } - console.log("Armor", armorIdx, toggled) + console.log("Armor", armorIdx, toggled) } /* -------------------------------------------- */ - manageWeapons( weaponIdx, toggled) { + manageWeapons(weaponIdx, toggled) { let weapon = this.rollData.weaponsList[weaponIdx] if (weapon) { if (toggled) { @@ -128,42 +129,42 @@ export class PegasusRollDialog extends Dialog { this.rollData.weaponName = undefined } weapon.applied = toggled - if (weapon.type == 'damage' || weapon.type == 'enhanced' ) { + if (weapon.type == 'damage' || weapon.type == 'enhanced') { if (toggled) { this.rollData.otherDicesLevel += Number(weapon.value) } else { this.rollData.weaponName = undefined this.rollData.otherDicesLevel -= Number(weapon.value) - this.rollData.otherDicesLevel = (this.rollData.otherDicesLevel<0) ? 0 : this.rollData.otherDicesLevel + this.rollData.otherDicesLevel = (this.rollData.otherDicesLevel < 0) ? 0 : this.rollData.otherDicesLevel } $("#otherDicesLevel").val(this.rollData.otherDicesLevel) } } - console.log("Weapon", weaponIdx, toggled, this.rollData.otherDicesLevel, weapon) + console.log("Weapon", weaponIdx, toggled, this.rollData.otherDicesLevel, weapon) } /* -------------------------------------------- */ - manageEquip( equipIdx, toggled) { + manageEquip(equipIdx, toggled) { let equip = this.rollData.equipmentsList[equipIdx] if (equip) { equip.applied = toggled let idVal = "#otherDicesLevel" // Default if (equip.equip.data.bonusdice) { - idVal = "#bonusDicesLevel" + idVal = "#bonusDicesLevel" } if (equip.equip.data.statdice) { - idVal = "#statDicesLevel" + idVal = "#statDicesLevel" } if (equip.equip.data.otherdice) { - idVal = "#otherDicesLevel" + idVal = "#otherDicesLevel" } let newLevel = Number($(idVal).val()) if (toggled) { - newLevel += Number(equip.value) - } else { + newLevel += Number(equip.value) + } else { newLevel -= Number(equip.value) } - newLevel = (newLevel <0) ? 0 : newLevel + newLevel = (newLevel < 0) ? 0 : newLevel $(idVal).val(newLevel) // Then refresh this.rollData.statDicesLevel = Number($('#statDicesLevel').val()) @@ -174,6 +175,14 @@ export class PegasusRollDialog extends Dialog { } } + /* -------------------------------------------- */ + async refreshDialog() { + PegasusUtility.updateSpecDicePool(this.rollData) + const content = await renderTemplate("systems/fvtt-pegasus-rpg/templates/roll-dialog-generic.html", this.rollData) + this.data.content = content + this.render(true) + } + /* -------------------------------------------- */ activateListeners(html) { super.activateListeners(html); @@ -182,11 +191,11 @@ export class PegasusRollDialog extends Dialog { function onLoad() { } $(function () { onLoad(); }); - - html.find('#specList').change(async (event) => { + + html.find('#specList').change(async (event) => { this.rollData.selectedSpec = event.currentTarget.value let spec = this.rollData.specList.find(item => item._id == this.rollData.selectedSpec) - if ( spec) { + if (spec) { this.rollData.specDicesLevel = spec.data.level this.rollData.specName = spec.name $('#specDicesLevel').val(this.rollData.specDicesLevel) @@ -194,15 +203,16 @@ export class PegasusRollDialog extends Dialog { this.rollData.specName = undefined $('#specDicesLevel').val(0) } - const content = await renderTemplate("systems/fvtt-pegasus-rpg/templates/roll-dialog-generic.html", this.rollData) - this.data.content = content - this.render(true) + PegasusUtility.updateSpecDicePool(this.rollData) + this.refreshDialog() }); html.find('#statDicesLevel').change((event) => { this.rollData.statDicesLevel = Number(event.currentTarget.value) }); - html.find('#specDicesLevel').change((event) => { + html.find('#specDicesLevel').change( async (event) => { this.rollData.specDicesLevel = Number(event.currentTarget.value) + PegasusUtility.updateSpecDicePool(this.rollData) + this.refreshDialog() }); html.find('#bonusDicesLevel').change((event) => { this.rollData.bonusDicesLevel = Number(event.currentTarget.value) @@ -213,27 +223,39 @@ export class PegasusRollDialog extends Dialog { html.find('#otherDicesLevel').change((event) => { this.rollData.otherDicesLevel = Number(event.currentTarget.value) }); - html.find('.effect-clicked').change((event) => { + html.find('.effect-clicked').change(async (event) => { let toggled = event.currentTarget.checked let effectIdx = $(event.currentTarget).data("effect-idx") - this.manageEffects( effectIdx, toggled) + this.manageEffects(effectIdx, toggled) + this.refreshDialog() }); html.find('.armor-clicked').change((event) => { let toggled = event.currentTarget.checked let armorIdx = $(event.currentTarget).data("armor-idx") - this.manageArmors( armorIdx, toggled) + this.manageArmors(armorIdx, toggled) }); html.find('.weapon-clicked').change((event) => { let toggled = event.currentTarget.checked let weaponIdx = $(event.currentTarget).data("weapon-idx") - this.manageWeapons( weaponIdx, toggled) + this.manageWeapons(weaponIdx, toggled) }); html.find('.equip-clicked').change((event) => { let toggled = event.currentTarget.checked let equipIdx = $(event.currentTarget).data("equip-idx") - this.manageEquip( equipIdx, toggled) - }); + this.manageEquip(equipIdx, toggled) + }) + + html.find('.pool-add-dice').click(async (event) => { + let diceKey = $(event.currentTarget).data("dice-key") + PegasusUtility.addDicePool( this.rollData, diceKey) + this.refreshDialog() + }) + html.find('.pool-remove-dice').click(async (event) => { + let idx = $(event.currentTarget).data("dice-idx") + PegasusUtility.removeFromDicePool( this.rollData, idx) + this.refreshDialog() + }) - + } } \ No newline at end of file diff --git a/modules/pegasus-utility.js b/modules/pegasus-utility.js index 71087fb..cc011e9 100644 --- a/modules/pegasus-utility.js +++ b/modules/pegasus-utility.js @@ -55,11 +55,78 @@ export class PegasusUtility { /* -------------------------------------------- */ static pushInitiativeOptions(html, options) { - console.log('Option pushed....') options.push({ name: "Apply -10", condition: true, icon: '', callback: target => { PegasusCombat.decInitBy10(target.data('combatant-id'), -10); } }) } /* -------------------------------------------- */ + static getDiceList() { + return [{ key: "d4", img: "systems/fvtt-pegasus-rpg/images/dice/d4.webp" }, { key: "d6", img: "systems/fvtt-pegasus-rpg/images/dice/d6.webp" }, + { key: "d8", img: "systems/fvtt-pegasus-rpg/images/dice/d8.webp" }, { key: "d10", img: "systems/fvtt-pegasus-rpg/images/dice/d10.webp" }, + { key: "d12", img: "systems/fvtt-pegasus-rpg/images/dice/d12.webp" }] + } + + /* -------------------------------------------- */ + static updateEffectsBonusDice( rollData) { + let newDicePool = rollData.dicePool.filter(dice => dice.name != "effect-bonus-dice") + for (let effect of rollData.effectsList) { + if (effect && effect.applied && effect.effect.data.bonusdice) { + let diceKey = PegasusUtility.getDiceFromLevel(effect.effect.data.effectlevel) + let newDice = { + name: "effect-bonus-dice", key: diceKey, effect: effect.effect.name, + img: `systems/fvtt-pegasus-rpg/images/dice/${diceKey}.webp` + } + newDicePool.push(newDice) + } + } + rollData.dicePool = newDicePool + } + + /* -------------------------------------------- */ + static updateSpecDicePool(rollData) { + let newDicePool = rollData.dicePool.filter(dice => dice.name != "spec") + if (rollData.specDicesLevel > 0) { + let diceKey = PegasusUtility.getDiceFromLevel(rollData.specDicesLevel) + let newDice = { + name: "spec", key: diceKey, + img: `systems/fvtt-pegasus-rpg/images/dice/${diceKey}.webp` + } + newDicePool.push(newDice) + } + rollData.dicePool = newDicePool + } + + /* -------------------------------------------- */ + static addDicePool(rollData, diceKey) { + let newDice = { + name: "dice-click", key: diceKey, + img: `systems/fvtt-pegasus-rpg/images/dice/${diceKey}.webp` + } + rollData.dicePool.push(newDice) + } + + /*-------------------------------------------- */ + static removeFromDicePool( rollData, diceIdx ) { + let toRemove = rollData.dicePool[diceIdx] + console.log("CLICK : ", rollData.dicePool, diceIdx) + if (toRemove && toRemove.name != "spec" && toRemove.name != "stat") { + let newDicePool = [] + for (let i=0; i 0) { + console.log("Going to remove one use effects", toRem) + let actor = game.actors.get(rollData.actorId) + actor.deleteEmbeddedDocuments('Item', toRem) + } + } + /* -------------------------------------------- */ static async rollPegasus(rollData) { @@ -489,11 +572,15 @@ export class PegasusUtility { if (rollData.specDicesLevel) { dicePool[1].level = rollData.specDicesLevel } - if (rollData.bonusDicesLevel) { - dicePool[2].level += Number(rollData.bonusDicesLevel) + if (rollData.traumaState == "none") { + if (rollData.bonusDicesLevel) { + dicePool[2].level += Number(rollData.bonusDicesLevel) + } } - if (rollData.hindranceDicesLevel) { - dicePool[3].level += Number(rollData.hindranceDicesLevel) + if (!rollData.isInit) { // No Hindrance dice for Init + if (rollData.hindranceDicesLevel) { + dicePool[3].level += Number(rollData.hindranceDicesLevel) + } } if (rollData.otherDicesLevel) { dicePool[4].level += Number(rollData.otherDicesLevel) @@ -509,7 +596,6 @@ export class PegasusUtility { let myRoll = rollData.roll; if (!myRoll) { // New rolls only of no rerolls myRoll = new Roll(diceFormula).roll({ async: false }); - console.log("ROLL : ", diceFormula) await this.showDiceSoNice(myRoll, game.settings.get("core", "rollMode")); rollData.roll = myRoll } @@ -534,7 +620,14 @@ export class PegasusUtility { combat.updateEmbeddedDocuments("Combatant", [{ _id: rollData.combatantId, initiative: rollData.finalScore }]); } + // Stun specific -> Suffere a stun level when dmg-res + if (rollData.subKey && rollData.subKey == "dmg-res") { + let actor = game.actors.get(rollData.actorId) + actor.modifyStun(-1) + } + //this.removeUsedPerkEffects( rollData) // Unused for now + this.removeOneUseEffects(rollData) // Unused for now // And save the roll this.saveRollData(rollData); @@ -631,7 +724,7 @@ export class PegasusUtility { item = await fromUuid("Compendium." + dataItem.pack + "." + dataItem.id) } else { item = game.items.get(dataItem.id) - } + } return item } diff --git a/styles/simple.css b/styles/simple.css index 1cb264b..9755a57 100644 --- a/styles/simple.css +++ b/styles/simple.css @@ -1164,12 +1164,13 @@ ul, li { box-shadow: inset 0px 1px 0px 0px #a6827e; background: linear-gradient(to bottom, #21374afc 5%, #152833ab 100%); background-color: #7d5d3b00; - border-radius: 3px; - border: 2px ridge #846109; + border-radius: 2px; + border: 1px ridge #846109; display: inline-block; cursor: pointer; color: #ffffff; - padding: 0px 6px 0px 6px; + margin: 2px 2px 2px 2px; + padding: 2px 2px 2px 2px; text-decoration: none; text-shadow: 0px 1px 0px #4d3534; position: relative; @@ -1406,11 +1407,21 @@ Focus FOC: #ff0084 max-width: 12rem; min-width: 12rem; } +.item-name-label-header-long { + flex-grow:2; + max-width: 14rem; + min-width: 14rem; +} .item-name-label { flex-grow:2; max-width: 10rem; min-width: 10rem; } +.item-name-label-long { + flex-grow:2; + max-width: 12rem; + min-width: 12rem; +} .item-name-label-level2 { flex-grow:2; max-width: 9rem; @@ -1445,4 +1456,30 @@ Focus FOC: #ff0084 .item-controls-fixed { min-width:2rem; max-width: 2rem; +} + +.dice-pool-stack { + flex: 1 1 5rem; + display: flex !important; + flex-grow: 0; + justify-content: flex-start; +} +.dice-pool-label { + margin-left: 4px; +} +.dice-pool-div { + border-left: 4px; + border-radius: 2px; + margin-bottom: 1rem; + background-color: #403f3e40; +} + +.dice-pool-image { + border: 0; + margin-left: 4px; + min-width: 48px; + min-height: 48px; + max-width: 48px; + max-height: 48px; + flex-grow: 0; } \ No newline at end of file diff --git a/system.json b/system.json index 28f4f11..10a5b82 100644 --- a/system.json +++ b/system.json @@ -180,9 +180,9 @@ "styles": [ "styles/simple.css" ], - "templateVersion": 90, + "templateVersion": 92, "title": "Pegasus RPG", "url": "https://www.uberwald.me/data/files/fvtt-pegasus-rpg", - "version": "0.5.11", + "version": "0.5.13", "background" : "./images/ui/pegasus_welcome_page.webp" } diff --git a/template.json b/template.json index db09437..03af94a 100644 --- a/template.json +++ b/template.json @@ -28,7 +28,9 @@ "notes": "", "gmnotes": "", "racename": "", - "rolename": "" + "rolename": "", + "corruption": 0, + "moralitythreshold": 0 } }, "core": { @@ -195,7 +197,7 @@ } }, "Item": { - "types": [ "race", "role", "ability", "specialisation", "perk", "power" , "armor", "shield", "equipment", "weapon", "effect", "money"], + "types": [ "race", "role", "ability", "specialisation", "perk", "power" , "armor", "shield", "equipment", "weapon", "effect", "money", "virtuevice"], "effect": { "type": "", "genre": "", @@ -205,7 +207,7 @@ "specaffected": [], "statdice": false, "bonusdice": false, - "otherdice": false, + "weapondamage": false, "hindrance" : false, "resistedby": "", "recoveryroll": false, @@ -213,6 +215,7 @@ "recoveryrollspec": [], "effectstatlevel": false, "effectstat": "", + "oneuse": false, "description": "" }, "race": { @@ -263,6 +266,14 @@ "threatlevel": 0, "description": "" }, + "virtuevice": { + "subtype": "", + "unavailablevice": [], + "unavailablevirtue": [], + "effectsgained": [], + "threatlevel": 0, + "description": "" + }, "specialisation": { "statistic": "", "level": 1, @@ -279,6 +290,8 @@ "duration": "", "isweaver": false, "effectsgained": [], + "category": "general", + "upgradable": false, "features": { "nrgcost": { "label": "NRG cost to use", diff --git a/templates/actor-sheet.html b/templates/actor-sheet.html index bd4dce3..44180b7 100644 --- a/templates/actor-sheet.html +++ b/templates/actor-sheet.html @@ -7,61 +7,64 @@
- -
-
-
    - {{#each data.statistics as |stat key|}} - {{#if (eq stat.col 1)}} - {{> systems/fvtt-pegasus-rpg/templates/partial-actor-stat-block.html stat=stat key=key}} - {{/if}} - {{/each}} -
  • - - - - -

    Dice Pool

    -
    -
  • -
-
- -
-
    - {{#each data.statistics as |stat key|}} - {{#if (eq stat.col 2)}} - {{> systems/fvtt-pegasus-rpg/templates/partial-actor-stat-block.html stat=stat key=key}} - {{/if}} - {{/each}} -
  • - - - - -

    MR

    -
    - - -
  • -
-
-
- {{> systems/fvtt-pegasus-rpg/templates/partial-actor-status.html}} -
+
+
+
    + {{#each data.statistics as |stat key|}} + {{#if (eq stat.col 1)}} + {{> systems/fvtt-pegasus-rpg/templates/partial-actor-stat-block.html stat=stat key=key}} + {{/if}} + {{/each}} +
  • + + + + +

    Dice Pool

    +
    +
  • +
+
- - +
@@ -83,76 +86,83 @@ {{!-- Combat Tab --}}
- -
- -
+ -
+ -
- +
+

Stun

+ + + +  - +
  • Current - + Threshold - +
@@ -160,54 +170,55 @@
    -
  • - -

    -
    - - - - - - - - - - - - - - - - - - - - - - - - -
  • +
  • + +

    +
    + + + + + + + + + + + + + + + + + + + + + + + + +
  • {{#each perks as |perk key|}}
  • - - {{perk.name}} - + + {{perk.name}} + {{perk.data.level}} - + {{#if perk.data.features.range.flag}} - {{perk.data.features.range.value}} + {{perk.data.features.range.value}} {{else}} -  -  - +  -  + {{/if}} {{#if perk.data.features.nbtargets.flag}} {{perk.data.features.nbtargets.value}} {{else}} -  -  +  -  {{/if}} - + + {{#if (ne perk.data.status "ready")}} - {{#if (eq perk.data.nbuse "next1action")}} - -   -   - {{/if}} - {{#if (eq perk.data.nbuse "next2action")}} - - -   - {{/if}} - {{#if (eq perk.data.nbuse "next3action")}} - - - - {{/if}} + {{#if (eq perk.data.nbuse "next1action")}} + +   +   + {{/if}} + {{#if (eq perk.data.nbuse "next2action")}} + + +   + {{/if}} + {{#if (eq perk.data.nbuse "next3action")}} + + + + {{/if}} {{else}} - - - + + + {{/if}}
     
    @@ -248,7 +276,7 @@ {{/each}}
- +
  • @@ -269,8 +297,10 @@
  • {{#each effects as |effect key|}} -
  • - +
  • + {{effect.name}} {{effect.data.effectlevel}} {{upperFirst effect.data.type}} @@ -289,44 +319,45 @@ {{!-- Other Tab --}}
    -
      -
    • - -

      -
      - - - - - - - - - -
    • - {{#each specs as |spec key|}} -
    • - - {{spec.name}} - {{upper spec.data.statistic}} - {{spec.data.dice}} - {{#if spec.data.ispowergroup}} - {{#if spec.data.powersactivated}} - Deactivate - {{else}} - Activate - {{/if}} - {{else}} -  -  - {{/if}} -
       
      -
      - -
      -
    • - {{/each}} -
    -
    +
      +
    • + +

      +
      + + + + + + + + + +
    • + {{#each specs as |spec key|}} +
    • + + {{spec.name}} + {{upper spec.data.statistic}} + {{spec.data.dice}} + {{#if spec.data.ispowergroup}} + {{#if spec.data.powersactivated}} + Deactivate + {{else}} + Activate + {{/if}} + {{else}} +  -  + {{/if}} +
       
      +
      + +
      +
    • + {{/each}} +
    +
@@ -339,11 +370,21 @@
  • -

    {{data.nrg.label}}

    - Activated -  Current -  Mod -  Max + +

    {{data.nrg.label}}

    +
    + Activated +  Current +  Mod +  Max / {{data.nrg.absolutemax}}
@@ -375,7 +416,8 @@ {{#each powers as |power key|}}
  • - + {{#if power.data.rollneeded}} {{power.name}} @@ -386,33 +428,34 @@ {{upperFirst power.data.type}} - + - {{upperFirst power.data.action}} + {{upperFirst power.data.action}} - {{#if power.data.dmgroll}} - {{upper power.data.dmgstatistic}} - {{else}} -  -  - {{/if}} - + {{#if power.data.dmgroll}} + {{upper power.data.dmgstatistic}} + {{else}} +  -  + {{/if}} + - {{power.data.cost}} + {{power.data.cost}} - +
     
    {{#if power.data.activated}}{{else}}{{/if}} + class="fas fa-circle">{{else}}{{/if}}
  • @@ -436,10 +479,11 @@ - + {{#each abilities as |ability key|}}
  • - + {{ability.name}} {{upper ability.data.affectedstat}} @@ -454,7 +498,7 @@
  • {{/each}} - +
    @@ -486,20 +530,21 @@
    - + {{#each moneys as |money key|}}
  • - + {{money.name}} - + - + {{money.data.quantity}} + ( -/+) + + - + {{#if money.data.idrDice}} {{money.data.idrDice}} @@ -530,50 +575,58 @@ + + + + + + - + - + -
     
    -
  • + {{#each weapons as |weapon key|}}
  • - + {{weapon.name}} - + + + {{#if (gt weapon.data.ammomax 0)}} - -
     
    {{#if weapon.data.equipped}}{{else}}{{/if}} @@ -613,7 +665,7 @@ - + @@ -623,24 +675,25 @@
    -
  • + {{#each armors as |armor key|}}
  • - + {{armor.name}} - {{upper armor.data.statistic}} + {{upper armor.data.statistic}} {{armor.data.resistanceDice}} {{armor.data.locationprotected}} {{#if (count armor.data.effects)}} - {{#if armor.data.activated}} - Deactivate - {{else}} - Activate - {{/if}} + {{#if armor.data.activated}} + Deactivate {{else}} -  -  + Activate + {{/if}} + {{else}} +  -  {{/if}} @@ -659,7 +712,7 @@ class="fas fa-circle">{{else}}{{/if}}
  • - + {{/each}} @@ -675,31 +728,32 @@ - + - +
     
    - + {{#each shields as |shield key|}}
  • - + {{shield.name}} {{shield.data.levelDice}} {{#if (count shield.data.effects)}} - {{#if shield.data.activated}} - Deactivate - {{else}} - Activate - {{/if}} + {{#if shield.data.activated}} + Deactivate {{else}} -  -  + Activate + {{/if}} + {{else}} +  -  {{/if}} @@ -733,7 +787,7 @@ - + @@ -743,17 +797,17 @@
  • - + {{#each containersTree as |equip key|}} - {{> systems/fvtt-pegasus-rpg/templates/partial-actor-equipment.html equip=equip level=1}} -
      - {{#each equip.data.contents as |subgear key|}} - {{> systems/fvtt-pegasus-rpg/templates/partial-actor-equipment.html equip=subgear level=2}} - {{/each}} -
    + {{> systems/fvtt-pegasus-rpg/templates/partial-actor-equipment.html equip=equip level=1}} +
      + {{#each equip.data.contents as |subgear key|}} + {{> systems/fvtt-pegasus-rpg/templates/partial-actor-equipment.html equip=subgear level=2}} + {{/each}} +
    {{/each}} - +
    @@ -799,12 +853,14 @@
  • - -
  • + +
  • - +
    @@ -812,7 +868,8 @@
  • - +
    @@ -825,14 +882,18 @@
    • - - + +
    • - - -
    • + + +

    Catchphrase :

    @@ -849,7 +910,8 @@
  • - +
  • @@ -862,13 +924,11 @@
  • - +
  • - +
  • @@ -879,7 +939,7 @@ -
  • +
    diff --git a/templates/deleted.html b/templates/deleted.html new file mode 100644 index 0000000..c6b2242 --- /dev/null +++ b/templates/deleted.html @@ -0,0 +1,24 @@ +{{#if (eq traumaState "none")}} +
    + Bonus Dice : + +   +
    +{{/if}} + +{{#if isInit}} +{{else}} +
    + Hindrance Dice : + +   +
    +{{/if}} diff --git a/templates/item-armor-sheet.html b/templates/item-armor-sheet.html index b6fd3c2..33b6de1 100644 --- a/templates/item-armor-sheet.html +++ b/templates/item-armor-sheet.html @@ -26,7 +26,7 @@ -
  • +
  • + +
  • + +
  • -
  • +
  • @@ -71,7 +75,7 @@
  • @@ -87,7 +91,7 @@ -
  • +
  • diff --git a/templates/item-perk-sheet.html b/templates/item-perk-sheet.html index d353c99..1c4f585 100644 --- a/templates/item-perk-sheet.html +++ b/templates/item-perk-sheet.html @@ -16,6 +16,20 @@
  • + +
  • + +
  • + +
  • + +
  • +
  • diff --git a/templates/item-shield-sheet.html b/templates/item-shield-sheet.html index 5614e11..5bf15f4 100644 --- a/templates/item-shield-sheet.html +++ b/templates/item-shield-sheet.html @@ -22,7 +22,7 @@ {{/select}} -
  • +
  • -
  • +
  • - /{{data.nrg.absolutemax}} +  / {{data.nrg.absolutemax}}
  • @@ -49,11 +49,12 @@ - - + + - - +  - + +