diff --git a/modules/pegasus-actor-sheet.js b/modules/pegasus-actor-sheet.js
index 54a6016..8320464 100644
--- a/modules/pegasus-actor-sheet.js
+++ b/modules/pegasus-actor-sheet.js
@@ -48,6 +48,7 @@ export class PegasusActorSheet extends ActorSheet {
shields: duplicate(this.actor.getShields()),
equipments: duplicate(this.actor.getEquipments()),
perks: duplicate(this.actor.getPerks()),
+ activePerks: duplicate(this.actor.getActivePerks()),
powers: duplicate(this.actor.getPowers()),
subActors: duplicate(this.actor.getSubActors()),
options: this.options,
@@ -162,6 +163,13 @@ export class PegasusActorSheet extends ActorSheet {
const li = $(ev.currentTarget).parents(".item");
this.actor.equipItem( li.data("item-id") );
this.render(true);
+
+ });
+ html.find('.perk-active').click(ev => {
+ const li = $(ev.currentTarget).parents(".item");
+ this.actor.activatePerk( li.data("item-id") );
+ this.render(true);
+
});
}
diff --git a/modules/pegasus-actor.js b/modules/pegasus-actor.js
index 81194c1..ae16c82 100644
--- a/modules/pegasus-actor.js
+++ b/modules/pegasus-actor.js
@@ -84,7 +84,11 @@ export class PegasusActor extends Actor {
super._preUpdate(changed, options, user);
}
-
+ /* -------------------------------------------- */
+ getActivePerks() {
+ let perks = this.data.items.filter( item => item.type == 'perk' && item.data.data.active);
+ return perks;
+ }
/* -------------------------------------------- */
getPerks() {
let comp = this.data.items.filter( item => item.type == 'perk');
@@ -139,6 +143,15 @@ export class PegasusActor extends Actor {
return comp;
}
+ /* -------------------------------------------- */
+ async activatePerk(perkId ) {
+ let item = this.data.items.find( item => item.id == perkId );
+ if (item && item.data.data) {
+ let update = { _id: item.id, "data.active": !item.data.data.active };
+ await this.updateEmbeddedDocuments('Item', [update]); // Updates one EmbeddedEntity
+ }
+ }
+
/* -------------------------------------------- */
async equipItem(itemId ) {
let item = this.data.items.find( item => item.id == itemId );
@@ -392,6 +405,7 @@ export class PegasusActor extends Actor {
rollMode: game.settings.get("core", "rollMode"),
title: `Stat ${stat.label} `,
stat: stat,
+ activePerks: duplicate(this.getActivePerks()),
optionsDiceList: PegasusUtility.getOptionsDiceList(),
bonusDicesLevel: 0,
hindranceDicesLevel: 0,
@@ -420,10 +434,11 @@ export class PegasusActor extends Actor {
actorId: this.id,
img: spec.img,
rollMode: game.settings.get("core", "rollMode"),
- title: `Specialisation Roll : ${spec.name} `,
- spec : spec ,
- optionsDiceList: PegasusUtility.getOptionsDiceList(),
+ title: `Spec. : ${spec.name} `,
stat: this.getStat( spec.data.statistic ),
+ spec : spec ,
+ activePerks: duplicate(this.getActivePerks()),
+ optionsDiceList: PegasusUtility.getOptionsDiceList(),
bonusDicesLevel: 0,
hindranceDicesLevel: 0,
otherDicesLevel: 0,
@@ -439,17 +454,6 @@ export class PegasusActor extends Actor {
}
}
- /* -------------------------------------------- */
- applyTechniqueCost( techId) {
- let tech = duplicate(this.data.items.find( item => item.id == techId));
- if (tech ) {
- let attr = this.getAttributeFromChiName( tech.data.chicolor);
- let chiscore = attr.chiscore - tech.data.chicost;
- chiscore = (chiscore < 0) ? 0 : chiscore;
- this.update( { [`data.attributes.${attr.key}.chiscore`]: chiscore } );
- }
- }
-
/* -------------------------------------------- */
updateWithTarget( rollData) {
let objectDefender
@@ -469,48 +473,30 @@ export class PegasusActor extends Actor {
}
/* -------------------------------------------- */
- async rollTechnique( techId ) {
- let technique = this.data.items.find( item => item.type == 'technique' && item.id == techId);
- if (technique) {
- let usedChi = this.getAttributeFromChiName( technique.data.data.chicolor);
- if ( usedChi.chiscore < 0 || technique.data.data.chicost > usedChi.chiscore) {
- ui.notifications.warn(`Not enough ${usedChi.chi} to use Technique ${technique.name}`);
- return;
- }
-
- let chi = undefined;
- let skill = this.data.items.find( item => item.type == 'skill' && item.name == technique.data.data.skillchi);
- if ( !skill) {
- chi = this.getAttributeFromChiName( technique.data.data.skillchi);
- }
+ async rollPower( powId ) {
+ let power = this.data.items.find( item => item.type == 'power' && item.id == powId);
+ if (power) {
let rollData = {
- mode: "technique",
+ mode: "power",
alias: this.name,
- armorModifier: this.getArmorModifier(),
actorImg: this.img,
actorId: this.id,
- img: technique.img,
+ img: power.img,
rollMode: game.settings.get("core", "rollMode"),
- title: `Technique ${technique.name} `,
- technique: duplicate(technique),
- optionsNegative: WotGUtility.getNegativeModifiers(),
- optionsPositive: WotGUtility.getPositiveModifiers(),
- negativeModifier: 0,
- positiveModifier: 0,
- specialtiesBonus: 0
- }
- if ( skill) {
- rollData.skill = duplicate(skill);
- rollData.attr = this.getAttribute( skill.data.data.attribute );
- } else {
- rollData.attr = chi;
+ title: `Power ${power.name} `,
+ power: duplicate(power),
+ activePerks: duplicate(this.getActivePerks()),
+ optionsDiceList: PegasusUtility.getOptionsDiceList(),
+ bonusDicesLevel: 0,
+ hindranceDicesLevel: 0,
+ otherDicesLevel: 0,
}
this.updateWithTarget(rollData);
this.syncRoll( rollData);
- let rollDialog = await WotGRollDialog.create( this, rollData);
+ let rollDialog = await PegasusRollDialog.create( this, rollData);
console.log(rollDialog);
rollDialog.render( true );
} else {
@@ -534,22 +520,20 @@ export class PegasusActor extends Actor {
actorId: this.id,
img: weapon.img,
rollMode: game.settings.get("core", "rollMode"),
- armorModifier: this.getArmorModifier(),
title: "Attack : " + weapon.name,
weapon: weapon,
- skillKey : 0,
- optionsNegative: WotGUtility.getNegativeModifiers(),
- optionsPositive: WotGUtility.getPositiveModifiers(),
- negativeModifier: 0,
- positiveModifier: 0,
- specialtiesBonus: 0,
- }
+ activePerks: duplicate(this.getActivePerks()),
+ optionsDiceList: PegasusUtility.getOptionsDiceList(),
+ bonusDicesLevel: 0,
+ hindranceDicesLevel: 0,
+ otherDicesLevel: 0,
+ }
this.updateWithTarget(rollData);
this.syncRoll( rollData);
- let rollDialog = await WotGRollDialog.create( this, rollData);
+ let rollDialog = await PegasusRollDialog.create( this, rollData);
console.log("WEAPON ROLL", rollData);
rollDialog.render( true );
} else {
diff --git a/modules/pegasus-utility.js b/modules/pegasus-utility.js
index 6e53f1d..8f6d2d6 100644
--- a/modules/pegasus-utility.js
+++ b/modules/pegasus-utility.js
@@ -122,6 +122,7 @@ export class PegasusUtility {
const templatePaths = [
'systems/fvtt-pegasus-rpg/templates/editor-notes-gm.html',
+ 'systems/fvtt-pegasus-rpg/templates/partial-roll-common-dices.html',
'systems/fvtt-pegasus-rpg/templates/partial-options-statistics.html',
'systems/fvtt-pegasus-rpg/templates/partial-options-level.html',
'systems/fvtt-pegasus-rpg/templates/partial-options-equipment-types.html'
diff --git a/system.json b/system.json
index 6ba0911..bfbdb27 100644
--- a/system.json
+++ b/system.json
@@ -40,9 +40,9 @@
"styles": [
"styles/simple.css"
],
- "templateVersion": 4,
+ "templateVersion": 6,
"title": "Pegasus RPG",
"url": "https://www.uberwald.me/data/files/fvtt-pegasus-rpg",
- "version": "0.0.4'",
+ "version": "0.0.6",
"background" : ""
}
\ No newline at end of file
diff --git a/template.json b/template.json
index 96bb399..c688850 100644
--- a/template.json
+++ b/template.json
@@ -40,7 +40,7 @@
"mod": 0
},
"soc":{
- "label": "Sociability",
+ "label": "Social",
"abbrev": "soc",
"level": 1,
"mod": 0
@@ -52,19 +52,19 @@
"mod": 0
},
"phy":{
- "label": "Physical",
+ "label": "Physique",
"abbrev": "phy",
"level": 1,
"mod": 0
},
"com":{
- "label": "Communication",
+ "label": "Combat",
"abbrev": "com",
"level": 1,
"mod": 0
},
"def":{
- "label": "Defense",
+ "label": "Defence",
"abbrev": "def",
"level": 1,
"mod": 0
@@ -92,20 +92,24 @@
"health": {
"label": "Health",
"value": 0,
+ "type": "value",
"max": 0
},
"delirium": {
"label": "Delirium",
"value": 0,
+ "type": "value",
"max": 0
},
"nrg": {
- "label": "NRJ",
+ "label": "NRG",
"value": 0,
+ "type": "value",
"max": 0
},
"mr": {
"label": "MR",
+ "type": "dice",
"value": 0
}
}
@@ -123,7 +127,7 @@
}
},
"Item": {
- "types": [ "race", "role", "ability", "specialisation", "perk", "power" , "armor", "equipment", "weapon"],
+ "types": [ "race", "role", "ability", "specialisation", "perk", "power" , "armor", "shield", "equipment", "weapon"],
"race": {
"description": "",
"environment": "",
@@ -149,6 +153,7 @@
"level": 1,
"active": false,
"roundcount": 0,
+ "nbuse": "",
"description": "",
"upgrades": "",
"rules": ""
@@ -161,7 +166,8 @@
"range": "",
"action": "",
"type": "",
- "effects": ""
+ "effects": "",
+ "purchasedeffects": ""
},
"armor": {
"statistic": "",
diff --git a/templates/actor-sheet.html b/templates/actor-sheet.html
index f86d26c..c430ba2 100644
--- a/templates/actor-sheet.html
+++ b/templates/actor-sheet.html
@@ -15,7 +15,7 @@
Statistics
Specialisations
Powers
- Fight
+ Combat
Equipment
Biography
@@ -42,7 +42,7 @@
{{{@root.optionsDiceList}}}
{{/select}}
-
+
{{/each}}
@@ -55,8 +55,12 @@
{{stat2.label}}
{{/each}}
@@ -70,29 +74,50 @@
{{!-- Other Tab --}}