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( ) { getCurrentCargoCapacity( ) {
let capacity = 0 let capacity = 0

View File

@ -21,6 +21,8 @@ export class PegasusActorCreate {
this.roles = rolesPack.map(i => i.toObject()) this.roles = rolesPack.map(i => i.toObject())
const perksPack = await PegasusUtility.loadCompendium("fvtt-pegasus-rpg.perk") const perksPack = await PegasusUtility.loadCompendium("fvtt-pegasus-rpg.perk")
this.perks = perksPack.map(i => i.toObject()) 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() this.showRaces()
} }
@ -44,6 +46,23 @@ export class PegasusActorCreate {
return formData; 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 ) { processChatEvent( event ) {
const step = $(event.currentTarget).data("step-name"); const step = $(event.currentTarget).data("step-name");
@ -54,12 +73,12 @@ export class PegasusActorCreate {
this.currentRace = race; this.currentRace = race;
this.actor.applyRace( race); this.actor.applyRace( race);
PegasusUtility.removeChatMessageId(PegasusUtility.findChatMessageId(event.currentTarget)); 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); this.manageOptionnalAbilities(race);
} else { } else {
if ( race.data.selectablestats ) { if ( race.system.selectablestats ) {
this.manageSelectableStats(race); this.manageSelectableStats(race);
} else if ( race.data.perksgained) { } else if ( race.system.perksgained) {
this.manageRacePerks(race); this.manageRacePerks(race);
} else { } else {
this.showRoles() this.showRoles()
@ -107,7 +126,7 @@ export class PegasusActorCreate {
this.actor.applyRole( role ); this.actor.applyRole( role );
this.currentRole = role; this.currentRole = role;
this.nbRoleStat = 2; this.nbRoleStat = 2;
this.roleStats = duplicate(role.data.statincreasechoice) this.roleStats = duplicate(role.system.statincreasechoice)
this.showRoleStartSpec( ); this.showRoleStartSpec( );
} }
@ -136,7 +155,7 @@ export class PegasusActorCreate {
} }
this.nbRoleStat--; this.nbRoleStat--;
if ( this.nbRoleStat == 0 || this.roleStats.length == 0) { 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.nbDT2 = 1;
this.nbDT1 = 2; this.nbDT1 = 2;
this.showRoleSpecialisations() this.showRoleSpecialisations()
@ -157,7 +176,7 @@ export class PegasusActorCreate {
} }
this.roleSpec = this.roleSpec.filter( item => item._id != itemId);//Remove selected spec this.roleSpec = this.roleSpec.filter( item => item._id != itemId);//Remove selected spec
if ( this.nbDT1 == 0 || this.roleSpec.length == 0) { 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.nbPerks = 2;
this.showRolePerks() this.showRolePerks()
} else { } else {
@ -293,7 +312,7 @@ export class PegasusActorCreate {
if ( this.raceOptionnalAbilities.nboptionnal == 0) { if ( this.raceOptionnalAbilities.nboptionnal == 0) {
if ( this.raceSelectableStats ) { if ( this.raceSelectableStats ) {
this.manageSelectableStats(this.currentrace); this.manageSelectableStats(this.currentrace);
} else if ( this.currentRace.data.perksgained) { } else if ( this.currentRace.system.perksgained) {
this.manageRacePerks(this.currentRace); this.manageRacePerks(this.currentRace);
} else { } else {
this.showRoles() this.showRoles()
@ -319,7 +338,9 @@ export class PegasusActorCreate {
/* ------------------------------- ------------- */ /* ------------------------------- ------------- */
async showRoleStartSpec() { async showRoleStartSpec() {
if ( !this.roleSpecStart) { 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; this.nbRoleSpecStart = 2;
} }
let formData = this.createFormData("select-role-start-spec") let formData = this.createFormData("select-role-start-spec")
@ -334,7 +355,7 @@ export class PegasusActorCreate {
formData.rolestats = [] formData.rolestats = []
for(let stat of this.roleStats) { for(let stat of this.roleStats) {
if (stat.flag) { 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) //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 }) 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 let speed = ev.currentTarget.value
this.actor.manageCurrentSpeed(speed) this.actor.manageCurrentSpeed(speed)
}) })
@ -227,6 +227,12 @@ export class PegasusVehicleSheet extends ActorSheet {
html.find('.damage-resistance').click((event) => { html.find('.damage-resistance').click((event) => {
this.actor.rollVehicleDamageResistance( ); 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) => { html.find('.roll-stat').click((event) => {
const statId = $(event.currentTarget).data("stat-key"); 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", "title": "Pegasus RPG",
"url": "https://www.uberwald.me/data/files/fvtt-pegasus-rpg", "url": "https://www.uberwald.me/data/files/fvtt-pegasus-rpg",
"version": "10.0.18", "version": "10.0.19",
"download": "https://www.uberwald.me/gitea/uberwald/fvtt-pegasus-rpg/archive/fvtt-pegasus-rpg-v10.0.18.zip", "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" "background": "systems/fvtt-pegasus-rpg/images/ui/pegasus_welcome_page.webp"
} }

View File

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

View File

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

View File

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

View File

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