Fix #160 - Add new values...
This commit is contained in:
@@ -75,7 +75,7 @@ export class PegasusActorCreate {
|
||||
if (step == "select-race") {
|
||||
let race = this.races.find(item => item._id == itemId);
|
||||
this.currentRace = race;
|
||||
this.actor.applyRace(race);
|
||||
await this.actor.applyRace(race);
|
||||
PegasusUtility.removeChatMessageId(PegasusUtility.findChatMessageId(event.currentTarget));
|
||||
if (race.system.nboptionnal > 0 && race.system.optionnalabilities.length > 0) {
|
||||
this.manageOptionnalAbilities(race);
|
||||
@@ -93,7 +93,7 @@ export class PegasusActorCreate {
|
||||
if (step == 'select-race-optionnal') {
|
||||
let ability = this.raceOptionnalAbilities.optionnalabilities.find(item => item._id == itemId);
|
||||
let update = []
|
||||
this.actor.applyAbility(ability, update);
|
||||
await this.actor.applyAbility(ability, update);
|
||||
this.actor.update(update)
|
||||
this.actor.createEmbeddedDocuments('Item', [ability]);
|
||||
PegasusUtility.removeChatMessageId(PegasusUtility.findChatMessageId(event.currentTarget));
|
||||
@@ -104,7 +104,7 @@ export class PegasusActorCreate {
|
||||
|
||||
if (step == 'select-race-stats') {
|
||||
let statKey = $(event.currentTarget).data("stat-key");
|
||||
this.actor.modStat(statKey, 1);
|
||||
await this.actor.modStat(statKey, 1);
|
||||
this.raceSelectableStats.stats[statKey].used = true;
|
||||
this.raceSelectableStats.numberstats -= 1;
|
||||
PegasusUtility.removeChatMessageId(PegasusUtility.findChatMessageId(event.currentTarget));
|
||||
@@ -114,7 +114,7 @@ export class PegasusActorCreate {
|
||||
if (step == 'select-race-perks') {
|
||||
PegasusUtility.removeChatMessageId(PegasusUtility.findChatMessageId(event.currentTarget));
|
||||
let perk = this.racePerks.find(item => item._id == itemId);
|
||||
this.actor.createEmbeddedDocuments('Item', [perk]);
|
||||
await this.actor.createEmbeddedDocuments('Item', [perk]);
|
||||
this.racePerks = this.racePerks.filter(item => item._id != itemId);
|
||||
this.nbRacePerks -= 1;
|
||||
if (this.nbRacePerks == 0 || this.racePerks.length == 0) {
|
||||
@@ -127,7 +127,7 @@ export class PegasusActorCreate {
|
||||
if (step == 'select-role') {
|
||||
let role = this.roles.find(item => item._id == itemId);
|
||||
PegasusUtility.removeChatMessageId(PegasusUtility.findChatMessageId(event.currentTarget));
|
||||
this.actor.applyRole(role);
|
||||
await this.actor.applyRole(role);
|
||||
this.currentRole = role;
|
||||
this.nbRoleStat = 2;
|
||||
this.roleStats = duplicate(role.system.statincreasechoice)
|
||||
@@ -137,7 +137,7 @@ export class PegasusActorCreate {
|
||||
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);
|
||||
await this.actor.addIncSpec(spec, 1);
|
||||
this.nbRoleSpecStart--;
|
||||
this.roleSpecStart = this.roleSpecStart.filter(item => item._id != itemId);//Remove selected spec
|
||||
if (this.nbRoleSpecStart == 0) {
|
||||
@@ -150,7 +150,7 @@ export class PegasusActorCreate {
|
||||
if (step == 'select-role-stat') {
|
||||
PegasusUtility.removeChatMessageId(PegasusUtility.findChatMessageId(event.currentTarget));
|
||||
let statKey = $(event.currentTarget).data("stat-key");
|
||||
this.actor.valueStat(statKey, 1);
|
||||
await this.actor.valueStat(statKey, 1);
|
||||
|
||||
for (let stat of this.roleStats) {
|
||||
if (stat.name.toLowerCase() == statKey.toLowerCase()) {
|
||||
@@ -172,15 +172,15 @@ export class PegasusActorCreate {
|
||||
PegasusUtility.removeChatMessageId(PegasusUtility.findChatMessageId(event.currentTarget));
|
||||
let spec = this.roleSpec.find(item => item._id == itemId);
|
||||
if (this.nbDT2 > 0) {
|
||||
this.actor.addIncSpec(spec, 2)
|
||||
await this.actor.addIncSpec(spec, 2)
|
||||
this.nbDT2--;
|
||||
} else {
|
||||
this.actor.addIncSpec(spec, 1)
|
||||
await this.actor.addIncSpec(spec, 1)
|
||||
this.nbDT1--;
|
||||
}
|
||||
this.roleSpec = this.roleSpec.filter(item => item._id != itemId);//Remove selected spec
|
||||
if (this.nbDT1 == 0 || this.roleSpec.length == 0) {
|
||||
this.rolePerks = this.getPerksFromRole(this.currentRole) // duplicate(this.currentRole.data.perks)
|
||||
this.rolePerks = this.getPerksFromRole(this.currentRole)
|
||||
this.nbPerks = 2;
|
||||
this.showRolePerks()
|
||||
} else {
|
||||
@@ -191,7 +191,7 @@ export class PegasusActorCreate {
|
||||
if (step == 'select-role-perk') {
|
||||
PegasusUtility.removeChatMessageId(PegasusUtility.findChatMessageId(event.currentTarget));
|
||||
let perk = this.rolePerks.find(item => item._id == itemId);
|
||||
this.actor.addIncPerk(perk, 1)
|
||||
await this.actor.addIncPerk(perk, 1)
|
||||
let excludedPerks = this.actor.items.filter(it => it.type == "perk" && !it.system.upgradable)
|
||||
this.rolePerks = []
|
||||
for (let perk of this.rolePerks) {
|
||||
@@ -216,7 +216,7 @@ export class PegasusActorCreate {
|
||||
if (step == 'select-global-spec') {
|
||||
PegasusUtility.removeChatMessageId(PegasusUtility.findChatMessageId(event.currentTarget));
|
||||
let spec = this.specs.find(item => item._id == itemId);
|
||||
this.actor.addIncSpec(spec, 1)
|
||||
await this.actor.addIncSpec(spec, 1)
|
||||
this.nbGlobalSpec--;
|
||||
if (this.nbGlobalSpec == 0) {
|
||||
this.nbGlobalStat = 5
|
||||
@@ -233,7 +233,7 @@ export class PegasusActorCreate {
|
||||
if (step == 'select-global-stat') {
|
||||
PegasusUtility.removeChatMessageId(PegasusUtility.findChatMessageId(event.currentTarget))
|
||||
let statKey = $(event.currentTarget).data("stat-key")
|
||||
this.actor.valueStat(statKey, 1)
|
||||
await this.actor.valueStat(statKey, 1)
|
||||
this.nbGlobalStat--
|
||||
if (this.nbGlobalStat == 0) {
|
||||
this.nbGlobalPerk = 1
|
||||
@@ -250,13 +250,14 @@ export class PegasusActorCreate {
|
||||
if (step == 'select-global-perk') {
|
||||
PegasusUtility.removeChatMessageId(PegasusUtility.findChatMessageId(event.currentTarget))
|
||||
let perk = this.perks.find(item => item._id == itemId);
|
||||
this.actor.addIncPerk(perk, 1)
|
||||
await this.actor.addIncPerk(perk, 1)
|
||||
this.nbGlobalPerk--;
|
||||
if (this.nbGlobalPerk == 0) {
|
||||
this.nbGlobalStatus = 1
|
||||
if (this.forceVirtue) {
|
||||
this.showVirtue()
|
||||
} else {
|
||||
this.statusCount = {}
|
||||
this.showGlobalStatus()
|
||||
}
|
||||
} else {
|
||||
@@ -267,7 +268,8 @@ export class PegasusActorCreate {
|
||||
if (step == 'select-global-status') {
|
||||
PegasusUtility.removeChatMessageId(PegasusUtility.findChatMessageId(event.currentTarget))
|
||||
let statusKey = $(event.currentTarget).data("status-key")
|
||||
this.actor.addStatusBonus(statusKey, 1)
|
||||
await this.actor.addStatusBonus(statusKey, 1)
|
||||
this.statusCount[statusKey] = (this.statusCount[statusKey]) ? this.statusCount[statusKey]+1 : 1;
|
||||
this.nbGlobalStatus--;
|
||||
if (this.nbGlobalStatus == 0) {
|
||||
this.nbBonusSelection = 1
|
||||
@@ -286,48 +288,63 @@ export class PegasusActorCreate {
|
||||
let nextStep = $(event.currentTarget).data("bonus-key")
|
||||
this.forceVirtue = true
|
||||
if (nextStep == "bonus-statistic") {
|
||||
this.actor.setBonusInformation("Stats Increased")
|
||||
this.nbGlobalStat = 2
|
||||
this.showGlobalStat()
|
||||
}
|
||||
if (nextStep == "bonus-specialisation") {
|
||||
this.actor.setBonusInformation("Specialisations Increased")
|
||||
this.nbGlobalSpec = 4
|
||||
this.showGlobalSpec()
|
||||
}
|
||||
if (nextStep == "bonus-perk") {
|
||||
this.actor.setBonusInformation("Perks - Check Effects & Perk Details.")
|
||||
this.nbGlobalPerk = 2
|
||||
this.showGlobalPerk()
|
||||
}
|
||||
if (nextStep == "bonus-status") {
|
||||
this.actor.setBonusInformation("Status Modifiers")
|
||||
this.nbGlobalStatus = 5
|
||||
this.statusCount = {}
|
||||
this.showGlobalStatus()
|
||||
}
|
||||
if (nextStep == "bonus-roleability") {
|
||||
this.actor.setBonusInformation("Role Ability Level Increased")
|
||||
this.actor.increaseRoleAbility()
|
||||
this.showVirtue()
|
||||
}
|
||||
if (nextStep == "bonus-ppp5") {
|
||||
this.actor.setBonusInformation("Power Purchase Points")
|
||||
this.actor.addPPP(5)
|
||||
this.showVirtue()
|
||||
}
|
||||
if (nextStep == "bonus-wealthy") {
|
||||
this.actor.setBonusInformation("x2 Starting Funds")
|
||||
ChatMessage.create({ content: "NOT AUTOMATED! Your character starts with x2 Starting Funds" })
|
||||
this.showVirtue()
|
||||
}
|
||||
if (nextStep == "bonus-heirloom") {
|
||||
this.actor.setBonusInformation("Family Heirloom (Level 1 Bonus Dice Item)")
|
||||
ChatMessage.create({ content: "NOT AUTOMATED! Your character starts with an item of choice (GM Must approve). This item provides a Level 1 Bonus Dice to a Stat of choice" })
|
||||
this.showVirtue()
|
||||
}
|
||||
if (nextStep == "bonus-vehicle") {
|
||||
this.actor.setBonusInformation("Vehicle")
|
||||
ChatMessage.create({ content: "NOT AUTOMATED! Your character starts with a Vehicle of Choice (GM Must approve)." })
|
||||
this.showVirtue()
|
||||
}
|
||||
if (nextStep == "bonus-mount") {
|
||||
this.actor.setBonusInformation("Mount")
|
||||
ChatMessage.create({ content: "NOT AUTOMATED! Your character starts with a Mount of Choice (GM Must approve)." })
|
||||
this.showVirtue()
|
||||
}
|
||||
if (nextStep == "bonus-sidekick") {
|
||||
this.actor.setBonusInformation("Sidekick")
|
||||
ChatMessage.create({ content: "NOT AUTOMATED! Your character starts with a Sidekick of Choice (GM Must approve)." })
|
||||
this.showVirtue()
|
||||
}
|
||||
if (nextStep == "bonus-ambidextrious") {
|
||||
this.actor.setBonusInformation("Ambidextrious")
|
||||
this.actor.setHandInformation("Ambidextrious")
|
||||
this.showVirtue()
|
||||
}
|
||||
@@ -411,9 +428,9 @@ export class PegasusActorCreate {
|
||||
manageSelectableStats(race) {
|
||||
this.raceSelectableStats = {
|
||||
"race": race,
|
||||
"statsonlyonce": race.data.statsonlyonce,
|
||||
"numberstats": race.data.numberstats,
|
||||
"stats": duplicate(this.actor.data.data.statistics)
|
||||
"statsonlyonce": race.system.statsonlyonce,
|
||||
"numberstats": race.system.numberstats,
|
||||
"stats": duplicate(this.actor.system.statistics)
|
||||
}
|
||||
this.processSelectableStats()
|
||||
}
|
||||
@@ -433,17 +450,17 @@ export class PegasusActorCreate {
|
||||
|
||||
/* --------------- -------------------- --------- */
|
||||
manageRacePerks(race) {
|
||||
if (!this.currentRace.data.perksgained) {
|
||||
if (!this.currentRace.system.perksgained) {
|
||||
this.showRoles()
|
||||
return;
|
||||
}
|
||||
if (!this.racePerks) { // First init
|
||||
if (this.currentRace.data.perksall) {
|
||||
if (this.currentRace.system.perksall) {
|
||||
this.racePerks = duplicate(this.perks)
|
||||
} else {
|
||||
this.racePerks = duplicate(this.currentRace.data.perks)
|
||||
this.racePerks = duplicate(this.currentRace.system.perks)
|
||||
}
|
||||
this.nbRacePerks = this.currentRace.data.perksnumber;
|
||||
this.nbRacePerks = this.currentRace.system.perksnumber;
|
||||
}
|
||||
let formData = this.createFormData("select-race-perks")
|
||||
formData.raceperks = this.racePerks;
|
||||
@@ -474,8 +491,8 @@ export class PegasusActorCreate {
|
||||
/* --------------- ----------------------------- */
|
||||
manageOptionnalAbilities(race) {
|
||||
this.raceOptionnalAbilities = {
|
||||
"nboptionnal": race.data.nboptionnal,
|
||||
"optionnalabilities": duplicate(race.data.optionnalabilities),
|
||||
"nboptionnal": race.system.nboptionnal,
|
||||
"optionnalabilities": duplicate(race.system.optionnalabilities),
|
||||
}
|
||||
this.processOptionnalAbilitiesStep()
|
||||
}
|
||||
@@ -513,8 +530,6 @@ export class PegasusActorCreate {
|
||||
async showRoleStartSpec() {
|
||||
if (!this.roleSpecStart) {
|
||||
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")
|
||||
@@ -589,7 +604,7 @@ export class PegasusActorCreate {
|
||||
formData.stats = {}
|
||||
for (let key in this.actor.system.statistics) {
|
||||
let stat = this.actor.system.statistics[key]
|
||||
if (stat.level < 5) {
|
||||
if (stat.value < 5) {
|
||||
formData.stats[key] = duplicate(stat)
|
||||
}
|
||||
}
|
||||
@@ -620,8 +635,18 @@ export class PegasusActorCreate {
|
||||
/* -------------------------------------------- */
|
||||
async showGlobalStatus() {
|
||||
let formData = this.createFormData("select-global-status")
|
||||
formData.status = duplicate(this.actor.system.secondary)
|
||||
formData.status["nrg"] = duplicate(this.actor.system.nrg)
|
||||
formData.status = {}
|
||||
for(let statusKey in this.actor.system.secondary) {
|
||||
if ( this.statusCount[statusKey] == undefined) {
|
||||
this.statusCount[statusKey] = 0
|
||||
}
|
||||
if ( this.statusCount[statusKey] < 3) {
|
||||
formData.status[statusKey] = duplicate(this.actor.system.secondary[statusKey])
|
||||
}
|
||||
}
|
||||
if ( this.statusCount["nrg"] < 3) {
|
||||
formData.status["nrg"] = duplicate(this.actor.system.nrg)
|
||||
}
|
||||
this.renderChatMessage(formData)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user