Fix #6 Crew limits

This commit is contained in:
sladecraven 2022-09-25 14:45:02 +02:00
parent b185a3902d
commit 857f36387a
4 changed files with 33 additions and 5 deletions

View File

@ -1122,7 +1122,7 @@ export class PegasusActor extends Actor {
modifyHeroLevelRemaining(incDec) {
let biodata = duplicate(this.system.biodata)
biodata.currentlevelremaining = Math.max(biodata.currentlevelremaining + incDec, 0)
this.update({ "data.biodata": biodata })
this.update({ "system.biodata": biodata })
ChatMessage.create({ content: `${this.name} has used a Hero Level to reroll !` })
return biodata.currentlevelremaining
}
@ -2063,6 +2063,10 @@ export class PegasusActor extends Actor {
/* -------------------------------------------- */
addCrew(actorId) {
if ( this.system.crew.length >= this.system.crewmax) {
ui.notifications.warn("Vehicle crew is already full.")
return
}
let crewList = duplicate(this.system.crew.filter(actorDef => actorDef.id != actorId) || [])
crewList.push({ id: actorId })
this.update({ 'system.crew': crewList })

View File

@ -201,6 +201,8 @@
},
"vehicle": {
"crew": [],
"crewmax": 0,
"crewmin": 0,
"statistics": {
"fc": {
"label": "FC",

View File

@ -11,7 +11,11 @@
<select class="status-small-label color-class-common" type="text" name="system.statistics.{{key}}.level"
value="{{stat.level}}" data-dtype="Number" disabled>
{{#select stat.level}}
{{{@root.optionsDiceList}}}
{{#if (eq key "ad")}}
{{{@root.optionsLevel}}}
{{else}}
{{{@root.optionsDiceList}}}
{{/if}}
{{/select}}
</select>
</div>
@ -20,8 +24,12 @@
<select class="status-small-label color-class-common" type="text" name="system.statistics.{{key}}.currentlevel"
value="{{stat.currentlevel}}" data-dtype="Number" {{#unless @root.editScore}}disabled{{/unless}}>
{{#select stat.currentlevel}}
{{{@root.optionsDiceList}}}
{{/select}}
{{#if (eq key "ad")}}
{{{@root.optionsLevel}}}
{{else}}
{{{@root.optionsDiceList}}}
{{/if}}
{{/select}}
</select>
</div>
{{#if (eq key "man")}}
@ -30,7 +38,7 @@
<select class="status-small-label color-class-common" type="text" name="system.statistics.{{key}}.turningarc45"
value="{{stat.turningarc45}}" data-dtype="Number" {{#unless @root.editScore}}disabled{{/unless}}>
{{#select stat.turningarc45}}
{{{@root.optionsDiceList}}}
{{{@root.optionsLevel}}}
{{/select}}
</select>
</div>

View File

@ -553,6 +553,20 @@
{{!-- Crew Tab --}}
<div class="tab items" data-group="primary" data-tab="crew">
<div class="stat-item">
<ul class="stat-list alternate-list">
<li class="item stat flexrow list-item">
<span class="generic-label small-label "><strong>Maximum Crew Capacity</strong></span>
<input type="text" class="input-numeric-short padd-right" name="system.crewmax" value="{{data.crewmax}}"
data-dtype="Number" />
<span class="generic-label small-label"><strong>Minimum Crew Required</strong></span>
<input type="text" class="input-numeric-short" name="system.crewmin" value="{{data.crewmin}}"
data-dtype="Number" />
</li>
</ul>
</div>
<ul class="item-list alternate-list">
<li class="item flexrow list-item items-title-bg">
<span class="item-name-label-header">