Enhance perks

This commit is contained in:
sladecraven 2021-12-19 15:35:54 +01:00
parent c1849edaf4
commit 474f34dadc
7 changed files with 191 additions and 97 deletions

View File

@ -289,6 +289,12 @@ export class PegasusItemSheet extends ItemSheet {
}
}
/* -------------------------------------------- */
async addPerkSpecialisation( event, item, dataItem) {
let newItem = duplicate(item.data);
await this.object.update( { 'data.features.affectedspec.value': newItem.name} );
}
/* -------------------------------------------- */
async _onDrop(event) {
//console.log(event);
@ -302,6 +308,18 @@ export class PegasusItemSheet extends ItemSheet {
}
}
}
if (this.object.type == 'perk' ) {
let data = event.dataTransfer.getData('text/plain');
if (data) {
let dataItem = JSON.parse( data );
let item = await this.searchItem( dataItem);
if ( item.data.type == 'specialisation') {
return this.addPerkSpecialisation( event, item, dataItem);
}
}
}
if (this.object.type == 'specialisation' ) {
let data = event.dataTransfer.getData('text/plain');
if (data) {
@ -326,16 +344,6 @@ export class PegasusItemSheet extends ItemSheet {
}
}
if (this.object.type == 'perk' || this.object.type == 'ability') {
let data = event.dataTransfer.getData('text/plain');
if (data) {
let dataItem = JSON.parse( data );
let item = await this.searchItem( dataItem);
if ( item.data.type == 'specialisation') {
return this.addSpecialisation( item, dataItem);
}
}
}
if (this.object.type == 'role' ) {
let data = event.dataTransfer.getData('text/plain');
if (data) {

View File

@ -50,9 +50,9 @@
"styles": [
"styles/simple.css"
],
"templateVersion": 18,
"templateVersion": 20,
"title": "Pegasus RPG",
"url": "https://www.uberwald.me/data/files/fvtt-pegasus-rpg",
"version": "0.0.18",
"version": "0.0.20",
"background" : "./images/ui/pegasus_welcome_page.webp"
}

View File

@ -174,22 +174,137 @@
"perk": {
"level": 1,
"active": false,
"duration": "",
"features": {
"nrgcost": {
"label": "NRG cost to use",
"flag": false,
"type": "number",
"value": 0
},
"range": {
"label": "Range",
"flag": false,
"type": "range",
"value": ""
},
"nbtargets": {
"label": "# Targets",
"flag": false,
"type": "string",
"value": ""
},
"gainstatdice": {
"label": "Gain Stat Dice to Pool",
"flag": false,
"type": "statdice",
"value": ""
},
"gainspecdice": {
"label": "Gain Specialisation Dice",
"flag": false,
"type": "statdice",
"value": ""
},
"gainbonusdice": {
"label": "Gain Bonus Dice to Pool",
"flag": false,
"type": "string",
"value": ""
},
"gainotherdice": {
"label": "Gain Other Dice to Pool",
"flag": false,
"type": "statdice",
"value": ""
},
"targethindrance": {
"label": "Apply Hindrance to Target",
"flag": false,
"type": "string",
"value": ""
},
"sufferindrance": {
"label": "Perk User suffers Hindrance",
"flag": false,
"type": "string",
"value": ""
},
"affectedstat": {
"label": "Affected Stat",
"flag": false,
"type": "string",
"value": ""
},
"affectedspec": {
"label": "Affected Specialisation",
"flag": false,
"type": "string",
"value": ""
},
"affectspecial": {
"label": "Affects Special",
"flag": false,
"type": "string",
"value": ""
},
"bonushealth": {
"label": "Bonus to Health",
"flag": false,
"type": "string",
"value": ""
},
"bonusnrg": {
"label": "Bonus to NRG",
"flag": false,
"type": "string",
"value": ""
},
"bonusdelirium": {
"label": "Bonus to Delirium",
"flag": false,
"type": "string",
"value": ""
},
"gainmomentum": {
"label": "Gain Momentum",
"flag": false,
"type": "string",
"value": ""
},
"applyeffect": {
"label": "Apply Effect",
"flag": false,
"type": "string",
"value": ""
},
"removeeffect": {
"label": "Remove Effect",
"flag": false,
"type": "string",
"value": ""
},
"specialrule": {
"label": "Special Rule",
"flag": false,
"type": "text",
"value": ""
},
"upgrade1": {
"label": "Upgrade 1",
"flag": false,
"type": "string",
"value": ""
},
"upgrade2": {
"label": "Upgrade 2",
"flag": false,
"type": "string",
"value": ""
}
},
"roundcount": 0,
"nbuse": "",
"gainstatdice": "",
"gainbonusdice": 0,
"gainotherdice": 0,
"specialisation": [ {"name": "None"}],
"range": "",
"aoe": "",
"nbtargets": 0,
"nrgcost": 0,
"effectscaused": "",
"stataffected": "",
"targetresists": "",
"description": "",
"upgrades": "",
"rules": ""
"nbuse": ""
},
"power": {
"rollneeded": false,

View File

@ -18,17 +18,7 @@
</select>
</li>
<li class="flexrow"><label class="generic-label">Stat modifier</label>
<select class="competence-base flexrow" type="text" name="data.statmodifier" value="{{data.statmodifier}}" data-dtype="Number">
{{#select data.statmodifier}}
<option value="-3">-3</option>
<option value="-2">-2</option>
<option value="-1">-1</option>
<option value="0">0</option>
<option value="+1">+1</option>
<option value="+2">+2</option>
<option value="+3">+3</option>
{{/select}}
</select>
<input type="text" class="" name="data.statmodifier" value="{{data.statmodifier}}" data-dtype="Number"/>
</li>
<li class="flexrow"><label class="generic-label">Stat level increase</label>
<select class="competence-base flexrow" type="text" name="data.statlevelincrease" value="{{data.statlevelincrease}}" data-dtype="Number">

View File

@ -37,69 +37,51 @@
{{/select}}
</select>
</li>
<li class="flexrow"><label class="generic-label">Gain Stat Dice</label>
<select class="competence-base flexrow" type="text" name="data.gainstatdice" value="{{data.gainstatdice}}" data-dtype="String">
{{#select data.gainstatdice}}
{{> systems/fvtt-pegasus-rpg/templates/partial-options-statistics.html notapplicable=true}}
{{/select}}
</select>
{{#each data.features as |feature key|}}
<li class="flexrow">
<label class="generic-label">{{feature.label}} ? </label>
<label class="attribute-value checkbox"><input type="checkbox" name="data.features.{{key}}.flag" {{checked feature.flag}}/></label>
</li>
<li class="flexrow"><label class="generic-label">Gain Bonus Dice</label>
<select class="competence-base flexrow" type="text" name="data.gainbonusdice" value="{{data.gainbonusdice}}" data-dtype="String">
{{#select data.gainbonusdice}}
{{> systems/fvtt-pegasus-rpg/templates/partial-options-statistics.html notapplicable=true}}
{{/select}}
</select>
</li>
<li class="flexrow"><label class="generic-label">Gain Other Dice</label>
<select class="competence-base flexrow" type="text" name="data.gainotherdice" value="{{data.gainotherdice}}" data-dtype="String">
{{#select data.gainotherdice}}
{{> systems/fvtt-pegasus-rpg/templates/partial-options-statistics.html notapplicable=true}}
{{/select}}
</select>
</li>
<li class="flexrow"><label class="generic-label">Specialisation Affected</label>
{{#each data.specialisation as |spec idx|}}
<label name="data.specialisation[{{idx}}].name"><a class="view-spec" data-spec-index="{{idx}}">{{spec.name}}</a></label>
<div class="item-controls padd-left">
<a class="item-control delete-spec padd-left" data-spec-index="{{idx}}" title="Delete Spec"><i class="fas fa-trash"></i></a>
</div>
{{/each}}
</li>
<li class="flexrow"><label class="generic-label">Range</label>
<select class="competence-base flexrow" type="text" name="data.range" value="{{data.range}}" data-dtype="String">
{{#select data.range}}
{{> systems/fvtt-pegasus-rpg/templates/partial-options-range.html notapplicable=true}}
{{/select}}
</select>
</li>
<li class="flexrow"><label class="generic-label">AoE</label>
<select class="competence-base flexrow" type="text" name="data.aoe" value="{{data.aoe}}" data-dtype="String">
{{#select data.aoe}}
{{> systems/fvtt-pegasus-rpg/templates/partial-options-range.html notapplicable=true}}
{{/select}}
</select>
</li>
<li class="flexrow"><label class="generic-label">Quantity of Targets</label>
<input type="text" class="padd-right" name="data.nbtargets" value="{{data.nbtargets}}" data-dtype="Number"/>
</li>
<li class="flexrow"><label class="generic-label">NRG Cost</label>
<input type="text" class="padd-right" name="data.nrgcost" value="{{data.nrgcost}}" data-dtype="Number"/>
</li>
{{#if feature.flag}}
<ul class="ul-level1">
<li class="flexrow"><label class="generic-label">{{feature.label}}</label>
{{#if (eq feature.type "statdice")}}
<select class="competence-base flexrow" type="text" name="data.features.{{key}}.value" value="{{feature.value}}" data-dtype="String">
{{#select feature.value}}
{{> systems/fvtt-pegasus-rpg/templates/partial-options-statistics.html notapplicable=true}}
{{/select}}
</select>
{{/if}}
{{#if (eq feature.type "range")}}
<select class="competence-base flexrow" type="text" name="data.features.{{key}}.value" value="{{feature.value}}" data-dtype="String">
{{#select feature.value}}
{{> systems/fvtt-pegasus-rpg/templates/partial-options-range.html notapplicable=true}}
{{/select}}
</select>
{{/if}}
{{#if (eq feature.type "number")}}
<input type="text" class="padd-right" name="data.features.{{key}}.value" value="{{feature.value}}" data-dtype="Number"/>
{{/if}}
{{#if (eq feature.type "string")}}
<input type="text" class="padd-right" name="data.features.{{key}}.value" value="{{feature.value}}" data-dtype="String"/>
{{/if}}
{{#if (eq feature.type "text")}}
<div class="small-editor item-text-long-line">
{{editor content=features.value target="data.features.{{key}}.value" button=true owner=owner editable=editable}}
</div>
{{/if}}
</li>
</ul>
{{/if}}
{{/each}}
</ul>
<label class="generic-label">Description</label>
<div class="small-editor item-text-long-line">
{{editor content=data.description target="data.description" button=true owner=owner editable=editable}}
</div>
<label class="generic-label">Rules</label>
<div class="small-editor item-text-long-line">
{{editor content=data.rules target="data.rules" button=true owner=owner editable=editable}}
</div>
<label class="generic-label">Upgrades</label>
<div class="small-editor item-text-long-line">
{{editor content=data.upgrades target="data.upgrades" button=true owner=owner editable=editable}}
</div>
</div>
</section>

View File

@ -30,9 +30,7 @@
</li>
{{#if data.ispowergroup}}
<li class="flexrow"><label class="generic-label">Available Power sources</label>
<div class="small-editor item-text-long-line">
{{editor content=data.powersource target="data.powersource" button=true owner=owner editable=editable}}
</div>
<input type="text" class="" name="data.powersource" value="{{data.powersource}}" data-dtype="String"/>
</li>
<li class="flexrow"><label class="generic-label">Available Powers</label>
</li>

View File

@ -6,3 +6,4 @@
<option value="medium">Medium</option>
<option value="long">Long</option>
<option value="extreme">Extreme</option>
<option value="sight">Line of Sight</option>