Compare commits
12 Commits
fvtt-pegas
...
fvtt-pegas
Author | SHA1 | Date | |
---|---|---|---|
cb896c9813 | |||
7d46699c62 | |||
b5f196f942 | |||
11270eb450 | |||
60856df818 | |||
45e856a30b | |||
dad117fc17 | |||
cc0dc9e43c | |||
d484064fdd | |||
43d4acaea4 | |||
50f4339454 | |||
109ce4f192 |
@ -62,6 +62,8 @@ export class PegasusActorSheet extends ActorSheet {
|
|||||||
levelRemainingList: this.actor.getLevelRemainingList(),
|
levelRemainingList: this.actor.getLevelRemainingList(),
|
||||||
maxLevelRemainingList: this.actor.getMaxLevelRemainingList(),
|
maxLevelRemainingList: this.actor.getMaxLevelRemainingList(),
|
||||||
disabledBonus: (this.actor.system.biodata.noautobonus) ? "" : "disabled",
|
disabledBonus: (this.actor.system.biodata.noautobonus) ? "" : "disabled",
|
||||||
|
mt: this.actor.getMT(),
|
||||||
|
kbv: this.actor.getKBV(),
|
||||||
containersTree: this.actor.containersTree,
|
containersTree: this.actor.containersTree,
|
||||||
encCurrent: this.actor.encCurrent,
|
encCurrent: this.actor.encCurrent,
|
||||||
encHindrance: this.actor.encHindrance,
|
encHindrance: this.actor.encHindrance,
|
||||||
|
@ -134,7 +134,14 @@ export class PegasusActor extends Actor {
|
|||||||
|
|
||||||
super._preUpdate(changed, options, user);
|
super._preUpdate(changed, options, user);
|
||||||
}
|
}
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
getMT() {
|
||||||
|
return PegasusUtility.getDiceValue(this.system.statistics.mnd.value) + this.system.statistics.mnd.mod + PegasusUtility.getDiceValue(this.system.statistics.mnd.bonuseffect)
|
||||||
|
}
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
getKBV() {
|
||||||
|
return this.system.statistics.phy.value + this.system.statistics.phy.mod + this.system.statistics.phy.bonuseffect
|
||||||
|
}
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
getEncumbranceCapacity() {
|
getEncumbranceCapacity() {
|
||||||
return this.system.statistics.str.value * 25
|
return this.system.statistics.str.value * 25
|
||||||
@ -194,12 +201,12 @@ export class PegasusActor extends Actor {
|
|||||||
let comp = this.items.filter(item => item.type == 'vehiclemodule');
|
let comp = this.items.filter(item => item.type == 'vehiclemodule');
|
||||||
return comp;
|
return comp;
|
||||||
}
|
}
|
||||||
getVehicleWeaponModules( activated = false ) {
|
getVehicleWeaponModules(activated = false) {
|
||||||
let comp = []
|
let comp = []
|
||||||
if (activated ) {
|
if (activated) {
|
||||||
comp = this.items.filter(item => item.type == 'vehicleweaponmodule' && item.system.activated)
|
comp = this.items.filter(item => item.type == 'vehicleweaponmodule' && item.system.activated)
|
||||||
} else {
|
} else {
|
||||||
comp = this.items.filter(item => item.type == 'vehicleweaponmodule' )
|
comp = this.items.filter(item => item.type == 'vehicleweaponmodule')
|
||||||
}
|
}
|
||||||
return comp;
|
return comp;
|
||||||
}
|
}
|
||||||
@ -280,6 +287,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() {
|
||||||
@ -459,6 +486,33 @@ export class PegasusActor extends Actor {
|
|||||||
let update = { _id: item.id, "data.activated": !item.system.activated }
|
let update = { _id: item.id, "data.activated": !item.system.activated }
|
||||||
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() {
|
||||||
|
|
||||||
|
}
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
setBonusInformation( info) {
|
||||||
|
this.update( {'system.biodata.bonusselection': info})
|
||||||
|
}
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
addCDP( value) {
|
||||||
|
let cdp = this.system.biodata.cdp
|
||||||
|
cdp += value
|
||||||
|
this.update( {'system.biodata.cdp': cdp})
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
addPPP(value) {
|
||||||
|
let ppp = duplicate(this.system.ppp)
|
||||||
|
console.log("PPP", ppp)
|
||||||
|
ppp.availablePPP += Number(value)
|
||||||
|
this.update({ 'system.ppp': ppp })
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -755,13 +809,13 @@ export class PegasusActor extends Actor {
|
|||||||
ui.notifications.warn("Container is already full !")
|
ui.notifications.warn("Container is already full !")
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
this.updateEmbeddedDocuments( "Item", [{ _id: object.id, 'system.containerid':containerId }])
|
this.updateEmbeddedDocuments("Item", [{ _id: object.id, 'system.containerid': containerId }])
|
||||||
}
|
}
|
||||||
} else if (object && object.system.containerid) { // remove from container
|
} else if (object && object.system.containerid) { // remove from container
|
||||||
this.updateEmbeddedDocuments( "Item", [{ _id: object.id, 'system.containerid':"" }])
|
this.updateEmbeddedDocuments("Item", [{ _id: object.id, 'system.containerid': "" }])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
checkVirtue(virtue) {
|
checkVirtue(virtue) {
|
||||||
let vices = this.getVices()
|
let vices = this.getVices()
|
||||||
@ -794,7 +848,7 @@ export class PegasusActor extends Actor {
|
|||||||
|
|
||||||
console.log("Pre-process", item)
|
console.log("Pre-process", item)
|
||||||
if (!item) {
|
if (!item) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (item.type != "effect" && __isVehicle[item.type]) {
|
if (item.type != "effect" && __isVehicle[item.type]) {
|
||||||
ui.notifications.warn("You can't drop Vehicles item over a character sheet.")
|
ui.notifications.warn("You can't drop Vehicles item over a character sheet.")
|
||||||
@ -1414,9 +1468,11 @@ export class PegasusActor extends Actor {
|
|||||||
}
|
}
|
||||||
if (!this.isToken) {
|
if (!this.isToken) {
|
||||||
if (this.warnMorality != this.system.biodata.morality && this.system.biodata.morality < 0) {
|
if (this.warnMorality != this.system.biodata.morality && this.system.biodata.morality < 0) {
|
||||||
console.log("CHAR", this)
|
|
||||||
ChatMessage.create({ content: "WARNING: Your character is dangerously close to becoming corrupted and defeated. Start on a path of redemption!" })
|
ChatMessage.create({ content: "WARNING: Your character is dangerously close to becoming corrupted and defeated. Start on a path of redemption!" })
|
||||||
}
|
}
|
||||||
|
if (this.warnMorality != this.system.biodata.morality && this.system.biodata.morality == 0) {
|
||||||
|
ChatMessage.create({ content: "This character can no longer spend CDP until their Morality has reached 1 or higher" })
|
||||||
|
}
|
||||||
if (this.warnMorality != this.system.biodata.morality) {
|
if (this.warnMorality != this.system.biodata.morality) {
|
||||||
this.warnMorality = this.system.biodata.morality
|
this.warnMorality = this.system.biodata.morality
|
||||||
}
|
}
|
||||||
@ -1478,7 +1534,7 @@ export class PegasusActor extends Actor {
|
|||||||
}
|
}
|
||||||
if (bonus != stat.bonuseffect) {
|
if (bonus != stat.bonuseffect) {
|
||||||
stat.bonuseffect = bonus
|
stat.bonuseffect = bonus
|
||||||
if ( stat.bonuseffect + stat.value < 1) {
|
if (stat.bonuseffect + stat.value < 1) {
|
||||||
stat.value = 1
|
stat.value = 1
|
||||||
stat.bonuseffect = 0
|
stat.bonuseffect = 0
|
||||||
}
|
}
|
||||||
@ -1536,6 +1592,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 +1612,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) {
|
||||||
@ -1575,6 +1658,9 @@ export class PegasusActor extends Actor {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async applyAbility(ability, updates = [], directUpdate = false) {
|
async applyAbility(ability, updates = [], directUpdate = false) {
|
||||||
// manage stat bonus
|
// manage stat bonus
|
||||||
|
if (!ability.system) {
|
||||||
|
ability.system = ability.data
|
||||||
|
}
|
||||||
if (ability.system.affectedstat != "notapplicable") {
|
if (ability.system.affectedstat != "notapplicable") {
|
||||||
let stat = duplicate(this.system.statistics[ability.system.affectedstat])
|
let stat = duplicate(this.system.statistics[ability.system.affectedstat])
|
||||||
stat.mod += Number(ability.system.statmodifier)
|
stat.mod += Number(ability.system.statmodifier)
|
||||||
@ -1705,9 +1791,9 @@ export class PegasusActor extends Actor {
|
|||||||
if (overCapacity > 0) {
|
if (overCapacity > 0) {
|
||||||
effectsList.push({ label: "Encumbrance Hindrance", type: "hindrance", foreign: true, actorId: this.id, applied: false, value: overCapacity })
|
effectsList.push({ label: "Encumbrance Hindrance", type: "hindrance", foreign: true, actorId: this.id, applied: false, value: overCapacity })
|
||||||
}
|
}
|
||||||
if (this.system.biodata.morality <= 0) {
|
/* Remove as per ticket #159if (this.system.biodata.morality <= 0) {
|
||||||
effectsList.push({ label: "Morality Hindrance", type: "hindrance", foreign: true, actorId: this.id, applied: false, value: 3 })
|
effectsList.push({ label: "Morality Hindrance", type: "hindrance", foreign: true, actorId: this.id, applied: false, value: 3 })
|
||||||
}
|
}*/
|
||||||
let effects = this.items.filter(item => item.type == 'effect')
|
let effects = this.items.filter(item => item.type == 'effect')
|
||||||
for (let effect of effects) {
|
for (let effect of effects) {
|
||||||
effect = duplicate(effect)
|
effect = duplicate(effect)
|
||||||
@ -1772,7 +1858,23 @@ export class PegasusActor extends Actor {
|
|||||||
if (isPowerDmg && effect.system.stataffected == "powerdmgroll") {
|
if (isPowerDmg && effect.system.stataffected == "powerdmgroll") {
|
||||||
this.pushEffect(rollData, effect)
|
this.pushEffect(rollData, effect)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
addRoleBonus(rollData, statKey, subKey) {
|
||||||
|
let role = this.getRole()
|
||||||
|
if (role.name.toLowerCase() == "ranged" && subKey == "ranged-dmg") {
|
||||||
|
rollData.effectsList.push({ label: "Ranged Role Bonus", type: "effect", applied: true, isdynamic: true, value: this.getRoleLevel() })
|
||||||
|
rollData.dicePool = rollData.dicePool.concat(PegasusUtility.buildDicePool("effect-bonus-dice", this.getRoleLevel(), 0, "Ranged Role Bonus"))
|
||||||
|
}
|
||||||
|
if (role.name.toLowerCase() == "defender" && subKey == "defence") {
|
||||||
|
rollData.effectsList.push({ label: "Defender Role Bonus", type: "effect", applied: true, isdynamic: true, value: this.getRoleLevel() })
|
||||||
|
rollData.dicePool = rollData.dicePool.concat(PegasusUtility.buildDicePool("effect-bonus-dice", this.getRoleLevel(), 0,"Defender Role Bonus"))
|
||||||
|
}
|
||||||
|
if (role.name.toLowerCase() == "scrapper" && statKey == "com") {
|
||||||
|
rollData.effectsList.push({ label: "Scrapper Role Bonus", type: "effect", applied: true, isdynamic: true, value: this.getRoleLevel() })
|
||||||
|
rollData.dicePool = rollData.dicePool.concat(PegasusUtility.buildDicePool("effect-bonus-dice", this.getRoleLevel(), 0,"Scrapper Role Bonus"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1839,10 +1941,10 @@ export class PegasusActor extends Actor {
|
|||||||
ChatMessage.create({ content: `${vehicle.name} is moving at Slow speed : add a D4 to your Attack Dice Pool against this Vehicle` })
|
ChatMessage.create({ content: `${vehicle.name} is moving at Slow speed : add a D4 to your Attack Dice Pool against this Vehicle` })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.type == "vehicle" && rollData.statKey == "man" && this.system.statistics.ad.currentspeed == "fast") {
|
if (this.type == "vehicle" && rollData.statKey == "man" && this.system.statistics.ad.currentspeed == "fast") {
|
||||||
ChatMessage.create({ content: `${this.name} is moving at Fast speed : anyone using the vehicles MAN Dice Pool suffers a D8 Hindrance which is added to the Difficulty Dice Pool against this Vehicle` })
|
ChatMessage.create({ content: `${this.name} is moving at Fast speed : anyone using the vehicles MAN Dice Pool suffers a D8 Hindrance which is added to the Difficulty Dice Pool against this Vehicle` })
|
||||||
}
|
}
|
||||||
if (this.type == "vehicle" && rollData.statKey == "man" && this.system.statistics.ad.currentspeed == "extfast") {
|
if (this.type == "vehicle" && rollData.statKey == "man" && this.system.statistics.ad.currentspeed == "extfast") {
|
||||||
ChatMessage.create({ content: `${this.name} is moving at Extremely Fast speed : anyone using the vehicles MAN Dice Pool suffers a D12 Hindrance which is added to the Difficulty Dice Pool against this Vehicle` })
|
ChatMessage.create({ content: `${this.name} is moving at Extremely Fast speed : anyone using the vehicles MAN Dice Pool suffers a D12 Hindrance which is added to the Difficulty Dice Pool against this Vehicle` })
|
||||||
}
|
}
|
||||||
if (rollData.subKey == "defence" && rollData.vehicle && rollData.vehicle.system.statistics.ad.currentspeed == "crawling") {
|
if (rollData.subKey == "defence" && rollData.vehicle && rollData.vehicle.system.statistics.ad.currentspeed == "crawling") {
|
||||||
@ -1851,7 +1953,7 @@ export class PegasusActor extends Actor {
|
|||||||
if (rollData.subKey == "defence" && rollData.vehicle && rollData.vehicle.system.statistics.ad.currentspeed == "slow") {
|
if (rollData.subKey == "defence" && rollData.vehicle && rollData.vehicle.system.statistics.ad.currentspeed == "slow") {
|
||||||
ChatMessage.create({ content: `${this.name} is moving at Slow speed : add a D4 to your Attack Dice Pool against this Vehicle` })
|
ChatMessage.create({ content: `${this.name} is moving at Slow speed : add a D4 to your Attack Dice Pool against this Vehicle` })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -1956,6 +2058,7 @@ export class PegasusActor extends Actor {
|
|||||||
this.addArmorsShields(rollData, statKey, useShield, subKey)
|
this.addArmorsShields(rollData, statKey, useShield, subKey)
|
||||||
this.addWeapons(rollData, statKey, useShield)
|
this.addWeapons(rollData, statKey, useShield)
|
||||||
this.addEquipments(rollData, statKey)
|
this.addEquipments(rollData, statKey)
|
||||||
|
this.addRoleBonus(rollData, statKey, subKey)
|
||||||
this.processVehicleTargetMessage(rollData)
|
this.processVehicleTargetMessage(rollData)
|
||||||
|
|
||||||
console.log("ROLLDATA", rollData)
|
console.log("ROLLDATA", rollData)
|
||||||
@ -2243,15 +2346,15 @@ export class PegasusActor extends Actor {
|
|||||||
}
|
}
|
||||||
if (bonus != stat.bonuseffect) {
|
if (bonus != stat.bonuseffect) {
|
||||||
stat.bonuseffect = bonus
|
stat.bonuseffect = bonus
|
||||||
if ( stat.bonuseffect + stat.level < 1) {
|
if (stat.bonuseffect + stat.level < 1) {
|
||||||
stat.level = 1
|
stat.level = 1
|
||||||
stat.bonuseffect = 0
|
stat.bonuseffect = 0
|
||||||
}
|
}
|
||||||
if (stat.currentlevel > stat.bonuseffect+stat.level) {
|
if (stat.currentlevel > stat.bonuseffect + stat.level) {
|
||||||
stat.currentlevel = stat.bonuseffect+stat.level
|
stat.currentlevel = stat.bonuseffect + stat.level
|
||||||
}
|
}
|
||||||
this.update({ [`system.statistics.${statKey}`]: stat })
|
this.update({ [`system.statistics.${statKey}`]: stat })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2395,12 +2498,12 @@ export class PegasusActor extends Actor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// NRG max management
|
// NRG max management
|
||||||
if (item.type == "powercoremodule" ) {
|
if (item.type == "powercoremodule") {
|
||||||
if (this.system.statistics.pc.maxnrg != item.system.nrg ) {
|
if (this.system.statistics.pc.maxnrg != item.system.nrg) {
|
||||||
this.update( {'system.statistics.pc.maxnrg': item.system.nrg })
|
this.update({ 'system.statistics.pc.maxnrg': item.system.nrg })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cargo management
|
// Cargo management
|
||||||
if (__isVehicleCargo[item.type]) {
|
if (__isVehicleCargo[item.type]) {
|
||||||
let capacity = this.getCurrentCargoCapacity()
|
let capacity = this.getCurrentCargoCapacity()
|
||||||
@ -2531,7 +2634,7 @@ export class PegasusActor extends Actor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async addVehicleModuleEffects( mod) {
|
async addVehicleModuleEffects(mod) {
|
||||||
let effects = []
|
let effects = []
|
||||||
for (let effect of mod.system.effects) {
|
for (let effect of mod.system.effects) {
|
||||||
if (!effect.system) {
|
if (!effect.system) {
|
||||||
@ -2545,7 +2648,7 @@ export class PegasusActor extends Actor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async removeVehicleModuleEffects( mod) {
|
async removeVehicleModuleEffects(mod) {
|
||||||
let toRem = []
|
let toRem = []
|
||||||
for (let item of this.items) {
|
for (let item of this.items) {
|
||||||
if (item.type == 'effect' && item.system.effectId == mod.id) {
|
if (item.type == 'effect' && item.system.effectId == mod.id) {
|
||||||
@ -2583,7 +2686,7 @@ export class PegasusActor extends Actor {
|
|||||||
this.removeVehicleModuleEffects(mod)
|
this.removeVehicleModuleEffects(mod)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ( mod.system.activated) {
|
if (mod.system.activated) {
|
||||||
this.removeVehicleModuleEffects(mod)
|
this.removeVehicleModuleEffects(mod)
|
||||||
} else {
|
} else {
|
||||||
this.addVehicleModuleEffects(mod)
|
this.addVehicleModuleEffects(mod)
|
||||||
@ -2613,7 +2716,7 @@ export class PegasusActor extends Actor {
|
|||||||
let lvChanged = level - arc.maxshieldlevel
|
let lvChanged = level - arc.maxshieldlevel
|
||||||
arc.maxshieldlevel = level
|
arc.maxshieldlevel = level
|
||||||
arc.shieldlevel += lvChanged
|
arc.shieldlevel += lvChanged
|
||||||
if ( arc.shieldlevel <= 0 || arc.shieldlevel > level) {
|
if (arc.shieldlevel <= 0 || arc.shieldlevel > level) {
|
||||||
arc.shieldlevel = level
|
arc.shieldlevel = level
|
||||||
}
|
}
|
||||||
setTimeout(shift, this.update({ [`system.arcs.${arcKey}`]: arc }))
|
setTimeout(shift, this.update({ [`system.arcs.${arcKey}`]: arc }))
|
||||||
@ -2636,7 +2739,7 @@ export class PegasusActor extends Actor {
|
|||||||
let lvChanged = level - arc.maxarmourlevel
|
let lvChanged = level - arc.maxarmourlevel
|
||||||
arc.maxarmourlevel = level
|
arc.maxarmourlevel = level
|
||||||
arc.armourlevel += lvChanged
|
arc.armourlevel += lvChanged
|
||||||
if ( arc.armourlevel <= 0 || arc.armourlevel > arc.maxarmourlevel) {
|
if (arc.armourlevel <= 0 || arc.armourlevel > arc.maxarmourlevel) {
|
||||||
arc.armourlevel = level
|
arc.armourlevel = level
|
||||||
}
|
}
|
||||||
setTimeout(500, this.update({ [`system.arcs.${arcKey}`]: arc }))
|
setTimeout(500, this.update({ [`system.arcs.${arcKey}`]: arc }))
|
||||||
@ -2645,7 +2748,7 @@ export class PegasusActor extends Actor {
|
|||||||
}
|
}
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
updateMaxNrg(currentLevel) {
|
updateMaxNrg(currentLevel) {
|
||||||
this.update({ 'system.statistics.pc.maxnrg': Number( PegasusUtility.getDiceValue(currentLevel) ) })
|
this.update({ 'system.statistics.pc.maxnrg': Number(PegasusUtility.getDiceValue(currentLevel)) })
|
||||||
}
|
}
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
setTurningArc(currentLevel) {
|
setTurningArc(currentLevel) {
|
||||||
|
@ -12,9 +12,9 @@ export class PegasusActorCreate {
|
|||||||
type: "character"
|
type: "character"
|
||||||
});
|
});
|
||||||
this.actor.sheet.render(true)
|
this.actor.sheet.render(true)
|
||||||
|
|
||||||
this.actor.computeValue = true // To force value computation
|
this.actor.computeValue = true // To force value computation
|
||||||
|
|
||||||
const racesPack = await PegasusUtility.loadCompendium("fvtt-pegasus-rpg.race")
|
const racesPack = await PegasusUtility.loadCompendium("fvtt-pegasus-rpg.race")
|
||||||
this.races = racesPack.map(i => i.toObject())
|
this.races = racesPack.map(i => i.toObject())
|
||||||
const rolesPack = await PegasusUtility.loadCompendium("fvtt-pegasus-rpg.role")
|
const rolesPack = await PegasusUtility.loadCompendium("fvtt-pegasus-rpg.role")
|
||||||
@ -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()
|
||||||
}
|
}
|
||||||
@ -35,10 +39,10 @@ export class PegasusActorCreate {
|
|||||||
step: step,
|
step: step,
|
||||||
races: this.races,
|
races: this.races,
|
||||||
roles: this.roles,
|
roles: this.roles,
|
||||||
nboptionnal: this.raceOptionnalAbilities?.nboptionnal?? 0,
|
nboptionnal: this.raceOptionnalAbilities?.nboptionnal ?? 0,
|
||||||
optionnalabilities: this.raceOptionnalAbilities?.optionnalabilities?? [],
|
optionnalabilities: this.raceOptionnalAbilities?.optionnalabilities ?? [],
|
||||||
}
|
}
|
||||||
if ( this.raceSelectableStats ) {
|
if (this.raceSelectableStats) {
|
||||||
formData.numberstats = this.raceSelectableStats.numberstats;
|
formData.numberstats = this.raceSelectableStats.numberstats;
|
||||||
formData.statsonlyonce = this.raceSelectableStats.statsonlyonce;
|
formData.statsonlyonce = this.raceSelectableStats.statsonlyonce;
|
||||||
formData.stats = this.raceSelectableStats.stats;
|
formData.stats = this.raceSelectableStats.stats;
|
||||||
@ -47,38 +51,38 @@ export class PegasusActorCreate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
getSpecFromRoleStat( role) {
|
getSpecFromRoleStat(role) {
|
||||||
let specList = []
|
let specList = []
|
||||||
for(let stat of role.system.statincreasechoice) {
|
for (let stat of role.system.statincreasechoice) {
|
||||||
if (stat.flag) {
|
if (stat.flag) {
|
||||||
specList = specList.concat( this.specs.filter( spec => spec.system.statistic.toLowerCase() == stat.name.toLowerCase() ))
|
specList = specList.concat(this.specs.filter(spec => spec.system.statistic.toLowerCase() == stat.name.toLowerCase()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return specList
|
return specList
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
getPerksFromRole( role ) {
|
getPerksFromRole(role) {
|
||||||
let perks = this.perks.filter( perk => perk.system.category.toLowerCase() == role.system.perksrole.toLowerCase())
|
let perks = this.perks.filter(perk => perk.system.category.toLowerCase() == role.system.perksrole.toLowerCase())
|
||||||
return perks
|
return perks
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
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");
|
||||||
|
|
||||||
if ( step == "select-race") {
|
if (step == "select-race") {
|
||||||
let race = this.races.find( item => item._id == itemId);
|
let race = this.races.find(item => item._id == itemId);
|
||||||
this.currentRace = race;
|
this.currentRace = race;
|
||||||
this.actor.applyRace( race);
|
await this.actor.applyRace(race);
|
||||||
PegasusUtility.removeChatMessageId(PegasusUtility.findChatMessageId(event.currentTarget));
|
PegasusUtility.removeChatMessageId(PegasusUtility.findChatMessageId(event.currentTarget));
|
||||||
if ( race.system.nboptionnal > 0 && race.system.optionnalabilities.length > 0) {
|
if (race.system.nboptionnal > 0 && race.system.optionnalabilities.length > 0) {
|
||||||
this.manageOptionnalAbilities(race);
|
this.manageOptionnalAbilities(race);
|
||||||
} else {
|
} else {
|
||||||
if ( race.system.selectablestats ) {
|
if (race.system.selectablestats) {
|
||||||
this.manageSelectableStats(race);
|
this.manageSelectableStats(race);
|
||||||
} else if ( race.system.perksgained) {
|
} else if (race.system.perksgained) {
|
||||||
this.manageRacePerks(race);
|
this.manageRacePerks(race);
|
||||||
} else {
|
} else {
|
||||||
this.showRoles()
|
this.showRoles()
|
||||||
@ -86,97 +90,97 @@ export class PegasusActorCreate {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( step == 'select-race-optionnal') {
|
if (step == 'select-race-optionnal') {
|
||||||
let ability = this.raceOptionnalAbilities.optionnalabilities.find( item => item._id == itemId);
|
let ability = this.raceOptionnalAbilities.optionnalabilities.find(item => item._id == itemId);
|
||||||
let update = []
|
let update = []
|
||||||
this.actor.applyAbility( ability, update );
|
await this.actor.applyAbility(ability, update);
|
||||||
this.actor.update( update )
|
this.actor.update(update)
|
||||||
this.actor.createEmbeddedDocuments( 'Item', [ability]);
|
this.actor.createEmbeddedDocuments('Item', [ability]);
|
||||||
PegasusUtility.removeChatMessageId(PegasusUtility.findChatMessageId(event.currentTarget));
|
PegasusUtility.removeChatMessageId(PegasusUtility.findChatMessageId(event.currentTarget));
|
||||||
this.raceOptionnalAbilities.optionnalabilities = this.raceOptionnalAbilities.optionnalabilities.filter( item => item._id != itemId);
|
this.raceOptionnalAbilities.optionnalabilities = this.raceOptionnalAbilities.optionnalabilities.filter(item => item._id != itemId);
|
||||||
this.raceOptionnalAbilities.nboptionnal -= 1;
|
this.raceOptionnalAbilities.nboptionnal -= 1;
|
||||||
this.processOptionnalAbilitiesStep();
|
this.processOptionnalAbilitiesStep();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (step == 'select-race-stats') {
|
if (step == 'select-race-stats') {
|
||||||
let statKey = $(event.currentTarget).data("stat-key");
|
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.stats[statKey].used = true;
|
||||||
this.raceSelectableStats.numberstats -=1;
|
this.raceSelectableStats.numberstats -= 1;
|
||||||
PegasusUtility.removeChatMessageId(PegasusUtility.findChatMessageId(event.currentTarget));
|
PegasusUtility.removeChatMessageId(PegasusUtility.findChatMessageId(event.currentTarget));
|
||||||
this.processSelectableStats();
|
this.processSelectableStats();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (step == 'select-race-perks') {
|
if (step == 'select-race-perks') {
|
||||||
PegasusUtility.removeChatMessageId(PegasusUtility.findChatMessageId(event.currentTarget));
|
PegasusUtility.removeChatMessageId(PegasusUtility.findChatMessageId(event.currentTarget));
|
||||||
let perk = this.racePerks.find( item => item._id == itemId);
|
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.racePerks = this.racePerks.filter(item => item._id != itemId);
|
||||||
this.nbRacePerks -= 1;
|
this.nbRacePerks -= 1;
|
||||||
if ( this.nbRacePerks == 0 || this.racePerks.length == 0) {
|
if (this.nbRacePerks == 0 || this.racePerks.length == 0) {
|
||||||
this.showRoles()
|
this.showRoles()
|
||||||
} else {
|
|
||||||
this.manageRacePerks()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( step == 'select-role') {
|
|
||||||
let role = this.roles.find( item => item._id == itemId);
|
|
||||||
PegasusUtility.removeChatMessageId(PegasusUtility.findChatMessageId(event.currentTarget));
|
|
||||||
this.actor.applyRole( role );
|
|
||||||
this.currentRole = role;
|
|
||||||
this.nbRoleStat = 2;
|
|
||||||
this.roleStats = duplicate(role.system.statincreasechoice)
|
|
||||||
this.showRoleStartSpec( );
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
|
||||||
this.nbRoleSpecStart--;
|
|
||||||
this.roleSpecStart = this.roleSpecStart.filter( item => item._id != itemId);//Remove selected spec
|
|
||||||
if( this.nbRoleSpecStart == 0) {
|
|
||||||
this.showRoleStat( );
|
|
||||||
} else {
|
} else {
|
||||||
this.showRoleStartSpec( );
|
this.manageRacePerks()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( step == 'select-role-stat') {
|
if (step == 'select-role') {
|
||||||
|
let role = this.roles.find(item => item._id == itemId);
|
||||||
|
PegasusUtility.removeChatMessageId(PegasusUtility.findChatMessageId(event.currentTarget));
|
||||||
|
await this.actor.applyRole(role);
|
||||||
|
this.currentRole = role;
|
||||||
|
this.nbRoleStat = 2;
|
||||||
|
this.roleStats = duplicate(role.system.statincreasechoice)
|
||||||
|
this.showRoleStartSpec();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (step == 'select-role-start-spec') {
|
||||||
|
PegasusUtility.removeChatMessageId(PegasusUtility.findChatMessageId(event.currentTarget));
|
||||||
|
let spec = this.roleSpecStart.find(item => item._id == itemId);
|
||||||
|
await this.actor.addIncSpec(spec, 1);
|
||||||
|
this.nbRoleSpecStart--;
|
||||||
|
this.roleSpecStart = this.roleSpecStart.filter(item => item._id != itemId);//Remove selected spec
|
||||||
|
if (this.nbRoleSpecStart == 0) {
|
||||||
|
this.showRoleStat();
|
||||||
|
} else {
|
||||||
|
this.showRoleStartSpec();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (step == 'select-role-stat') {
|
||||||
PegasusUtility.removeChatMessageId(PegasusUtility.findChatMessageId(event.currentTarget));
|
PegasusUtility.removeChatMessageId(PegasusUtility.findChatMessageId(event.currentTarget));
|
||||||
let statKey = $(event.currentTarget).data("stat-key");
|
let statKey = $(event.currentTarget).data("stat-key");
|
||||||
this.actor.valueStat( statKey, 1);
|
await this.actor.valueStat(statKey, 1);
|
||||||
|
|
||||||
for (let stat of this.roleStats ) {
|
for (let stat of this.roleStats) {
|
||||||
if ( stat.name.toLowerCase() == statKey.toLowerCase()) {
|
if (stat.name.toLowerCase() == statKey.toLowerCase()) {
|
||||||
stat.flag = false
|
stat.flag = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.nbRoleStat--;
|
this.nbRoleStat--;
|
||||||
if ( this.nbRoleStat == 0 || this.roleStats.length == 0) {
|
if (this.nbRoleStat == 0 || this.roleStats.length == 0) {
|
||||||
this.roleSpec = this.getSpecFromRoleStat( this.currentRole )
|
this.roleSpec = this.getSpecFromRoleStat(this.currentRole)
|
||||||
this.nbDT2 = 1;
|
this.nbDT2 = 1;
|
||||||
this.nbDT1 = 2;
|
this.nbDT1 = 2;
|
||||||
this.showRoleSpecialisations()
|
this.showRoleSpecialisations()
|
||||||
} else{
|
} else {
|
||||||
this.showRoleStat( );
|
this.showRoleStat();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (step == 'select-role-spec') {
|
if (step == 'select-role-spec') {
|
||||||
PegasusUtility.removeChatMessageId(PegasusUtility.findChatMessageId(event.currentTarget));
|
PegasusUtility.removeChatMessageId(PegasusUtility.findChatMessageId(event.currentTarget));
|
||||||
let spec = this.roleSpec.find( item => item._id == itemId);
|
let spec = this.roleSpec.find(item => item._id == itemId);
|
||||||
if (this.nbDT2 > 0) {
|
if (this.nbDT2 > 0) {
|
||||||
this.actor.addIncSpec(spec, 2)
|
await this.actor.addIncSpec(spec, 2)
|
||||||
this.nbDT2--;
|
this.nbDT2--;
|
||||||
} else {
|
} else {
|
||||||
this.actor.addIncSpec(spec, 1)
|
await this.actor.addIncSpec(spec, 1)
|
||||||
this.nbDT1--;
|
this.nbDT1--;
|
||||||
}
|
}
|
||||||
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 = this.getPerksFromRole( this.currentRole ) // duplicate(this.currentRole.data.perks)
|
this.rolePerks = this.getPerksFromRole(this.currentRole)
|
||||||
this.nbPerks = 2;
|
this.nbPerks = 2;
|
||||||
this.showRolePerks()
|
this.showRolePerks()
|
||||||
} else {
|
} else {
|
||||||
@ -186,122 +190,309 @@ 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)
|
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) {
|
||||||
|
if (!excludedPerks.find(it => it.name == perk.name)) {
|
||||||
|
this.rolePerks.push(perk)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.rolePerks.sort(function compare(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);
|
||||||
|
await 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")
|
||||||
|
await 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);
|
||||||
|
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 {
|
||||||
|
this.showGlobalPerk()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (step == 'select-global-status') {
|
||||||
|
PegasusUtility.removeChatMessageId(PegasusUtility.findChatMessageId(event.currentTarget))
|
||||||
|
let statusKey = $(event.currentTarget).data("status-key")
|
||||||
|
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
|
||||||
|
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.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()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async openItemView( event) {
|
async openItemView(event) {
|
||||||
let step = $(event.currentTarget).data("step");
|
let step = $(event.currentTarget).data("step");
|
||||||
let itemId = $(event.currentTarget).data("item-id");
|
let itemId = $(event.currentTarget).data("item-id");
|
||||||
let itemData
|
let itemData
|
||||||
|
|
||||||
if ( step == 'select-race') {
|
if (step == 'select-race') {
|
||||||
itemData = this.races.find( item => item._id == itemId );
|
itemData = this.races.find(item => item._id == itemId);
|
||||||
}
|
}
|
||||||
if ( step == 'select-race-optionnal') {
|
if (step == 'select-race-optionnal') {
|
||||||
itemData = this.raceOptionnalAbilities.optionnalabilities.find( item => item._id == itemId );
|
itemData = this.raceOptionnalAbilities.optionnalabilities.find(item => item._id == itemId);
|
||||||
}
|
}
|
||||||
if ( step == 'select-race-perks') {
|
if (step == 'select-race-perks') {
|
||||||
itemData = this.perks.find( item => item._id == itemId );
|
itemData = this.perks.find(item => item._id == itemId);
|
||||||
}
|
}
|
||||||
if ( step == 'select-race-perks'){
|
if (step == 'select-race-perks') {
|
||||||
itemData = this.racePerks.find( item => item._id == itemId );
|
itemData = this.racePerks.find(item => item._id == itemId);
|
||||||
}
|
}
|
||||||
if ( step == 'select-role') {
|
if (step == 'select-role') {
|
||||||
itemData = this.roles.find( item => item._id == itemId );
|
itemData = this.roles.find(item => item._id == itemId);
|
||||||
}
|
}
|
||||||
if ( step == 'select-role-start-spec') {
|
if (step == 'select-role-start-spec') {
|
||||||
itemData = this.roleSpecStart.find( item => item._id == itemId );
|
itemData = this.roleSpecStart.find(item => item._id == itemId);
|
||||||
}
|
}
|
||||||
if (step == 'select-role-spec') {
|
if (step == 'select-role-spec') {
|
||||||
itemData = this.roleSpec.find( item => item._id == itemId );
|
itemData = this.roleSpec.find(item => item._id == itemId);
|
||||||
}
|
}
|
||||||
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
manageSelectableStats( race ) {
|
manageSelectableStats(race) {
|
||||||
this.raceSelectableStats = {
|
this.raceSelectableStats = {
|
||||||
"race": race,
|
"race": race,
|
||||||
"statsonlyonce": race.data.statsonlyonce,
|
"statsonlyonce": race.system.statsonlyonce,
|
||||||
"numberstats": race.data.numberstats,
|
"numberstats": race.system.numberstats,
|
||||||
"stats": duplicate(this.actor.data.data.statistics)
|
"stats": duplicate(this.actor.system.statistics)
|
||||||
}
|
}
|
||||||
this.processSelectableStats()
|
this.processSelectableStats()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async renderChatMessage( formData) {
|
async renderChatMessage(formData) {
|
||||||
let chatData = {
|
let chatData = {
|
||||||
user: game.user.id,
|
user: game.user.id,
|
||||||
alias : this.actor.name,
|
alias: this.actor.name,
|
||||||
rollMode: game.settings.get("core", "rollMode"),
|
rollMode: game.settings.get("core", "rollMode"),
|
||||||
whisper: [game.user.id].concat( ChatMessage.getWhisperRecipients('GM') ),
|
whisper: [game.user.id].concat(ChatMessage.getWhisperRecipients('GM')),
|
||||||
content: await renderTemplate('systems/fvtt-pegasus-rpg/templates/chat-create-actor.html', formData)
|
content: await renderTemplate('systems/fvtt-pegasus-rpg/templates/chat-create-actor.html', formData)
|
||||||
};
|
};
|
||||||
//console.log("Apply damage chat", chatData );
|
//console.log("Apply damage chat", chatData );
|
||||||
await ChatMessage.create( chatData );
|
await ChatMessage.create(chatData);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------- -------------------- --------- */
|
/* --------------- -------------------- --------- */
|
||||||
manageRacePerks(race) {
|
manageRacePerks(race) {
|
||||||
if ( !this.currentRace.data.perksgained ) {
|
if (!this.currentRace.system.perksgained) {
|
||||||
this.showRoles()
|
this.showRoles()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ( !this.racePerks) { // First init
|
if (!this.racePerks) { // First init
|
||||||
if ( this.currentRace.data.perksall) {
|
if (this.currentRace.system.perksall) {
|
||||||
this.racePerks = duplicate(this.perks)
|
this.racePerks = duplicate(this.perks)
|
||||||
} else {
|
} 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")
|
let formData = this.createFormData("select-race-perks")
|
||||||
formData.raceperks = this.racePerks;
|
formData.raceperks = this.racePerks;
|
||||||
formData.nbraceperks = this.nbRacePerks;
|
formData.raceperks.sort( function compare(a, b) { if (a.name<b.name){ return -1}else{return 1}} )
|
||||||
|
formData.nbraceperks = this.nbRacePerks;
|
||||||
this.renderChatMessage(formData)
|
this.renderChatMessage(formData)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------- -------------------- --------- */
|
/* --------------- -------------------- --------- */
|
||||||
async processSelectableStats() {
|
async processSelectableStats() {
|
||||||
// End of race options choice
|
// End of race options choice
|
||||||
if ( this.raceSelectableStats.numberstats == 0) {
|
if (this.raceSelectableStats.numberstats == 0) {
|
||||||
this.manageRacePerks();
|
this.manageRacePerks();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let formData = this.createFormData("select-race-stats")
|
let formData = this.createFormData("select-race-stats")
|
||||||
let chatData = {
|
let chatData = {
|
||||||
user: game.user.id,
|
user: game.user.id,
|
||||||
alias : this.actor.name,
|
alias: this.actor.name,
|
||||||
rollMode: game.settings.get("core", "rollMode"),
|
rollMode: game.settings.get("core", "rollMode"),
|
||||||
whisper: [game.user.id].concat( ChatMessage.getWhisperRecipients('GM') ),
|
whisper: [game.user.id].concat(ChatMessage.getWhisperRecipients('GM')),
|
||||||
content: await renderTemplate('systems/fvtt-pegasus-rpg/templates/chat-create-actor.html', formData)
|
content: await renderTemplate('systems/fvtt-pegasus-rpg/templates/chat-create-actor.html', formData)
|
||||||
};
|
};
|
||||||
//console.log("Apply damage chat", chatData );
|
//console.log("Apply damage chat", chatData );
|
||||||
await ChatMessage.create( chatData );
|
await ChatMessage.create(chatData);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------- ----------------------------- */
|
/* --------------- ----------------------------- */
|
||||||
manageOptionnalAbilities( race) {
|
manageOptionnalAbilities(race) {
|
||||||
this.raceOptionnalAbilities = {
|
this.raceOptionnalAbilities = {
|
||||||
"nboptionnal": race.data.nboptionnal,
|
"nboptionnal": race.system.nboptionnal,
|
||||||
"optionnalabilities": duplicate(race.data.optionnalabilities),
|
"optionnalabilities": duplicate(race.system.optionnalabilities),
|
||||||
}
|
}
|
||||||
this.processOptionnalAbilitiesStep()
|
this.processOptionnalAbilitiesStep()
|
||||||
}
|
}
|
||||||
@ -309,76 +500,234 @@ export class PegasusActorCreate {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async processOptionnalAbilitiesStep() {
|
async processOptionnalAbilitiesStep() {
|
||||||
// End of race options choice
|
// End of race options choice
|
||||||
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.system.perksgained) {
|
} else if (this.currentRace.system.perksgained) {
|
||||||
this.manageRacePerks(this.currentRace);
|
this.manageRacePerks(this.currentRace);
|
||||||
} else {
|
} else {
|
||||||
this.showRoles()
|
this.showRoles()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let formData = this.createFormData("select-race-optionnal")
|
let formData = this.createFormData("select-race-optionnal")
|
||||||
this.renderChatMessage( formData)
|
this.renderChatMessage(formData)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async showRaces() {
|
async showRaces() {
|
||||||
let formData = this.createFormData("select-race")
|
let formData = this.createFormData("select-race")
|
||||||
this.renderChatMessage( formData)
|
this.renderChatMessage(formData)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async showRoles() {
|
async showRoles() {
|
||||||
let formData = this.createFormData("select-role")
|
let formData = this.createFormData("select-role")
|
||||||
this.renderChatMessage( formData)
|
this.renderChatMessage(formData)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------- ------------- */
|
/* ------------------------------- ------------- */
|
||||||
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)
|
|
||||||
//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)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------- ------------- */
|
/* ------------------------------- ------------- */
|
||||||
async showRoleStat( ) {
|
async showRoleStat() {
|
||||||
let formData = this.createFormData("select-role-stat")
|
let formData = this.createFormData("select-role-stat")
|
||||||
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.system.statistics[stat.name.toLowerCase()]) )
|
let actorStat = this.actor.system.statistics[stat.name.toLowerCase()]
|
||||||
|
if ( actorStat.value < 5) { // Only below D12
|
||||||
|
formData.rolestats.push(duplicate(actorStat))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//console.log("STAT", this.roleStats, formData)
|
//console.log("STAT", this.roleStats, formData)
|
||||||
this.renderChatMessage( formData)
|
this.renderChatMessage(formData)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
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
|
||||||
}
|
}
|
||||||
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.value < 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 = {}
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
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)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -386,7 +735,7 @@ export class PegasusActorCreate {
|
|||||||
await this.actor.computeNRGHealth()
|
await this.actor.computeNRGHealth()
|
||||||
this.actor.computeValue = false // To force value computation
|
this.actor.computeValue = false // To force value computation
|
||||||
let formData = this.createFormData("character-end")
|
let formData = this.createFormData("character-end")
|
||||||
this.renderChatMessage( formData)
|
this.renderChatMessage(formData)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
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.1",
|
||||||
"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.1.zip",
|
||||||
"background": "systems/fvtt-pegasus-rpg/images/ui/pegasus_welcome_page.webp"
|
"background": "systems/fvtt-pegasus-rpg/images/ui/pegasus_welcome_page.webp"
|
||||||
}
|
}
|
@ -168,6 +168,22 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<ul class="stat-list alternate-list">
|
||||||
|
<li class="item flexrow list-item items-title-bg">
|
||||||
|
<span class="item-name-label-header-long">
|
||||||
|
<h3><label class="items-title-text">Status Thresholds</label></h3>
|
||||||
|
</span>
|
||||||
|
<span class="item-name-label-header-long">
|
||||||
|
<label class="items-title-text">Madness Threshold (MT): {{mt}}</label>
|
||||||
|
</span>
|
||||||
|
<span class="item-name-label-header-long">
|
||||||
|
<label class="items-title-text">Knock Back Value (KBV): {{kbv}}</label>
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<ul class="stat-list alternate-list">
|
<ul class="stat-list alternate-list">
|
||||||
<li class="item flexrow list-item items-title-bg">
|
<li class="item flexrow list-item items-title-bg">
|
||||||
@ -410,7 +426,7 @@
|
|||||||
<h4>Power Purchase Points (PPP)</h4>
|
<h4>Power Purchase Points (PPP)</h4>
|
||||||
</span>
|
</span>
|
||||||
<span class="small-label padd-right packed-left">Available PPP</span><input type="text"
|
<span class="small-label padd-right packed-left">Available PPP</span><input type="text"
|
||||||
class="padd-right input-numeric-short" name="system.ppp.available" value="{{data.ppp.available}}"
|
class="padd-right input-numeric-short" name="system.ppp.availablePPP" value="{{data.ppp.availablePPP}}"
|
||||||
data-dtype="Number" />
|
data-dtype="Number" />
|
||||||
|
|
||||||
<span class="small-label padd-right packed-left">Spent PPP</span><input type="text"
|
<span class="small-label padd-right packed-left">Spent PPP</span><input type="text"
|
||||||
|
@ -134,9 +134,115 @@
|
|||||||
</table>
|
</table>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if (eq step "character-end")}}
|
{{#if (eq step "select-global-spec")}}
|
||||||
<div>Follow the next steps from the rulebook page 50 !. You can now spend 150 CDPs to customise your character.
|
<div>Now select a Specialisation at +1DT.
|
||||||
</div>
|
</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")}}
|
||||||
|
<div>
|
||||||
|
Choose Starting Gear, Worst Fear, Desires, Catchphrase & Catchphrase Trigger and fill in the empty fields in the Bio Tab. Lastly, make sure any UPGRADED (Level 2+) Perks and Perk Effects have been updated according to the rules. <br>
|
||||||
|
Games Masters May have to create new Effects and attach to the Perk Items in some cases.
|
||||||
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,24 +0,0 @@
|
|||||||
{{#if (eq traumaState "none")}}
|
|
||||||
<div class="flexrow">
|
|
||||||
<span class="roll-dialog-label" >Bonus Dice : </span>
|
|
||||||
<select class="roll-dialog-label" id="bonusDicesLevel" type="text" name="bonusDicesLevel" value="{{bonusDicesLevel}}" data-dtype="Number">
|
|
||||||
{{#select bonusDicesLevel}}
|
|
||||||
{{{optionsDiceList}}}
|
|
||||||
{{/select}}
|
|
||||||
</select>
|
|
||||||
<span class="small-label"> </span>
|
|
||||||
</div>
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{#if isInit}}
|
|
||||||
{{else}}
|
|
||||||
<div class="flexrow">
|
|
||||||
<span class="roll-dialog-label" >Hindrance Dice :</span>
|
|
||||||
<select class="roll-dialog-label" id="hindranceDicesLevel" type="text" name="hindranceDicesLevel" value="{{hindranceDicesLevel}}" data-dtype="Number">
|
|
||||||
{{#select hindranceDicesLevel}}
|
|
||||||
{{{optionsDiceList}}}
|
|
||||||
{{/select}}
|
|
||||||
</select>
|
|
||||||
<span class="small-label"> </span>
|
|
||||||
</div>
|
|
||||||
{{/if}}
|
|
@ -82,7 +82,7 @@
|
|||||||
<li class="flexrow"><label class="generic-label">No perks allowed ?</label>
|
<li class="flexrow"><label class="generic-label">No perks allowed ?</label>
|
||||||
<label class="attribute-value checkbox"><input type="checkbox" name="system.noperksallowed" {{checked data.noperksallowed}}/></label>
|
<label class="attribute-value checkbox"><input type="checkbox" name="system.noperksallowed" {{checked data.noperksallowed}}/></label>
|
||||||
</li>
|
</li>
|
||||||
<li class="flexrow"><label class="generic-label">Locked (Only GM can change/edit) ?</label>
|
<li class="flexrow"><label class="generic-label">Permanent/Locked (Only GM can change/edit) ?</label>
|
||||||
<label class="attribute-value checkbox"><input type="checkbox" name="system.locked" {{checked data.locked}}/></label>
|
<label class="attribute-value checkbox"><input type="checkbox" name="system.locked" {{checked data.locked}}/></label>
|
||||||
</li>
|
</li>
|
||||||
<li class="flexrow"><label class="generic-label">Display Text when added to Actor</label>
|
<li class="flexrow"><label class="generic-label">Display Text when added to Actor</label>
|
||||||
|
@ -142,6 +142,7 @@
|
|||||||
<option value="none5">===== Other Circumstances</option>
|
<option value="none5">===== Other Circumstances</option>
|
||||||
<option value="d4">Concentrated<option>
|
<option value="d4">Concentrated<option>
|
||||||
<option value="d4">Off Hand d4<option>
|
<option value="d4">Off Hand d4<option>
|
||||||
|
<option value="d6">Higher Ground d6</option>
|
||||||
{{/select}}
|
{{/select}}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user