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") { if (statKey == 'phy' && subKey == "dmg-res") {
let armors = this.getArmors() let armors = this.getArmors()
for (let armor of armors) { 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) { if (useShield) {

View File

@ -19,6 +19,11 @@ export class PegasusCombatTracker extends CombatTracker {
let combatantId = $(ev.currentTarget).data("combatant-id") let combatantId = $(ev.currentTarget).data("combatant-id")
game.combat.revealTIC(ticNum, combatantId) game.combat.revealTIC(ticNum, combatantId)
}) })
html.find('.reset-npc-initiative').click(ev => {
game.combat.resetNPCInitiative()
})
} }
} }
@ -39,18 +44,27 @@ export class PegasusCombat extends Combat {
return this; 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) { isCharacter(combatantId) {
const combatant = game.combat.combatants.get(combatantId) const combatant = game.combat.combatants.get(combatantId)
if (combatant) { if (combatant) {
return combatant.actor.type == "character" return combatant.actor.type == "character"
} }
return false return false
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
async setTic(combatantId, rollData) { async setTic(combatantId, rollData) {
if ( !combatantId) { if (!combatantId) {
return return
} }
const combatant = game.combat.combatants.get(combatantId) const combatant = game.combat.combatants.get(combatantId)
@ -62,25 +76,35 @@ export class PegasusCombat extends Combat {
/* -------------------------------------------- */ /* -------------------------------------------- */
getTIC(num, combatantId) { getTIC(num, combatantId) {
if ( !combatantId) { if (!combatantId) {
return "" return ""
} }
const combatant = game.combat.combatants.get(combatantId) const combatant = game.combat.combatants.get(combatantId)
if (combatant) { if (combatant) {
let ticData = combatant.getFlag("world", "tic" + num) let ticData = combatant.getFlag("world", "tic" + num)
if (ticData) { if (ticData) {
let ticText = "TIC" + num + ":" + ticData.text let ticText = "ACTED"
/* returns if revealed or if GM and NPC or if player and owner */ /* 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 ticText
} }
} }
} }
return "TIC" + num + ":???" return "TIC" + num
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
async revealTIC(num, combatantId) { async revealTIC(num, combatantId) {
if ( !num || !combatantId) { if (!num || !combatantId) {
return return
} }
const combatant = game.combat.combatants.get(combatantId) const combatant = game.combat.combatants.get(combatantId)
@ -92,7 +116,14 @@ 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) { _onUpdate(changed, options, userId) {
} }

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.6", "version": "11.0.7",
"download": "https://www.uberwald.me/gitea/uberwald/fvtt-pegasus-rpg/archive/fvtt-pegasus-rpg-v11.0.6.zip", "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" "background": "systems/fvtt-pegasus-rpg/images/ui/pegasus_welcome_page.webp"
} }

View File

@ -51,6 +51,15 @@
<li>Damage type : {{weapon.weapon.system.damagetype}} {{weapon.weapon.system.damagetypelevel}}</li> <li>Damage type : {{weapon.weapon.system.damagetype}} {{weapon.weapon.system.damagetypelevel}}</li>
{{/if}} {{/if}}
{{/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}} {{#if power}}
<li>Power Damage type : {{power.system.powerdamagetype}} {{power.system.powerdamagetypelevel}}</li> <li>Power Damage type : {{power.system.powerdamagetype}} {{power.system.powerdamagetypelevel}}</li>

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}}> <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> <i class="fas fa-users-cog"></i>
</a> </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 combatCount}}
{{#if combat.round}} {{#if combat.round}}