Version 10.6.19 - La cerise de Pralinor #630

Merged
uberwald merged 4 commits from VincentVk/foundryvtt-reve-de-dragon:v10 into v10 2023-02-24 09:56:30 +01:00
5 changed files with 41 additions and 73 deletions

View File

@ -137,7 +137,13 @@ export class RdDBaseActorSheet extends ActorSheet {
this.html.find('.item-edit').click(async event => this.getItem(event)?.sheet.render(true))
this.html.find('.item-montrer').click(async event => this.getItem(event)?.postItemToChat());
this.html.find('.actor-montrer').click(async event => this.actor.postActorToChat());
this.html.find('.recherche')
.each((index, field) => {
this._rechercheSelectArea(field);
})
.keyup(async event => this._rechercherKeyup(event))
.change(async event => this._rechercherKeyup(event));
this.html.find('.recherche').prop( "disabled", false );
// Everything below here is only needed if the sheet is editable
if (!this.options.editable) return;
@ -160,12 +166,6 @@ export class RdDBaseActorSheet extends ActorSheet {
this.html.find('.monnaie-moins').click(async event => {
this.actor.monnaieIncDec(this.getItemId(event), -1);
});
this.html.find('.recherche')
.each((index, field) => {
this._rechercheSelectArea(field);
})
.keyup(async event => this._rechercherKeyup(event))
.change(async event => this._rechercherKeyup(event));
}
_rechercherKeyup(event) {

View File

@ -39,35 +39,31 @@ export class RdDCombatManager extends Combat {
static init() {
/* -------------------------------------------- */
Hooks.on("getCombatTrackerEntryContext", (html, options) => {
RdDCombatManager.pushInitiativeOptions(html, options);
});
Hooks.on("preDeleteCombat", (combat, html, id) => {
combat.onPreDeleteCombat()
});
}
/* -------------------------------------------- */
cleanItemUse() {
for (let turn of this.turns) {
turn.actor.resetItemUse()
}
Hooks.on("getCombatTrackerEntryContext", (html, options) => { RdDCombatManager.pushInitiativeOptions(html, options); });
Hooks.on("updateCombat", (combat, change, options, userId) => { RdDCombat.onUpdateCombat(combat, change, options, userId) });
Hooks.on("preDeleteCombat", (combat, html, id) => { combat.onPreDeleteCombat() });
}
/* -------------------------------------------- */
async nextRound() {
this.cleanItemUse();
await this.finDeRound();
return await super.nextRound();
}
/* -------------------------------------------- */
async onPreDeleteCombat() {
if (Misc.isUniqueConnectedGM()) {
await this.finDeRound({ terminer: true });
ChatUtility.removeChatMessageContaining(`<div data-combatid="${this.id}" data-combatmessage="actor-turn-summary">`)
game.messages.filter(m => ChatUtility.getMessageData(m, 'attacker-roll') != undefined && ChatUtility.getMessageData(m, 'defender-roll') != undefined)
.forEach(it => it.delete());
}
}
/* -------------------------------------------- */
async finDeRound(options = { terminer: false }) {
this.turns.forEach(turn => turn.actor.resetItemUse());
for (let combatant of this.combatants) {
if (combatant.actor) {
await combatant.actor.finDeRound(options);
@ -144,9 +140,8 @@ export class RdDCombatManager extends Combat {
}
/* -------------------------------------------- */
static calculInitiative(niveau, caracValue, bonusEcaille = 0) {
let base = niveau + Math.floor(caracValue / 2);
base += bonusEcaille;
static calculInitiative(niveau, caracValue, bonus = 0) {
let base = niveau + Math.floor(caracValue / 2) + bonus;
return "1d6" + (base >= 0 ? "+" : "") + base;
}
@ -420,18 +415,11 @@ export class RdDCombatManager extends Combat {
/* -------------------------------------------- */
export class RdDCombat {
static init() {
Hooks.on("updateCombat", (combat, change, options, userId) => { RdDCombat.onUpdateCombat(combat, change, options, userId) });
Hooks.on("preDeleteCombat", (combat, options, userId) => { RdDCombat.onPreDeleteCombat(combat, options, userId); });
}
/* -------------------------------------------- */
static onSocketMessage(sockmsg) {
switch (sockmsg.msg) {
case "msg_encaisser":
return RdDCombat.onMsgEncaisser(sockmsg.data);
case "msg_defense":
return RdDCombat.onMsgDefense(sockmsg.data);
case "msg_encaisser": return RdDCombat.onMsgEncaisser(sockmsg.data);
case "msg_defense": return RdDCombat.onMsgDefense(sockmsg.data);
}
}
@ -442,16 +430,6 @@ export class RdDCombat {
}
}
/* -------------------------------------------- */
static onPreDeleteCombat(combat, options, userId) {
if (Misc.isUniqueConnectedGM()) {
combat.cleanItemUse();
ChatUtility.removeChatMessageContaining(`<div data-combatid="${combat.id}" data-combatmessage="actor-turn-summary">`)
game.messages.filter(m => ChatUtility.getMessageData(m, 'attacker-roll') != undefined && ChatUtility.getMessageData(m, 'defender-roll') != undefined)
.forEach(it => it.delete());
}
}
/* -------------------------------------------- */
static combatNouveauTour(combat) {
if (Misc.isUniqueConnectedGM()) {
@ -756,15 +734,6 @@ export class RdDCombat {
/* -------------------------------------------- */
async attaque(competence, arme) {
// const nonIncarnee = this.defender.isEntite([ENTITE_NONINCARNE])
// const blurette = this.defender.isEntite([ENTITE_BLURETTE])
// if (nonIncarnee || blurette) {
// ChatMessage.create( {
// content: `<strong>La cible est ${nonIncarnee ? 'non incarnée' : 'une blurette'}.
// Il est impossible de l'atteindre.`,
// whisper: ChatMessage.getWhisperRecipients("GM")})
// }
if (!await this.attacker.accorder(this.defender, 'avant-attaque')) {
return;
}
@ -970,9 +939,8 @@ export class RdDCombat {
/* -------------------------------------------- */
_filterArmesParade(defender, competence) {
let items = defender.items.filter(it => RdDItemArme.isArmeUtilisable(it) || RdDItemCompetenceCreature.isCompetenceParade(it))
for (let item of items) {
item.system.nbUsage = defender.getItemUse(item.id); // Ajout du # d'utilisation ce round
}
items.forEach(item => item.system.nbUsage = defender.getItemUse(item.id)); // Ajout du # d'utilisation ce round
switch (competence.system.categorie) {
case 'tir':
case 'lancer':

View File

@ -180,7 +180,6 @@ export class SystemReveDeDragon {
RdDUtility.init();
RdDDice.init();
RdDCommands.init();
RdDCombat.init();
RdDCombatManager.init();
RdDTokenHud.init();
RdDBaseActor.init();

File diff suppressed because one or more lines are too long

View File

@ -1,8 +1,8 @@
{
"id": "foundryvtt-reve-de-dragon",
"title": "Rêve de Dragon",
"version": "10.6.18",
"download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-10.6.18.zip",
"version": "10.6.19",
"download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-10.6.19.zip",
"manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/v10/system.json",
"compatibility": {
"minimum": "10",