Minor changes

This commit is contained in:
LeRatierBretonnien 2023-09-14 21:03:08 +02:00
parent 47db569efd
commit 2394026d0c
5 changed files with 55 additions and 12 deletions

View File

@ -2057,7 +2057,7 @@ export class PegasusActor extends Actor {
if (statKey == 'phy' && subKey == "dmg-res") {
let armors = this.getArmors()
for (let armor of armors) {
rollData.armorsList.push({ label: `Armor ${armor.name}`, type: "armor", applied: false, value: armor.system.resistance })
rollData.armorsList.push({ label: `Armor ${armor.name}`, type: "armor", applied: false, value: armor.system.resistance, adrl:armor.system.adrl })
}
}
if (useShield) {

View File

@ -19,6 +19,11 @@ export class PegasusCombatTracker extends CombatTracker {
let combatantId = $(ev.currentTarget).data("combatant-id")
game.combat.revealTIC(ticNum, combatantId)
})
html.find('.reset-npc-initiative').click(ev => {
game.combat.resetNPCInitiative()
})
}
}
@ -39,6 +44,15 @@ export class PegasusCombat extends Combat {
return this;
}
/* -------------------------------------------- */
async resetNPCInitiative() {
for(let c of this.combatants) {
if (c.actor && c.actor.type == "npc") {
await this.updateEmbeddedDocuments("Combatant", [{ _id: c.id, initiative: -1 }]);
}
}
}
/* -------------------------------------------- */
isCharacter(combatantId) {
const combatant = game.combat.combatants.get(combatantId)
@ -50,7 +64,7 @@ export class PegasusCombat extends Combat {
/* -------------------------------------------- */
async setTic(combatantId, rollData) {
if ( !combatantId) {
if (!combatantId) {
return
}
const combatant = game.combat.combatants.get(combatantId)
@ -62,25 +76,35 @@ export class PegasusCombat extends Combat {
/* -------------------------------------------- */
getTIC(num, combatantId) {
if ( !combatantId) {
if (!combatantId) {
return ""
}
const combatant = game.combat.combatants.get(combatantId)
if (combatant) {
let ticData = combatant.getFlag("world", "tic" + num)
if (ticData) {
let ticText = "TIC" + num + ":" + ticData.text
let ticText = "ACTED"
/* returns if revealed or if GM and NPC or if player and owner */
if (ticData.revealed || (game.user.isGM && combatant.isNPC) || (!game.user.isGM && combatant.isOwner)) {
if (ticData.revealed && !ticData.displayed) {
ticData.displayed = true
combatant.setFlag("world", "tic" + num, ticData )
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} is performing ${ticData.text}</div`
};
ChatMessage.create(chatData);
return ticText
}
}
}
return "TIC" + num + ":???"
return "TIC" + num
}
/* -------------------------------------------- */
async revealTIC(num, combatantId) {
if ( !num || !combatantId) {
if (!num || !combatantId) {
return
}
const combatant = game.combat.combatants.get(combatantId)
@ -92,6 +116,13 @@ export class PegasusCombat extends Combat {
}
}
}
/* -------------------------------------------- */
nextRound() {
for(let c of this.combatants) {
c.setFlag("world", "tic1", { revealed: false, text: "", displayed: false })
}
super.nextRound()
}
/* -------------------------------------------- */
_onUpdate(changed, options, userId) {

View File

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

View File

@ -52,6 +52,15 @@
{{/if}}
{{/if}}
{{#if (eq subKey "dmg-res")}}
<li>Damage Resistance</li>
{{#each armorsList as |armor idx|}}
{{#if armor.applied}}
<li>ADRL: {{armor.adrl}}</li>
{{/if}}
{{/each}}
{{/if}}
{{#if power}}
<li>Power Damage type : {{power.system.powerdamagetype}} {{power.system.powerdamagetypelevel}}</li>
{{/if}}

View File

@ -30,7 +30,10 @@
<a class="combat-button combat-control" aria-label="{{localize 'COMBAT.RollNPC'}}" role="button" data-tooltip="COMBAT.RollNPC" data-control="rollNPC" {{#unless turns}}disabled{{/unless}}>
<i class="fas fa-users-cog"></i>
</a>
{{/if}}
<a class="combat-button reset-npc-initiative" aria-label="Reset NPC" role="button" data-tooltip="Reset NPC Initiative" data-control="resetNPC" {{#unless turns}}disabled{{/unless}}>
<i class="fas fa-pickaxe"></i>
</a>
{{/if}}
{{#if combatCount}}
{{#if combat.round}}