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 ) { 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 ) { if ( !item ) {
await this.createEmbeddedDocuments( 'Item', [newItem]); await this.createEmbeddedDocuments( 'Item', [newItem]);
} }
@ -501,12 +501,16 @@ export class PegasusActor extends Actor {
/* -------------------------------------------- */ /* -------------------------------------------- */
computeNRGHealth( ) { computeNRGHealth( ) {
let focValue = this.data.data.statistics.foc.value; let focDiceValue = PegasusUtility.getDiceValue(this.data.data.statistics.foc.value);
this.update( {'data.secondary.nrg.max': focValue, 'data.secondary.nrg.value': focValue} ) this.update( {'data.secondary.nrg.max': focDiceValue, 'data.secondary.nrg.value': focDiceValue} )
let phyValue = this.data.data.statistics.phy.value; let phyDiceValue = PegasusUtility.getDiceValue(this.data.data.statistics.phy.value);
this.update( {'data.secondary.health.max': phyValue, 'data.secondary.health.value': phyValue} ) this.update( {'data.secondary.health.max': phyDiceValue, 'data.secondary.health.value': phyDiceValue} )
let mndValue = this.data.data.statistics.mnd.value; let mndDiceValue = PegasusUtility.getDiceValue(this.data.data.statistics.mnd.value);
this.update( {'data.secondary.delirium.max': mndValue, 'data.secondary.delirium.value': mndValue} ) 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,19 +560,27 @@ export class PegasusActor extends Actor {
stat.mod += parseInt(ability.data.statmodifier) stat.mod += parseInt(ability.data.statmodifier)
updates[`data.statistics.${ability.data.affectedstat}`] = stat updates[`data.statistics.${ability.data.affectedstat}`] = stat
} }
if ( race.data.powersgained) {
for (let power of race.data.powersgained) { for (let power of race.data.powersgained) {
newItems.push(power); newItems.push(power);
} }
}
if ( race.data.specialisations) {
for (let spec of race.data.specialisations) { for (let spec of race.data.specialisations) {
newItems.push(spec); newItems.push(spec);
} }
}
if ( race.data.attackgained) {
for (let weapon of race.data.attackgained) { for (let weapon of race.data.attackgained) {
newItems.push(weapon); newItems.push(weapon);
} }
}
if ( race.data.armorgained) {
for (let armor of race.data.armorgained) { for (let armor of race.data.armorgained) {
newItems.push(armor); newItems.push(armor);
} }
} }
}
await this.update( updates ) await this.update( updates )
await this.createEmbeddedDocuments('Item', newItems) await this.createEmbeddedDocuments('Item', newItems)
console.log("Updates", updates, newItems) console.log("Updates", updates, newItems)
@ -594,7 +606,7 @@ export class PegasusActor extends Actor {
this.getIncreaseStatValue( updates, role.data.statincrease1) this.getIncreaseStatValue( updates, role.data.statincrease1)
this.getIncreaseStatValue( updates, role.data.statincrease2) 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)) newItems = newItems.concat(duplicate(role.data.specialperk))
await this.update( updates ) await this.update( updates )

View File

@ -105,7 +105,20 @@ export class PegasusActorCreate {
this.currentRole = role; this.currentRole = role;
this.nbRoleStat = 2; this.nbRoleStat = 2;
this.roleStats = duplicate(role.data.statincreasechoice) this.roleStats = duplicate(role.data.statincreasechoice)
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( ); this.showRoleStat( );
} else {
this.showRoleStartSpec( );
}
} }
if ( step == 'select-role-stat') { if ( step == 'select-role-stat') {
@ -261,6 +274,18 @@ export class PegasusActorCreate {
this.renderChatMessage( formData) 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( ) { async showRoleStat( ) {
let formData = this.createFormData("select-role-stat") let formData = this.createFormData("select-role-stat")

View File

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

File diff suppressed because one or more lines are too long

View File

@ -100,9 +100,9 @@
"styles": [ "styles": [
"styles/simple.css" "styles/simple.css"
], ],
"templateVersion": 36, "templateVersion": 41,
"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.0.37", "version": "0.0.41",
"background" : "./images/ui/pegasus_welcome_page.webp" "background" : "./images/ui/pegasus_welcome_page.webp"
} }

View File

@ -16,10 +16,12 @@
"desires": "", "desires": "",
"preferredhand": "", "preferredhand": "",
"catchphrase": "", "catchphrase": "",
"catchphrase_trigger": "", "catchphraseused": false,
"character_value": 0, "catchphrasetrigger": "",
"charactervalue": 0,
"level": 0, "level": 0,
"cdp": 0, "cdp": 0,
"cdpused": 0,
"notes": "", "notes": "",
"gmnotes": "", "gmnotes": "",
"racename": "", "racename": "",
@ -107,25 +109,59 @@
"label": "Health", "label": "Health",
"value": 0, "value": 0,
"type": "value", "type": "value",
"ismax": true,
"max": 0 "max": 0
}, },
"delirium": { "delirium": {
"label": "Delirium", "label": "Delirium",
"value": 0, "value": 0,
"type": "value", "type": "value",
"ismax": true,
"max": 0 "max": 0
}, },
"nrg": { "nrg": {
"label": "NRG", "label": "NRG",
"value": 0, "value": 0,
"type": "value", "type": "value",
"max": 0 "max": 0,
"ismax": true,
"isactivated": true,
"activated": 0
}, },
"mr": { "mr": {
"label": "MR", "label": "MR",
"type": "dice", "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": { "npccore": {

View File

@ -68,6 +68,21 @@
{{/if}} {{/if}}
{{/select}} {{/select}}
</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> </li>
{{/each}} {{/each}}
</ul> </ul>
@ -292,6 +307,10 @@
<label class="generic-label">Sex</label> <label class="generic-label">Sex</label>
<input type="text" class="" name="data.biodata.sex" value="{{data.biodata.sex}}" data-dtype="String" /> <input type="text" class="" name="data.biodata.sex" value="{{data.biodata.sex}}" data-dtype="String" />
</li> </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}}"> <li class="flexrow item list_item" data-item-id="{{race._id}}">
<label class="generic-label">Race</label> <label class="generic-label">Race</label>
<input type="text" class="" name="data.racename" value="{{data.racename}}" data-dtype="String" /> <input type="text" class="" name="data.racename" value="{{data.racename}}" data-dtype="String" />
@ -310,42 +329,61 @@
</div> </div>
</div> </div>
<hr> <hr>
<h3>Destiny : </h3>
<h3>Psychology : </h3>
<ul> <ul>
<li class="flexrow"> <li class="flexrow">
<label class="short-label">Achieved (Total) : </label> <label class="short-label">Worstfear </label>
<input type="text" class="" name="data.destiny.achieved" value="{{data.destiny.achieved}}" <input type="text" class="" name="data.biodata.worstfear" value="{{datadata.biodata.worstfear}}"
data-dtype="Number" /> data-dtype="Number" />
</li> </li>
<li class="flexrow"> <li class="flexrow">
<label class="short-label">Avanced (Spent) : </label> <label class="short-label">Desires </label>
<input type="text" class="" name="data.destiny.advanced" value="{{data.destiny.advanced}}" <input type="text" class="" name="data.biodata.desires" value="{{data.biodata.desires}}"
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}}"
data-dtype="Number" /> data-dtype="Number" />
</li> </li>
</ul> </ul>
<hr> <h3>Catchphrase : </h3>
<h3>Goals : </h3>
<ul> <ul>
<li class="flexrow"> <li class="flexrow">
<label class="short-label">Immediate : </label> <label class="short-label">Catchphrase </label>
<input type="text" class="" name="data.biodata.goalimmediate" value="{{data.biodata.goalimmediate}}" <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" /> data-dtype="String" />
</li> </li>
<li class="flexrow"> <li class="flexrow">
<label class="short-label">Futur : </label> <label class="short-label">Level : </label>
<input type="text" class="" name="data.biodata.goalfutur" value="{{data.biodata.goalfutur}}" <input type="text" class="" name="data.biodata.level" value="{{data.biodata.level}}"
data-dtype="String" /> data-dtype="Number" />
</li> </li>
<li class="flexrow"> <li class="flexrow">
<label class="short-label">Passion : </label> <label class="short-label">Character Development Points Total (CDP total) : </label>
<input type="text" class="" name="data.biodata.passion" value="{{data.biodata.passion}}" <input type="text" class="" name="data.biodata.cdp" value="{{data.biodata.cdp}}"
data-dtype="String" /> 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> </li>
</ul> </ul>

View File

@ -88,6 +88,19 @@
</table> </table>
{{/if}} {{/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")}} {{#if (eq step "select-role-stat")}}
<div>Choose 1 Stat at +1DT : <div>Choose 1 Stat at +1DT :
</div> </div>

View File

@ -28,7 +28,7 @@
</select> </select>
</li> </li>
<li class="flexrow"> <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> </li>
<ul class="ul-level1"> <ul class="ul-level1">
<li class="flexrow"> <li class="flexrow">