Fix #31 - Global perl select
This commit is contained in:
@@ -191,11 +191,11 @@ export class PegasusActorCreate {
|
||||
let excludedPerks = this.actor.items.filter(it => it.type == "perk" && !it.system.upgradable)
|
||||
this.rolePerks = []
|
||||
for (let perk of this.rolePerks) {
|
||||
if ( !excludedPerks.find(it => it.name == perk.name)) {
|
||||
if (!excludedPerks.find(it => it.name == perk.name)) {
|
||||
this.rolePerks.push(perk)
|
||||
}
|
||||
}
|
||||
this.rolePerks.sort(function(a, b) { if (a.name < b.name) {return -1} else {return 1} })
|
||||
this.rolePerks.sort(function (a, b) { if (a.name < b.name) { return -1 } else { return 1 } })
|
||||
this.nbPerks--;
|
||||
if (this.nbPerks == 0 || this.rolePerks.length == 0) {
|
||||
this.nbGlobalSpec = 5
|
||||
@@ -239,12 +239,26 @@ export class PegasusActorCreate {
|
||||
this.actor.addIncPerk(perk, 1)
|
||||
this.nbGlobalPerk--;
|
||||
if (this.nbGlobalPerk == 0) {
|
||||
this.showCharacterEnd()
|
||||
this.nbGlobalStatus = 1
|
||||
this.showGlobalStatus()
|
||||
//this.showCharacterEnd()
|
||||
} else {
|
||||
this.showGlobalPerk()
|
||||
}
|
||||
}
|
||||
|
||||
if (step == 'select-global-status') {
|
||||
PegasusUtility.removeChatMessageId(PegasusUtility.findChatMessageId(event.currentTarget))
|
||||
let statusKey = $(event.currentTarget).data("status-key")
|
||||
this.actor.addStatusBonus(statusKey, 1)
|
||||
this.nbGlobalStatus--;
|
||||
if (this.nbGlobalStatus == 0) {
|
||||
this.showCharacterEnd()
|
||||
} else {
|
||||
this.showGlobalStatus()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -492,7 +506,16 @@ export class PegasusActorCreate {
|
||||
formData.perks.sort(function compare(a, b) { if (a.name < b.name) { return -1 } else { return 1 } })
|
||||
this.renderChatMessage(formData)
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async showGlobalStatus() {
|
||||
let formData = this.createFormData("select-global-status")
|
||||
formData.status = duplicate(this.actor.system.secondary)
|
||||
formData.status["nrg"] = duplicate(this.actor.system.nrg)
|
||||
this.renderChatMessage(formData)
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async showCharacterEnd() {
|
||||
await this.actor.computeNRGHealth()
|
||||
|
||||
Reference in New Issue
Block a user