Compare commits
8 Commits
fvtt-pegas
...
fvtt-pegas
| Author | SHA1 | Date | |
|---|---|---|---|
| 60856df818 | |||
| 45e856a30b | |||
| dad117fc17 | |||
| cc0dc9e43c | |||
| d484064fdd | |||
| 43d4acaea4 | |||
| 50f4339454 | |||
| 109ce4f192 |
@@ -280,6 +280,26 @@ export class PegasusActor extends Actor {
|
|||||||
ChatMessage.create({ content: `Tactician Bonus Dice has been removed to ${this.name}`, whisper: ChatMessage.getWhisperRecipients('GM') })
|
ChatMessage.create({ content: `Tactician Bonus Dice has been removed to ${this.name}`, whisper: ChatMessage.getWhisperRecipients('GM') })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
getStatus(statusKey) {
|
||||||
|
if (statusKey == "nrg") {
|
||||||
|
return duplicate(this.system.nrg)
|
||||||
|
}
|
||||||
|
return duplicate(this.system.secondary[statusKey])
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
async addStatusBonus(statusKey, value) {
|
||||||
|
let status = this.getStatus(statusKey)
|
||||||
|
let effect = duplicate(__bonusEffect)
|
||||||
|
effect.name = `${status.label} Creation Bonus`
|
||||||
|
effect.system.affectstatus = true
|
||||||
|
effect.system.affectedstatus = statusKey
|
||||||
|
effect.system.effectlevel = value
|
||||||
|
effect.system.bonusdice = false
|
||||||
|
effect.system.locked = true
|
||||||
|
await this.createEmbeddedDocuments('Item', [effect])
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
isEnhancer() {
|
isEnhancer() {
|
||||||
@@ -460,6 +480,29 @@ export class PegasusActor extends Actor {
|
|||||||
await this.updateEmbeddedDocuments('Item', [update]) // Updates one EmbeddedEntity
|
await this.updateEmbeddedDocuments('Item', [update]) // Updates one EmbeddedEntity
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
setHandInformation( info) {
|
||||||
|
this.update( {'system.biodata.preferredhand': info} )
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
increaseRoleAbility() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
addCDP( value) {
|
||||||
|
let cdp = this.system.biodata.cdp
|
||||||
|
cdp += value
|
||||||
|
this.update( {'system.biodata.cdp': cdp})
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
addPPP(value) {
|
||||||
|
let ppp = duplicate(this.system.ppp)
|
||||||
|
ppp.availablePPP += value
|
||||||
|
this.update({ 'system.ppp': ppp })
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
updatePPP() {
|
updatePPP() {
|
||||||
@@ -1536,6 +1579,19 @@ export class PegasusActor extends Actor {
|
|||||||
await this.update({ [`data.statistics.${key}`]: stat })
|
await this.update({ [`data.statistics.${key}`]: stat })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
async modStatus(key, inc = 1) {
|
||||||
|
if (key == "nrg") {
|
||||||
|
let nrg = duplicate(this.system.nrg)
|
||||||
|
nrg.mod += parseInt(inc)
|
||||||
|
await this.update({ [`data.nrg`]: nrg })
|
||||||
|
} else {
|
||||||
|
let status = duplicate(this.system.secondary[key])
|
||||||
|
status.bonus += parseInt(inc)
|
||||||
|
await this.update({ [`data.secondary.${key}`]: status })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async addIncSpec(spec, inc = 1) {
|
async addIncSpec(spec, inc = 1) {
|
||||||
console.log("Using spec : ", spec, inc)
|
console.log("Using spec : ", spec, inc)
|
||||||
@@ -1543,13 +1599,27 @@ export class PegasusActor extends Actor {
|
|||||||
if (specExist) {
|
if (specExist) {
|
||||||
specExist = duplicate(specExist)
|
specExist = duplicate(specExist)
|
||||||
specExist.system.level += inc;
|
specExist.system.level += inc;
|
||||||
let update = { _id: specExist._id, "data.level": specExist.system.level };
|
let update = { _id: specExist._id, "system.level": specExist.system.level };
|
||||||
await this.updateEmbeddedDocuments('Item', [update]);
|
await this.updateEmbeddedDocuments('Item', [update]);
|
||||||
} else {
|
} else {
|
||||||
spec.system.level += inc;
|
spec.system.level = inc;
|
||||||
await this.createEmbeddedDocuments('Item', [spec]);
|
await this.createEmbeddedDocuments('Item', [spec]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
async addIncPerk(perk, inc = 1) {
|
||||||
|
console.log("Using perk : ", perk, inc)
|
||||||
|
let perkExist = this.items.find(item => item.type == 'perk' && item.name.toLowerCase() == perk.name.toLowerCase())
|
||||||
|
if (perkExist) {
|
||||||
|
perkExist = duplicate(perkExist)
|
||||||
|
perkExist.system.level += inc;
|
||||||
|
let update = { _id: perkExist._id, "system.level": perkExist.system.level };
|
||||||
|
await this.updateEmbeddedDocuments('Item', [update]);
|
||||||
|
} else {
|
||||||
|
perk.system.level = inc;
|
||||||
|
await this.createEmbeddedDocuments('Item', [perk]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async incDecQuantity(objetId, incDec = 0) {
|
async incDecQuantity(objetId, incDec = 0) {
|
||||||
|
|||||||
@@ -23,6 +23,10 @@ export class PegasusActorCreate {
|
|||||||
this.perks = perksPack.map(i => i.toObject())
|
this.perks = perksPack.map(i => i.toObject())
|
||||||
const specPack = await PegasusUtility.loadCompendium("fvtt-pegasus-rpg.specialisations")
|
const specPack = await PegasusUtility.loadCompendium("fvtt-pegasus-rpg.specialisations")
|
||||||
this.specs = specPack.map(i => i.toObject())
|
this.specs = specPack.map(i => i.toObject())
|
||||||
|
const virtuePack = await PegasusUtility.loadCompendium("fvtt-pegasus-rpg.virtues")
|
||||||
|
this.virtues = virtuePack.map(i => i.toObject())
|
||||||
|
const vicePack = await PegasusUtility.loadCompendium("fvtt-pegasus-rpg.vices")
|
||||||
|
this.vices = vicePack.map(i => i.toObject())
|
||||||
|
|
||||||
this.showRaces()
|
this.showRaces()
|
||||||
}
|
}
|
||||||
@@ -64,7 +68,7 @@ export class PegasusActorCreate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
processChatEvent( event ) {
|
async processChatEvent(event) {
|
||||||
const step = $(event.currentTarget).data("step-name");
|
const step = $(event.currentTarget).data("step-name");
|
||||||
const itemId = $(event.currentTarget).data("item-id");
|
const itemId = $(event.currentTarget).data("item-id");
|
||||||
|
|
||||||
@@ -187,15 +191,181 @@ export class PegasusActorCreate {
|
|||||||
if (step == 'select-role-perk') {
|
if (step == 'select-role-perk') {
|
||||||
PegasusUtility.removeChatMessageId(PegasusUtility.findChatMessageId(event.currentTarget));
|
PegasusUtility.removeChatMessageId(PegasusUtility.findChatMessageId(event.currentTarget));
|
||||||
let perk = this.rolePerks.find(item => item._id == itemId);
|
let perk = this.rolePerks.find(item => item._id == itemId);
|
||||||
this.actor.addItemWithoutDuplicate(perk)
|
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) {
|
||||||
|
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.nbPerks--;
|
this.nbPerks--;
|
||||||
this.rolePerks = this.rolePerks.filter( item => item._id != itemId);//Remove selected perk
|
|
||||||
if (this.nbPerks == 0 || this.rolePerks.length == 0) {
|
if (this.nbPerks == 0 || this.rolePerks.length == 0) {
|
||||||
this.showCharacterEnd()
|
this.nbGlobalSpec = 5
|
||||||
|
if (this.forceVirtue) {
|
||||||
|
this.showVirtue()
|
||||||
|
} else {
|
||||||
|
this.showGlobalSpec()
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.showRolePerks()
|
this.showRolePerks()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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)
|
||||||
|
this.nbGlobalSpec--;
|
||||||
|
if (this.nbGlobalSpec == 0) {
|
||||||
|
this.nbGlobalStat = 5
|
||||||
|
if (this.forceVirtue) {
|
||||||
|
this.showVirtue()
|
||||||
|
} else {
|
||||||
|
this.showGlobalStat()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.showGlobalSpec()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (step == 'select-global-stat') {
|
||||||
|
PegasusUtility.removeChatMessageId(PegasusUtility.findChatMessageId(event.currentTarget))
|
||||||
|
let statKey = $(event.currentTarget).data("stat-key")
|
||||||
|
this.actor.valueStat(statKey, 1)
|
||||||
|
this.nbGlobalStat--
|
||||||
|
if (this.nbGlobalStat == 0) {
|
||||||
|
this.nbGlobalPerk = 1
|
||||||
|
if (this.forceVirtue) {
|
||||||
|
this.showVirtue()
|
||||||
|
} else {
|
||||||
|
this.showGlobalPerk()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.showGlobalStat()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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)
|
||||||
|
this.nbGlobalPerk--;
|
||||||
|
if (this.nbGlobalPerk == 0) {
|
||||||
|
this.nbGlobalStatus = 1
|
||||||
|
if (this.forceVirtue) {
|
||||||
|
this.showVirtue()
|
||||||
|
} else {
|
||||||
|
this.showGlobalStatus()
|
||||||
|
}
|
||||||
|
} 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.nbBonusSelection = 1
|
||||||
|
if (this.forceVirtue) {
|
||||||
|
this.showVirtue()
|
||||||
|
} else {
|
||||||
|
this.showBonusSelection()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.showGlobalStatus()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (step == 'select-bonus-selection') {
|
||||||
|
PegasusUtility.removeChatMessageId(PegasusUtility.findChatMessageId(event.currentTarget))
|
||||||
|
let nextStep = $(event.currentTarget).data("bonus-key")
|
||||||
|
this.forceVirtue = true
|
||||||
|
if (nextStep == "bonus-statistic") {
|
||||||
|
this.nbGlobalStat = 2
|
||||||
|
this.showGlobalStat()
|
||||||
|
}
|
||||||
|
if (nextStep == "bonus-specialisation") {
|
||||||
|
this.nbGlobalSpec = 4
|
||||||
|
this.showGlobalSpec()
|
||||||
|
}
|
||||||
|
if (nextStep == "bonus-perk") {
|
||||||
|
this.nbGlobalPerk = 2
|
||||||
|
this.showGlobalPerk()
|
||||||
|
}
|
||||||
|
if (nextStep == "bonus-status") {
|
||||||
|
this.nbGlobalStatus = 5
|
||||||
|
this.showGlobalStatus()
|
||||||
|
}
|
||||||
|
if (nextStep == "bonus-roleability") {
|
||||||
|
this.actor.increaseRoleAbility()
|
||||||
|
}
|
||||||
|
if (nextStep == "bonus-ppp5") {
|
||||||
|
this.actor.addPPP(5)
|
||||||
|
}
|
||||||
|
if (nextStep == "bonus-wealthy") {
|
||||||
|
ChatMessage.create({ content: "NOT AUTOMATED! Your character starts with x2 Starting Funds" })
|
||||||
|
this.showVirtue()
|
||||||
|
}
|
||||||
|
if (nextStep == "bonus-heirloom") {
|
||||||
|
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") {
|
||||||
|
ChatMessage.create({ content: "NOT AUTOMATED! Your character starts with a Vehicle of Choice (GM Must approve)." })
|
||||||
|
this.showVirtue()
|
||||||
|
}
|
||||||
|
if (nextStep == "bonus-mount") {
|
||||||
|
ChatMessage.create({ content: "NOT AUTOMATED! Your character starts with a Mount of Choice (GM Must approve)." })
|
||||||
|
this.showVirtue()
|
||||||
|
}
|
||||||
|
if (nextStep == "bonus-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.setHandInformation("Ambidextrious")
|
||||||
|
this.showVirtue()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (step == 'select-global-virtue') {
|
||||||
|
PegasusUtility.removeChatMessageId(PegasusUtility.findChatMessageId(event.currentTarget));
|
||||||
|
let virtue = this.virtues.find(item => item._id == itemId);
|
||||||
|
await this.actor.createEmbeddedDocuments('Item', [virtue])
|
||||||
|
this.showVice()
|
||||||
|
}
|
||||||
|
|
||||||
|
if (step == 'select-global-vice') {
|
||||||
|
PegasusUtility.removeChatMessageId(PegasusUtility.findChatMessageId(event.currentTarget));
|
||||||
|
let vice = this.vices.find(item => item._id == itemId);
|
||||||
|
await this.actor.createEmbeddedDocuments('Item', [vice]);
|
||||||
|
if(this.forceEnd) {
|
||||||
|
this.showCharacterEnd()
|
||||||
|
} else {
|
||||||
|
this.showViceQuestion()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (step == "select-vice-question") {
|
||||||
|
PegasusUtility.removeChatMessageId(PegasusUtility.findChatMessageId(event.currentTarget))
|
||||||
|
let nextStep = $(event.currentTarget).data("question-key")
|
||||||
|
this.forceEnd = true
|
||||||
|
if (nextStep == "vice-next-step") {
|
||||||
|
this.showCharacterEnd()
|
||||||
|
}
|
||||||
|
if (nextStep == "vice-5-cdp") {
|
||||||
|
this.actor.addCDP(5)
|
||||||
|
this.showVice()
|
||||||
|
}
|
||||||
|
if (nextStep == "vice-vertue") {
|
||||||
|
this.showVirtue()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@@ -228,6 +398,9 @@ export class PegasusActorCreate {
|
|||||||
if (step == 'select-role-perk') {
|
if (step == 'select-role-perk') {
|
||||||
itemData = this.rolePerks.find(item => item._id == itemId);
|
itemData = this.rolePerks.find(item => item._id == itemId);
|
||||||
}
|
}
|
||||||
|
if (step == 'select-global-spec') {
|
||||||
|
itemData = this.specs.find(item => item._id == itemId);
|
||||||
|
}
|
||||||
if (itemData) {
|
if (itemData) {
|
||||||
let item = await Item.create(itemData, { temporary: true });
|
let item = await Item.create(itemData, { temporary: true });
|
||||||
new PegasusItemSheet(item).render(true);
|
new PegasusItemSheet(item).render(true);
|
||||||
@@ -339,12 +512,13 @@ export class PegasusActorCreate {
|
|||||||
async showRoleStartSpec() {
|
async showRoleStartSpec() {
|
||||||
if (!this.roleSpecStart) {
|
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())
|
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)
|
//console.log("SPEC FOUND", this.roleSpecStart)
|
||||||
//this.roleSpecStart = duplicate(this.currentRole.data.specialisationsplus1)
|
//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")
|
||||||
formData.rolestartspec = this.roleSpecStart
|
formData.rolestartspec = this.roleSpecStart
|
||||||
|
formData.rolestartspec.sort(function compare(a, b) { if (a.name < b.name) { return -1 } else { return 1 } })
|
||||||
formData.nbrolespecstart = this.nbRoleSpecStart;
|
formData.nbrolespecstart = this.nbRoleSpecStart;
|
||||||
this.renderChatMessage(formData)
|
this.renderChatMessage(formData)
|
||||||
}
|
}
|
||||||
@@ -366,6 +540,7 @@ export class PegasusActorCreate {
|
|||||||
async showRoleSpecialisations() {
|
async showRoleSpecialisations() {
|
||||||
let formData = this.createFormData("select-role-spec")
|
let formData = this.createFormData("select-role-spec")
|
||||||
formData.rolespec = duplicate(this.roleSpec)
|
formData.rolespec = duplicate(this.roleSpec)
|
||||||
|
formData.rolespec.sort(function compare(a, b) { if (a.name < b.name) { return -1 } else { return 1 } })
|
||||||
formData.dt = 1
|
formData.dt = 1
|
||||||
if (this.nbDT2 > 0) {
|
if (this.nbDT2 > 0) {
|
||||||
formData.dt = 2
|
formData.dt = 2
|
||||||
@@ -373,14 +548,159 @@ export class PegasusActorCreate {
|
|||||||
this.renderChatMessage(formData)
|
this.renderChatMessage(formData)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async showRolePerks() {
|
async showRolePerks() {
|
||||||
let formData = this.createFormData("select-role-perk")
|
let formData = this.createFormData("select-role-perk")
|
||||||
formData.roleperks = duplicate(this.rolePerks)
|
formData.roleperks = duplicate(this.rolePerks)
|
||||||
|
formData.roleperks.sort(function compare(a, b) { if (a.name < b.name) { return -1 } else { return 1 } })
|
||||||
formData.nbperks = this.nbPerks
|
formData.nbperks = this.nbPerks
|
||||||
this.renderChatMessage(formData)
|
this.renderChatMessage(formData)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
async showGlobalSpec() {
|
||||||
|
let formData = this.createFormData("select-global-spec")
|
||||||
|
let excludedSpecs = this.actor.items.filter(it => it.type == "specialisation" && it.system.level >= 4)
|
||||||
|
formData.specs = []
|
||||||
|
for (let spec of this.specs) {
|
||||||
|
let isOK = true
|
||||||
|
for (let excluded of excludedSpecs) {
|
||||||
|
if (excluded.name == spec.name) {
|
||||||
|
isOK = false
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isOK) {
|
||||||
|
formData.specs.push(spec)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
formData.specs.sort(function compare(a, b) { if (a.name < b.name) { return -1 } else { return 1 } })
|
||||||
|
this.renderChatMessage(formData)
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
async showGlobalStat() {
|
||||||
|
let formData = this.createFormData("select-global-stat")
|
||||||
|
formData.stats = {}
|
||||||
|
for (let key in this.actor.system.statistics) {
|
||||||
|
let stat = this.actor.system.statistics[key]
|
||||||
|
if (stat.level < 5) {
|
||||||
|
formData.stats[key] = duplicate(stat)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.renderChatMessage(formData)
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
async showGlobalPerk() {
|
||||||
|
let formData = this.createFormData("select-global-perk")
|
||||||
|
let excludedPerks = this.actor.items.filter(it => it.type == "perk" && !it.system.upgradable)
|
||||||
|
formData.perks = []
|
||||||
|
for (let perk of this.perks) {
|
||||||
|
let isOK = true
|
||||||
|
for (let excluded of excludedPerks) {
|
||||||
|
if (excluded.name == perk.name) {
|
||||||
|
isOK = false
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isOK) {
|
||||||
|
formData.perks.push(perk)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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 showBonusSelection() {
|
||||||
|
let formData = this.createFormData("select-bonus-selection")
|
||||||
|
formData.bonuses = {
|
||||||
|
"bonus-statistic": { name: "Increase 2 Stats" },
|
||||||
|
"bonus-specialisation": { name: "Increase 4 Specialisations" },
|
||||||
|
"bonus-perk": { name: "Choose/Upgrade 2 Perks" },
|
||||||
|
"bonus-status": { name: "Upgrade 5 status" },
|
||||||
|
"bonus-roleability": { name: "Role Ability +1" },
|
||||||
|
"bonus-ppp5": { name: "Gain +5 PPP" },
|
||||||
|
"bonus-wealthy": { name: "Wealthy (money x 2)" },
|
||||||
|
"bonus-heirloom": { name: "Family Heirloom (Special Item)" },
|
||||||
|
"bonus-vehicle": { name: "Starting Vehicle" },
|
||||||
|
"bonus-sidekick": { name: "Starting Sidekick" },
|
||||||
|
"bonus-ambidextrious": { name: "Ambidextrious" }
|
||||||
|
}
|
||||||
|
this.renderChatMessage(formData)
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
async showVirtue() {
|
||||||
|
let formData = this.createFormData("select-global-virtue")
|
||||||
|
let virtues = this.actor.items.filter(it => it.type == "virtue")
|
||||||
|
formData.virtues = []
|
||||||
|
for ( let virtue1 of this.virtues) { // Filter existing virtues
|
||||||
|
let isOK = true
|
||||||
|
for(let virtue2 of virtues) {
|
||||||
|
if (virtue1.name == virtue2.name) {
|
||||||
|
isOK = false
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isOK) {
|
||||||
|
formData.virtues.push(virtue1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
formData.virtues.sort(function compare(a, b) { if (a.name < b.name) { return -1 } else { return 1 } })
|
||||||
|
this.renderChatMessage(formData)
|
||||||
|
}
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
async showVice() {
|
||||||
|
let formData = this.createFormData("select-global-vice")
|
||||||
|
let virtues = this.actor.items.filter(it => it.type == "virtue")
|
||||||
|
let vices = this.actor.items.filter(it => it.type == "vice")
|
||||||
|
formData.vices = []
|
||||||
|
for (let vice of this.vices) {
|
||||||
|
let isOK = true
|
||||||
|
for ( let virtue of virtues) {
|
||||||
|
for (let nonVice of virtue.system.unavailablevice) {
|
||||||
|
if(nonVice.name == vice.name) {
|
||||||
|
isOK = false
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for ( let vice2 of vices) {
|
||||||
|
if(vice2.name == vice.name) {
|
||||||
|
isOK = false
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isOK) {
|
||||||
|
formData.vices.push( vice)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
formData.vices.sort(function compare(a, b) { if (a.name < b.name) { return -1 } else { return 1 } })
|
||||||
|
this.renderChatMessage(formData)
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
showViceQuestion() {
|
||||||
|
let formData = this.createFormData("select-vice-question")
|
||||||
|
formData.questions = {
|
||||||
|
"vice-next-step": { name: "Go to next step" },
|
||||||
|
"vice-5-cdp": { name: "Gain +5 CDP and choose a Vice" },
|
||||||
|
"vice-vertue": { name: "Choose a Virtue and a Vice" }
|
||||||
|
}
|
||||||
|
this.renderChatMessage(formData)
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async showCharacterEnd() {
|
async showCharacterEnd() {
|
||||||
await this.actor.computeNRGHealth()
|
await this.actor.computeNRGHealth()
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -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.1.11",
|
"version": "10.2.0",
|
||||||
"download": "https://www.uberwald.me/gitea/uberwald/fvtt-pegasus-rpg/archive/fvtt-pegasus-rpg-v10.1.11.zip",
|
"download": "https://www.uberwald.me/gitea/uberwald/fvtt-pegasus-rpg/archive/fvtt-pegasus-rpg-v10.2.0.zip",
|
||||||
"background": "systems/fvtt-pegasus-rpg/images/ui/pegasus_welcome_page.webp"
|
"background": "systems/fvtt-pegasus-rpg/images/ui/pegasus_welcome_page.webp"
|
||||||
}
|
}
|
||||||
@@ -134,8 +134,114 @@
|
|||||||
</table>
|
</table>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
{{#if (eq step "select-global-spec")}}
|
||||||
|
<div>Now select a Specialisation at +1DT.
|
||||||
|
</div>
|
||||||
|
<table class="table-create-actor">
|
||||||
|
{{#each specs as |spec index|}}
|
||||||
|
<tr>
|
||||||
|
<td><a class="view-item-from-chat" data-step="{{@root.step}}" data-item-id="{{spec._id}}">{{spec.name}}</a></td>
|
||||||
|
<td><a class="chat-card-button chat-create-actor" data-step-name="{{@root.step}}" data-item-id="{{spec._id}}" >Select it !</a></td>
|
||||||
|
</tr>
|
||||||
|
{{/each}}
|
||||||
|
</table>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{#if (eq step "select-global-stat")}}
|
||||||
|
<div>Now select a Statistic at +1DT.
|
||||||
|
</div>
|
||||||
|
<table class="table-create-actor">
|
||||||
|
{{#each stats as |stat key|}}
|
||||||
|
<tr>
|
||||||
|
<td><a class="view-item-from-chat" data-step="{{@root.step}}" data-stat-key="{{key}}">{{stat.label}}</a></td>
|
||||||
|
<td><a class="chat-card-button chat-create-actor" data-step-name="{{@root.step}}" data-stat-key="{{key}}" >Select it !</a></td>
|
||||||
|
</tr>
|
||||||
|
{{/each}}
|
||||||
|
</table>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{#if (eq step "select-global-perk")}}
|
||||||
|
<div>Choose a new perk or add +1DT for en existing one.
|
||||||
|
</div>
|
||||||
|
<table class="table-create-actor">
|
||||||
|
{{#each perks as |perk index|}}
|
||||||
|
<tr>
|
||||||
|
<td><a class="view-item-from-chat" data-step="{{@root.step}}" data-item-id="{{perk._id}}">{{perk.name}}</a></td>
|
||||||
|
<td><a class="chat-card-button chat-create-actor" data-step-name="{{@root.step}}" data-item-id="{{perk._id}}" >Select it !</a></td>
|
||||||
|
</tr>
|
||||||
|
{{/each}}
|
||||||
|
</table>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{#if (eq step "select-global-status")}}
|
||||||
|
<div>Now add a +1 bonus to a status
|
||||||
|
</div>
|
||||||
|
<table class="table-create-actor">
|
||||||
|
{{#each status as |stat key|}}
|
||||||
|
<tr>
|
||||||
|
<td><a class="view-item-from-chat" data-step="{{@root.step}}" data-status-key="{{key}}">{{stat.label}}</a></td>
|
||||||
|
<td><a class="chat-card-button chat-create-actor" data-step-name="{{@root.step}}" data-status-key="{{key}}" >Select it !</a></td>
|
||||||
|
</tr>
|
||||||
|
{{/each}}
|
||||||
|
</table>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{#if (eq step "select-bonus-selection")}}
|
||||||
|
<div>Select a bonus
|
||||||
|
</div>
|
||||||
|
<table class="table-create-actor">
|
||||||
|
{{#each bonuses as |bonus key|}}
|
||||||
|
<tr>
|
||||||
|
<td><a class="view-item-from-chat" data-step="{{@root.step}}" data-bonus-key="{{key}}">{{bonus.name}}</a></td>
|
||||||
|
<td><a class="chat-card-button chat-create-actor" data-step-name="{{@root.step}}" data-bonus-key="{{key}}" >Select it !</a></td>
|
||||||
|
</tr>
|
||||||
|
{{/each}}
|
||||||
|
</table>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{#if (eq step "select-global-virtue")}}
|
||||||
|
<div>Choose a Virtue.
|
||||||
|
</div>
|
||||||
|
<table class="table-create-actor">
|
||||||
|
{{#each virtues as |virtue index|}}
|
||||||
|
<tr>
|
||||||
|
<td><a class="view-item-from-chat" data-step="{{@root.step}}" data-item-id="{{virtue._id}}">{{virtue.name}}</a></td>
|
||||||
|
<td><a class="chat-card-button chat-create-actor" data-step-name="{{@root.step}}" data-item-id="{{virtue._id}}" >Select it !</a></td>
|
||||||
|
</tr>
|
||||||
|
{{/each}}
|
||||||
|
</table>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{#if (eq step "select-global-vice")}}
|
||||||
|
<div>Choose an available Vice.
|
||||||
|
</div>
|
||||||
|
<table class="table-create-actor">
|
||||||
|
{{#each vices as |vice index|}}
|
||||||
|
<tr>
|
||||||
|
<td><a class="view-item-from-chat" data-step="{{@root.step}}" data-item-id="{{vice._id}}">{{vice.name}}</a></td>
|
||||||
|
<td><a class="chat-card-button chat-create-actor" data-step-name="{{@root.step}}" data-item-id="{{vice._id}}" >Select it !</a></td>
|
||||||
|
</tr>
|
||||||
|
{{/each}}
|
||||||
|
</table>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{#if (eq step "select-vice-question")}}
|
||||||
|
<div>Would you like to skip, to choose a second Vice for 5 CDP or to choose 1 Virtue and 1 Vice?
|
||||||
|
</div>
|
||||||
|
<table class="table-create-actor">
|
||||||
|
{{#each questions as |question key|}}
|
||||||
|
<tr>
|
||||||
|
<td><a class="view-item-from-chat" data-step="{{@root.step}}" data-question-key="{{key}}">{{question.name}}</a></td>
|
||||||
|
<td><a class="chat-card-button chat-create-actor" data-step-name="{{@root.step}}" data-question-key="{{key}}" >Select it !</a></td>
|
||||||
|
</tr>
|
||||||
|
{{/each}}
|
||||||
|
</table>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
{{#if (eq step "character-end")}}
|
{{#if (eq step "character-end")}}
|
||||||
<div>Follow the next steps from the rulebook page 50 !. You can now spend 150 CDPs to customise your character.
|
<div>Choose Starting Gear, Worst Fear, Desires, Catchphrase & Catchphrase Trigger
|
||||||
|
and fill in the empty fields in the Bio Tab.<br>
|
||||||
|
Automated character creation is over.
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user