From c26eabca398a93652d030ab08399fd9071a2882a Mon Sep 17 00:00:00 2001 From: HavelockV Date: Thu, 17 Sep 2020 13:31:43 +0200 Subject: [PATCH 1/3] Pulp Talents --- README.md | 10 ++ coc7g.css | 133 +++++++++++++++++--------- lang/en.json | 16 +++- less/book.less | 3 +- module/actors/sheets/base.js | 4 +- module/coc7.js | 5 +- module/config.js | 10 ++ module/items/sheets/talent.js | 43 +++++++++ styles/coc7.css | 2 +- system.json | 4 +- template.json | 28 ++++-- templates/actors/character-sheet.html | 33 +++++++ templates/actors/npc-sheet.html | 29 ++++++ templates/items/talent.html | 80 ++++++++++++++++ 14 files changed, 340 insertions(+), 60 deletions(-) create mode 100644 module/items/sheets/talent.js create mode 100644 templates/items/talent.html diff --git a/README.md b/README.md index 46976ba4..bbd75cfd 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,16 @@ Compendium 'Weapons' contains a single test weapon. ## What is working +version 0.3.6 : + +* Addition of pulp talents (To be tested, I’m not familiar with Pulp Cthulhu, all of this is mainly cosmetic, no automation implemented so far) + * There's a new sheet for pulp talents. + * Talents can be dragged/dropped on actors (PC & NPC). + * Talents are displayed as a section of the "Gear&Cash" tab. + * Talents have no effect in play (e.g. the "Resilient" talent will NOT be taken in account for sanity loss, you'll have to do it "manually") +* Two fields added to the character sheet for pulp heroes (Archetype and Organization). + * To have those displayed, as well as the auto HP calculation you will have to enable the "Pulp Rules" option from the system's options. + version 0.3.5 : * Automatic damage. diff --git a/coc7g.css b/coc7g.css index 8a88116a..18ef0ceb 100644 --- a/coc7g.css +++ b/coc7g.css @@ -67,7 +67,8 @@ flex: 4; } .coc7.sheet.book .sheet-header img.profile, -.coc7.sheet.spell .sheet-header img.profile { +.coc7.sheet.spell .sheet-header img.profile, +.coc7.sheet.talent .sheet-header img.profile { border: 1px groove; flex: 0 0 64px; max-width: 64px; @@ -77,74 +78,90 @@ margin-right: 4px; } .coc7.sheet.book .sheet-header .name input, -.coc7.sheet.spell .sheet-header .name input { +.coc7.sheet.spell .sheet-header .name input, +.coc7.sheet.talent .sheet-header .name input { margin: 0; padding: 0; } .coc7.sheet.book .details .editor, -.coc7.sheet.spell .details .editor { +.coc7.sheet.spell .details .editor, +.coc7.sheet.talent .details .editor { height: 100px; } .coc7.sheet.book .details .editor button, -.coc7.sheet.spell .details .editor button { +.coc7.sheet.spell .details .editor button, +.coc7.sheet.talent .details .editor button { height: 20px; } .coc7.sheet.book .details input[type="text"], .coc7.sheet.spell .details input[type="text"], +.coc7.sheet.talent .details input[type="text"], .coc7.sheet.book .details select, -.coc7.sheet.spell .details select { +.coc7.sheet.spell .details select, +.coc7.sheet.talent .details select { height: 20px; border: 1px solid #7a7971; background: rgba(0, 0, 0, 0.05); } .coc7.sheet.book .details .form-group, -.coc7.sheet.spell .details .form-group { +.coc7.sheet.spell .details .form-group, +.coc7.sheet.talent .details .form-group { border: 0; margin: 0; } .coc7.sheet.book .details .form-group span, -.coc7.sheet.spell .details .form-group span { +.coc7.sheet.spell .details .form-group span, +.coc7.sheet.talent .details .form-group span { text-align: center; line-height: 20px; } .coc7.sheet.book .details .form-group.input-select select, -.coc7.sheet.spell .details .form-group.input-select select { +.coc7.sheet.spell .details .form-group.input-select select, +.coc7.sheet.talent .details .form-group.input-select select { flex: 1.8; } .coc7.sheet.book .details .form-group.input-select-select select, -.coc7.sheet.spell .details .form-group.input-select-select select { +.coc7.sheet.spell .details .form-group.input-select-select select, +.coc7.sheet.talent .details .form-group.input-select-select select { flex: 1.5; } .coc7.sheet.book .details .form-group.uses-per input, -.coc7.sheet.spell .details .form-group.uses-per input { +.coc7.sheet.spell .details .form-group.uses-per input, +.coc7.sheet.talent .details .form-group.uses-per input { flex: 1; } .coc7.sheet.book .details .form-group.uses-per span, -.coc7.sheet.spell .details .form-group.uses-per span { +.coc7.sheet.spell .details .form-group.uses-per span, +.coc7.sheet.talent .details .form-group.uses-per span { flex: 0 0 16px; } .coc7.sheet.book .details .form-group.uses-per select, -.coc7.sheet.spell .details .form-group.uses-per select { +.coc7.sheet.spell .details .form-group.uses-per select, +.coc7.sheet.talent .details .form-group.uses-per select { flex: 3; } .coc7.sheet.book .details span.sep, -.coc7.sheet.spell .details span.sep { +.coc7.sheet.spell .details span.sep, +.coc7.sheet.talent .details span.sep { flex: 0 0 8px; } .coc7.sheet.book .details .prepared, -.coc7.sheet.spell .details .prepared { +.coc7.sheet.spell .details .prepared, +.coc7.sheet.talent .details .prepared { flex: 1.3 !important; text-align: right; padding-right: 10px; } .coc7.sheet.book .details .spell-materials, -.coc7.sheet.spell .details .spell-materials { +.coc7.sheet.spell .details .spell-materials, +.coc7.sheet.talent .details .spell-materials { flex: 0 0 100%; margin: 0.25em 0; justify-content: flex-end; } .coc7.sheet.book .details .spell-materials label, -.coc7.sheet.spell .details .spell-materials label { +.coc7.sheet.spell .details .spell-materials label, +.coc7.sheet.talent .details .spell-materials label { flex: 0 0 64px; text-align: right; margin-right: 5px; @@ -152,54 +169,65 @@ line-height: 24px; } .coc7.sheet.book .details .spell-materials input[type="text"], -.coc7.sheet.spell .details .spell-materials input[type="text"] { +.coc7.sheet.spell .details .spell-materials input[type="text"], +.coc7.sheet.talent .details .spell-materials input[type="text"] { flex: 0 0 48px; margin-right: 10px; } .coc7.sheet.book .sheet-navigation, -.coc7.sheet.spell .sheet-navigation { +.coc7.sheet.spell .sheet-navigation, +.coc7.sheet.talent .sheet-navigation { margin-bottom: 5px; } .coc7.sheet.book .sheet-navigation .item, -.coc7.sheet.spell .sheet-navigation .item { +.coc7.sheet.spell .sheet-navigation .item, +.coc7.sheet.talent .sheet-navigation .item { font-size: 18px; } .coc7.sheet.book .sheet-body, -.coc7.sheet.spell .sheet-body { +.coc7.sheet.spell .sheet-body, +.coc7.sheet.talent .sheet-body { overflow: hidden; } .coc7.sheet.book .sheet-body .tab, -.coc7.sheet.spell .sheet-body .tab { +.coc7.sheet.spell .sheet-body .tab, +.coc7.sheet.talent .sheet-body .tab { padding: 0 5px; overflow: hidden auto; } .coc7.sheet.book .sheet-body .item-properties, -.coc7.sheet.spell .sheet-body .item-properties { +.coc7.sheet.spell .sheet-body .item-properties, +.coc7.sheet.talent .sheet-body .item-properties { flex: 0 0 120px; margin: 5px 5px 5px 0; padding-right: 5px; border-right: 2px groove #eeede0; } .coc7.sheet.book .sheet-body .item-properties .form-group, -.coc7.sheet.spell .sheet-body .item-properties .form-group { +.coc7.sheet.spell .sheet-body .item-properties .form-group, +.coc7.sheet.talent .sheet-body .item-properties .form-group { margin: 0; } .coc7.sheet.book .sheet-body .item-properties .form-group label, -.coc7.sheet.spell .sheet-body .item-properties .form-group label { +.coc7.sheet.spell .sheet-body .item-properties .form-group label, +.coc7.sheet.talent .sheet-body .item-properties .form-group label { line-height: 20px; } .coc7.sheet.book .sheet-body .item-properties .form-group input, -.coc7.sheet.spell .sheet-body .item-properties .form-group input { +.coc7.sheet.spell .sheet-body .item-properties .form-group input, +.coc7.sheet.talent .sheet-body .item-properties .form-group input { text-align: right; } .coc7.sheet.book .sheet-body .item-properties .properties-list, -.coc7.sheet.spell .sheet-body .item-properties .properties-list { +.coc7.sheet.spell .sheet-body .item-properties .properties-list, +.coc7.sheet.talent .sheet-body .item-properties .properties-list { list-style: none; margin: 0; padding: 0; } .coc7.sheet.book .sheet-body .item-properties .properties-list li, -.coc7.sheet.spell .sheet-body .item-properties .properties-list li { +.coc7.sheet.spell .sheet-body .item-properties .properties-list li, +.coc7.sheet.talent .sheet-body .item-properties .properties-list li { margin: 3px 0; padding: 0 2px; background: rgba(0, 0, 0, 0.05); @@ -209,7 +237,8 @@ line-height: 18px; } .coc7.sheet.book .sheet-body .spell-list, -.coc7.sheet.spell .sheet-body .spell-list { +.coc7.sheet.spell .sheet-body .spell-list, +.coc7.sheet.talent .sheet-body .spell-list { list-style: none; margin: 0; padding: 0 5px; @@ -217,47 +246,56 @@ scrollbar-width: thin; } .coc7.sheet.book .sheet-body .spell-list .spell, -.coc7.sheet.spell .sheet-body .spell-list .spell { +.coc7.sheet.spell .sheet-body .spell-list .spell, +.coc7.sheet.talent .sheet-body .spell-list .spell { line-height: 16px; padding: 0 2px; border-bottom: 1px solid #c9c7b8; } .coc7.sheet.book .sheet-body .spell-list .spell:last-child, -.coc7.sheet.spell .sheet-body .spell-list .spell:last-child { +.coc7.sheet.spell .sheet-body .spell-list .spell:last-child, +.coc7.sheet.talent .sheet-body .spell-list .spell:last-child { border-bottom: none; } .coc7.sheet.book .sheet-body .spell-list .spell .spell-name, -.coc7.sheet.spell .sheet-body .spell-list .spell .spell-name { +.coc7.sheet.spell .sheet-body .spell-list .spell .spell-name, +.coc7.sheet.talent .sheet-body .spell-list .spell .spell-name { cursor: pointer; max-height: 24px; overflow: hidden; } .coc7.sheet.book .sheet-body .spell-list .spell .spell-name .spell-image, -.coc7.sheet.spell .sheet-body .spell-list .spell .spell-name .spell-image { +.coc7.sheet.spell .sheet-body .spell-list .spell .spell-name .spell-image, +.coc7.sheet.talent .sheet-body .spell-list .spell .spell-name .spell-image { flex: 0 0 16px; background-size: 16px; margin-right: 5px; } .coc7.sheet.book .sheet-body .spell-list .spell .spell-name h4, -.coc7.sheet.spell .sheet-body .spell-list .spell .spell-name h4 { +.coc7.sheet.spell .sheet-body .spell-list .spell .spell-name h4, +.coc7.sheet.talent .sheet-body .spell-list .spell .spell-name h4 { margin: 0; white-space: nowrap; overflow-x: hidden; } .coc7.sheet.book .sheet-body .spell-list .spell .spell-name.rollable:hover .item-image, -.coc7.sheet.spell .sheet-body .spell-list .spell .spell-name.rollable:hover .item-image { +.coc7.sheet.spell .sheet-body .spell-list .spell .spell-name.rollable:hover .item-image, +.coc7.sheet.talent .sheet-body .spell-list .spell .spell-name.rollable:hover .item-image { background-image: url("/icons/svg/d20-grey.svg") !important; } .coc7.sheet.book .sheet-body .spell-list .spell .spell-name.rollable .item-image:hover, -.coc7.sheet.spell .sheet-body .spell-list .spell .spell-name.rollable .item-image:hover { +.coc7.sheet.spell .sheet-body .spell-list .spell .spell-name.rollable .item-image:hover, +.coc7.sheet.talent .sheet-body .spell-list .spell .spell-name.rollable .item-image:hover { background-image: url("/icons/svg/d20-black.svg") !important; } .coc7.sheet.book .sheet-body .spell-list .spell .spell-name i.attuned, -.coc7.sheet.spell .sheet-body .spell-list .spell .spell-name i.attuned { +.coc7.sheet.spell .sheet-body .spell-list .spell .spell-name i.attuned, +.coc7.sheet.talent .sheet-body .spell-list .spell .spell-name i.attuned { color: #7a7971; } .coc7.sheet.book .sheet-body .spell-list .item-controls, -.coc7.sheet.spell .sheet-body .spell-list .item-controls { +.coc7.sheet.spell .sheet-body .spell-list .item-controls, +.coc7.sheet.talent .sheet-body .spell-list .item-controls { flex: 0 0 32px; display: flex; flex-direction: row; @@ -266,34 +304,41 @@ justify-content: flex-end; } .coc7.sheet.book .sheet-body .spell-list .item-controls > *, -.coc7.sheet.spell .sheet-body .spell-list .item-controls > * { +.coc7.sheet.spell .sheet-body .spell-list .item-controls > *, +.coc7.sheet.talent .sheet-body .spell-list .item-controls > * { flex: 1; } .coc7.sheet.book .sheet-body .spell-list .item-controls .flex1, -.coc7.sheet.spell .sheet-body .spell-list .item-controls .flex1 { +.coc7.sheet.spell .sheet-body .spell-list .item-controls .flex1, +.coc7.sheet.talent .sheet-body .spell-list .item-controls .flex1 { flex: 1; } .coc7.sheet.book .sheet-body .spell-list .item-controls .flex2, -.coc7.sheet.spell .sheet-body .spell-list .item-controls .flex2 { +.coc7.sheet.spell .sheet-body .spell-list .item-controls .flex2, +.coc7.sheet.talent .sheet-body .spell-list .item-controls .flex2 { flex: 2; } .coc7.sheet.book .sheet-body .spell-list .item-controls .flex3, -.coc7.sheet.spell .sheet-body .spell-list .item-controls .flex3 { +.coc7.sheet.spell .sheet-body .spell-list .item-controls .flex3, +.coc7.sheet.talent .sheet-body .spell-list .item-controls .flex3 { flex: 3; } .coc7.sheet.book .sheet-body .spell-list .item-controls .flex4, -.coc7.sheet.spell .sheet-body .spell-list .item-controls .flex4 { +.coc7.sheet.spell .sheet-body .spell-list .item-controls .flex4, +.coc7.sheet.talent .sheet-body .spell-list .item-controls .flex4 { flex: 4; } .coc7.sheet.book .sheet-body .spell-list .item-controls a, -.coc7.sheet.spell .sheet-body .spell-list .item-controls a { +.coc7.sheet.spell .sheet-body .spell-list .item-controls a, +.coc7.sheet.talent .sheet-body .spell-list .item-controls a { flex: 0 0 16px; font-size: 10px; text-align: center; color: #7a7971; } .coc7.sheet.book .sheet-body .spell-list .item-summary, -.coc7.sheet.spell .sheet-body .spell-list .item-summary { +.coc7.sheet.spell .sheet-body .spell-list .item-summary, +.coc7.sheet.talent .sheet-body .spell-list .item-summary { flex: 0 0 100%; font-size: 12px; line-height: 13px; diff --git a/lang/en.json b/lang/en.json index 2923ab2a..18c73aa4 100644 --- a/lang/en.json +++ b/lang/en.json @@ -19,11 +19,13 @@ "CHARAC.Education": "Education", "CoC7.Name": "Name", +"CoC7.Archetype": "Archetype", "CoC7.Occupation": "Occupation", "CoC7.Age": "Age", "CoC7.Sex": "Sex", "CoC7.Residence": "Residence", "CoC7.Birthplace": "Birthplace", +"CoC7.Organization": "Organization", "CoC7.HitPoints": "Hit Points", "CoC7.HP": "HP", "CoC7.MagicPoints": "Magic Points", @@ -306,6 +308,16 @@ "CoC7.OccultBook": "Occult Tome", "CoC7.Unidentified": "Unidentified description", +"CoC7.PulpTalents": "Pulp Talents", +"CoC7.TalentType": "Talent Type", +"CoC7.PhysicalTalent": "Physical", +"CoC7.MentalTalent": "Mental", +"CoC7.CombatTalent": "Combat", +"CoC7.MiscellaneousTalent": "Miscellaneous", +"CoC7.BasicTalent": "Basic", +"CoC7.InsaneTalent": "Insane", +"CoC7.OtherTalent": "Other", + "CoC7.Items": "Items", "CoC7.Books": "Books", @@ -326,6 +338,6 @@ "SETTINGS.InitiativeRuleOptional": "Optional", "SETTINGS.displayInitDices": "Display init dice", "SETTINGS.displayInitDicesHint": "Display the dices when rolling for initiative (Optional rules only)", -"SETTINGS.PulpRules" : "Use Pulp HP", -"SETTINGS.PulpRulesHint" : "Use Pulp Rules for HP calculation" +"SETTINGS.PulpRules" : "Pulp rules", +"SETTINGS.PulpRulesHint" : "Alow the usage of Pulp Rules (Archetype, Talent, HP), !early implementation!" } diff --git a/less/book.less b/less/book.less index 7254734f..97464c2c 100644 --- a/less/book.less +++ b/less/book.less @@ -1,5 +1,6 @@ .coc7.sheet.book, -.coc7.sheet.spell { +.coc7.sheet.spell, +.coc7.sheet.talent { .sheet-header { img.profile { border: 1px groove; diff --git a/module/actors/sheets/base.js b/module/actors/sheets/base.js index 9eb69ffa..1590cbe6 100644 --- a/module/actors/sheets/base.js +++ b/module/actors/sheets/base.js @@ -29,6 +29,8 @@ export class CoC7ActorSheet extends ActorSheet { data.isDead = this.actor.dead; data.isDying = this.actor.dying; + data.pulpCharacter = game.settings.get('CoC7', 'pulpRules'); + if( data.items){ for (const item of data.items) { //si c'est une formule et qu'on peut l'evaluer @@ -579,7 +581,7 @@ export class CoC7ActorSheet extends ActorSheet { summary.slideUp(200, () => summary.remove()); } else { let div = $(`
${chatData.description.value}
`); - if( item.data.data.properties.spcl) { + if( item.data.data.properties?.spcl) { let specialDiv = $(`
${chatData.description.special}
`); div.append(specialDiv); } diff --git a/module/coc7.js b/module/coc7.js index 5c6d311a..8f728f7e 100644 --- a/module/coc7.js +++ b/module/coc7.js @@ -17,6 +17,7 @@ import { CoC7Chat } from './chat.js'; import { CoC7Combat, rollInitiative } from './combat.js'; import { CoC7BookSheet } from './items/sheets/book.js'; import { CoC7SpellSheet } from './items/sheets/spell.js'; +import { CoC7TalentSheet } from './items/sheets/talent.js'; import { COC7 } from './config.js'; // import { CoC7ActorSheet } from './actors/sheets/base.js'; @@ -133,10 +134,12 @@ Hooks.once('init', async function() { Actors.registerSheet('CoC7', CoC7NPCSheet, { types: ['npc'] }); Actors.registerSheet('CoC7', CoC7CreatureSheet, { types: ['creature'] }); Actors.registerSheet('CoC7', CoC7CharacterSheet, { types: ['character'], makeDefault: true }); + Items.unregisterSheet('core', ItemSheet); Items.registerSheet('CoC7', CoC7WeaponSheet, { types: ['weapon'], makeDefault: true}); Items.registerSheet('CoC7', CoC7BookSheet, { types: ['book'], makeDefault: true}); Items.registerSheet('CoC7', CoC7SpellSheet, { types: ['spell'], makeDefault: true}); + Items.registerSheet('CoC7', CoC7TalentSheet, { types: ['talent'], makeDefault: true}); Items.registerSheet('CoC7', CoCItemSheet, { makeDefault: true}); preloadHandlebarsTemplates(); }); @@ -145,7 +148,7 @@ Hooks.on('renderCombatTracker', (app, html, data) => CoC7Combat.renderCombatTrac Hooks.once('setup', function() { // Localize CONFIG objects once up-front - const toLocalize = [ 'spellProperties', 'bookType']; + const toLocalize = [ 'spellProperties', 'bookType', 'talentType']; for ( let o of toLocalize ) { const localized = Object.entries(COC7[o]).map(e => { diff --git a/module/config.js b/module/config.js index 198b7a35..3ba72f3e 100644 --- a/module/config.js +++ b/module/config.js @@ -82,6 +82,16 @@ COC7.bookType = { other: 'CoC7.Other' }; +COC7.talentType = { + physical: 'CoC7.PhysicalTalent', + mental: 'CoC7.MentalTalent', + combat: 'CoC7.CombatTalent', + miscellaneous: 'CoC7.MiscellaneousTalent', + basic: 'CoC7.BasicTalent', + insane: 'CoC7.InsaneTalent', + other: 'CoC7.OtherTalent' +}; + COC7.formula = {}; COC7.formula.actor = { diff --git a/module/items/sheets/talent.js b/module/items/sheets/talent.js new file mode 100644 index 00000000..fd638534 --- /dev/null +++ b/module/items/sheets/talent.js @@ -0,0 +1,43 @@ +import { COC7 } from '../../config.js'; +// import { CoCActor } from '../../actors/actor.js'; + +/** + * Extend the basic ItemSheet with some very simple modifications + */ +export class CoC7TalentSheet extends ItemSheet { + /** + * + */ + static get defaultOptions() { + return mergeObject(super.defaultOptions, { + classes: ['coc7', 'sheet', 'talent'], + width: 520, + height: 480, + resizable: false, + scrollY: ['.tab.description'], + tabs: [{navSelector: '.sheet-navigation', contentSelector: '.sheet-body', initial: 'description'}] + }); + } + + /** + * + */ + get template() { + return 'systems/CoC7/templates/items/talent.html'; + } + + /* Prepare data for rendering the Item sheet + * The prepared data object contains both the actor data as well as additional sheet options + */ + getData() { + // this.item.checkSkillProperties(); + const data = super.getData(); + + data.itemProperties = []; + + for (let [key, value] of Object.entries(data.data.type)) { + if( value) data.itemProperties.push( COC7.talentType[key]?COC7.talentType[key]:null); + } + return data; + } +} \ No newline at end of file diff --git a/styles/coc7.css b/styles/coc7.css index c30e0c18..9da1ffab 100644 --- a/styles/coc7.css +++ b/styles/coc7.css @@ -650,7 +650,7 @@ .coc7.sheet.actor .info-fields .form-group, .coc7.sheet.actor .info-fields .form-group-stacked { - margin: 0 0 1px 0; + margin: 0; justify-content: space-between; } diff --git a/system.json b/system.json index b722f693..6973e93d 100644 --- a/system.json +++ b/system.json @@ -2,7 +2,7 @@ "name": "CoC7", "title": "The Call of Cthulhu 7th edition", "description": "The Call of Cthulhu 7th edition simple game system", - "version": "0.3.5", + "version": "0.3.6", "author": "HavelockV", "minimumCoreVersion": "0.5.2", "compatibleCoreVersion": "0.6.6", @@ -72,6 +72,6 @@ "secondaryTokenAttribute": "power", "url": "https://github.com/HavlockV/CoC7-FoundryVTT/", "manifest": "https://github.com/HavlockV/CoC7-FoundryVTT/raw/master/system.json", - "download": "https://github.com/HavlockV/CoC7-FoundryVTT/archive/0.3.5.zip" + "download": "https://github.com/HavlockV/CoC7-FoundryVTT/archive/0.3.6.zip" } \ No newline at end of file diff --git a/template.json b/template.json index cfab3e8d..5635c3fb 100644 --- a/template.json +++ b/template.json @@ -160,7 +160,9 @@ "age": "", "sex": "", "residence": "", - "birthplace": "" + "birthplace": "", + "archetype": "", + "organization": "" }, "flags": { "locked": true, @@ -228,13 +230,7 @@ } }, "Item": { - "types": [ - "item", - "weapon", - "skill", - "book", - "spell" - ], + "types": [ "item", "weapon", "skill", "book", "spell", "talent"], "item": { "description": "", "quantity": 1, @@ -356,6 +352,22 @@ "spells": [], "properties": {}, "flags": {} + }, + "talent":{ + "source": null, + "description": { + "value": "", + "chat": "", + "notes": ""}, + "type":{ + "physical": false, + "mental": false, + "combat": false, + "miscellaneous": false, + "basic": false, + "insane": false, + "other": false + } } } diff --git a/templates/actors/character-sheet.html b/templates/actors/character-sheet.html index 0863b634..8ace3912 100644 --- a/templates/actors/character-sheet.html +++ b/templates/actors/character-sheet.html @@ -8,6 +8,16 @@ + {{#if pulpCharacter}} +
+ + +
+
+ + +
+ {{/if}}
@@ -240,6 +250,29 @@

{{item.name}}

{{/each}}
+ {{#if pulpCharacter}} + {{#if itemsByType.talent}} +
+
  • +
    +

    {{localize 'CoC7.PulpTalents'}}

    +
    +
  • +
      + {{#each itemsByType.talent as |item id|}} +
    1. +
      +

      {{item.name}}

      +
      + + +
      +
    2. + {{/each}} +
    +
    + {{/if}} + {{/if}}
    diff --git a/templates/actors/npc-sheet.html b/templates/actors/npc-sheet.html index ba43459c..80c1a941 100644 --- a/templates/actors/npc-sheet.html +++ b/templates/actors/npc-sheet.html @@ -12,6 +12,12 @@
    + {{#if pulpCharacter}} +
    + + +
    + {{/if}}
    @@ -361,6 +367,29 @@

    {{item.name}}

    {{/if}} + {{#if pulpCharacter}} + {{#if itemsByType.talent}} +
    +
  • +
    +

    {{localize 'CoC7.PulpTalents'}}

    +
    +
  • +
      + {{#each itemsByType.talent as |item id|}} +
    1. +
      +

      {{item.name}}

      +
      + + +
      +
    2. + {{/each}} +
    +
    + {{/if}} + {{/if}} diff --git a/templates/items/talent.html b/templates/items/talent.html new file mode 100644 index 00000000..0ea80ace --- /dev/null +++ b/templates/items/talent.html @@ -0,0 +1,80 @@ +
    +
    +
    +

    + +

    + +
      +
    • + +
    • +
    + +
    + + +
    + {{!-- Item Sheet Navigation --}} + + + + {{!-- Item Sheet Body --}} +
    + + {{!-- Description Tab --}} +
    + +
    +
      + {{#each itemProperties}} +
    1. {{this}}
    2. + {{/each}} +
    +
    + + {{editor content=data.description.value target="data.description.value" button=true owner=owner editable=editable}} +
    + + {{!-- Details Tab --}} +
    + +

    {{ localize "CoC7.Details" }}

    + {{!-- Talent Type --}} +
    + +
    + + + + + + + +
    +
    + +

    {{ localize "CoC7.Notes"}}

    + {{editor content=data.description.notes target="data.description.notes" button=true owner=owner editable=editable}} +
    +
    + +
    \ No newline at end of file From 221516fc287c807adcc8cb1b154503e07722842e Mon Sep 17 00:00:00 2001 From: HavelockV Date: Thu, 17 Sep 2020 15:16:53 +0200 Subject: [PATCH 2/3] Volley size selection --- README.md | 2 + lang/en.json | 6 ++- module/chat.js | 14 +++++++ module/chat/rangecombat.js | 45 ++++++++++++++++++---- module/coc7.js | 18 +++++++++ template.json | 1 + templates/chat/combat/range-initiator.html | 6 ++- 7 files changed, 83 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index bbd75cfd..a7187b24 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,8 @@ version 0.3.6 : * Talents have no effect in play (e.g. the "Resilient" talent will NOT be taken in account for sanity loss, you'll have to do it "manually") * Two fields added to the character sheet for pulp heroes (Archetype and Organization). * To have those displayed, as well as the auto HP calculation you will have to enable the "Pulp Rules" option from the system's options. +* Bug correction: Ammo loaded in weapons is now correctly saved between sessions. +* Option added on the combat chat card to increase/decrease the volley size in full-auto mode. version 0.3.5 : diff --git a/lang/en.json b/lang/en.json index 18c73aa4..42a7b95d 100644 --- a/lang/en.json +++ b/lang/en.json @@ -339,5 +339,9 @@ "SETTINGS.displayInitDices": "Display init dice", "SETTINGS.displayInitDicesHint": "Display the dices when rolling for initiative (Optional rules only)", "SETTINGS.PulpRules" : "Pulp rules", -"SETTINGS.PulpRulesHint" : "Alow the usage of Pulp Rules (Archetype, Talent, HP), !early implementation!" +"SETTINGS.PulpRulesHint" : "Alow the usage of Pulp Rules (Archetype, Talent, HP), !early implementation!", +"SETTINGS.DisregardAmmo": "Disregard Ammo count.", +"SETTINGS.DisregardAmmoHint": "Enabling this will not take in account the number of bullets loaded in the gun.", +"SETTINGS.DisregardUsePerRound": "Disregard Uses per Rounds.", +"SETTINGS.DisregardUsePerRoundHint": "Enabling this will allow you to fire as much as you want, regardless of the uses per round of the weapon." } diff --git a/module/chat.js b/module/chat.js index ee82ec54..c03a41f6 100644 --- a/module/chat.js +++ b/module/chat.js @@ -43,6 +43,7 @@ export class CoC7Chat{ html.on('click', '.panel-switch', CoC7Chat._onChatCardToggleSwitch.bind(this)); html.on('click', '.simple-flag', CoC7Chat._onChatCardToggleSwitch.bind(this)); + html.on('click', '.volley-size', CoC7Chat._onChatCardVolleySize.bind(this)); html.on('click', '.dropdown-element', CoC7Chat._onDropDownElementSelected.bind(this)); html.on('click', '.simple-toggle', CoC7Chat._onToggleSelected.bind(this)); @@ -654,6 +655,19 @@ export class CoC7Chat{ event.currentTarget.parentElement.dataset.selected = event.currentTarget.dataset.property; } + static async _onChatCardVolleySize( event){ + const card = event.currentTarget.closest('.chat-card'); + + if( card.classList.contains( 'range')){ + if( card.classList.contains('initiator')){ + const rangeCard = CoC7RangeInitiator.getFromCard( card); + if( event.currentTarget.classList.contains('increase')) rangeCard.changeVolleySize( 1); + else if( event.currentTarget.classList.contains('decrease')) rangeCard.changeVolleySize( -1); + } + } + + } + static async _onChatCardToggleSwitch( event){ event.preventDefault(); diff --git a/module/chat/rangecombat.js b/module/chat/rangecombat.js index 966efe0f..8eecf8d0 100644 --- a/module/chat/rangecombat.js +++ b/module/chat/rangecombat.js @@ -201,6 +201,30 @@ export class CoC7RangeInitiator{ return false; } + get volleySize(){ + if( ! this.weapon.data.data.properties.auto) return 1; + if( this._volleySize) return this._volleySize; + const size = Math.floor(this.autoWeaponSkill.data.data.value/10); + return (size < 3) ? 3:size; + } + + set volleySize(x){ + if( x >= Math.floor(this.autoWeaponSkill.data.data.value/10)) this._volleySize = Math.floor(this.autoWeaponSkill.data.data.value/10); + else if ( x <= 3) this._volleySize = 3; + this._volleySize = parseInt(x); + } + + get isVolleyMinSize(){ + if( 3 == this.volleySize ) return true; + return false; + } + + get isVolleyMaxSize(){ + const maxSize = Math.floor(this.autoWeaponSkill.data.data.value/10) < 3 ? 3 : Math.floor(this.autoWeaponSkill.data.data.value/10); + if( maxSize == this.volleySize ) return true; + return false; + } + getTargetFromKey( key){ return this._targets.find( t => key === t.actorKey); } @@ -286,7 +310,7 @@ export class CoC7RangeInitiator{ shot.transit = true; } } - shot.bulletsShot = Math.floor(this.autoWeaponSkill.data.data.value/10); + shot.bulletsShot = this.volleySize; if( shot.bulletsShot <= 3) shot.bulletsShot = 3; if( shot.bulletsShot >= bulletLeft){ shot.bulletsShot = bulletLeft; @@ -461,6 +485,12 @@ export class CoC7RangeInitiator{ return initiator; } + + + changeVolleySize( x){ + this.volleySize = this.volleySize + x; + this.updateChatCard(); + } static updateCardSwitch( event, publishUpdate = true){ const card = event.currentTarget.closest('.range.initiator'); @@ -556,13 +586,14 @@ export class CoC7RangeInitiator{ this.damage = []; const hits=this.successfulHits; - let volleySize = 1; - if( this.fullAuto) { - volleySize = Math.floor(this.autoWeaponSkill.data.data.value/10); - if(volleySize < 3) volleySize = 3; - } - if( this.burst) volleySize = parseInt(this.weapon.data.data.usesPerRound.burst); + // let volleySize = 1; + // if( this.fullAuto) { + // volleySize = this.volleySize; + // if(volleySize < 3) volleySize = 3; + // } + // if( this.burst) volleySize = parseInt(this.weapon.data.data.usesPerRound.burst); hits.forEach( h => { + const volleySize = parseInt(h.shot.bulletsShot); const damageRolls = []; const damageFormula = h.shot.damage; diff --git a/module/coc7.js b/module/coc7.js index 8f728f7e..dd1747b9 100644 --- a/module/coc7.js +++ b/module/coc7.js @@ -107,6 +107,24 @@ Hooks.once('init', async function() { default: true, type: Boolean }); + + game.settings.register('CoC7', 'disregardAmmo', { + name: 'SETTINGS.DisregardAmmo', + hint: 'SETTINGS.DisregardAmmoHint', + scope: 'world', + config: true, + default: false, + type: Boolean + }); + + game.settings.register('CoC7', 'disregardUsePerRound', { + name: 'SETTINGS.DisregardUsePerRound', + hint: 'SETTINGS.DisregardUsePerRoundHint', + scope: 'world', + config: true, + default: false, + type: Boolean + }); function _setInitiativeOptions(rule) { diff --git a/template.json b/template.json index 5635c3fb..dab94987 100644 --- a/template.json +++ b/template.json @@ -277,6 +277,7 @@ "burst": null }, "bullets": null, + "ammo": 0, "malfunction": null, "blastRadius": null, "properties": {}, diff --git a/templates/chat/combat/range-initiator.html b/templates/chat/combat/range-initiator.html index ff9b36d0..f182ee93 100644 --- a/templates/chat/combat/range-initiator.html +++ b/templates/chat/combat/range-initiator.html @@ -20,7 +20,8 @@ data-damage-dealt="{{damageDealt}}" data-total-bullets-fired="{{totalBulletsFired}}" data-roll-mode="{{rollMode}}" - data-is-blind="false"> + data-is-blind="false" + data-volley-size="{{volleySize}}">
    @@ -52,6 +53,9 @@

    Bullets fired : {{totalBulletsFired}}/{{totalAmmo}} Shots fired : {{shotFired}}{{#unless fullAuto}}/{{maxShots}}{{/unless}} + {{#if fullAuto}} + Volley size: {{#unless isVolleyMinSize}} {{/unless}}{{volleySize}}{{#unless isVolleyMaxSize}} {{/unless}} + {{/if}}
    {{#if item.singleShot}} From 847bd45afa3a8a3b22db6eb97934e04e5d91e839 Mon Sep 17 00:00:00 2001 From: HavelockV Date: Thu, 17 Sep 2020 15:36:12 +0200 Subject: [PATCH 3/3] Option to ignore ammo/uses per round --- README.md | 4 +++- module/chat/rangecombat.js | 16 +++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index a7187b24..27e31f9e 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,9 @@ version 0.3.6 : * Two fields added to the character sheet for pulp heroes (Archetype and Organization). * To have those displayed, as well as the auto HP calculation you will have to enable the "Pulp Rules" option from the system's options. * Bug correction: Ammo loaded in weapons is now correctly saved between sessions. -* Option added on the combat chat card to increase/decrease the volley size in full-auto mode. +* On the combat chat card you can now increase/decrease the volley size in full-auto mode. +* Added option to ignore bullets limitation. +* Added option to ignore uses per round limitation. version 0.3.5 : diff --git a/module/chat/rangecombat.js b/module/chat/rangecombat.js index 8eecf8d0..8df500a6 100644 --- a/module/chat/rangecombat.js +++ b/module/chat/rangecombat.js @@ -191,12 +191,22 @@ export class CoC7RangeInitiator{ return this.weapon.data.data.usesPerRound.max? parseInt( this.weapon.data.data.usesPerRound.max) : 1; } + get ignoreAmmo(){ + return game.settings.get('CoC7', 'disregardAmmo'); + } + + get ignoreUsesPerRound(){ + return game.settings.get('CoC7', 'disregardUsePerRound'); + } + get outOfAmmo(){ + if( this.ignoreAmmo) return false; if( this.totalBulletsFired >= this.weapon.getBulletLeft()) return true; return false; } get outOfShots(){ + if( this.ignoreUsesPerRound) return false; if( this.shots) return this.shots.length >= this.maxShots; return false; } @@ -302,7 +312,7 @@ export class CoC7RangeInitiator{ if( previousShot.actorKey != this.activeTarget.actorKey){ const distance = chatHelper.getDistance( chatHelper.getTokenFromKey(previousShot.actorKey), chatHelper.getTokenFromKey(this.activeTarget.actorKey)); shot.transitBullets = Math.floor( chatHelper.toYards(distance)); - if( shot.transitBullets >= bulletLeft) { + if( shot.transitBullets >= bulletLeft && !this.ignoreAmmo) { shot.transitBullets = bulletLeft; bulletLeft = 0; } @@ -312,14 +322,14 @@ export class CoC7RangeInitiator{ } shot.bulletsShot = this.volleySize; if( shot.bulletsShot <= 3) shot.bulletsShot = 3; - if( shot.bulletsShot >= bulletLeft){ + if( shot.bulletsShot >= bulletLeft && !this.ignoreAmmo){ shot.bulletsShot = bulletLeft; bulletLeft = 0; } } if( this.burst){ shot.bulletsShot = parseInt( this.weapon.data.data.usesPerRound.burst)? parseInt( this.weapon.data.data.usesPerRound.burst):1; - if( shot.bulletsShot >= bulletLeft){ + if( shot.bulletsShot >= bulletLeft && !this.ignoreAmmo){ shot.bulletsShot = bulletLeft; bulletLeft = 0; }