This commit is contained in:
sladecraven 2022-09-26 20:57:55 +02:00
parent c194afe048
commit 0800a98606
9 changed files with 76 additions and 76 deletions

View File

@ -2171,6 +2171,11 @@ export class PegasusActor extends Actor {
}
}
/* -------------------------------------------- */
setTurningArc( currentLevel) {
this.update( { 'system.statistics.man.turningarc45': currentLevel })
}
/* -------------------------------------------- */
getCurrentCargoCapacity( ) {
let capacity = 0

View File

@ -21,6 +21,8 @@ export class PegasusActorCreate {
this.roles = rolesPack.map(i => i.toObject())
const perksPack = await PegasusUtility.loadCompendium("fvtt-pegasus-rpg.perk")
this.perks = perksPack.map(i => i.toObject())
const specPack = await PegasusUtility.loadCompendium("fvtt-pegasus-rpg.specialisations")
this.specs = specPack.map(i => i.toObject())
this.showRaces()
}
@ -44,6 +46,23 @@ export class PegasusActorCreate {
return formData;
}
/* -------------------------------------------- */
getSpecFromRoleStat( role) {
let specList = []
for(let stat of role.system.statincreasechoice) {
if (stat.flag) {
specList = specList.concat( this.specs.filter( spec => spec.system.statistic.toLowerCase() == stat.name.toLowerCase() ))
}
}
return specList
}
/* -------------------------------------------- */
getPerksFromRole( role ) {
let perks = this.perks.filter( perk => perk.system.category.toLowerCase() == role.system.perksrole.toLowerCase())
return perks
}
/* -------------------------------------------- */
processChatEvent( event ) {
const step = $(event.currentTarget).data("step-name");
@ -54,12 +73,12 @@ export class PegasusActorCreate {
this.currentRace = race;
this.actor.applyRace( race);
PegasusUtility.removeChatMessageId(PegasusUtility.findChatMessageId(event.currentTarget));
if ( race.data.nboptionnal > 0 && race.data.optionnalabilities.length > 0) {
if ( race.system.nboptionnal > 0 && race.system.optionnalabilities.length > 0) {
this.manageOptionnalAbilities(race);
} else {
if ( race.data.selectablestats ) {
if ( race.system.selectablestats ) {
this.manageSelectableStats(race);
} else if ( race.data.perksgained) {
} else if ( race.system.perksgained) {
this.manageRacePerks(race);
} else {
this.showRoles()
@ -107,7 +126,7 @@ export class PegasusActorCreate {
this.actor.applyRole( role );
this.currentRole = role;
this.nbRoleStat = 2;
this.roleStats = duplicate(role.data.statincreasechoice)
this.roleStats = duplicate(role.system.statincreasechoice)
this.showRoleStartSpec( );
}
@ -136,7 +155,7 @@ export class PegasusActorCreate {
}
this.nbRoleStat--;
if ( this.nbRoleStat == 0 || this.roleStats.length == 0) {
this.roleSpec = duplicate(this.currentRole.data.specincrease)
this.roleSpec = this.getSpecFromRoleStat( this.currentRole )
this.nbDT2 = 1;
this.nbDT1 = 2;
this.showRoleSpecialisations()
@ -157,7 +176,7 @@ export class PegasusActorCreate {
}
this.roleSpec = this.roleSpec.filter( item => item._id != itemId);//Remove selected spec
if ( this.nbDT1 == 0 || this.roleSpec.length == 0) {
this.rolePerks = duplicate(this.currentRole.data.perks)
this.rolePerks = this.getPerksFromRole( this.currentRole ) // duplicate(this.currentRole.data.perks)
this.nbPerks = 2;
this.showRolePerks()
} else {
@ -293,7 +312,7 @@ export class PegasusActorCreate {
if ( this.raceOptionnalAbilities.nboptionnal == 0) {
if ( this.raceSelectableStats ) {
this.manageSelectableStats(this.currentrace);
} else if ( this.currentRace.data.perksgained) {
} else if ( this.currentRace.system.perksgained) {
this.manageRacePerks(this.currentRace);
} else {
this.showRoles()
@ -319,7 +338,9 @@ export class PegasusActorCreate {
/* ------------------------------- ------------- */
async showRoleStartSpec() {
if ( !this.roleSpecStart) {
this.roleSpecStart = duplicate(this.currentRole.data.specialisationsplus1)
this.roleSpecStart = this.specs.filter(spec => spec.system.statistic.toUpperCase() == this.currentRole.system.statincrease1.toUpperCase() || spec.system.statistic.toUpperCase() == this.currentRole.system.statincrease2.toUpperCase() )
console.log("SPEC FOUND", this.roleSpecStart)
//this.roleSpecStart = duplicate(this.currentRole.data.specialisationsplus1)
this.nbRoleSpecStart = 2;
}
let formData = this.createFormData("select-role-start-spec")
@ -334,7 +355,7 @@ export class PegasusActorCreate {
formData.rolestats = []
for(let stat of this.roleStats) {
if (stat.flag) {
formData.rolestats.push( duplicate(this.actor.data.data.statistics[stat.name.toLowerCase()]) )
formData.rolestats.push( duplicate(this.actor.system.statistics[stat.name.toLowerCase()]) )
}
}
//console.log("STAT", this.roleStats, formData)

View File

@ -124,7 +124,7 @@ export class PegasusVehicleSheet extends ActorSheet {
this.actor.createEmbeddedDocuments('Item', [{ name: "NewItem", type: dataType }], { renderSheet: true })
})
html.find('.current-speed-change').click(ev => {
html.find('.current-speed-change').change(ev => {
let speed = ev.currentTarget.value
this.actor.manageCurrentSpeed(speed)
})
@ -227,6 +227,12 @@ export class PegasusVehicleSheet extends ActorSheet {
html.find('.damage-resistance').click((event) => {
this.actor.rollVehicleDamageResistance( );
});
html.find('.currentlevel-change').change((event) => {
const statKey = $(event.currentTarget).data("stat-key");
if ( statKey == "man") {
this.actor.setTurningArc(event.currentTarget.value)
}
})
html.find('.roll-stat').click((event) => {
const statId = $(event.currentTarget).data("stat-key");

File diff suppressed because one or more lines are too long

View File

@ -253,7 +253,7 @@
],
"title": "Pegasus RPG",
"url": "https://www.uberwald.me/data/files/fvtt-pegasus-rpg",
"version": "10.0.18",
"download": "https://www.uberwald.me/gitea/uberwald/fvtt-pegasus-rpg/archive/fvtt-pegasus-rpg-v10.0.18.zip",
"version": "10.0.19",
"download": "https://www.uberwald.me/gitea/uberwald/fvtt-pegasus-rpg/archive/fvtt-pegasus-rpg-v10.0.19.zip",
"background": "systems/fvtt-pegasus-rpg/images/ui/pegasus_welcome_page.webp"
}

View File

@ -411,6 +411,7 @@
"perksall": false,
"perksnumber": 0,
"perks": [],
"perksrole": "",
"statistics": ""
},
"role": {
@ -423,6 +424,7 @@
"specialability": [],
"specincrease": [],
"perks": [],
"perksrole": "",
"description": ""
},
"ability": {

View File

@ -21,12 +21,12 @@
<select class="competence-base flexrow" type="text" name="system.category" value="{{data.category}}" data-dtype="String">
{{#select data.category}}
<option value="general">General</option>
<option value="agitator">Agitator</option>,
<option value="defender">Defender</option>,
<option value="enhancer">Enhancer</option>,
<option value="scrapper">Scrapper</option>,
<option value="ranged">Ranged</option>,
<option value="tactician">Tactician</option>,
<option value="agitator">Agitator</option>
<option value="defender">Defender</option>
<option value="enhancer">Enhancer</option>
<option value="scrapper">Scrapper</option>
<option value="ranged">Ranged</option>
<option value="tactician">Tactician</option>
{{/select}}
</select>
</li>

View File

@ -30,27 +30,7 @@
{{/select}}
</select>
</li>
<li class="flexrow">
<label class="generic-label">Starting Specialisation at +1 DT (Two to be selected)</label>
</li>
<ul class="ul-level1">
<li class="flexrow">
<label class="generic-label">Starting Specialisations : </label>
</li>
<li class="flexrow">
<input type="text" class="padd-right" name="system.messagespecplus1" value="{{data.messagespecplus1}}" data-dtype="String"/>
</li>
<li class="flexrow"><div class="drop-spec1"><label>Drop Specialisations here !</label></div>
</li>
{{#each data.specialisationsplus1 as |spec idx|}}
<li class="flexrow">
<label name="system.specialisationsplus1[{{idx}}].name"><a class="view-subitem" data-type="specialisationsplus1" data-index="{{idx}}">{{spec.name}}</a></label>
<div class="item-controls padd-left">
<a class="item-control delete-subitem padd-left" data-type="specialisationsplus1" data-index="{{idx}}" title="Delete Spec"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ul>
<li class="flexrow">
<label class="generic-label">Role Ability</label>
</li>
@ -77,37 +57,23 @@
{{/each}}
</li>
</ul>
<li class="flexrow"><label class="generic-label">Available specialisations (Choose 1 at +2 DT, Choose 2 at +1 DT)</label>
</li>
<ul class="ul-level1">
<li class="flexrow"><div class="drop-spec2"><label>Drop Specialisations here !</label></div>
</li>
{{#each data.specincrease as |spec idx|}}
<li class="flexrow">
<label name="system.specincrease[{{idx}}].name"><a class="view-subitem" data-type="specincrease" data-index="{{idx}}">{{spec.name}}</a></label>
<div class="item-controls padd-left">
<a class="item-control delete-subitem padd-left" data-type="specincrease" data-index="{{idx}}" title="Delete Spec"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ul>
<li class="flexrow"><label class="generic-label">Role category for available perks</label>
<select class="competence-base flexrow" type="text" name="system.perksrole" value="{{data.perksrole}}" data-dtype="String">
{{#select data.perksrole}}
<option value="agitator">Agitator</option>
<option value="defender">Defender</option>
<option value="enhancer">Enhancer</option>
<option value="scrapper">Scrapper</option>
<option value="ranged">Ranged</option>
<option value="tactician">Tactician</option>
{{/select}}
</select>
</li>
<li class="flexrow"><label class="generic-label">Available perks (Choose 2)</label>
</li>
<ul class="ul-level1">
<li class="flexrow"><div class="drop-perk2"><label>Drop Perks here !</label></div>
</li>
{{#each data.perks as |perk idx|}}
<li class="flexrow">
<label name="system.perk[{{idx}}].name"><a class="view-subitem" data-type="perks" data-index="{{idx}}">{{perk.name}}</a></label>
<div class="item-controls padd-left">
<a class="item-control delete-subitem padd-left" data-type="perks" data-index="{{idx}}" title="Delete Perk"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ul>
</li>
</ul>
</div>
</section>

View File

@ -25,8 +25,8 @@
</div>
<div class="flexrow stat-text-white">
<span class="stat-label stat-margin" name="{{key}}">Current level</span>
<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 class="status-small-label color-class-common currentlevel-change" type="text" name="system.statistics.{{key}}.currentlevel"
value="{{stat.currentlevel}}" data-stat-key="{{key}}" data-dtype="Number" {{#unless @root.editScore}}disabled{{/unless}}>
{{#select stat.currentlevel}}
{{#if (eq key "ad")}}
{{{@root.optionsLevel}}}
@ -40,7 +40,7 @@
<div class="flexrow stat-text-white">
<span class="stat-label stat-margin" name="{{key}}">45° Turning Arcs</span>
<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}}>
value="{{stat.turningarc45}}" data-dtype="Number" {{#unless @root.editScore}}disabled{{/unless}} disabled>
{{#select stat.turningarc45}}
{{{@root.optionsLevel}}}
{{/select}}