v10 branch - Update manifest

This commit is contained in:
sladecraven 2022-07-13 22:47:07 +02:00
parent f66b9c1913
commit bf52b61a0d
12 changed files with 268 additions and 85 deletions

View File

@ -58,6 +58,7 @@ export class PegasusActorSheet extends ActorSheet {
effects: duplicate(this.actor.getEffects()),
moneys: duplicate(this.actor.getMoneys()),
encCapacity: this.actor.getEncumbranceCapacity(),
levelRemainingList: this.actor.getLevelRemainingList(),
containersTree: this.actor.containersTree,
encCurrent: this.actor.encCurrent,
encHindrance: this.actor.encHindrance,
@ -79,6 +80,10 @@ export class PegasusActorSheet extends ActorSheet {
rollData.mode = "generic"
rollData.title = `Dice Pool Roll`
rollData.img = "icons/dice/d12black.svg"
rollData.isGeneric = true
rollData.traumaState = this.actor.getTraumaState()
rollData.diceList = PegasusUtility.getDiceList()
rollData.dicePool = []
let rollDialog = await PegasusRollDialog.create( this.actor, rollData);
rollDialog.render( true );

View File

@ -857,6 +857,18 @@ export class PegasusActor extends Actor {
return this.traumaState
}
/* -------------------------------------------- */
getLevelRemaining() {
return this.data.data.biodata.currentlevelremaining
}
/* -------------------------------------------- */
modifyHeroLevelRemaining( incDec) {
let biodata = duplicate(this.data.data.biodata)
biodata.currentlevelremaining = Math.max(biodata.currentlevelremaining+incDec, 0)
this.update( {"data.biodata": biodata} )
return biodata.currentlevelremaining
}
/* -------------------------------------------- */
async computeNRGHealth() {
if (this.isToken) return
@ -1205,6 +1217,7 @@ export class PegasusActor extends Actor {
rollData.actorId = this.id
rollData.img = this.img
rollData.traumaState = this.getTraumaState()
rollData.levelRemaining = this.getLevelRemaining()
rollData.activePerks = duplicate(this.getActivePerks())
rollData.diceList = PegasusUtility.getDiceList()
rollData.dicePool = []
@ -1223,7 +1236,7 @@ export class PegasusActor extends Actor {
}
let diceKey = PegasusUtility.getDiceFromLevel(rollData.stat.value)
rollData.dicePool.push({
name: "stat", key: diceKey,
name: "stat", key: diceKey, mod: rollData.stat.mod,
img: `systems/fvtt-pegasus-rpg/images/dice/${diceKey}.webp`
})
}
@ -1236,6 +1249,15 @@ export class PegasusActor extends Actor {
return rollData
}
/* -------------------------------------------- */
getLevelRemainingList( ) {
let options = []
for (let i=0; i<=this.data.data.biodata.maxlevelremaining; i++) {
options.push( `<option value="${i}">${i}</option>`)
}
return options.join("\n")
}
/* -------------------------------------------- */
async startRoll(rollData) {
this.syncRoll(rollData);
@ -1251,7 +1273,7 @@ export class PegasusActor extends Actor {
let power = this.data.items.get(itemId)
if (power) {
power = duplicate(power)
this.rollPool(power.data.dmgstatistic)
this.rollPool(power.data.dmgstatistic, false, "power-dmg")
}
}
@ -1264,7 +1286,9 @@ export class PegasusActor extends Actor {
rollData.subKey = subKey
rollData.title = `Roll : ${stat.label} `
rollData.img = "icons/dice/d12black.svg"
if (subKey == "melee-dmg" || subKey == "ranged-dmg" || subKey == "power-dmg") {
rollData.isDamage = true
}
this.startRoll(rollData)
} else {
ui.notifications.warn("Statistic not found !");
@ -1312,6 +1336,7 @@ export class PegasusActor extends Actor {
rollData.specName = spec.name
rollData.img = spec.img
rollData.specDicesLevel = spec.data.level
PegasusUtility.updateSpecDicePool(rollData)
this.startRoll(rollData)
} else {
ui.notifications.warn("Specialisation not found !");
@ -1355,7 +1380,7 @@ export class PegasusActor extends Actor {
rollData.title = `Armor : ${armor.name}`
rollData.isResistance = true;
rollData.img = armor.img
rollData.otherDicesLevel = armor.data.resistance
rollData.damageDiceLevel = armor.data.resistance
this.startRoll(rollData);
} else {

View File

@ -5,7 +5,7 @@ export class PegasusRollDialog extends Dialog {
/* -------------------------------------------- */
static async create(actor, rollData) {
let options = { classes: ["PegasusDialog"], width: 620, height: 380, 'z-index': 99999 };
let options = { classes: ["PegasusDialog"], width: 620, height: 480, 'z-index': 99999 };
let html = await renderTemplate('systems/fvtt-pegasus-rpg/templates/roll-dialog-generic.html', rollData);
return new PegasusRollDialog(actor, rollData, html, options);
@ -63,7 +63,7 @@ export class PegasusRollDialog extends Dialog {
idVal = "#statDicesLevel"
}
if (effectData.data.otherdice) {
idVal = "#otherDicesLevel"
idVal = "#damageDiceLevel"
}
if (effectData.data.hindrance) {
idVal = "#hindranceDicesLevel"
@ -96,8 +96,9 @@ export class PegasusRollDialog extends Dialog {
this.rollData.specDicesLevel = Number($('#specDicesLevel').val())
//this.rollData.bonusDicesLevel = Number($('#bonusDicesLevel').val())
//this.rollData.hindranceDicesLevel = Number($('#hindranceDicesLevel').val())
this.rollData.otherDicesLevel = Number($('#otherDicesLevel').val())
this.rollData.damageDiceLevel = Number($('#damageDiceLevel').val())
PegasusUtility.updateSpecDicePool(this.rollData)
PegasusUtility.updateDamageDicePool(this.rollData)
PegasusUtility.updateEffectsBonusDice(this.rollData)
}
@ -148,7 +149,7 @@ export class PegasusRollDialog extends Dialog {
let equip = this.rollData.equipmentsList[equipIdx]
if (equip) {
equip.applied = toggled
let idVal = "#otherDicesLevel" // Default
let idVal = "#damageDiceLevel" // Default
if (equip.equip.data.bonusdice) {
idVal = "#bonusDicesLevel"
}
@ -156,7 +157,7 @@ export class PegasusRollDialog extends Dialog {
idVal = "#statDicesLevel"
}
if (equip.equip.data.otherdice) {
idVal = "#otherDicesLevel"
idVal = "#damageDiceLevel"
}
let newLevel = Number($(idVal).val())
if (toggled) {
@ -171,7 +172,7 @@ export class PegasusRollDialog extends Dialog {
this.rollData.specDicesLevel = Number($('#specDicesLevel').val())
this.rollData.bonusDicesLevel = Number($('#bonusDicesLevel').val())
this.rollData.hindranceDicesLevel = Number($('#hindranceDicesLevel').val())
this.rollData.otherDicesLevel = Number($('#otherDicesLevel').val())
this.rollData.damageDiceLevel = Number($('#damageDiceLevel').val())
}
}
@ -214,14 +215,10 @@ export class PegasusRollDialog extends Dialog {
PegasusUtility.updateSpecDicePool(this.rollData)
this.refreshDialog()
});
html.find('#bonusDicesLevel').change((event) => {
this.rollData.bonusDicesLevel = Number(event.currentTarget.value)
});
html.find('#hindranceDicesLevel').change((event) => {
this.rollData.hindranceDicesLevel = Number(event.currentTarget.value)
});
html.find('#otherDicesLevel').change((event) => {
this.rollData.otherDicesLevel = Number(event.currentTarget.value)
html.find('#damageDiceLevel').change(async (event) => {
this.rollData.damageDiceLevel = Number(event.currentTarget.value)
PegasusUtility.updateDamageDicePool(this.rollData)
this.refreshDialog()
});
html.find('.effect-clicked').change(async (event) => {
let toggled = event.currentTarget.checked

View File

@ -81,17 +81,39 @@ export class PegasusUtility {
rollData.dicePool = newDicePool
}
/* -------------------------------------------- */
static updateDamageDicePool(rollData) {
if (rollData.isDamage) {
let newDicePool = rollData.dicePool.filter(dice => dice.name != "damage")
if (rollData.damageDiceLevel > 0) {
let diceKey = PegasusUtility.getDiceFromLevel(rollData.damageDiceLevel)
let diceList = diceKey.split(" ")
for(let myDice of diceList) {
let newDice = {
name: "damage", key: myDice,
img: `systems/fvtt-pegasus-rpg/images/dice/${myDice}.webp`
}
newDicePool.push(newDice)
}
}
rollData.dicePool = newDicePool
}
}
/* -------------------------------------------- */
static updateSpecDicePool(rollData) {
let newDicePool = rollData.dicePool.filter(dice => dice.name != "spec")
if (rollData.specDicesLevel > 0) {
let diceKey = PegasusUtility.getDiceFromLevel(rollData.specDicesLevel)
let diceList = diceKey.split(" ")
for(let myDice of diceList) {
let newDice = {
name: "spec", key: diceKey,
img: `systems/fvtt-pegasus-rpg/images/dice/${diceKey}.webp`
name: "spec", key: myDice,
img: `systems/fvtt-pegasus-rpg/images/dice/${myDice}.webp`
}
newDicePool.push(newDice)
}
}
rollData.dicePool = newDicePool
}
@ -107,8 +129,7 @@ export class PegasusUtility {
/*-------------------------------------------- */
static removeFromDicePool( rollData, diceIdx ) {
let toRemove = rollData.dicePool[diceIdx]
console.log("CLICK : ", rollData.dicePool, diceIdx)
if (toRemove && toRemove.name != "spec" && toRemove.name != "stat") {
if (toRemove && toRemove.name != "spec" && toRemove.name != "stat" && toRemove.name != "damage") {
let newDicePool = []
for (let i=0; i<rollData.dicePool.length; i++) {
if ( i!=diceIdx) {
@ -259,10 +280,17 @@ export class PegasusUtility {
html.on("click", '.chat-create-actor', event => {
game.system.pegasus.creator.processChatEvent(event);
});
})
html.on("click", '.view-item-from-chat', event => {
game.system.pegasus.creator.openItemView(event)
});
})
html.on("click", '.reroll-level-remaining', event => {
let rollId = $(event.currentTarget).data("roll-id")
let rollData = this.getRollData(rollId)
rollData.reroll = true
this.rollPegasus( rollData)
})
}
/* -------------------------------------------- */
@ -347,7 +375,7 @@ export class PegasusUtility {
static getDiceValue(level = 0) {
let diceString = this.diceList[level]
if (!diceString) {
console.log("Level error", level)
return __name2DiceValue[level]
}
let diceTab = diceString.split(" ")
let diceValue = 0
@ -554,6 +582,7 @@ export class PegasusUtility {
/* -------------------------------------------- */
static async rollPegasus(rollData) {
/*
let dicePool = [{ name: "stat", level: 0, statmod: 0 }, { name: "spec", level: 0 }, { name: "bonus", level: 0 }, { name: "hindrance", level: 0 }, { name: "other", level: 0 }];
if (rollData.stat) {
dicePool[0].level += Number(rollData.stat.value)
@ -591,23 +620,34 @@ export class PegasusUtility {
diceFormulaTab.push(this.getFoundryDiceFromLevel(diceGroup.level))
}
let diceFormula = '{' + diceFormulaTab.join(', ') + '}kh';
*/
let actor = game.actors.get(rollData.actorId)
let diceFormulaTab = []
for (let dice of rollData.dicePool) {
diceFormulaTab.push(dice.key)
}
let diceFormula = '{' + diceFormulaTab.join(', ') + '}kh + ' + (rollData.stat?.mod || 0)
// Performs roll
let myRoll = rollData.roll;
if (!myRoll) { // New rolls only of no rerolls
myRoll = new Roll(diceFormula).roll({ async: false });
await this.showDiceSoNice(myRoll, game.settings.get("core", "rollMode"));
let myRoll = rollData.roll
if (!myRoll || rollData.reroll) { // New rolls only of no rerolls
myRoll = new Roll(diceFormula).roll({ async: false })
await this.showDiceSoNice(myRoll, game.settings.get("core", "rollMode"))
rollData.roll = myRoll
}
if (rollData.reroll) {
rollData.levelRemaining = actor.modifyHeroLevelRemaining(-1)
}
// Final score and keep data
rollData.finalScore = myRoll.total + dicePool[0].statmod;
rollData.finalScore = myRoll.total
if (rollData.damages) {
let dmgFormula = this.getFoundryDiceFromLevel(rollData.damages.value)
let dmgRoll = new Roll(dmgFormula).roll({ async: false });
await this.showDiceSoNice(dmgRoll, game.settings.get("core", "rollMode"));
rollData.dmgResult = dmgRoll.total;
let dmgRoll = new Roll(dmgFormula).roll({ async: false })
await this.showDiceSoNice(dmgRoll, game.settings.get("core", "rollMode"))
rollData.dmgResult = dmgRoll.total
}
this.createChatWithRollMode(rollData.alias, {
@ -617,12 +657,11 @@ export class PegasusUtility {
// Init stuf
if (rollData.isInit) {
let combat = game.combats.get(rollData.combatId)
combat.updateEmbeddedDocuments("Combatant", [{ _id: rollData.combatantId, initiative: rollData.finalScore }]);
combat.updateEmbeddedDocuments("Combatant", [{ _id: rollData.combatantId, initiative: rollData.finalScore }])
}
// Stun specific -> Suffere a stun level when dmg-res
if (rollData.subKey && rollData.subKey == "dmg-res") {
let actor = game.actors.get(rollData.actorId)
actor.modifyStun(-1)
}

View File

@ -180,9 +180,9 @@
"styles": [
"styles/simple.css"
],
"templateVersion": 92,
"templateVersion": 94,
"title": "Pegasus RPG",
"url": "https://www.uberwald.me/data/files/fvtt-pegasus-rpg",
"version": "0.5.13",
"version": "0.5.15",
"background" : "./images/ui/pegasus_welcome_page.webp"
}

View File

@ -21,7 +21,8 @@
"catchphraseused": false,
"catchphrasetrigger": "",
"charactervalue": 0,
"level": 0,
"maxlevelremaining": 0,
"currentlevelremaining": 0,
"threatlevel": 0,
"cdp": 0,
"cdpused": 0,
@ -197,7 +198,7 @@
}
},
"Item": {
"types": [ "race", "role", "ability", "specialisation", "perk", "power" , "armor", "shield", "equipment", "weapon", "effect", "money", "virtuevice"],
"types": [ "race", "role", "ability", "specialisation", "perk", "power" , "armor", "shield", "equipment", "weapon", "effect", "money", "virtue", "vice"],
"effect": {
"type": "",
"genre": "",
@ -266,9 +267,13 @@
"threatlevel": 0,
"description": ""
},
"virtuevice": {
"subtype": "",
"virtue": {
"unavailablevice": [],
"effectsgained": [],
"threatlevel": 0,
"description": ""
},
"vice": {
"unavailablevirtue": [],
"effectsgained": [],
"threatlevel": 0,

View File

@ -927,13 +927,16 @@
<input type="text" class="" name="data.biodata.cdp" value="{{data.biodata.cdp}}" data-dtype="Number" />
</li>
<li class="flexrow">
<label class="short-label">Hero Level : </label>
<input type="text" class="" name="data.biodata.level" value="{{data.biodata.level}}" data-dtype="Number" />
<label class="short-label">Hero Level (max) : </label>
<input type="text" class="" name="data.biodata.maxlevelremaining" value="{{data.biodata.maxlevelremaining}}" data-dtype="Number" />
</li>
<li class="flexrow">
<label class="short-label">Hero Levels Remaining : </label>
<input type="text" class="" name="data.biodata.cdpused" value="{{data.biodata.cdpused}}"
data-dtype="Number" />
<select class="status-small-label color-class-common" type="text" name="data.biodata.currentlevelremaining" value="{{data.biodata.currentlevelremaining}}" data-dtype="Number" {{#unless @root.editScore}}disabled{{/unless}}>
{{#select data.biodata.currentlevelremaining}}
{{{@root.levelRemainingList}}}
{{/select}}
</select>
</li>
<li class="flexrow">
<label class="short-label">Threat Level : </label>

View File

@ -48,6 +48,10 @@
{{/if}}
{{/if}}
{{#if levelRemaining}}
<button class="chat-card-button reroll-level-remaining" data-roll-id="{{rollId}}">Reroll</button>
{{/if}}
</ul>
</div>

View File

@ -88,25 +88,6 @@
</li>
</li>
<!--
<li class="flexrow"><label class="generic-label">AoE</label>
<input type="text" class="padd-right" name="data.aoe" value="{{data.aoe}}" data-dtype="String"/>
</li>
<li class="flexrow"><label class="generic-label">Affected Circumstances</label>
<input type="text" class="padd-right" name="data.affectedcircumstances" value="{{data.affectedcircumstances}}" data-dtype="String"/>
</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>
<li class="flexrow"><label class="generic-label">Opponents Gain Hindrance Dice</label>
<select class="competence-base flexrow" type="text" name="data.opponenthindrance" value="{{data.opponenthindrance}}" data-dtype="Number">
{{#select data.opponenthindrance}}
{{{optionsDiceList}}}
{{/select}}
</select>
</li>
-->
<li class="flexrow"><label class="generic-label">Threat Level Value</label>
<input type="text" class="input-numeric-short padd-right" name="data.threatlevel" value="{{data.threatlevel}}" data-dtype="Number"/>
</li>

View File

@ -0,0 +1,59 @@
<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-pegasus-rpg/templates/partial-item-nav.html}}
{{!-- Sheet Body --}}
<section class="sheet-body">
{{> systems/fvtt-pegasus-rpg/templates/partial-item-description.html}}
<div class="tab details" data-group="primary" data-tab="details">
<li class="flexrow"><label class="generic-label">Unavailable Virtue</label>
</li>
<li>
<ul class="ul-level1">
<li class="flexrow"><div class="drop-ability-effect"><label>Drop Virtue here !</label></div>
</li>
{{#each data.unavailablevirtue as |vice idx|}}
<li class="flexrow">
<label name="data.unavailablevirtue[{{idx}}].name"><a class="view-subitem" data-type="unavailablevirtue" data-index="{{idx}}">{{vice.name}}</a></label>
<div class="item-controls padd-left">
<a class="item-control delete-subitem padd-left" data-type="unavailablevirtue" data-index="{{idx}}" title="Delete Virtue"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ul>
</li>
<li class="flexrow"><label class="generic-label">Effects Gained</label>
</li>
<li>
<ul class="ul-level1">
<li class="flexrow"><div class="drop-ability-effect"><label>Drop Effects here !</label></div>
</li>
{{#each data.effectsgained as |effect idx|}}
<li class="flexrow">
<label name="data.effectsgained[{{idx}}].name"><a class="view-subitem" data-type="effectsgained" data-index="{{idx}}">{{effect.name}}</a></label>
<div class="item-controls padd-left">
<a class="item-control delete-subitem padd-left" data-type="effectsgained" data-index="{{idx}}" title="Delete Effect"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ul>
</li>
<li class="flexrow"><label class="generic-label">Threat Level Value</label>
<input type="text" class="input-numeric-short padd-right" name="data.threatlevel" value="{{data.threatlevel}}" data-dtype="Number"/>
</li>
</ul>
</div>
</section>
</form>

View File

@ -0,0 +1,59 @@
<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-pegasus-rpg/templates/partial-item-nav.html}}
{{!-- Sheet Body --}}
<section class="sheet-body">
{{> systems/fvtt-pegasus-rpg/templates/partial-item-description.html}}
<div class="tab details" data-group="primary" data-tab="details">
<li class="flexrow"><label class="generic-label">Unavailable Vice</label>
</li>
<li>
<ul class="ul-level1">
<li class="flexrow"><div class="drop-ability-effect"><label>Drop Vice here !</label></div>
</li>
{{#each data.unavailablevice as |vice idx|}}
<li class="flexrow">
<label name="data.unavailablevice[{{idx}}].name"><a class="view-subitem" data-type="unavailablevice" data-index="{{idx}}">{{vice.name}}</a></label>
<div class="item-controls padd-left">
<a class="item-control delete-subitem padd-left" data-type="unavailablevice" data-index="{{idx}}" title="Delete Vice"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ul>
</li>
<li class="flexrow"><label class="generic-label">Effects Gained</label>
</li>
<li>
<ul class="ul-level1">
<li class="flexrow"><div class="drop-ability-effect"><label>Drop Effects here !</label></div>
</li>
{{#each data.effectsgained as |effect idx|}}
<li class="flexrow">
<label name="data.effectsgained[{{idx}}].name"><a class="view-subitem" data-type="effectsgained" data-index="{{idx}}">{{effect.name}}</a></label>
<div class="item-controls padd-left">
<a class="item-control delete-subitem padd-left" data-type="effectsgained" data-index="{{idx}}" title="Delete Effect"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ul>
</li>
<li class="flexrow"><label class="generic-label">Threat Level Value</label>
<input type="text" class="input-numeric-short padd-right" name="data.threatlevel" value="{{data.threatlevel}}" data-dtype="Number"/>
</li>
</ul>
</div>
</section>
</form>

View File

@ -10,6 +10,9 @@
<div class="flexcol">
{{#if isGeneric}}
{{else}}
<div class="flexrow">
<span class="roll-dialog-label">Stat Dice : </span>
<select class="roll-dialog-label" id="statDicesLevel" type="text" name="statDicesLevel"
@ -47,17 +50,20 @@
</select>
<span class="small-label">&nbsp;</span>
</div>
{{/if}}
{{#if isDamage}}
<div class="flexrow">
<span class="roll-dialog-label">Weapon Damage :</span>
<select class="roll-dialog-label" id="otherDicesLevel" type="text" name="otherDicesLevel"
value="{{otherDicesLevel}}" data-dtype="Number">
{{#select otherDicesLevel}}
<select class="roll-dialog-label" id="damageDiceLevel" type="text" name="damageDiceLevel"
value="{{damageDiceLevel}}" data-dtype="Number">
{{#select damageDiceLevel}}
{{{optionsDiceList}}}
{{/select}}
</select>
<span class="small-label">&nbsp;</span>
</div>
{{/if}}
<div class="dice-pool-div">
<span>