Fix glitches

This commit is contained in:
sladecraven 2022-01-22 21:49:34 +01:00
parent 0d144ef2a9
commit 35b78c8127
9 changed files with 181 additions and 76 deletions

View File

@ -55,6 +55,7 @@ export class PegasusActorSheet extends ActorSheet {
race: duplicate(this.actor.getRace()), race: duplicate(this.actor.getRace()),
role: duplicate(this.actor.getRole()), role: duplicate(this.actor.getRole()),
effects: duplicate(this.actor.getEffects()), effects: duplicate(this.actor.getEffects()),
moneys: duplicate(this.actor.getMoneys()),
options: this.options, options: this.options,
owner: this.document.isOwner, owner: this.document.isOwner,
editScore: this.options.editScore, editScore: this.options.editScore,
@ -119,22 +120,22 @@ export class PegasusActorSheet extends ActorSheet {
this.actor.rollUnarmedAttack(); this.actor.rollUnarmedAttack();
}); });
html.find('.attack-melee').click((event) => { html.find('.attack-melee').click((event) => {
this.actor.rollPool( 'com', true); this.actor.rollPool( 'com');
}); });
html.find('.attack-ranged').click((event) => { html.find('.attack-ranged').click((event) => {
this.actor.rollPool( 'agi', true); this.actor.rollPool( 'agi');
}); });
html.find('.defense-roll').click((event) => { html.find('.defense-roll').click((event) => {
this.actor.rollPool( 'def', true); this.actor.rollPool( 'def', true);
}); });
html.find('.damage-melee').click((event) => { html.find('.damage-melee').click((event) => {
this.actor.rollPool( 'str', true); this.actor.rollPool( 'str');
}); });
html.find('.damage-ranged').click((event) => { html.find('.damage-ranged').click((event) => {
this.actor.rollPool( 'per', true); this.actor.rollPool( 'per');
}); });
html.find('.damage-resistance').click((event) => { html.find('.damage-resistance').click((event) => {
this.actor.rollPool( 'phy', true); this.actor.rollPool( 'phy');
}); });
html.find('.roll-stat').click((event) => { html.find('.roll-stat').click((event) => {

View File

@ -110,6 +110,11 @@ export class PegasusActor extends Actor {
return comp; return comp;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
getMoneys() {
let comp = this.data.items.filter(item => item.type == 'money');
return comp;
}
/* -------------------------------------------- */
getArmors() { getArmors() {
let comp = duplicate(this.data.items.filter(item => item.type == 'armor') || []); let comp = duplicate(this.data.items.filter(item => item.type == 'armor') || []);
return comp; return comp;
@ -481,9 +486,18 @@ export class PegasusActor extends Actor {
rollDialog.render(true); rollDialog.render(true);
} }
/* -------------------------------------------- */
getShieldDice() {
let shields = this.data.items.filter( item => item.type == "shield" && item.data.data.equipped)
let def = 0
for ( let sh of shields) {
def += sh.data.data.level
}
return def
}
/* -------------------------------------------- */ /* -------------------------------------------- */
rollPool(statKey, useSPec) { rollPool(statKey, useShield=false) {
let stat = this.getStat(statKey); let stat = this.getStat(statKey);
if (stat) { if (stat) {
let rollData = this.getCommonRollData() let rollData = this.getCommonRollData()
@ -491,7 +505,10 @@ export class PegasusActor extends Actor {
rollData.specList = this.getRelevantSpec(statKey) rollData.specList = this.getRelevantSpec(statKey)
rollData.selectedSpec = "0" rollData.selectedSpec = "0"
rollData.stat = stat; rollData.stat = stat;
if (useShield) {
rollData.otherDicesLevel = this.getShieldDice()
}
this.startRoll(rollData); this.startRoll(rollData);
} else { } else {
ui.notifications.warn("Statistic not found !"); ui.notifications.warn("Statistic not found !");
@ -608,14 +625,15 @@ export class PegasusActor extends Actor {
updates['data.nrg.max'] = nrgValue updates['data.nrg.max'] = nrgValue
updates['data.nrg.value'] = nrgValue updates['data.nrg.value'] = nrgValue
} }
nrgValue = PegasusUtility.getDiceValue(this.data.data.statistics.foc.value) + this.data.data.statistics.foc.mod;
if (nrgValue != this.data.data.combat.stunthreshold) { if (nrgValue != this.data.data.combat.stunthreshold) {
updates['data.combat.stunthreshold'] = nrgValue updates['data.combat.stunthreshold'] = nrgValue
} }
let mrLevel = (this.data.data.statistics.agi.value + this.data.data.statistics.str.value) - this.data.data.statistics.phy.value let momentum = PegasusUtility.getDiceValue(this.data.data.statistics.foc.value) + this.data.data.statistics.foc.mod
mrLevel = (mrLevel < 1) ? 1 : mrLevel; if (momentum != this.data.data.momentum.max) {
if (mrLevel != this.data.data.mr.value) { updates['data.momentum.value'] = momentum
updates['data.mr.value'] = mrLevel updates['data.momentum.max'] = momentum
} }
let race = this.getRace() let race = this.getRace()

View File

@ -4,7 +4,7 @@ export const defaultItemImg = {
specialisation: "systems/fvtt-pegasus-rpg/images/icons/icon_spec.webp", specialisation: "systems/fvtt-pegasus-rpg/images/icons/icon_spec.webp",
perk: "systems/fvtt-pegasus-rpg/images/icons/icon_perk.webp", perk: "systems/fvtt-pegasus-rpg/images/icons/icon_perk.webp",
ability: "systems/fvtt-pegasus-rpg/images/icons/icon_raceability.webp", ability: "systems/fvtt-pegasus-rpg/images/icons/icon_raceability.webp",
armor: "systems/fvtt-pegasus-rpg/images/icons/icon_armor.webp", armor: "systems/fvtt-pegasus-rpg/images/icons/icon_armour.webp",
weapon: "systems/fvtt-pegasus-rpg/images/icons/icon_weapon.webp", weapon: "systems/fvtt-pegasus-rpg/images/icons/icon_weapon.webp",
equipment: "systems/fvtt-pegasus-rpg/images/icons/icon_equipment.webp", equipment: "systems/fvtt-pegasus-rpg/images/icons/icon_equipment.webp",
effect: "systems/fvtt-pegasus-rpg/images/icons/icon_effect.webp", effect: "systems/fvtt-pegasus-rpg/images/icons/icon_effect.webp",

View File

@ -678,6 +678,10 @@ ul, li {
margin-left: 4px; margin-left: 4px;
} }
.small-label {
margin-top: 5px;
}
.padd-right { .padd-right {
margin-right: 8px; margin-right: 8px;
} }
@ -780,8 +784,7 @@ ul, li {
/* background: rgb(105,85,65) url("../images/ui/texture_feuille_perso_onglets.webp") no-repeat right bottom;*/ /* background: rgb(105,85,65) url("../images/ui/texture_feuille_perso_onglets.webp") no-repeat right bottom;*/
#sidebar.collapsed { #sidebar.collapsed {
height: 430px !important; height: 470px !important;
position: absolute;
} }
#sidebar-tabs > .collapsed, #chat-controls .chat-control-icon { #sidebar-tabs > .collapsed, #chat-controls .chat-control-icon {

View File

@ -160,9 +160,9 @@
"styles": [ "styles": [
"styles/simple.css" "styles/simple.css"
], ],
"templateVersion": 61, "templateVersion": 63,
"title": "Pegasus RPG", "title": "Pegasus RPG",
"url": "https://www.uberwald.me/data/files/fvtt-pegasus-rpg", "url": "https://www.uberwald.me/data/files/fvtt-pegasus-rpg",
"version": "0.1.10", "version": "0.1.12",
"background" : "./images/ui/pegasus_welcome_page.webp" "background" : "./images/ui/pegasus_welcome_page.webp"
} }

View File

@ -130,6 +130,7 @@
"value": 0, "value": 0,
"type": "value", "type": "value",
"ismax": true, "ismax": true,
"iscombat": true,
"bonus": 0, "bonus": 0,
"max": 0 "max": 0
}, },
@ -138,6 +139,7 @@
"value": 0, "value": 0,
"type": "value", "type": "value",
"ismax": true, "ismax": true,
"iscombat": true,
"bonus": 0, "bonus": 0,
"max": 0 "max": 0
}, },
@ -179,7 +181,7 @@
} }
}, },
"Item": { "Item": {
"types": [ "race", "role", "ability", "specialisation", "perk", "power" , "armor", "shield", "equipment", "weapon", "effect"], "types": [ "race", "role", "ability", "specialisation", "perk", "power" , "armor", "shield", "equipment", "weapon", "effect", "money"],
"effect": { "effect": {
"type": "", "type": "",
"genre": "", "genre": "",
@ -430,6 +432,12 @@
"equipped": false, "equipped": false,
"description":"" "description":""
}, },
"money" : {
"value": 0,
"quantity": 0,
"weight": 0,
"description": ""
},
"weapon": { "weapon": {
"statistic": "", "statistic": "",
"damagestatistic": "", "damagestatistic": "",

View File

@ -53,7 +53,7 @@
<div class=""> <div class="">
<ul> <ul>
<li class="item flexrow list-item"><span></span><span>Current</span><span>Bonus</span><span>Max</span></li> <li class="item flexrow list-item"><span>&nbsp;</span><span>Current</span><span>Bonus</span><span>Max</span></li>
<li class="item flexrow list-item"></li> <li class="item flexrow list-item"></li>
<li class="item flexrow list-item"></li> <li class="item flexrow list-item"></li>
{{#each data.secondary as |stat2 key|}} {{#each data.secondary as |stat2 key|}}
@ -71,10 +71,10 @@
<ul> <ul>
<li class="item flexrow list-item" data-key="nrg"> <li class="item flexrow list-item" data-key="nrg">
<span class="stat-label flexrow" name="nrg"> <h4>{{data.nrg.label}}</h4> </span> <span class="stat-label flexrow" name="nrg"> <h4>{{data.nrg.label}}</h4> </span>
<input type="text" class="padd-right" name="data.nrg.activated" value="{{data.nrg.activated}}" data-dtype="Number"/> <span class="small-label padd-right packed-left">Act</span><input type="text" class="padd-right" name="data.nrg.activated" value="{{data.nrg.activated}}" data-dtype="Number"/>
<input type="text" class="padd-right" name="data.nrg.value" value="{{data.nrg.value}}" data-dtype="Number"/> <span class="small-label padd-right packed-left">&nbsp;Val</span><input type="text" class="padd-right" name="data.nrg.value" value="{{data.nrg.value}}" data-dtype="Number"/>
<input type="text" class="padd-right" name="data.nrg.mod" value="{{data.nrg.mod}}" data-dtype="Number"/> <span class="small-label padd-right packed-left">&nbsp;Mod</span><input type="text" class="padd-right" name="data.nrg.mod" value="{{data.nrg.mod}}" data-dtype="Number"/>
<input type="text" class="padd-right" name="data.nrg.max" value="{{data.nrg.max}}" data-dtype="Number"/> <span class="small-label padd-right packed-left">&nbsp;Max</span><input type="text" class="padd-right" name="data.nrg.max" value="{{data.nrg.max}}" data-dtype="Number"/>
</li> </li>
</ul> </ul>
@ -86,21 +86,6 @@
</li> </li>
</ul> </ul>
<ul>
<li class="item flexrow list-item" data-key="mr">
<span class="stat-label flexrow" name="mr">
<a class="roll-mr" data-stat-key="{{mr}}"><h4>{{data.mr.label}}</h4></a>
</span>
<select class="carac-base flexrow" type="text" name="data.mr.value" value="{{data.mr.value}}"
data-dtype="Number" {{#unless @root.editScore}}disabled{{/unless}}>
{{#select data.mr.value}}
{{{@root.optionsDiceList}}}
{{/select}}
</select>
<input type="text" class="padd-right" name="data.mr.mod" value="{{data.mr.mod}}" data-dtype="Number"/>
</li>
</ul>
</div> </div>
</div> </div>
@ -133,36 +118,6 @@
</ul> </ul>
</div> </div>
<div>
<span class="generic-label">
<h3>Perks</h3>
</span>
<ul class="stat-list alternate-list">
{{#each perks as |perk key|}}
<li class="item stat flexrow list-item" data-item-id="{{perk._id}}">
<img class="sheet-competence-img" src="{{perk.img}}" />
<span class="stat-label">{{perk.name}}</span>
<span class="stat-label">Lvl:{{perk.data.level}}</span>
<span class="stat-label">Rounds:
<select class="competence-base flexrow park-round-count" type="text" value="{{perk.data.roundcount}}" data-dtype="Number">
{{#select perk.data.roundcount}}
<option value="3">Ready</option>
<option value="2">Activated</option>
<option value="1">2 Rounds left</option>
<option value="0">1 Round left</option>
{{/select}}
</select>
</span>
<div class="item-controls">
<a class="item-control perk-active" title="active">{{#if perk.data.active}}<i
class="fas fa-circle"></i>{{else}}<i class="fas fa-genderless"></i>{{/if}}</a>
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ul>
</div>
</div> </div>
<div> <div>
@ -191,12 +146,42 @@
<div class="flexcol"> <div class="flexcol">
<ul> <ul>
<li class="item flexrow list-item" data-key="mr">
<span class="stat-label flexrow" name="mr">
<a class="roll-mr" data-stat-key="{{mr}}"><h4>{{data.mr.label}}</h4></a>
</span>
<select class="carac-base flexrow" type="text" name="data.mr.value" value="{{data.mr.value}}"
data-dtype="Number" >
{{#select data.mr.value}}
{{{@root.optionsDiceList}}}
{{/select}}
</select>
<input type="text" class="padd-right input-numeric-short" name="data.mr.mod" value="{{data.mr.mod}}" data-dtype="Number"/>
</li>
<li class="item flexrow list-item" data-key="nrg"> <li class="item flexrow list-item" data-key="nrg">
<span class="stat-label flexrow" name="nrg"><h4>{{data.nrg.label}}</h4> </span> <span class="stat-label flexrow" name="nrg"><h4>{{data.nrg.label}}</h4> </span>
<input type="text" class="padd-right update-field" data-field-name="data.nrg.activated" value="{{data.nrg.activated}}" data-dtype="Number"/> <span class="small-label padd-right packed-left">Act</span><input type="text" class="padd-right update-field input-numeric-short" data-field-name="data.nrg.activated" value="{{data.nrg.activated}}" data-dtype="Number"/>
<input type="text" class="padd-right update-field" data-field-name="data.nrg.value" value="{{data.nrg.value}}" data-dtype="Number"/> <span class="small-label padd-right packed-left">&nbsp;Val</span><input type="text" class="padd-right update-field input-numeric-short" data-field-name="data.nrg.value" value="{{data.nrg.value}}" data-dtype="Number"/>
<input type="text" class="padd-right update-field" data-field-name="data.nrg.mod" value="{{data.nrg.mod}}" data-dtype="Number"/> <span class="small-label padd-right packed-left">&nbsp;Mod</span><input type="text" class="padd-right update-field input-numeric-short" data-field-name="data.nrg.mod" value="{{data.nrg.mod}}" data-dtype="Number"/>
<input type="text" class="padd-right update-field" data-field-name="data.nrg.max" value="{{data.nrg.max}}" data-dtype="Number"/> <span class="small-label padd-right packed-left">&nbsp;Max</span><input type="text" class="padd-right update-field input-numeric-short" data-field-name="data.nrg.max" value="{{data.nrg.max}}" data-dtype="Number"/>
</li>
{{#each data.secondary as |stat2 key|}}
{{#if stat2.iscombat}}
<li class="item flexrow list-item" data-attr-key="{{key}}">
<span class="stat-label flexrow" name="{{key}}">
<h4>{{stat2.label}}</h4>
</span>
<span class="small-label padd-right packed-left">Val</span><input type="text" class="padd-right update-field input-numeric-short" data-field-name="data.secondary.{{key}}.value" value="{{stat2.value}}" data-dtype="Number"/>
<span class="small-label padd-right packed-left">&nbsp;Bonus</span><input type="text" class="padd-right update-field input-numeric-short" data-field-name="data.secondary.{{key}}.bonus" value="{{stat2.bonus}}" data-dtype="Number"/>
<span class="small-label padd-right packed-left">&nbsp;Max</span><input type="text" class="padd-right update-field input-numeric-short" data-field-name="data.secondary.{{key}}.max" value="{{stat2.max}}" data-dtype="Number"/>
</li>
{{/if}}
{{/each}}
<li class="item flexrow list-item" data-key="momentum">
<span class="stat-label flexrow" name="momentum"><h4>{{data.momentum.label}}</h4></span>
<span class="small-label padd-right packed-left">Val</span><input type="text" class="padd-right update-field input-numeric-short" data-field-name="data.momentum.value" value="{{data.momentum.value}}" data-dtype="Number"/>
<span class="small-label padd-right packed-left">&nbsp;Max</span><input type="text" class="padd-right update-field input-numeric-short" data-field-name="data.momentum.max" value="{{data.momentum.max}}" data-dtype="Number"/>
</li> </li>
</ul> </ul>
@ -254,6 +239,37 @@
{{/each}} {{/each}}
</ul> </ul>
<div>
<span class="generic-label">
<h3>Perks</h3>
</span>
<ul class="stat-list alternate-list">
{{#each perks as |perk key|}}
<li class="item stat flexrow list-item" data-item-id="{{perk._id}}">
<img class="sheet-competence-img" src="{{perk.img}}" />
<span class="stat-label">{{perk.name}}</span>
<span class="stat-label">Lvl:{{perk.data.level}}</span>
<span class="stat-label">Rounds:
<select class="competence-base flexrow park-round-count" type="text" value="{{perk.data.roundcount}}" data-dtype="Number">
{{#select perk.data.roundcount}}
<option value="3">Ready</option>
<option value="2">Activated</option>
<option value="1">2 Rounds left</option>
<option value="0">1 Round left</option>
{{/select}}
</select>
</span>
<div class="item-controls">
<a class="item-control perk-active" title="active">{{#if perk.data.active}}<i
class="fas fa-circle"></i>{{else}}<i class="fas fa-genderless"></i>{{/if}}</a>
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ul>
</div>
<span class="generic-label"> <span class="generic-label">
<h3>Weapons</h3> <h3>Weapons</h3>
</span> </span>
@ -302,10 +318,10 @@
<ul> <ul>
<li class="item flexrow list-item" data-key="nrg"> <li class="item flexrow list-item" data-key="nrg">
<span class="stat-label flexrow" name="nrg"><h4>{{data.nrg.label}}</h4> </span> <span class="stat-label flexrow" name="nrg"><h4>{{data.nrg.label}}</h4> </span>
<input type="text" class="padd-right update-field" data-field-name="data.nrg.activated" value="{{data.nrg.activated}}" data-dtype="Number"/> <span class="small-label padd-right packed-left">Act</span><input type="text" class="padd-right update-field" data-field-name="data.nrg.activated" value="{{data.nrg.activated}}" data-dtype="Number"/>
<input type="text" class="padd-right update-field" data-field-name="data.nrg.value" value="{{data.nrg.value}}" data-dtype="Number"/> <span class="small-label padd-right packed-left">&nbsp;Val</span><input type="text" class="padd-right update-field" data-field-name="data.nrg.value" value="{{data.nrg.value}}" data-dtype="Number"/>
<input type="text" class="padd-right update-field" data-field-name="data.nrg.mod" value="{{data.nrg.mod}}" data-dtype="Number"/> <span class="small-label padd-right packed-left">&nbsp;Mod</span><input type="text" class="padd-right update-field" data-field-name="data.nrg.mod" value="{{data.nrg.mod}}" data-dtype="Number"/>
<input type="text" class="padd-right update-field" data-field-name="data.nrg.max" value="{{data.nrg.max}}" data-dtype="Number"/> <span class="small-label padd-right packed-left">&nbsp;Max</span><input type="text" class="padd-right update-field" data-field-name="data.nrg.max" value="{{data.nrg.max}}" data-dtype="Number"/>
</li> </li>
</ul> </ul>
@ -323,6 +339,7 @@
{{power.name}} {{power.name}}
{{/if}} {{/if}}
</span> </span>
<span class="stat-label outfit-label">{{power.data.type}}</span>
<span class="stat-label outfit-label">{{#if power.data.activated}}Activated{{/if}}</span> <span class="stat-label outfit-label">{{#if power.data.activated}}Activated{{/if}}</span>
<div class="item-controls"> <div class="item-controls">
<a class="item-control power-activate" title="Worn">{{#if power.data.activated}}<i <a class="item-control power-activate" title="Worn">{{#if power.data.activated}}<i
@ -339,6 +356,32 @@
{{!-- Equipement Tab --}} {{!-- Equipement Tab --}}
<div class="tab equipment" data-group="primary" data-tab="equipment"> <div class="tab equipment" data-group="primary" data-tab="equipment">
<div>
<h4>Money</h4>
</div>
<ul class="item-list alternate-list">
<li class="item flexrow list-item">
<span class="equipement-label">Name</span>
<span class="equipement-label">Quantity</span>
<div class="item-controls">
<span class="equipement-label">&nbsp;</span>
<span class="equipement-label">&nbsp;</span>
<span class="equipement-label">&nbsp;</span>
</div>
</li>
{{#each moneys as |money key|}}
<li class="item flexrow list-item" data-item-id="{{money._id}}">
<img class="sheet-competence-img" src="{{money.img}}" />
<span class="equipement-label">{{money.name}}</span>
<span class="generic-label">Qty {{money.data.quantity}}</span>
<div class="item-controls">
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ul>
<div> <div>
<h4>Equipment</h4> <h4>Equipment</h4>

View File

@ -0,0 +1,32 @@
<form class="{{cssClass}}" autocomplete="off">
<header class="sheet-header">
<img class="profile-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>
{{!-- Sheet Body --}}
<section class="sheet-body">
<div class="tab" data-group="primary">
<ul>
<li class="flexrow"><label class="generic-label">Value</label>
<input type="text" class="input-numeric-short padd-right" name="data.value" value="{{data.value}}" data-dtype="Number"/>
</li>
<li class="flexrow"><label class="generic-label">Quantity</label>
<input type="text" class="input-numeric-short padd-right" name="data.quantity" value="{{data.quantity}}" data-dtype="Number"/>
</li>
<li class="flexrow"><label class="generic-label">Weight</label>
<input type="text" class="input-numeric-short padd-right" name="data.weight" value="{{data.weight}}" data-dtype="Number"/>
</li>
<li class="flexrow"><label class="generic-label">Notes</label>
<div class="small-editor item-text-long-line">
{{editor content=data.description target="data.description" button=true owner=owner editable=editable}}
</div>
</li>
</ul>
</div>
</section>
</form>

View File

@ -14,7 +14,7 @@
<div class="flexrow"> <div class="flexrow">
<span class="roll-dialog-label" >Bonus Dice : </span> <span class="roll-dialog-label" >Bonus Dice : </span>
<select class="competence-base" id="bonusDicesLevel" type="text" name="bonusDicesLevel" value="{{bonusDicesLevel}}" data-dtype="Number"> <select class="roll-dialog-label" id="bonusDicesLevel" type="text" name="bonusDicesLevel" value="{{bonusDicesLevel}}" data-dtype="Number">
{{#select bonusDicesLevel}} {{#select bonusDicesLevel}}
{{{optionsDiceList}}} {{{optionsDiceList}}}
{{/select}} {{/select}}