Varioux fixes

This commit is contained in:
LeRatierBretonnien 2023-09-16 20:31:34 +02:00
parent 9e92b904fb
commit d1fdc5a97f
4 changed files with 44 additions and 11 deletions

View File

@ -771,6 +771,11 @@ export class PegasusActor extends Actor {
let myself = this
let combat = duplicate(myself.system.combat)
combat.stunlevel += incDec
let daze = this.effects.find( e => e.label == "Daze")
if (daze && combat.stunlevel == 0) {
this.deleteEmbeddedDocuments("ActiveEffect", [ daze.id ] )
}
if (combat.stunlevel >= 0) {
myself.update({ 'system.combat': combat })
let chatData = {
@ -778,10 +783,11 @@ 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 (!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`
} else {
@ -805,7 +811,7 @@ export class PegasusActor extends Actor {
/* -------------------------------------------- */
modifyMomentum(incDec) {
if ( this.system.stun.value > 0 ) {
if ( this.system.combat.stunlevel > 0 ) {
ui.notifications.warn("Unable to gain/use Momentum while stunned")
return
}

View File

@ -16,6 +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)
let TICs = c.getFlag("world", "TICs")
if (TICs) {
t.TICs = TICs
@ -23,7 +24,7 @@ export class PegasusCombatTracker extends CombatTracker {
t.TICs = []
}
}
console.log("CBT", combatData)
//console.log("CBT", combatData)
return combatData
}
@ -88,13 +89,24 @@ export class PegasusCombat extends Combat {
selectActor(combatantId) {
const combatant = game.combat.combatants.get(combatantId)
if (combatant) {
let TICs = combatant.getFlag("world", "TICs") || []
let allRevealed = true
for(let tic of TICs) {
if (!tic.revealed ) {
allRevealed = false
}
}
let msg = `<div>${combatant.actor.name} has been nominated to act, ${combatant.actor.name} choose which TIC you wish to activate!</div`
if ( allRevealed) {
msg = `<div>${combatant.actor.name} has used all its TIC's please choose a different character.</div`
}
let chatData = {
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} has been nominated to act, ${combatant.actor.name} choose which TIC you wish to activate!</div`
}
content: msg
}
ChatMessage.create(chatData);
}
}
@ -123,6 +135,17 @@ export class PegasusCombat extends Combat {
if (ticData) {
console.log('revealTIC', num, combatantId, ticData)
num = Number(num)
if ( ticData[num].revealed && ticData[num].displayed ) {
let chatData = {
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} : This Action has already been performed please choose a different TIC</div`
};
ChatMessage.create(chatData);
return
}
ticData[num].revealed = true
ticData[num].displayed = true
combatant.setFlag("world", "TICs", ticData).then(() => {

View File

@ -252,7 +252,7 @@
],
"title": "Pegasus RPG",
"url": "https://www.uberwald.me/data/files/fvtt-pegasus-rpg",
"version": "11.0.11",
"download": "https://www.uberwald.me/gitea/uberwald/fvtt-pegasus-rpg/archive/fvtt-pegasus-rpg-v11.0.11.zip",
"version": "11.0.12",
"download": "https://www.uberwald.me/gitea/uberwald/fvtt-pegasus-rpg/archive/fvtt-pegasus-rpg-v11.0.12.zip",
"background": "systems/fvtt-pegasus-rpg/images/ui/pegasus_welcome_page.webp"
}

View File

@ -101,7 +101,11 @@
{{#if tic.revealed}}
ACTED
{{else}}
TIC: {{add index 1}}
{{#if ../displayTIC}}
{{tic.text}}
{{else}}
TIC: {{add index 1}}
{{/if}}
{{/if}}
</a></button>
{{/each}}