Combat tracker enhancements

This commit is contained in:
2023-09-16 10:16:59 +02:00
parent ff57953e75
commit c4160b2fd5
14 changed files with 165 additions and 81 deletions

View File

@@ -778,6 +778,10 @@ export class PegasusActor extends Actor {
rollMode: game.settings.get("core", "rollMode"),
whisper: [game.user.id].concat(ChatMessage.getWhisperRecipients('GM'))
}
this.createEmbeddedDocuments("ActiveEffect", [
{ label: 'EFFECT.StatusDaze', icon: 'icons/svg/daze.svg', flags: { core: { statusId: 'daze' } } }
])
if (incDec > 0) {
chatData.content = `<div>${this.name} suffered a Stun level.</div`
} else {
@@ -801,6 +805,11 @@ export class PegasusActor extends Actor {
/* -------------------------------------------- */
modifyMomentum(incDec) {
if ( this.system.stun.value > 0 ) {
ui.notifications.warn("Unable to gain/use Momentum while stunned")
return
}
let momentum = duplicate(this.system.momentum)
momentum.value += incDec
this.update({ 'system.momentum': momentum })
@@ -1902,9 +1911,6 @@ export class PegasusActor extends Actor {
let hindrancesDices = 0
if (this.type == "character" || this.type == 'npc') {
if (this.system.combat.stunlevel > 0) {
hindrancesDices += 2
}
hindrancesDices += this.system.combat.hindrancedice
let overCapacity = Math.floor(this.encCurrent / this.getEncumbranceCapacity())
if (overCapacity > 0) {
@@ -1924,9 +1930,6 @@ export class PegasusActor extends Actor {
}
}
if (this.type == "vehicle") {
if (this.system.stun.value > 0) {
hindrancesDices += 2
}
if (this.isVehicleCrawling()) {
hindrancesDices += 3
}
@@ -2136,8 +2139,6 @@ export class PegasusActor extends Actor {
rollData.noBonusDice = this.checkNoBonusDice()
rollData.dicePool = []
rollData.subKey = subKey
rollData.tic1 = "NONE"
rollData.tic2 = "NONE"
if (subKey == "melee-dmg" || subKey == "ranged-dmg" || subKey == "power-dmg") {
rollData.isDamage = true
@@ -2270,6 +2271,15 @@ export class PegasusActor extends Actor {
}
}
}
/* -------------------------------------------- */
getExtraTICsFromEffect() {
let effects = this.items.filter(it => it.type == "effect" && Number(it.system.extratics)>0)
let nbTics = 0
for (let e of effects) {
nbTics += Number(it.system.extratics)
}
return nbTics
}
/* -------------------------------------------- */
getLevelRemainingList() {
@@ -2390,6 +2400,11 @@ export class PegasusActor extends Actor {
console.log("MR ROLL", rollData)
if (isInit) {
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})
}
}
this.startRoll(rollData);
} else {