Rework skills and modules
This commit is contained in:
parent
85f4ba0e99
commit
be555d5adc
@ -7,7 +7,6 @@
|
|||||||
"TypeWeapon": "Weapon",
|
"TypeWeapon": "Weapon",
|
||||||
"TypeShield": "Shield",
|
"TypeShield": "Shield",
|
||||||
"TypeArmor": "Armor",
|
"TypeArmor": "Armor",
|
||||||
"TypeSkill": "Skill",
|
|
||||||
"TypeSpell": "Spell",
|
"TypeSpell": "Spell",
|
||||||
"TypeModule": "Module",
|
"TypeModule": "Module",
|
||||||
"TypeMoney": "Money",
|
"TypeMoney": "Money",
|
||||||
|
@ -121,6 +121,7 @@ export class Avd12ItemSheet extends ItemSheet {
|
|||||||
async _onDrop(event) {
|
async _onDrop(event) {
|
||||||
|
|
||||||
const levelIndex = Number($(event.toElement).data("level-index"))
|
const levelIndex = Number($(event.toElement).data("level-index"))
|
||||||
|
const choiceIndex = Number($(event.toElement).data("choice-index"))
|
||||||
let data = event.dataTransfer.getData('text/plain')
|
let data = event.dataTransfer.getData('text/plain')
|
||||||
let dataItem = JSON.parse(data)
|
let dataItem = JSON.parse(data)
|
||||||
let item = fromUuidSync(dataItem.uuid)
|
let item = fromUuidSync(dataItem.uuid)
|
||||||
@ -133,7 +134,7 @@ export class Avd12ItemSheet extends ItemSheet {
|
|||||||
}
|
}
|
||||||
if (this.object.type == "module" && __ALLOWED_MODULE_TYPES[item.type]) {
|
if (this.object.type == "module" && __ALLOWED_MODULE_TYPES[item.type]) {
|
||||||
let levels = duplicate(this.object.system.levels)
|
let levels = duplicate(this.object.system.levels)
|
||||||
levels[levelIndex].features[item.id] = duplicate(item)
|
levels[levelIndex].choices[choiceIndex].features[item.id] = duplicate(item)
|
||||||
this.object.update({ 'system.levels': levels })
|
this.object.update({ 'system.levels': levels })
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -202,27 +203,27 @@ export class Avd12ItemSheet extends ItemSheet {
|
|||||||
|
|
||||||
html.find('.add-module-level').click(ev => {
|
html.find('.add-module-level').click(ev => {
|
||||||
let levels = duplicate(this.object.system.levels)
|
let levels = duplicate(this.object.system.levels)
|
||||||
levels.push({ features: {} })
|
levels.push({ choices: [ {selected: false, features: {} }, {selected: false, features: {} } ] })
|
||||||
this.object.update({ 'system.levels': levels })
|
this.object.update({ 'system.levels': levels })
|
||||||
})
|
})
|
||||||
|
|
||||||
html.find('.module-feature-delete').click(ev => {
|
html.find('.module-feature-delete').click(ev => {
|
||||||
let levels = duplicate(this.object.system.levels)
|
let levels = duplicate(this.object.system.levels)
|
||||||
let levelIndex = Number($(ev.currentTarget).parents(".item").data("level-index"))
|
let levelIndex = Number($(ev.currentTarget).parents(".item").data("level-index"))
|
||||||
|
let choiceIndex = Number($(ev.currentTarget).parents(".item").data("choice-index"))
|
||||||
let featureId = $(ev.currentTarget).parents(".item").data("feature-id")
|
let featureId = $(ev.currentTarget).parents(".item").data("feature-id")
|
||||||
levels[levelIndex].features[featureId] = undefined
|
levels[levelIndex].choices[choiceIndex].features[featureId] = undefined
|
||||||
this.object.update({ 'system.levels': levels })
|
this.object.update({ 'system.levels': levels })
|
||||||
})
|
})
|
||||||
|
|
||||||
html.find('.feature-level-selected').change(ev => {
|
html.find('.choice-level-selected').change(ev => {
|
||||||
let levels = duplicate(this.object.system.levels)
|
let levels = duplicate(this.object.system.levels)
|
||||||
let levelIndex = Number($(ev.currentTarget).parents(".item").data("level-index"))
|
let levelIndex = Number($(ev.currentTarget).parents(".item").data("level-index"))
|
||||||
let featureId = $(ev.currentTarget).parents(".item").data("feature-id")
|
let choiceIndex = Number($(ev.currentTarget).parents(".item").data("choice-index"))
|
||||||
for (let id in levels[levelIndex].features) {
|
for (let choice of levels[levelIndex].choices) {
|
||||||
let feature = levels[levelIndex].features[id]
|
choice.selected = false // Everybody to false
|
||||||
feature.system.selected = false // Everybody to false
|
|
||||||
}
|
}
|
||||||
levels[levelIndex].features[featureId].system.selected = ev.currentTarget.value
|
levels[levelIndex].choices[choiceIndex].selected = ev.currentTarget.value
|
||||||
this.object.update({ 'system.levels': levels })
|
this.object.update({ 'system.levels': levels })
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { Avd12Utility } from "./avd12-utility.js";
|
import { Avd12Utility } from "./avd12-utility.js";
|
||||||
|
|
||||||
export const defaultItemImg = {
|
export const defaultItemImg = {
|
||||||
skill: "systems/fvtt-avd12/images/icons/skill1.webp",
|
//skill: "systems/fvtt-avd12/images/icons/skill1.webp",
|
||||||
armor: "systems/fvtt-avd12/images/icons/chest2.webp",
|
armor: "systems/fvtt-avd12/images/icons/chest2.webp",
|
||||||
shield: "systems/fvtt-avd12/images/icons/shield2.webp",
|
shield: "systems/fvtt-avd12/images/icons/shield2.webp",
|
||||||
weapon: "systems/fvtt-avd12/images/icons/weapon2.webp",
|
weapon: "systems/fvtt-avd12/images/icons/weapon2.webp",
|
||||||
|
@ -41,6 +41,9 @@ export class Avd12Utility {
|
|||||||
Handlebars.registerHelper('mul', function (a, b) {
|
Handlebars.registerHelper('mul', function (a, b) {
|
||||||
return parseInt(a) * parseInt(b);
|
return parseInt(a) * parseInt(b);
|
||||||
})
|
})
|
||||||
|
Handlebars.registerHelper('add', function (a, b) {
|
||||||
|
return parseInt(a) + parseInt(b);
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-------------------------------------------- */
|
/*-------------------------------------------- */
|
||||||
@ -71,6 +74,15 @@ export class Avd12Utility {
|
|||||||
bonusList.push( key + "." + bonus )
|
bonusList.push( key + "." + bonus )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for(let key in game.system.model.Actor.character.attributes) {
|
||||||
|
let attrs = game.system.model.Actor.character.attributes[key]
|
||||||
|
for(let skillKey in attrs.skills) {
|
||||||
|
bonusList.push( key + ".skills." + skillKey + ".modifier" )
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for(let key in game.system.model.Actor.character.universal.skills) {
|
||||||
|
bonusList.push( "universal.skills." + key + ".modifier" )
|
||||||
|
}
|
||||||
return bonusList
|
return bonusList
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,7 +9,8 @@
|
|||||||
{
|
{
|
||||||
"lang": "en",
|
"lang": "en",
|
||||||
"name": "English",
|
"name": "English",
|
||||||
"path": "lang/en.json"
|
"path": "lang/en.json",
|
||||||
|
"flags": {}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"authors": [
|
"authors": [
|
||||||
@ -26,7 +27,6 @@
|
|||||||
"maximum": "10"
|
"maximum": "10"
|
||||||
},
|
},
|
||||||
"id": "fvtt-avd12",
|
"id": "fvtt-avd12",
|
||||||
"packs": [],
|
|
||||||
"primaryTokenAttribute": "secondary.health",
|
"primaryTokenAttribute": "secondary.health",
|
||||||
"secondaryTokenAttribute": "secondary.delirium",
|
"secondaryTokenAttribute": "secondary.delirium",
|
||||||
"socket": true,
|
"socket": true,
|
||||||
|
114
template.json
114
template.json
@ -26,7 +26,21 @@
|
|||||||
"value": 0,
|
"value": 0,
|
||||||
"bonuseffect": 0,
|
"bonuseffect": 0,
|
||||||
"mod": 0,
|
"mod": 0,
|
||||||
"col": 1
|
"col": 1,
|
||||||
|
"skills": {
|
||||||
|
"athletics": {
|
||||||
|
"modifier": 0,
|
||||||
|
"good": false
|
||||||
|
},
|
||||||
|
"block": {
|
||||||
|
"modifier": 0,
|
||||||
|
"good": false
|
||||||
|
},
|
||||||
|
"strength": {
|
||||||
|
"modifier": 0,
|
||||||
|
"good": false
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"agility": {
|
"agility": {
|
||||||
"label": "Agility",
|
"label": "Agility",
|
||||||
@ -34,7 +48,21 @@
|
|||||||
"value": 0,
|
"value": 0,
|
||||||
"bonuseffect": 0,
|
"bonuseffect": 0,
|
||||||
"col": 1,
|
"col": 1,
|
||||||
"mod": 0
|
"mod": 0,
|
||||||
|
"skills": {
|
||||||
|
"acrobatics": {
|
||||||
|
"modifier": 0 ,
|
||||||
|
"good": false
|
||||||
|
},
|
||||||
|
"stealth": {
|
||||||
|
"modifier": 0,
|
||||||
|
"good": false
|
||||||
|
},
|
||||||
|
"dodge": {
|
||||||
|
"modifier": 0,
|
||||||
|
"good": false
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"willpower": {
|
"willpower": {
|
||||||
"label": "Willpower",
|
"label": "Willpower",
|
||||||
@ -42,7 +70,21 @@
|
|||||||
"value": 0,
|
"value": 0,
|
||||||
"bonuseffect": 0,
|
"bonuseffect": 0,
|
||||||
"col": 1,
|
"col": 1,
|
||||||
"mod": 0
|
"mod": 0,
|
||||||
|
"skills": {
|
||||||
|
"concentration": {
|
||||||
|
"modifier": 0,
|
||||||
|
"good": false
|
||||||
|
},
|
||||||
|
"endurance": {
|
||||||
|
"modifier": 0 ,
|
||||||
|
"good": false
|
||||||
|
},
|
||||||
|
"resistance": {
|
||||||
|
"modifier": 0,
|
||||||
|
"good": false
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"knowledge": {
|
"knowledge": {
|
||||||
"label": "Knowledge",
|
"label": "Knowledge",
|
||||||
@ -50,7 +92,29 @@
|
|||||||
"value": 0,
|
"value": 0,
|
||||||
"bonuseffect": 0,
|
"bonuseffect": 0,
|
||||||
"col": 1,
|
"col": 1,
|
||||||
"mod": 0
|
"mod": 0,
|
||||||
|
"skills": {
|
||||||
|
"wilderness": {
|
||||||
|
"modifier": 0,
|
||||||
|
"good": false
|
||||||
|
},
|
||||||
|
"academic": {
|
||||||
|
"modifier": 0,
|
||||||
|
"good": false
|
||||||
|
},
|
||||||
|
"arcanum": {
|
||||||
|
"modifier": 0,
|
||||||
|
"good": false
|
||||||
|
},
|
||||||
|
"medicine": {
|
||||||
|
"modifier": 0,
|
||||||
|
"good": false
|
||||||
|
},
|
||||||
|
"thievery": {
|
||||||
|
"modifier": 0,
|
||||||
|
"good": false
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"social": {
|
"social": {
|
||||||
"label": "Social",
|
"label": "Social",
|
||||||
@ -58,7 +122,37 @@
|
|||||||
"value": 0,
|
"value": 0,
|
||||||
"bonuseffect": 0,
|
"bonuseffect": 0,
|
||||||
"col": 1,
|
"col": 1,
|
||||||
"mod": 0
|
"mod": 0,
|
||||||
|
"skills": {
|
||||||
|
"persuasion": {
|
||||||
|
"modifier": 0,
|
||||||
|
"good": false
|
||||||
|
},
|
||||||
|
"insight": {
|
||||||
|
"modifier": 0,
|
||||||
|
"good": false
|
||||||
|
},
|
||||||
|
"performance": {
|
||||||
|
"modifier": 0,
|
||||||
|
"good": false
|
||||||
|
},
|
||||||
|
"animals": {
|
||||||
|
"modifier": 0,
|
||||||
|
"good": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"universal": {
|
||||||
|
"skills": {
|
||||||
|
"search": {
|
||||||
|
"modifier": 0,
|
||||||
|
"good": false
|
||||||
|
},
|
||||||
|
"initiative": {
|
||||||
|
"modifier": 0,
|
||||||
|
"good": false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"size": {
|
"size": {
|
||||||
@ -220,7 +314,6 @@
|
|||||||
},
|
},
|
||||||
"Item": {
|
"Item": {
|
||||||
"types": [
|
"types": [
|
||||||
"skill",
|
|
||||||
"spell",
|
"spell",
|
||||||
"armor",
|
"armor",
|
||||||
"shield",
|
"shield",
|
||||||
@ -290,15 +383,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"action": {
|
"action": {
|
||||||
"selected": false,
|
|
||||||
"description": ""
|
"description": ""
|
||||||
},
|
},
|
||||||
"reaction": {
|
"reaction": {
|
||||||
"selected": false,
|
|
||||||
"description": ""
|
"description": ""
|
||||||
},
|
},
|
||||||
"freeaction": {
|
"freeaction": {
|
||||||
"selected": false,
|
|
||||||
"description": ""
|
"description": ""
|
||||||
},
|
},
|
||||||
"stance": {
|
"stance": {
|
||||||
@ -310,12 +400,6 @@
|
|||||||
"computebonus": false,
|
"computebonus": false,
|
||||||
"bonusdata": "",
|
"bonusdata": "",
|
||||||
"bonusvalue": 0,
|
"bonusvalue": 0,
|
||||||
"selected": false,
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
"skill": {
|
|
||||||
"attribute": "",
|
|
||||||
"value": 0,
|
|
||||||
"description": ""
|
"description": ""
|
||||||
},
|
},
|
||||||
"spell": {
|
"spell": {
|
||||||
|
@ -6,46 +6,62 @@
|
|||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
{{> systems/fvtt-avd12/templates/items/partial-item-nav.hbs}}
|
{{> systems/fvtt-avd12/templates/items/partial-item-nav.hbs builder=true}}
|
||||||
|
|
||||||
|
|
||||||
{{!-- Sheet Body --}}
|
{{!-- Sheet Body --}}
|
||||||
<section class="sheet-body">
|
<section class="sheet-body">
|
||||||
|
|
||||||
{{> systems/fvtt-avd12/templates/items/partial-item-description.hbs}}
|
{{> systems/fvtt-avd12/templates/items/partial-item-description.hbs}}
|
||||||
|
|
||||||
<div class="tab details" data-group="primary" data-tab="details">
|
<div class="tab details" data-group="primary" data-tab="details">
|
||||||
|
TODO : The tre of module choices will be displayed here for players, with the "selected" option only
|
||||||
<div class="tab" data-group="primary">
|
|
||||||
<ul>
|
|
||||||
{{#each system.levels as |level index|}}
|
|
||||||
<hr>
|
|
||||||
<li class="flexrow">
|
|
||||||
<label class="item-field-label-long">Level {{index}}</label>
|
|
||||||
</li>
|
|
||||||
<li class="flexrow">
|
|
||||||
<div class="drop-module-step" data-level-index="{{index}}"><label data-level-index="{{index}}">Drop traits/actions/... here !</label></div>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
{{#each level.features as |feature id|}}
|
|
||||||
<li class="flexrow item" data-level-index="{{../index}}" data-feature-id="{{feature._id}}" >
|
|
||||||
<label class="item-field-label-medium">{{feature.name}}</label>
|
|
||||||
<input type="checkbox" class="item-field-label-short feature-level-selected" {{checked feature.system.selected}} />
|
|
||||||
<label class="item-field-label-long2">{{{feature.descriptionHTML}}}</label>
|
|
||||||
<div class="item-controls item-controls-fixed">
|
|
||||||
<a class="item-control module-feature-delete" title="Delete Feature"><i class="fas fa-trash"></i></a>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
{{/each}}
|
|
||||||
{{/each}}
|
|
||||||
|
|
||||||
<li class="flexrow item">
|
|
||||||
<button class="chat-card-button add-module-level">Add a level</button>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{{#if isGM}}
|
||||||
|
<div class="tab builder" data-group="primary" data-tab="builder">
|
||||||
|
|
||||||
|
<div class="tab" data-group="primary">
|
||||||
|
<ul>
|
||||||
|
{{#each system.levels as |level index|}}
|
||||||
|
<hr>
|
||||||
|
<li class="flexrow">
|
||||||
|
<h2 class="item-field-label-long">Level {{add index 1}}</h2>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<ul class="ul-level1">
|
||||||
|
{{#each level.choices as |choice choiceIndex|}}
|
||||||
|
<li class="">
|
||||||
|
<h3 class="item-field-label-long">Level choice {{add choiceIndex 1}}</h3></li>
|
||||||
|
<li class="item flexrow" data-level-index="{{../index}}" data-choice-index="{{choiceIndex}}">
|
||||||
|
<div class="drop-module-step" data-choice-index="{{choiceIndex}}" data-level-index="{{../index}}">
|
||||||
|
<label data-choice-index="{{choiceIndex}}" data-level-index="{{../index}}">Drop traits/actions/... here !</label>
|
||||||
|
</div>
|
||||||
|
<span class="item-field-label-short"> </span>
|
||||||
|
<label class="item-field-label-short">Selected</label>
|
||||||
|
<input type="checkbox" class="item-field-label-short choice-level-selected" {{checked choice.selected}} />
|
||||||
|
</li>
|
||||||
|
{{#each choice.features as |feature id|}}
|
||||||
|
<li class="flexrow item" data-level-index="{{../index}}" data-choice-index="{{choiceIndex}}" data-feature-id="{{feature._id}}" >
|
||||||
|
<label class="item-field-label-medium">{{feature.name}}</label>
|
||||||
|
<label class="item-field-label-long2">{{{feature.descriptionHTML}}}</label>
|
||||||
|
<div class="item-controls item-controls-fixed">
|
||||||
|
<a class="item-control module-feature-delete" title="Delete Feature"><i class="fas fa-trash"></i></a>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
{{/each}}
|
||||||
|
{{/each}}
|
||||||
|
</ul>
|
||||||
|
{{/each}}
|
||||||
|
|
||||||
|
<li class="flexrow item">
|
||||||
|
<button class="chat-card-button add-module-level">Add a level</button>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
@ -1,41 +0,0 @@
|
|||||||
<form class="{{cssClass}}" autocomplete="off">
|
|
||||||
<header class="sheet-header">
|
|
||||||
<img class="item-sheet-img" src="{{img}}" data-edit="img" title="{{name}}"/>
|
|
||||||
<div class="header-fields">
|
|
||||||
<h1 class="charname"><input name="name" type="text" value="{{name}}" placeholder="Name"/></h1>
|
|
||||||
</div>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
{{> systems/fvtt-avd12/templates/items/partial-item-nav.hbs}}
|
|
||||||
|
|
||||||
|
|
||||||
{{!-- Sheet Body --}}
|
|
||||||
<section class="sheet-body">
|
|
||||||
|
|
||||||
{{> systems/fvtt-avd12/templates/items/partial-item-description.hbs}}
|
|
||||||
|
|
||||||
<div class="tab details" data-group="primary" data-tab="details">
|
|
||||||
|
|
||||||
<div class="tab" data-group="primary">
|
|
||||||
<ul>
|
|
||||||
<li class="flexrow">
|
|
||||||
<label class="item-field-label-long">Attribute</label>
|
|
||||||
<select class="item-field-label-long" type="text" name="system.attribute" value="{{system.attribute}}" data-dtype="String">
|
|
||||||
{{#select system.attribute}}
|
|
||||||
{{> systems/fvtt-avd12/templates/items/partial-options-attributes.hbs}}
|
|
||||||
{{/select}}
|
|
||||||
</select>
|
|
||||||
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li class="flexrow">
|
|
||||||
<label class="item-field-label-long">Level</label>
|
|
||||||
<input type="text" class="item-field-label-short" name="system.value" value="{{system.value}}" data-dtype="Number"/>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</section>
|
|
||||||
</form>
|
|
@ -2,4 +2,7 @@
|
|||||||
<nav class="sheet-tabs tabs" data-group="primary">
|
<nav class="sheet-tabs tabs" data-group="primary">
|
||||||
<a class="item" data-tab="description">Description</a>
|
<a class="item" data-tab="description">Description</a>
|
||||||
<a class="item" data-tab="details">Details</a>
|
<a class="item" data-tab="details">Details</a>
|
||||||
|
{{#if builder}}
|
||||||
|
<a class="item" data-tab="builder">Builder (GM only)</a>
|
||||||
|
{{/if}}
|
||||||
</nav>
|
</nav>
|
||||||
|
Reference in New Issue
Block a user