Compare commits
8 Commits
fvtt-pegas
...
fvtt-pegas
Author | SHA1 | Date | |
---|---|---|---|
bbf0f31d4c | |||
552ff9564a | |||
26f2fba457 | |||
7d6408f6b7 | |||
72ff709682 | |||
588c6655b3 | |||
9de2bc48b8 | |||
460fd1f0d6 |
@ -495,7 +495,7 @@ export class PegasusActor extends Actor {
|
||||
/* -------------------------------------------- */
|
||||
async activateViceOrVirtue(itemId) {
|
||||
let item = this.items.find(item => item.id == itemId)
|
||||
if (item && item.system) {
|
||||
if (item?.system) {
|
||||
let nrg = duplicate(this.system.nrg)
|
||||
if (!item.system.activated) { // Current value
|
||||
|
||||
@ -581,7 +581,7 @@ export class PegasusActor extends Actor {
|
||||
/* -------------------------------------------- */
|
||||
async activatePower(itemId) {
|
||||
let item = this.items.find(item => item.id == itemId)
|
||||
if (item && item.system) {
|
||||
if (item?.system) {
|
||||
|
||||
let nrg = duplicate(this.system.nrg)
|
||||
if (!item.system.activated) { // Current value
|
||||
@ -764,17 +764,17 @@ export class PegasusActor extends Actor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
modifyStun(incDec) {
|
||||
if ( incDec < 0 && (this.system.secondary.confidence.status == "anxious" || this.system.secondary.confidence.status == "lostface") ) {
|
||||
if (incDec < 0 && (this.system.secondary.confidence.status == "anxious" || this.system.secondary.confidence.status == "lostface")) {
|
||||
ui.notifications.warn("Unable to recover STUN because of Confidence status : " + this.system.secondary.confidence.status)
|
||||
return
|
||||
}
|
||||
let myself = this
|
||||
let combat = duplicate(myself.system.combat)
|
||||
combat.stunlevel += incDec
|
||||
let daze = this.effects.find( e => e.label == "Daze")
|
||||
let daze = this.effects.find(e => e.label == "Daze")
|
||||
|
||||
if (daze && combat.stunlevel == 0) {
|
||||
this.deleteEmbeddedDocuments("ActiveEffect", [ daze.id ] )
|
||||
this.deleteEmbeddedDocuments("ActiveEffect", [daze.id])
|
||||
}
|
||||
if (combat.stunlevel >= 0) {
|
||||
myself.update({ 'system.combat': combat })
|
||||
@ -786,7 +786,7 @@ export class PegasusActor extends Actor {
|
||||
if (!daze) {
|
||||
this.createEmbeddedDocuments("ActiveEffect", [
|
||||
{ label: 'Daze', icon: 'icons/svg/daze.svg', flags: { core: { statusId: 'daze' } } }
|
||||
])
|
||||
])
|
||||
}
|
||||
if (incDec > 0) {
|
||||
chatData.content = `<div>${this.name} suffered a Stun level.</div`
|
||||
@ -811,7 +811,7 @@ export class PegasusActor extends Actor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
modifyMomentum(incDec) {
|
||||
if ( this.system.combat.stunlevel > 0 ) {
|
||||
if (this.system.combat.stunlevel > 0) {
|
||||
ui.notifications.warn("Unable to gain/use Momentum while stunned")
|
||||
return
|
||||
}
|
||||
@ -1467,7 +1467,7 @@ export class PegasusActor extends Actor {
|
||||
updates['system.momentum.max'] = momentum
|
||||
}
|
||||
|
||||
let mrLevel = (this.system.statistics.agi.value + this.system.statistics.str.value) - this.system.statistics.phy.value
|
||||
let mrLevel = (this.system.statistics.agi.value + this.system.statistics.agi.mod + this.system.statistics.str.value + this.system.statistics.str.mod) - (this.system.statistics.phy.value + this.system.statistics.phy.mod)
|
||||
mrLevel = (mrLevel < 1) ? 1 : mrLevel;
|
||||
if (mrLevel != this.system.mr.value) {
|
||||
updates['system.mr.value'] = mrLevel
|
||||
@ -1517,6 +1517,11 @@ export class PegasusActor extends Actor {
|
||||
let effect = await PegasusUtility.getEffectFromCompendium("Fear")
|
||||
this.createEmbeddedDocuments('Item', [effect])
|
||||
}
|
||||
} else { // Remove fear if healed
|
||||
let fear = this.items.find(it => it.name.toLowerCase() == "fear" && it.type == "effect")
|
||||
if (fear) {
|
||||
this.deleteEmbeddedDocuments('Item', [fear.id])
|
||||
}
|
||||
}
|
||||
/* Manage flag state for status */
|
||||
this.defeatedDisplayed = this.defeatedDisplayed && this.system.secondary.health.status != "defeated"
|
||||
@ -1573,9 +1578,11 @@ export class PegasusActor extends Actor {
|
||||
for (let e of effects) {
|
||||
meleeBonus += Number(e.system.effectlevel)
|
||||
}
|
||||
this.baseMDL = this.system.biodata.sizenum + this.system.biodata.sizebonus + this.system.statistics.str.value +
|
||||
this.system.statistics.str.mod + this.system.statistics.str.bonuseffect + meleeBonus
|
||||
let weaponsMelee = this.items.filter(it => it.type == "weapon" && it.system.damagestatistic.toLowerCase() == "str")
|
||||
for (let w of weaponsMelee) {
|
||||
let damage = Number(w.system.damage) + this.system.biodata.sizenum + this.system.biodata.sizebonus + this.system.statistics.str.value + this.system.statistics.str.bonuseffect + meleeBonus
|
||||
let damage = this.baseMDL + Number(w.system.damage)
|
||||
if (damage != w.system.mdl) {
|
||||
updates.push({ _id: w.id, "system.mdl": damage })
|
||||
}
|
||||
@ -1589,9 +1596,10 @@ export class PegasusActor extends Actor {
|
||||
if (role?.name?.toLowerCase() == "ranged") { // Add ranged bonus to ADRL
|
||||
roleBonus = this.getRoleLevel()
|
||||
}
|
||||
this.baseRDL = roleBonus + rangedBonus
|
||||
let weaponsRanged = this.items.filter(it => it.type == "weapon" && it.system.damagestatistic.toLowerCase() == "pre")
|
||||
for (let w of weaponsRanged) {
|
||||
let damage = roleBonus + Number(w.system.damage) + rangedBonus
|
||||
let damage = this.baseRDL + Number(w.system.damage)
|
||||
if (damage != w.system.rdl) {
|
||||
updates.push({ _id: w.id, "system.rdl": damage })
|
||||
}
|
||||
@ -1606,9 +1614,11 @@ export class PegasusActor extends Actor {
|
||||
if (role?.name?.toLowerCase() == "defender") { // Add defender bonus to ADRL
|
||||
roleBonus = this.getRoleLevel()
|
||||
}
|
||||
this.baseADRL = roleBonus + armorBonus + this.system.statistics.phy.value + this.system.statistics.phy.mod +
|
||||
this.system.statistics.phy.bonuseffect + this.system.biodata.sizenum + this.system.biodata.sizebonus
|
||||
let armors = this.items.filter(it => it.type == "armor")
|
||||
for (let a of armors) {
|
||||
let adrl = roleBonus + this.system.statistics.phy.value + this.system.statistics.phy.bonuseffect + this.system.biodata.sizenum + this.system.biodata.sizebonus + a.system.resistance + armorBonus
|
||||
let adrl = this.baseADRL + a.system.resistance
|
||||
if (adrl != a.system.adrl) {
|
||||
updates.push({ _id: a.id, "system.adrl": adrl })
|
||||
}
|
||||
@ -1618,7 +1628,10 @@ export class PegasusActor extends Actor {
|
||||
this.updateEmbeddedDocuments('Item', updates)
|
||||
}
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
getBaseADRL() {
|
||||
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
parseStatEffects() {
|
||||
if (this.system.biodata.noautobonus) { // If we are in "no-bonus mode
|
||||
@ -1911,6 +1924,18 @@ export class PegasusActor extends Actor {
|
||||
await this.createEmbeddedDocuments('Item', newItems)
|
||||
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
checkEFfectsHindranceDeletion(statKey) {
|
||||
let toRem = []
|
||||
let effects = this.items.filter(effect => effect.type == 'effect' && effect.system.oneuse &&
|
||||
effect.system.hindrance && (effect.system.stataffected == statKey || effect.system.stataffected == "all"))
|
||||
for (let effect of effects) {
|
||||
toRem.push(effect.id)
|
||||
}
|
||||
if (toRem.length > 0) {
|
||||
this.deleteEmbeddedDocuments('Item', toRem)
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
computeCurrentHindrances(statKey) {
|
||||
@ -1922,11 +1947,9 @@ export class PegasusActor extends Actor {
|
||||
if (overCapacity > 0) {
|
||||
hindrancesDices += overCapacity
|
||||
}
|
||||
let effects = this.items.filter(item => item.type == 'effect')
|
||||
let effects = this.items.filter(effect => effect.type == 'effect' && effect.system.hindrance && (effect.system.stataffected == statKey || effect.system.stataffected == "all"))
|
||||
for (let effect of effects) {
|
||||
if (effect.system.hindrance) {
|
||||
hindrancesDices += effect.system.effectlevel
|
||||
}
|
||||
hindrancesDices += effect.system.effectlevel
|
||||
}
|
||||
if (statKey.toLowerCase() == "stl" && this.system.secondary.concealment.status == "exposed") {
|
||||
hindrancesDices += 1
|
||||
@ -2145,6 +2168,8 @@ export class PegasusActor extends Actor {
|
||||
rollData.noBonusDice = this.checkNoBonusDice()
|
||||
rollData.dicePool = []
|
||||
rollData.subKey = subKey
|
||||
rollData.MDL = this.baseMDL
|
||||
rollData.ADRL = this.baseADRL
|
||||
|
||||
if (subKey == "melee-dmg" || subKey == "ranged-dmg" || subKey == "power-dmg") {
|
||||
rollData.isDamage = true
|
||||
@ -2279,7 +2304,7 @@ export class PegasusActor extends Actor {
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
getExtraTICsFromEffect() {
|
||||
let effects = this.items.filter(it => it.type == "effect" && Number(it.system.extratics)>0)
|
||||
let effects = this.items.filter(it => it.type == "effect" && Number(it.system.extratics) > 0)
|
||||
let nbTics = 0
|
||||
for (let e of effects) {
|
||||
nbTics += Number(e.system.extratics)
|
||||
@ -2408,8 +2433,8 @@ export class PegasusActor extends Actor {
|
||||
rollData.title = "MR / Initiative"
|
||||
rollData.nbTIC = ((this.type == "character") ? 2 : 1) + this.getExtraTICsFromEffect()
|
||||
rollData.TICs = []
|
||||
for(let i=0; i<rollData.nbTIC; i++) {
|
||||
rollData.TICs.push( {text:"NONE", revealed: false, displayed: false})
|
||||
for (let i = 0; i < rollData.nbTIC; i++) {
|
||||
rollData.TICs.push({ text: "NONE", revealed: false, displayed: false })
|
||||
}
|
||||
}
|
||||
this.startRoll(rollData);
|
||||
|
@ -16,7 +16,7 @@ export class PegasusCombatTracker extends CombatTracker {
|
||||
let combatData = await super.getData()
|
||||
for (let t of combatData.turns) {
|
||||
let c = game.combat.combatants.get(t.id)
|
||||
t.displayTIC = (c.actor.isOwner && c.actor.hasPlayerOwner) || (c.actor.type == "npc" && game.user.isGM)
|
||||
t.displayTIC = (c.actor.isOwner && c.actor.hasPlayerOwner && !game.user.isGM) || (c.actor.type == "npc" && !c.actor.hasPlayerOwner && game.user.isGM)
|
||||
let TICs = c.getFlag("world", "TICs")
|
||||
if (TICs) {
|
||||
t.TICs = TICs
|
||||
@ -104,7 +104,6 @@ export class PegasusCombat extends Combat {
|
||||
user: game.user.id,
|
||||
alias: combatant.actor.name,
|
||||
rollMode: game.settings.get("core", "rollMode"),
|
||||
whisper: [game.user.id].concat(ChatMessage.getWhisperRecipients('GM')),
|
||||
content: msg
|
||||
}
|
||||
ChatMessage.create(chatData);
|
||||
@ -153,7 +152,6 @@ export class PegasusCombat extends Combat {
|
||||
user: game.user.id,
|
||||
alias: combatant.actor.name,
|
||||
rollMode: game.settings.get("core", "rollMode"),
|
||||
whisper: [game.user.id].concat(ChatMessage.getWhisperRecipients('GM')),
|
||||
content: `<div>${combatant.actor.name} is performing ${ticData[num].text}</div`
|
||||
};
|
||||
ChatMessage.create(chatData);
|
||||
|
@ -104,6 +104,12 @@ export class PegasusRollDialog extends Dialog {
|
||||
if (armor) {
|
||||
armor.applied = toggled
|
||||
}
|
||||
this.rollData.armorUsed = false
|
||||
for(let a of this.rollData.armorsList) {
|
||||
if (a.applied) {
|
||||
this.rollData.armorUsed = true
|
||||
}
|
||||
}
|
||||
console.log("Armor", armorIdx, toggled)
|
||||
PegasusUtility.updateArmorDicePool(this.rollData)
|
||||
}
|
||||
@ -120,6 +126,12 @@ export class PegasusRollDialog extends Dialog {
|
||||
}
|
||||
weapon.applied = toggled
|
||||
}
|
||||
this.rollData.weaponUsed = false
|
||||
for(let a of this.rollData.weaponsList) {
|
||||
if (a.applied) {
|
||||
this.rollData.weaponUsed = true
|
||||
}
|
||||
}
|
||||
console.log("Weapon", weaponIdx, toggled, weapon)
|
||||
PegasusUtility.updateDamageDicePool(this.rollData)
|
||||
}
|
||||
|
@ -787,7 +787,7 @@ export class PegasusUtility {
|
||||
// De-actived used effects from perks
|
||||
let toRem = []
|
||||
for (let effect of rollData.effectsList) {
|
||||
if (effect.effect && effect.effect.system.isUsed && effect.effect.system.oneuse) {
|
||||
if (effect?.effect?.system.isUsed && effect.effect.system.oneuse) {
|
||||
effect.defenderTokenId = rollData.defenderTokenId
|
||||
if (effect.foreign) {
|
||||
if (game.user.isGM) {
|
||||
@ -801,11 +801,11 @@ export class PegasusUtility {
|
||||
}
|
||||
}
|
||||
}
|
||||
let actor = game.actors.get(rollData.actorId)
|
||||
if (toRem.length > 0) {
|
||||
//console.log("Going to remove one use effects", toRem)
|
||||
let actor = game.actors.get(rollData.actorId)
|
||||
actor.deleteEmbeddedDocuments('Item', toRem)
|
||||
}
|
||||
actor.checkEFfectsHindranceDeletion(rollData.statKey)
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
@ -244,15 +244,15 @@
|
||||
"flags": {}
|
||||
}
|
||||
],
|
||||
"primaryTokenAttribute": "secondary.health.status",
|
||||
"secondaryTokenAttribute": "secondary.delirium.status",
|
||||
"primaryTokenAttribute": "",
|
||||
"secondaryTokenAttribute": "",
|
||||
"socket": true,
|
||||
"styles": [
|
||||
"styles/simple.css"
|
||||
],
|
||||
"title": "Pegasus RPG",
|
||||
"url": "https://www.uberwald.me/data/files/fvtt-pegasus-rpg",
|
||||
"version": "11.0.13",
|
||||
"download": "https://www.uberwald.me/gitea/uberwald/fvtt-pegasus-rpg/archive/fvtt-pegasus-rpg-v11.0.13.zip",
|
||||
"version": "11.0.21",
|
||||
"download": "https://www.uberwald.me/gitea/uberwald/fvtt-pegasus-rpg/archive/fvtt-pegasus-rpg-v11.0.21.zip",
|
||||
"background": "systems/fvtt-pegasus-rpg/images/ui/pegasus_welcome_page.webp"
|
||||
}
|
@ -57,7 +57,16 @@
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
{{#if (eq subKey "melee-dmg")}}
|
||||
{{#if (not weaponUsed)}}
|
||||
<li>MDL : {{MDL}}</li>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
{{#if (eq subKey "dmg-res")}}
|
||||
{{#if (not armorUsed)}}
|
||||
<li>ADRL : {{ADRL}}</li>
|
||||
{{/if}}
|
||||
{{#each armorsList as |armor idx|}}
|
||||
{{#if armor.applied}}
|
||||
<li>ADRL: {{armor.adrl}}</li>
|
||||
|
Reference in New Issue
Block a user