All fixes'

This commit is contained in:
sladecraven 2022-01-10 08:00:27 +01:00
parent 9fbbd93a2e
commit 6387426b73
9 changed files with 184 additions and 47 deletions

View File

@ -493,7 +493,7 @@ export class PegasusActor extends Actor {
/* -------------------------------------------- */
async addItemWithoutDuplicate( newItem ) {
let item = this.data.items.filter( item => item.type == newItem.type && item.name.toLowerCase() == newItem.name.toLowerCase() )
let item = this.data.items.find( item => item.type == newItem.type && item.name.toLowerCase() == newItem.name.toLowerCase() )
if ( !item ) {
await this.createEmbeddedDocuments( 'Item', [newItem]);
}
@ -501,12 +501,16 @@ export class PegasusActor extends Actor {
/* -------------------------------------------- */
computeNRGHealth( ) {
let focValue = this.data.data.statistics.foc.value;
this.update( {'data.secondary.nrg.max': focValue, 'data.secondary.nrg.value': focValue} )
let phyValue = this.data.data.statistics.phy.value;
this.update( {'data.secondary.health.max': phyValue, 'data.secondary.health.value': phyValue} )
let mndValue = this.data.data.statistics.mnd.value;
this.update( {'data.secondary.delirium.max': mndValue, 'data.secondary.delirium.value': mndValue} )
let focDiceValue = PegasusUtility.getDiceValue(this.data.data.statistics.foc.value);
this.update( {'data.secondary.nrg.max': focDiceValue, 'data.secondary.nrg.value': focDiceValue} )
let phyDiceValue = PegasusUtility.getDiceValue(this.data.data.statistics.phy.value);
this.update( {'data.secondary.health.max': phyDiceValue, 'data.secondary.health.value': phyDiceValue} )
let mndDiceValue = PegasusUtility.getDiceValue(this.data.data.statistics.mnd.value);
this.update( {'data.secondary.delirium.max': mndDiceValue, 'data.secondary.delirium.value': mndDiceValue} )
let stlDiceValue = PegasusUtility.getDiceValue(this.data.data.statistics.stl.value);
this.update( {'data.secondary.stealthhealth.max': stlDiceValue, 'data.secondary.stealthhealth.value': stlDiceValue} )
let socDiceValue = PegasusUtility.getDiceValue(this.data.data.statistics.soc.value);
this.update( {'data.secondary.socialhealth.max': socDiceValue, 'data.secondary.socialhealth.value': socDiceValue} )
}
/* -------------------------------------------- */
@ -556,17 +560,25 @@ export class PegasusActor extends Actor {
stat.mod += parseInt(ability.data.statmodifier)
updates[`data.statistics.${ability.data.affectedstat}`] = stat
}
for (let power of race.data.powersgained) {
newItems.push(power);
if ( race.data.powersgained) {
for (let power of race.data.powersgained) {
newItems.push(power);
}
}
for (let spec of race.data.specialisations) {
newItems.push(spec);
if ( race.data.specialisations) {
for (let spec of race.data.specialisations) {
newItems.push(spec);
}
}
for (let weapon of race.data.attackgained) {
newItems.push(weapon);
if ( race.data.attackgained) {
for (let weapon of race.data.attackgained) {
newItems.push(weapon);
}
}
for (let armor of race.data.armorgained) {
newItems.push(armor);
if ( race.data.armorgained) {
for (let armor of race.data.armorgained) {
newItems.push(armor);
}
}
}
await this.update( updates )
@ -594,7 +606,7 @@ export class PegasusActor extends Actor {
this.getIncreaseStatValue( updates, role.data.statincrease1)
this.getIncreaseStatValue( updates, role.data.statincrease2)
newItems = newItems.concat(duplicate(role.data.specialisationsplus1))
//newItems = newItems.concat(duplicate(role.data.specialisationsplus1))
newItems = newItems.concat(duplicate(role.data.specialperk))
await this.update( updates )

View File

@ -105,7 +105,20 @@ export class PegasusActorCreate {
this.currentRole = role;
this.nbRoleStat = 2;
this.roleStats = duplicate(role.data.statincreasechoice)
this.showRoleStat( );
this.showRoleStartSpec( );
}
if ( step == 'select-role-start-spec') {
PegasusUtility.removeChatMessageId(PegasusUtility.findChatMessageId(event.currentTarget));
let spec = this.roleSpecStart.find( item => item._id == itemId);
this.actor.addIncSpec(spec, 1);
this.nbRoleSpecStart--;
this.roleSpecStart = this.roleSpecStart.filter( item => item._id != itemId);//Remove selected spec
if( this.nbRoleSpecStart == 0) {
this.showRoleStat( );
} else {
this.showRoleStartSpec( );
}
}
if ( step == 'select-role-stat') {
@ -261,7 +274,19 @@ export class PegasusActorCreate {
this.renderChatMessage( formData)
}
/* -------------------------------------------- */
/* ------------------------------- ------------- */
async showRoleStartSpec() {
if ( !this.roleSpecStart) {
this.roleSpecStart = duplicate(this.currentRole.data.specialisationsplus1)
this.nbRoleSpecStart = 2;
}
let formData = this.createFormData("select-role-start-spec")
formData.rolestartspec = this.roleSpecStart
formData.nbrolespecstart = this.nbRoleSpecStart;
this.renderChatMessage( formData)
}
/* ------------------------------- ------------- */
async showRoleStat( ) {
let formData = this.createFormData("select-role-stat")
formData.rolestats = []

View File

@ -4,6 +4,7 @@ import { PegasusActorCreate } from "./pegasus-create-char.js";
/* -------------------------------------------- */
const __level2Dice = [ "d0", "d4", "d6", "d8", "d10", "d12" ];
const __level2DiceValue = [ 0, 4, 6, 8, 10, 12 ];
/* -------------------------------------------- */
export class PegasusUtility {
@ -179,6 +180,18 @@ export class PegasusUtility {
return it;
}
/* -------------------------------------------- */
static getDiceValue( level = 0) {
let locLevel = level
let diceValue = 0
while (locLevel > 0) {
let idx = locLevel % __level2Dice.length
diceValue += __level2DiceValue[idx]
locLevel -= idx
}
return diceValue
}
/* -------------------------------------------- */
static getDiceFromLevel(level = 0) {
level = Number(level)

File diff suppressed because one or more lines are too long

View File

@ -100,9 +100,9 @@
"styles": [
"styles/simple.css"
],
"templateVersion": 36,
"templateVersion": 41,
"title": "Pegasus RPG",
"url": "https://www.uberwald.me/data/files/fvtt-pegasus-rpg",
"version": "0.0.37",
"version": "0.0.41",
"background" : "./images/ui/pegasus_welcome_page.webp"
}

View File

@ -16,10 +16,12 @@
"desires": "",
"preferredhand": "",
"catchphrase": "",
"catchphrase_trigger": "",
"character_value": 0,
"catchphraseused": false,
"catchphrasetrigger": "",
"charactervalue": 0,
"level": 0,
"cdp": 0,
"cdpused": 0,
"notes": "",
"gmnotes": "",
"racename": "",
@ -107,25 +109,59 @@
"label": "Health",
"value": 0,
"type": "value",
"ismax": true,
"max": 0
},
"delirium": {
"label": "Delirium",
"value": 0,
"type": "value",
"ismax": true,
"max": 0
},
"nrg": {
"label": "NRG",
"value": 0,
"type": "value",
"max": 0
"max": 0,
"ismax": true,
"isactivated": true,
"activated": 0
},
"mr": {
"label": "MR",
"type": "dice",
"value": 0
}
"value": 0,
"ismodifier": true,
"modifier": 0
},
"stealthhealth": {
"label": "Stealth Health",
"type": "value",
"value": 0,
"ismax": true,
"max": 0
},
"socialhealth": {
"label": "Social Health",
"type": "value",
"value": 0,
"ismax": true,
"max": 0
},
"momentum": {
"label": "Momentum",
"type": "value",
"value": 0,
"ismax": true,
"max": 0
}
},
"combat": {
"bonusdice": 0,
"otherdice": 0,
"hindrancedice": 0,
"stunlevel": 0
}
},
"npccore": {

View File

@ -68,6 +68,21 @@
{{/if}}
{{/select}}
</select>
{{#if stat2.ismax}}
<select class="carac-base flexrow" type="text" name="data.secondary.{{key}}.max" value="{{stat2.max}}"
data-dtype="Number" {{#unless @root.editScore}}disabled{{/unless}}>
{{#select stat2.max}}
{{#if (eq stat2.type "value")}}
{{{@root.optionsLevel}}}
{{else}}
{{{@root.optionsDiceList}}}
{{/if}}
{{/select}}
</select>
{{/if}}
{{#if stat2.ismodifier}}
<input type="text" class="" name="data.secondary.{{key}}.modifier" value="{{stat2.modifier}}" data-dtype="Number" />
{{/if}}
</li>
{{/each}}
</ul>
@ -292,6 +307,10 @@
<label class="generic-label">Sex</label>
<input type="text" class="" name="data.biodata.sex" value="{{data.biodata.sex}}" data-dtype="String" />
</li>
<li class="flexrow">
<label class="generic-label">Preferred Hand</label>
<input type="text" class="" name="data.biodata.preferredhand" value="{{data.biodata.preferredhand}}" data-dtype="String" />
</li>
<li class="flexrow item list_item" data-item-id="{{race._id}}">
<label class="generic-label">Race</label>
<input type="text" class="" name="data.racename" value="{{data.racename}}" data-dtype="String" />
@ -310,42 +329,61 @@
</div>
</div>
<hr>
<h3>Destiny : </h3>
<h3>Psychology : </h3>
<ul>
<li class="flexrow">
<label class="short-label">Achieved (Total) : </label>
<input type="text" class="" name="data.destiny.achieved" value="{{data.destiny.achieved}}"
<label class="short-label">Worstfear </label>
<input type="text" class="" name="data.biodata.worstfear" value="{{datadata.biodata.worstfear}}"
data-dtype="Number" />
</li>
<li class="flexrow">
<label class="short-label">Avanced (Spent) : </label>
<input type="text" class="" name="data.destiny.advanced" value="{{data.destiny.advanced}}"
data-dtype="Number" />
</li>
<li class="flexrow">
<label class="short-label">Held back (available) : </label>
<input type="text" class="" name="data.destiny.available" value="{{data.destiny.available}}"
<label class="short-label">Desires </label>
<input type="text" class="" name="data.biodata.desires" value="{{data.biodata.desires}}"
data-dtype="Number" />
</li>
</ul>
<hr>
<h3>Goals : </h3>
<h3>Catchphrase : </h3>
<ul>
<li class="flexrow">
<label class="short-label">Immediate : </label>
<input type="text" class="" name="data.biodata.goalimmediate" value="{{data.biodata.goalimmediate}}"
<label class="short-label">Catchphrase </label>
<input type="text" class="" name="data.biodata.catchphrase" value="{{datadata.biodata.catchphrase}}"
data-dtype="Number" />
</li>
<li class="flexrow">
<label class="short-label">Catchphrase Trigger : </label>
<input type="text" class="" name="data.biodata.catchphrasetrigger" value="{{data.biodata.catchphrasetrigger}}"
data-dtype="Number" />
</li>
<li class="flexrow">
<label class="short-label">Catchphrase used </label>
<label class="attribute-value checkbox"><input type="checkbox" name="data.biodata.catchphraseused" {{checked data.biodata.catchphraseused}}/></label>
</li>
</ul>
<hr>
<h3>Development : </h3>
<ul>
<li class="flexrow">
<label class="short-label">Character Value : </label>
<input type="text" class="" name="data.biodata.charactervalue" value="{{data.biodata.charactervalue}}"
data-dtype="String" />
</li>
<li class="flexrow">
<label class="short-label">Futur : </label>
<input type="text" class="" name="data.biodata.goalfutur" value="{{data.biodata.goalfutur}}"
data-dtype="String" />
<label class="short-label">Level : </label>
<input type="text" class="" name="data.biodata.level" value="{{data.biodata.level}}"
data-dtype="Number" />
</li>
<li class="flexrow">
<label class="short-label">Passion : </label>
<input type="text" class="" name="data.biodata.passion" value="{{data.biodata.passion}}"
data-dtype="String" />
<label class="short-label">Character Development Points Total (CDP total) : </label>
<input type="text" class="" name="data.biodata.cdp" value="{{data.biodata.cdp}}"
data-dtype="Number" />
</li>
<li class="flexrow">
<label class="short-label">Character Development Points Used (CDP used) : </label>
<input type="text" class="" name="data.biodata.cdpused" value="{{data.biodata.cdpused}}"
data-dtype="Number" />
</li>
</ul>

View File

@ -88,6 +88,19 @@
</table>
{{/if}}
{{#if (eq step "select-role-start-spec")}}
<div>Choose 1 Stat at +1DT :
</div>
<table class="table-create-actor">
{{#each rolestartspec as |spec index|}}
<tr>
<td>{{spec.name}}</td>
<td><a class="chat-card-button chat-create-actor" data-step-name="{{@root.step}}" data-item-id="{{spec._id}}" >Select it !</a></td>
</tr>
{{/each}}
</table>
{{/if}}
{{#if (eq step "select-role-stat")}}
<div>Choose 1 Stat at +1DT :
</div>

View File

@ -28,7 +28,7 @@
</select>
</li>
<li class="flexrow">
<label class="generic-label">Starting Specialisation at +1 DT</label>
<label class="generic-label">Starting Specialisation at +1 DT (Two to be selected)</label>
</li>
<ul class="ul-level1">
<li class="flexrow">