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 myself = this
let combat = duplicate(myself.system.combat) let combat = duplicate(myself.system.combat)
combat.stunlevel += incDec 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) { if (combat.stunlevel >= 0) {
myself.update({ 'system.combat': combat }) myself.update({ 'system.combat': combat })
let chatData = { let chatData = {
@ -778,10 +783,11 @@ export class PegasusActor extends Actor {
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'))
} }
this.createEmbeddedDocuments("ActiveEffect", [ if (!daze) {
{ label: 'EFFECT.StatusDaze', icon: 'icons/svg/daze.svg', flags: { core: { statusId: 'daze' } } } this.createEmbeddedDocuments("ActiveEffect", [
]) { label: 'Daze', icon: 'icons/svg/daze.svg', flags: { core: { statusId: 'daze' } } }
])
}
if (incDec > 0) { if (incDec > 0) {
chatData.content = `<div>${this.name} suffered a Stun level.</div` chatData.content = `<div>${this.name} suffered a Stun level.</div`
} else { } else {
@ -805,7 +811,7 @@ export class PegasusActor extends Actor {
/* -------------------------------------------- */ /* -------------------------------------------- */
modifyMomentum(incDec) { modifyMomentum(incDec) {
if ( this.system.stun.value > 0 ) { if ( this.system.combat.stunlevel > 0 ) {
ui.notifications.warn("Unable to gain/use Momentum while stunned") ui.notifications.warn("Unable to gain/use Momentum while stunned")
return return
} }

View File

@ -16,6 +16,7 @@ export class PegasusCombatTracker extends CombatTracker {
let combatData = await super.getData() let combatData = await super.getData()
for (let t of combatData.turns) { for (let t of combatData.turns) {
let c = game.combat.combatants.get(t.id) 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") let TICs = c.getFlag("world", "TICs")
if (TICs) { if (TICs) {
t.TICs = TICs t.TICs = TICs
@ -23,7 +24,7 @@ export class PegasusCombatTracker extends CombatTracker {
t.TICs = [] t.TICs = []
} }
} }
console.log("CBT", combatData) //console.log("CBT", combatData)
return combatData return combatData
} }
@ -88,13 +89,24 @@ export class PegasusCombat extends Combat {
selectActor(combatantId) { selectActor(combatantId) {
const combatant = game.combat.combatants.get(combatantId) const combatant = game.combat.combatants.get(combatantId)
if (combatant) { 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 = { let chatData = {
user: game.user.id, user: game.user.id,
alias: combatant.actor.name, alias: combatant.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: `<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); ChatMessage.create(chatData);
} }
} }
@ -123,6 +135,17 @@ export class PegasusCombat extends Combat {
if (ticData) { if (ticData) {
console.log('revealTIC', num, combatantId, ticData) console.log('revealTIC', num, combatantId, ticData)
num = Number(num) 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].revealed = true
ticData[num].displayed = true ticData[num].displayed = true
combatant.setFlag("world", "TICs", ticData).then(() => { combatant.setFlag("world", "TICs", ticData).then(() => {

View File

@ -252,7 +252,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": "11.0.11", "version": "11.0.12",
"download": "https://www.uberwald.me/gitea/uberwald/fvtt-pegasus-rpg/archive/fvtt-pegasus-rpg-v11.0.11.zip", "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" "background": "systems/fvtt-pegasus-rpg/images/ui/pegasus_welcome_page.webp"
} }

View File

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