added place to modify bond score

This commit is contained in:
The Last Scrub
2020-07-04 14:47:08 -07:00
parent 6619b646d7
commit a18ed7a3a0
4 changed files with 28 additions and 58 deletions
+13 -45
View File
@@ -146,17 +146,17 @@ export class DeltaGreenActorSheet extends ActorSheet {
this.actor.update({"data": updatedData});
});
html.find('.btn-add-bond').click(event => {
event.preventDefault();
this._addNewBond();
});
//html.find('.btn-add-bond').click(event => {
// event.preventDefault();
// this._addNewBond();
//});
html.find('.btn-remove-bond').click(event => {
event.preventDefault();
let skillindex = event.target.getAttribute("data-index");
//html.find('.btn-remove-bond').click(event => {
// event.preventDefault();
// let skillindex = event.target.getAttribute("data-index");
this._removeBond(skillindex);
});
// this._removeBond(skillindex);
//});
}
@@ -197,40 +197,6 @@ export class DeltaGreenActorSheet extends ActorSheet {
this.actor.update({"data": updatedData});
}
_addNewBond(){
let updatedData = duplicate(this.actor.data.data);
let updatedBonds = [];
let x;
for(x in updatedData.bonds){
if(Number.isNumeric(x)){
updatedBonds.push(updatedData.bonds[x]);
}
}
updatedBonds.push({"description": "New", "score": updatedData.statistics.cha.value});
updatedData.bonds = updatedBonds;
this.actor.update({"data": updatedData});
}
_removeBond(pos){
let updatedData = duplicate(this.actor.data.data);
let updatedBonds = [];
let x;
for(x in updatedData.bonds){
if(Number.isNumeric(x) && x != pos){
updatedBonds.push(updatedData.bonds[x]);
}
}
updatedData.bonds = updatedBonds;
this.actor.update({"data": updatedData});
}
/**
* Handle creating a new Owned Item for the actor using initial data defined in the HTML dataset
* @param {Event} event The originating click event
@@ -258,11 +224,13 @@ export class DeltaGreenActorSheet extends ActorSheet {
itemData.data.skill = "firearms"; //default skill to firearms, since that will be most common
itemData.data.expense = "Standard";
}
if(type == "armor"){
else if(type == "armor"){
itemData.data.armor = 3;
itemData.data.expense = "Standard";
}
else if(type == "bond"){
itemData.data.score = this.object.data.data.statistics.cha.value; // Can vary, but at character creation starting bond score is usually agent's charisma
}
// Finally, create the item!
return this.actor.createOwnedItem(itemData);
+1 -1
View File
@@ -386,7 +386,7 @@
"templates":[
"base"
],
"score": -9999
"score": 10
}
}
}
+14 -10
View File
@@ -1,15 +1,24 @@
<form class="{{cssClass}}" autocomplete="off">
<header class="sheet-header">
<img class="profile-img" src="{{item.img}}" data-edit="img" title="{{item.name}}"/>
<div class="header-fields">
<h1 class="charname"><input name="name" type="text" value="{{item.name}}" placeholder="Name"/></h1>
<div class="flexrow">
<img class="profile-img" src="{{item.img}}" data-edit="img" title="{{item.name}}" />
<div class="horizontal-flex-column">
<div>
<h1 class="charname"> <input name="name" type="text" value="{{item.name}}" placeholder="Name" /> </h1>
</div>
<div class="resource">
<label class="resource-label">Score</label>
<input type="text" name="data.score" value="{{data.score}}" data-dtype="Number"
title="A higher score represents a stronger relationship between the agent and the bond."
/>
</div>
</div>
</div>
</header>
{{!-- Sheet Tab Navigation --}}
<nav class="sheet-tabs tabs" data-group="primary">
<a class="item" data-tab="description">Description</a>
<a class="item" data-tab="attributes">Attributes</a>
<a class="item" data-tab="description">Description/Developments</a>
</nav>
{{!-- Sheet Body --}}
@@ -19,10 +28,5 @@
<div class="tab" data-group="primary" data-tab="description">
{{editor content=data.description target="data.description" button=true owner=owner editable=editable}}
</div>
{{!-- Attributes Tab --}}
<div class="tab attributes" data-group="primary" data-tab="attributes">
{{!-- As you add new fields, add them in here! --}}
</div>
</section>
</form>
@@ -1,7 +1,5 @@
<form class="{{cssClass}}" autocomplete="off">
{{!-- Sheet Tab Navigation --}}
<nav class="sheet-tabs tabs" data-group="primary">
<a class="item item-toggle" data-tab="attributes">Attributes</a>