Merge branch 'v1.5-active-effect' into 'v1.5'
Préparation ajout empoignade, ActiveEffect See merge request LeRatierBretonnien/foundryvtt-reve-de-dragon!285
This commit is contained in:
commit
6aca4e94d1
16
lang/fr.json
16
lang/fr.json
@ -40,5 +40,19 @@
|
|||||||
"TypeOmbre": "Ombre de Thanatos",
|
"TypeOmbre": "Ombre de Thanatos",
|
||||||
"TypeSouffle": "Souffle de Dragon",
|
"TypeSouffle": "Souffle de Dragon",
|
||||||
"TypeTete": "Tête de Dragon"
|
"TypeTete": "Tête de Dragon"
|
||||||
|
},
|
||||||
|
"EFFECT": {
|
||||||
|
"StatusStunned": "Sonné",
|
||||||
|
"StatusUnconscious": "Inconscient",
|
||||||
|
"StatusBlind": "Aveugle",
|
||||||
|
"StatusBleeding": "Saigne",
|
||||||
|
"StatusProne": "Au sol",
|
||||||
|
"StatusUnarmed": "Désarmé",
|
||||||
|
"StatusGrappling": "Empoignade",
|
||||||
|
"StatusGrappled": "Empoigné",
|
||||||
|
"StatusRestrained": "Immobilisé",
|
||||||
|
"StatusComma": "Comma",
|
||||||
|
"StatusDead": "Mort",
|
||||||
|
"StatusDemiReve": "Demi-rêve"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -103,7 +103,7 @@ export class RdDActorSheet extends ActorSheet {
|
|||||||
formData.difficultesLibres = CONFIG.RDD.difficultesLibres;
|
formData.difficultesLibres = CONFIG.RDD.difficultesLibres;
|
||||||
|
|
||||||
formData.hautreve = {
|
formData.hautreve = {
|
||||||
isDemiReve: this.actor.listeEffets( it => it.label == "Demi-rêve").length > 0,
|
isDemiReve: this.actor.getEffectByLabel("Demi-rêve"),
|
||||||
sortsReserve: formData.data.reve.reserve.list,
|
sortsReserve: formData.data.reve.reserve.list,
|
||||||
rencontres: duplicate(formData.data.reve.rencontre.list),
|
rencontres: duplicate(formData.data.reve.rencontre.list),
|
||||||
casesTmr: formData.itemsByType.casetmr,
|
casesTmr: formData.itemsByType.casetmr,
|
||||||
@ -327,7 +327,7 @@ export class RdDActorSheet extends ActorSheet {
|
|||||||
actor.sheet.render(true);
|
actor.sheet.render(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Boutons spéciaux MJs
|
// Boutons spéciaux MJs
|
||||||
html.find('.forcer-tmr-aleatoire').click(async event => {
|
html.find('.forcer-tmr-aleatoire').click(async event => {
|
||||||
this.actor.cacheTMRetMessage();
|
this.actor.cacheTMRetMessage();
|
||||||
@ -335,7 +335,7 @@ export class RdDActorSheet extends ActorSheet {
|
|||||||
html.find('.afficher-tmr').click(async event => {
|
html.find('.afficher-tmr').click(async event => {
|
||||||
this.actor.afficheTMRetMessage();
|
this.actor.afficheTMRetMessage();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Points de reve actuel
|
// Points de reve actuel
|
||||||
html.find('.ptreve-actuel a').click(async event => {
|
html.find('.ptreve-actuel a').click(async event => {
|
||||||
this.actor.rollCarac('reve-actuel');
|
this.actor.rollCarac('reve-actuel');
|
||||||
@ -344,8 +344,16 @@ export class RdDActorSheet extends ActorSheet {
|
|||||||
// Roll Weapon1
|
// Roll Weapon1
|
||||||
html.find('.arme-label a').click(async event => {
|
html.find('.arme-label a').click(async event => {
|
||||||
let armeName = event.currentTarget.text;
|
let armeName = event.currentTarget.text;
|
||||||
let competenceName = event.currentTarget.attributes['data-competence-name'].value;
|
let compName = event.currentTarget.attributes['data-competence-name'].value;
|
||||||
this.actor.rollArme(competenceName, armeName);
|
let arme = this.actor.data.find(it =>
|
||||||
|
it.name == armeName &&
|
||||||
|
RdDItemArme.isArme(it) &&
|
||||||
|
((compName ?? it.data.competence) == it.data.competence)
|
||||||
|
);
|
||||||
|
if (!arme) {
|
||||||
|
arme = { name: armeName, data: { competence: compName } };
|
||||||
|
}
|
||||||
|
this.actor.rollArme(arme);
|
||||||
});
|
});
|
||||||
// Initiative pour l'arme
|
// Initiative pour l'arme
|
||||||
html.find('.arme-initiative a').click(async event => {
|
html.find('.arme-initiative a').click(async event => {
|
||||||
@ -376,6 +384,10 @@ export class RdDActorSheet extends ActorSheet {
|
|||||||
html.find('.repos').click(async event => {
|
html.find('.repos').click(async event => {
|
||||||
await DialogRepos.create(this.actor);
|
await DialogRepos.create(this.actor);
|
||||||
});
|
});
|
||||||
|
html.find('.delete-active-effect').click(async event => {
|
||||||
|
let id = $(event.currentTarget).parents(".active-effect").data('id');
|
||||||
|
this.actor.enleverActiveEffectById(id);
|
||||||
|
});
|
||||||
html.find('.enlever-tous-effets').click(async event => {
|
html.find('.enlever-tous-effets').click(async event => {
|
||||||
this.actor.enleverTousLesEffets();
|
this.actor.enleverTousLesEffets();
|
||||||
});
|
});
|
||||||
@ -441,6 +453,7 @@ export class RdDActorSheet extends ActorSheet {
|
|||||||
this.render(true);
|
this.render(true);
|
||||||
});
|
});
|
||||||
html.find('.lock-unlock-controls').click(async event => {
|
html.find('.lock-unlock-controls').click(async event => {
|
||||||
|
console.log("CONTROLS", this.options.hideControls)
|
||||||
this.options.hideControls = !this.options.hideControls;
|
this.options.hideControls = !this.options.hideControls;
|
||||||
this.render(true);
|
this.render(true);
|
||||||
});
|
});
|
||||||
@ -514,9 +527,6 @@ export class RdDActorSheet extends ActorSheet {
|
|||||||
html.find('#endurance-moins').click(async event => {
|
html.find('#endurance-moins').click(async event => {
|
||||||
this.actor.santeIncDec("endurance", -1);
|
this.actor.santeIncDec("endurance", -1);
|
||||||
});
|
});
|
||||||
html.find('.data-sante-sonne').click(async event => {
|
|
||||||
this.actor.setSonne(event.currentTarget.checked);
|
|
||||||
});
|
|
||||||
html.find('#ptreve-actuel-plus').click(async event => {
|
html.find('#ptreve-actuel-plus').click(async event => {
|
||||||
this.actor.reveActuelIncDec(1);
|
this.actor.reveActuelIncDec(1);
|
||||||
});
|
});
|
||||||
@ -560,7 +570,7 @@ export class RdDActorSheet extends ActorSheet {
|
|||||||
async _onSplitItem(item, split) {
|
async _onSplitItem(item, split) {
|
||||||
if (split >= 1 && split < Misc.data(item).data.quantite) {
|
if (split >= 1 && split < Misc.data(item).data.quantite) {
|
||||||
await item.diminuerQuantite(split);
|
await item.diminuerQuantite(split);
|
||||||
const itemData = duplicate( Misc.data(item));
|
const itemData = duplicate(Misc.data(item));
|
||||||
itemData.data.quantite = split;
|
itemData.data.quantite = split;
|
||||||
await this.actor.createEmbeddedDocuments('Item', [itemData])
|
await this.actor.createEmbeddedDocuments('Item', [itemData])
|
||||||
}
|
}
|
||||||
|
182
module/actor.js
182
module/actor.js
@ -32,7 +32,6 @@ import { DialogFabriquerPotion } from "./dialog-fabriquer-potion.js";
|
|||||||
import { RollDataAjustements } from "./rolldata-ajustements.js";
|
import { RollDataAjustements } from "./rolldata-ajustements.js";
|
||||||
import { DialogItemAchat } from "./dialog-item-achat.js";
|
import { DialogItemAchat } from "./dialog-item-achat.js";
|
||||||
import { RdDItem } from "./item.js";
|
import { RdDItem } from "./item.js";
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
/**
|
/**
|
||||||
* Extend the base Actor entity by defining a custom roll data structure which is ideal for the Simple system.
|
* Extend the base Actor entity by defining a custom roll data structure which is ideal for the Simple system.
|
||||||
@ -42,7 +41,6 @@ export class RdDActor extends Actor {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static init() {
|
static init() {
|
||||||
Hooks.on("deleteActiveEffect", (effect, options, userId) => RdDActor.getParentActor(effect)?.onDeleteActiveEffect(effect, options));
|
Hooks.on("deleteActiveEffect", (effect, options, userId) => RdDActor.getParentActor(effect)?.onDeleteActiveEffect(effect, options));
|
||||||
Hooks.on("createActiveEffect", (effect, options, userId) => RdDActor.getParentActor(effect)?.onCreateActiveEffect(effect, options));
|
|
||||||
|
|
||||||
Hooks.on("preUpdateItem", (item, change, options, id) => RdDActor.getParentActor(item)?.onPreUpdateItem(item, change, options, id));
|
Hooks.on("preUpdateItem", (item, change, options, id) => RdDActor.getParentActor(item)?.onPreUpdateItem(item, change, options, id));
|
||||||
Hooks.on("createItem", (item, options, id) => RdDActor.getParentActor(item)?.onCreateItem(item, options, id));
|
Hooks.on("createItem", (item, options, id) => RdDActor.getParentActor(item)?.onCreateItem(item, options, id));
|
||||||
@ -424,13 +422,13 @@ export class RdDActor extends Actor {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
getSurprise(isCombat = undefined) {
|
getSurprise(isCombat = undefined) {
|
||||||
let niveauSurprise = Array.from(this.effects?.values() ?? [])
|
let niveauSurprise = this.getActiveEffects()
|
||||||
.map(effect => StatusEffects.valeurSurprise(effect.data, isCombat))
|
.map(effect => StatusEffects.valeurSurprise(effect.data, isCombat))
|
||||||
.reduce(Misc.sum(), 0);
|
.reduce(Misc.sum(), 0);
|
||||||
if (niveauSurprise > 1) {
|
if (niveauSurprise > 1) {
|
||||||
return 'totale';
|
return 'totale';
|
||||||
}
|
}
|
||||||
if (niveauSurprise == 1 || this.getSonne()) {
|
if (niveauSurprise == 1) {
|
||||||
return 'demi';
|
return 'demi';
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
@ -1507,21 +1505,20 @@ export class RdDActor extends Actor {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
getSonne() {
|
getSonne() {
|
||||||
let data = Misc.templateData(this);
|
return this.getEffectByLabel("EFFECT.StatusStunned");
|
||||||
return !this.isEntiteCauchemar() && (data.sante?.sonne?.value ?? false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
getSonneRound() {
|
async finDeRound(options = {terminer:false}) {
|
||||||
return !this.isEntiteCauchemar() && (Misc.templateData(this).sante.sonne?.round ?? false);
|
for (let effect of this.getActiveEffects()) {
|
||||||
}
|
if (effect.duration.type !== 'none' && (effect.duration.remaining <= 0 || options.terminer)) {
|
||||||
|
if (effect.data.origin) {
|
||||||
/* -------------------------------------------- */
|
await effect.update({ 'disabled': true });
|
||||||
async verifierSonneRound(round) {
|
}
|
||||||
if (this.getSonne()) {
|
else {
|
||||||
if (round > this.getSonneRound() + 1) {
|
await effect.delete();
|
||||||
await this.setSonne(false, -1); // Nettoyer l'état sonné
|
}
|
||||||
ChatMessage.create({ content: `${this.name} n'est plus sonné ce round !` });
|
ChatMessage.create({ content: `${this.name} n'est plus ${Misc.lowerFirst(game.i18n.localize(effect.data.label))} !` });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1531,20 +1528,11 @@ export class RdDActor extends Actor {
|
|||||||
if (this.isEntiteCauchemar()) {
|
if (this.isEntiteCauchemar()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let round = (sonne && game.combat) ? game.combat.current.round : -1; // Sauvegarde du round de sonné en cas de combat
|
if (!game.combat && sonne){
|
||||||
await this.setStatusSonne(sonne);
|
ui.notifications.info("Le personnage est hors combat, il ne reste donc pas sonné");
|
||||||
await this.setStateSonne(sonne, round);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
|
||||||
async setStateSonne(sonne, round = -1) {
|
|
||||||
if (this.isEntiteCauchemar()) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let sonneData = duplicate(Misc.templateData(this).sante.sonne);
|
await this.setStatusEffect("EFFECT.StatusStunned", sonne);
|
||||||
sonneData.value = sonne;
|
|
||||||
sonneData.round = round;
|
|
||||||
await this.update({ "data.sante.sonne": sonneData });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -1571,12 +1559,11 @@ export class RdDActor extends Actor {
|
|||||||
|
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async testSiSonne(sante, endurance) {
|
async testSiSonne(endurance) {
|
||||||
const result = await this._jetEndurance(endurance);
|
const result = await this._jetEndurance(endurance);
|
||||||
if (result.roll.total == 1) {
|
if (result.roll.total == 1) {
|
||||||
ChatMessage.create({ content: await this._gainXpConstitutionJetEndurance() });
|
ChatMessage.create({ content: await this._gainXpConstitutionJetEndurance() });
|
||||||
}
|
}
|
||||||
sante.sonne.value ||= result.sonne;
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1645,7 +1632,7 @@ export class RdDActor extends Actor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async santeIncDec(name, inc, options = { isCritique: false, ethylisme: false }) {
|
async santeIncDec(name, inc, isCritique = false) {
|
||||||
if (name == 'fatigue' && !ReglesOptionelles.isUsing("appliquer-fatigue")) {
|
if (name == 'fatigue' && !ReglesOptionelles.isUsing("appliquer-fatigue")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1664,7 +1651,7 @@ export class RdDActor extends Actor {
|
|||||||
//console.log("New value ", inc, minValue, result.newValue);
|
//console.log("New value ", inc, minValue, result.newValue);
|
||||||
let fatigue = 0;
|
let fatigue = 0;
|
||||||
if (name == "endurance" && !this.isEntiteCauchemar()) {
|
if (name == "endurance" && !this.isEntiteCauchemar()) {
|
||||||
if (result.newValue == 0 && inc < 0 && !options.isCritique) { // perte endurance et endurance devient 0 (sauf critique) -> -1 vie
|
if (result.newValue == 0 && inc < 0 && !isCritique) { // perte endurance et endurance devient 0 (sauf critique) -> -1 vie
|
||||||
sante.vie.value--;
|
sante.vie.value--;
|
||||||
result.perteVie = true;
|
result.perteVie = true;
|
||||||
}
|
}
|
||||||
@ -1674,14 +1661,13 @@ export class RdDActor extends Actor {
|
|||||||
}
|
}
|
||||||
const perte = compteur.value - result.newValue;
|
const perte = compteur.value - result.newValue;
|
||||||
result.perte = perte;
|
result.perte = perte;
|
||||||
if (perte > 1 && !options.ethylisme) {
|
if (perte > 1) {
|
||||||
// Peut-être sonné si 2 points d'endurance perdus d'un coup
|
// Peut-être sonné si 2 points d'endurance perdus d'un coup
|
||||||
const testIsSonne = await this.testSiSonne(sante, result.newValue);
|
const testIsSonne = await this.testSiSonne(result.newValue);
|
||||||
result.sonne = testIsSonne.sonne;
|
result.sonne = testIsSonne.sonne;
|
||||||
result.jetEndurance = testIsSonne.roll.total;
|
result.jetEndurance = testIsSonne.roll.total;
|
||||||
} else if (inc > 0) {
|
} else if (inc > 0) {
|
||||||
await this.setSonne(false);
|
await this.setSonne(false);
|
||||||
sante.sonne.value = false;
|
|
||||||
}
|
}
|
||||||
if (sante.fatigue && inc < 0) { // Each endurance lost -> fatigue lost
|
if (sante.fatigue && inc < 0) { // Each endurance lost -> fatigue lost
|
||||||
fatigue = perte;
|
fatigue = perte;
|
||||||
@ -1695,7 +1681,7 @@ export class RdDActor extends Actor {
|
|||||||
}
|
}
|
||||||
await this.update({ "data.sante": sante });
|
await this.update({ "data.sante": sante });
|
||||||
if (this.isDead()) {
|
if (this.isDead()) {
|
||||||
await this.addStatusEffectById('dead');
|
await this.setStatusEffect("EFFECT.StatusComma", true);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -1948,7 +1934,7 @@ export class RdDActor extends Actor {
|
|||||||
ethylisme.nb_doses = 0;
|
ethylisme.nb_doses = 0;
|
||||||
|
|
||||||
let perte = await RdDDice.rollTotal("1d6", { showDice: true });
|
let perte = await RdDDice.rollTotal("1d6", { showDice: true });
|
||||||
ethylismeData.perteEndurance = await this.santeIncDec("endurance", -perte, { ethylisme: true });
|
ethylismeData.perteEndurance = await this.santeIncDec("endurance", -perte);
|
||||||
|
|
||||||
if (!ethylisme.jet_moral) {
|
if (!ethylisme.jet_moral) {
|
||||||
ethylismeData.jetMoral = await this._jetMoral('heureuse');
|
ethylismeData.jetMoral = await this._jetMoral('heureuse');
|
||||||
@ -2169,10 +2155,7 @@ export class RdDActor extends Actor {
|
|||||||
async appliquerAjoutExperience(rollData, display) {
|
async appliquerAjoutExperience(rollData, display) {
|
||||||
if (!this.isPersonnage()) return;
|
if (!this.isPersonnage()) return;
|
||||||
let xpData = await this._appliquerExperience(rollData.rolled, rollData.selectedCarac.label, rollData.competence);
|
let xpData = await this._appliquerExperience(rollData.rolled, rollData.selectedCarac.label, rollData.competence);
|
||||||
if (!xpData) {
|
if (xpData && display) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (display) {
|
|
||||||
let message = {
|
let message = {
|
||||||
whisher: ChatUtility.getWhisperRecipientsAndGMs(this.name),
|
whisher: ChatUtility.getWhisperRecipientsAndGMs(this.name),
|
||||||
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-gain-xp.html`, xpData)
|
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-gain-xp.html`, xpData)
|
||||||
@ -2182,7 +2165,7 @@ export class RdDActor extends Actor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async _appliquerAppelMoral(rollData, display = true) {
|
async _appliquerAppelMoral(rollData) {
|
||||||
if (!this.isPersonnage()) return;
|
if (!this.isPersonnage()) return;
|
||||||
if (!rollData.useMoral) return;
|
if (!rollData.useMoral) return;
|
||||||
if (rollData.rolled.isEchec ||
|
if (rollData.rolled.isEchec ||
|
||||||
@ -3078,7 +3061,7 @@ export class RdDActor extends Actor {
|
|||||||
ui.notifications.warn("Vous êtes déja dans les TMR....");
|
ui.notifications.warn("Vous êtes déja dans les TMR....");
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let demiReve = this.listeEffets(it => it.label == "Demi-rêve");
|
let demiReve = this.getActiveEffects(it => it.data.label == "Demi-rêve");
|
||||||
if (mode != 'visu' && demiReve.length > 0) {
|
if (mode != 'visu' && demiReve.length > 0) {
|
||||||
ui.notifications.warn("Le joueur ou le MJ est déja dans les Terres Médianes avec ce personnage ! Visualisation uniquement");
|
ui.notifications.warn("Le joueur ou le MJ est déja dans les Terres Médianes avec ce personnage ! Visualisation uniquement");
|
||||||
mode = "visu"; // bascule le mode en visu automatiquement
|
mode = "visu"; // bascule le mode en visu automatiquement
|
||||||
@ -3094,7 +3077,7 @@ export class RdDActor extends Actor {
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await this.setStatusDemiReve(true);
|
await this.setStatusEffect("EFFECT.StatusDemiReve", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
const actorData = Misc.data(this);
|
const actorData = Misc.data(this);
|
||||||
@ -3117,11 +3100,9 @@ export class RdDActor extends Actor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
rollArme(compName, armeName = undefined) {
|
rollArme(arme) {
|
||||||
let arme = armeName ? this.data.items.find(it => Misc.data(it).name == armeName && RdDItemArme.isArme(it)) : undefined;
|
let competence = Misc.data(this.getCompetence(arme.data.competence));
|
||||||
let competence = Misc.data(this.getCompetence(compName));
|
if (arme || (competence.type == 'competencecreature' && competence.data.iscombat)) {
|
||||||
|
|
||||||
if (arme || armeName || (competence.type == 'competencecreature' && competence.data.iscombat)) {
|
|
||||||
RdDCombat.createUsingTarget(this)?.attaque(competence, arme);
|
RdDCombat.createUsingTarget(this)?.attaque(competence, arme);
|
||||||
} else {
|
} else {
|
||||||
this.rollCompetence(competence.name);
|
this.rollCompetence(competence.name);
|
||||||
@ -3245,7 +3226,7 @@ export class RdDActor extends Actor {
|
|||||||
const perteVie = this.isEntiteCauchemar()
|
const perteVie = this.isEntiteCauchemar()
|
||||||
? { newValue: 0 }
|
? { newValue: 0 }
|
||||||
: await this.santeIncDec("vie", - encaissement.vie);
|
: await this.santeIncDec("vie", - encaissement.vie);
|
||||||
const perteEndurance = await this.santeIncDec("endurance", -encaissement.endurance, { critiques: encaissement.critiques > 0 });
|
const perteEndurance = await this.santeIncDec("endurance", -encaissement.endurance, encaissement.critiques > 0);
|
||||||
|
|
||||||
this.computeEtatGeneral();
|
this.computeEtatGeneral();
|
||||||
|
|
||||||
@ -3353,7 +3334,7 @@ export class RdDActor extends Actor {
|
|||||||
count--;
|
count--;
|
||||||
} else {
|
} else {
|
||||||
// TODO: status effect dead
|
// TODO: status effect dead
|
||||||
this.addStatusEffectById('dead');
|
this.setStatusEffect("EFFECT.StatusComma", true);
|
||||||
ChatMessage.create({
|
ChatMessage.create({
|
||||||
content: `<img class="chat-icon" src="icons/svg/skull.svg" alt="charge" />
|
content: `<img class="chat-icon" src="icons/svg/skull.svg" alt="charge" />
|
||||||
<strong>${this.name} vient de succomber à une seconde blessure critique ! Que les Dragons gardent son Archétype en paix !</strong>`
|
<strong>${this.name} vient de succomber à une seconde blessure critique ! Que les Dragons gardent son Archétype en paix !</strong>`
|
||||||
@ -3992,109 +3973,64 @@ export class RdDActor extends Actor {
|
|||||||
async onUpdateActor(update, options, actorId) {
|
async onUpdateActor(update, options, actorId) {
|
||||||
const updatedEndurance = update?.data?.sante?.endurance;
|
const updatedEndurance = update?.data?.sante?.endurance;
|
||||||
if (updatedEndurance && options.diff) {
|
if (updatedEndurance && options.diff) {
|
||||||
this.forceStatusEffectId('unconscious', updatedEndurance.value == 0);
|
await this.setStatusEffect("EFFECT.StatusUnconscious", updatedEndurance.value == 0);
|
||||||
}
|
|
||||||
}
|
|
||||||
/* -------------------------------------------- */
|
|
||||||
async onCreateActiveEffect(effect, options) {
|
|
||||||
switch (StatusEffects.statusId(effect)) {
|
|
||||||
case 'sonne':
|
|
||||||
await this.setStateSonne(true);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async onDeleteActiveEffect(effect, options) {
|
async onDeleteActiveEffect(effect, options) {
|
||||||
switch (StatusEffects.statusId(effect)) {
|
switch (effect.label) {
|
||||||
case 'sonne':
|
case 'EFFECT.StatusStunned':
|
||||||
await this.setStateSonne(false);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
enleverTousLesEffets() {
|
getActiveEffects(matching = it => true) {
|
||||||
const ids = Array.from(this.effects?.keys() ?? []);
|
return Array.from(this.getEmbeddedCollection("ActiveEffect").values()).filter(it => matching(it));
|
||||||
this.deleteEmbeddedDocuments('ActiveEffect', ids);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
listeEffets(matching = it => true) {
|
getEffectByLabel(label) {
|
||||||
const all = Array.from(this.effects?.values() ?? []);
|
return this.getActiveEffects().find(it => it.data.label == label);
|
||||||
const filtered = all.filter(it => matching(it.data));
|
|
||||||
return filtered;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async setStatusDemiReve(status) {
|
getEffectById(id) {
|
||||||
const demiReve = StatusEffects.demiReve();
|
return this.getActiveEffects().find(it => it.id == id);
|
||||||
if (status) {
|
|
||||||
await this.addStatusEffect(demiReve)
|
|
||||||
} else {
|
|
||||||
await this.deleteStatusEffect(demiReve)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async setStatusSonne(sonne) {
|
async setStatusEffect(label, status, updates = {}) {
|
||||||
if (this.isEntiteCauchemar()) {
|
if (this.isEntiteCauchemar() || this.data.type == 'vehicule') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await this.forceStatusEffectId('sonne', sonne);
|
console.log("setStatusEffect", label, status, updates)
|
||||||
}
|
const existing = this.getEffectByLabel(label);
|
||||||
|
if (existing) {
|
||||||
/* -------------------------------------------- */
|
existing.delete();
|
||||||
async forceStatusEffectId(statusId, isSet) {
|
|
||||||
if (isSet) {
|
|
||||||
await this.addStatusEffectById(statusId);
|
|
||||||
}
|
}
|
||||||
else {
|
if (status) {
|
||||||
await this.deleteStatusEffectById(statusId);
|
const statusEffect = mergeObject(duplicate(StatusEffects.status(label)), updates);
|
||||||
|
await this.createEmbeddedDocuments("ActiveEffect", [statusEffect]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
enleverActiveEffectById(id) {
|
||||||
async deleteStatusEffectById(id) {
|
if (game.user.isGM){
|
||||||
|
const existing = this.getEffectById(id);
|
||||||
const ids = Array.from(this.effects?.values())
|
if (existing) {
|
||||||
.filter(it => it.data.flags.core?.statusId == id)
|
existing.delete();
|
||||||
.map(it => it.id);
|
}
|
||||||
console.log("Delete effect IDS1: ", this.effects, ids);
|
|
||||||
if (ids.length > 0) {
|
|
||||||
await this.deleteEmbeddedDocuments('ActiveEffect', ids);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async deleteStatusEffect(effect) {
|
enleverTousLesEffets() {
|
||||||
const ids = Array.from(this.effects?.values())
|
if (game.user.isGM){
|
||||||
.filter(it => StatusEffects.statusId(it.data) == StatusEffects.statusId(effect))
|
this.deleteEmbeddedDocuments('ActiveEffect', this.getActiveEffects().map(it => it.id));
|
||||||
.map(it => it.id);
|
|
||||||
console.log("Delete effect 1: ", this.effects, ids);
|
|
||||||
if (ids.length > 0) {
|
|
||||||
await this.deleteEmbeddedDocuments('ActiveEffect', ids);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
|
||||||
async addStatusEffectById(id) {
|
|
||||||
const statusEffect = CONFIG.statusEffects.find(it => it.id == id);
|
|
||||||
await this.addStatusEffect(statusEffect);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
|
||||||
async addStatusEffect(statusEffect) {
|
|
||||||
const effet = Misc.data(statusEffect);
|
|
||||||
await this.deleteStatusEffectById(effet.id);
|
|
||||||
effet.flags = effet.flags ?? { core: {} };
|
|
||||||
effet.flags.core.statusId = effet.id;
|
|
||||||
let effectArray = await this.createEmbeddedDocuments('ActiveEffect', [effet]);
|
|
||||||
//if (effectArray[0]) {
|
|
||||||
//await effectArray[0].setFlag('core', 'statusId', effet.id);
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async onPreUpdateItem(item, change, options, id) {
|
async onPreUpdateItem(item, change, options, id) {
|
||||||
const itemData = Misc.data(item);
|
const itemData = Misc.data(item);
|
||||||
|
@ -3,7 +3,8 @@ import { Misc } from "./misc.js";
|
|||||||
import { RdDCombatManager } from "./rdd-combat.js";
|
import { RdDCombatManager } from "./rdd-combat.js";
|
||||||
|
|
||||||
const nomCategorieParade = {
|
const nomCategorieParade = {
|
||||||
"sans-armes": "Sans arme / armes naturelles",
|
"sans-armes": "Sans arme",
|
||||||
|
"armes-naturelles": "Sans arme",
|
||||||
"hast": "Armes d'hast",
|
"hast": "Armes d'hast",
|
||||||
"batons": "Bâtons",
|
"batons": "Bâtons",
|
||||||
"boucliers": "Boucliers",
|
"boucliers": "Boucliers",
|
||||||
@ -71,7 +72,7 @@ export class RdDItemArme extends Item {
|
|||||||
}
|
}
|
||||||
// pour compatibilité avec des personnages existants
|
// pour compatibilité avec des personnages existants
|
||||||
if (armeData.type == 'competencecreature' || armeData.data.categorie == 'creature') {
|
if (armeData.type == 'competencecreature' || armeData.data.categorie == 'creature') {
|
||||||
return armeData.data.categorie_parade || (armeData.data.isparade ? 'sans-armes' : '');
|
return armeData.data.categorie_parade || (armeData.data.isparade ? 'armes-naturelles' : '');
|
||||||
}
|
}
|
||||||
if (!armeData.type.match(/arme|competencecreature/)) {
|
if (!armeData.type.match(/arme|competencecreature/)) {
|
||||||
return '';
|
return '';
|
||||||
@ -137,7 +138,7 @@ export class RdDItemArme extends Item {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static armeUneOuDeuxMains(armeData, aUneMain) {
|
static armeUneOuDeuxMains(armeData, aUneMain) {
|
||||||
armeData = Misc.data(armeData);
|
armeData = Misc.data(armeData);
|
||||||
if (armeData) {
|
if (armeData && !armeData.data.cac) {
|
||||||
armeData.data.unemain = armeData.data.unemain || !armeData.data.deuxmains;
|
armeData.data.unemain = armeData.data.unemain || !armeData.data.deuxmains;
|
||||||
const uneOuDeuxMains = armeData.data.unemain && armeData.data.deuxmains;
|
const uneOuDeuxMains = armeData.data.unemain && armeData.data.deuxmains;
|
||||||
const containsSlash = !Number.isInteger(armeData.data.dommages) && armeData.data.dommages.includes("/");
|
const containsSlash = !Number.isInteger(armeData.data.dommages) && armeData.data.dommages.includes("/");
|
||||||
@ -170,11 +171,12 @@ export class RdDItemArme extends Item {
|
|||||||
let corpsACorps = competences.find(it => it.name == 'Corps à corps') ?? { data: { niveau: -6 } };
|
let corpsACorps = competences.find(it => it.name == 'Corps à corps') ?? { data: { niveau: -6 } };
|
||||||
let init = RdDCombatManager.calculInitiative(corpsACorps.data.niveau, carac['melee'].value);
|
let init = RdDCombatManager.calculInitiative(corpsACorps.data.niveau, carac['melee'].value);
|
||||||
armes.push(RdDItemArme.mainsNues({ niveau: corpsACorps.data.niveau, initiative: init }));
|
armes.push(RdDItemArme.mainsNues({ niveau: corpsACorps.data.niveau, initiative: init }));
|
||||||
|
armes.push(RdDItemArme.empoignade({ niveau: corpsACorps.data.niveau, initiative: init }));
|
||||||
}
|
}
|
||||||
|
|
||||||
static mainsNues(actorData = {}) {
|
static corpsACorps(actorData) {
|
||||||
const mainsNues = {
|
const corpsACorps = {
|
||||||
name: 'Mains nues',
|
name: 'Corps à corps',
|
||||||
data: {
|
data: {
|
||||||
equipe: true,
|
equipe: true,
|
||||||
rapide: true,
|
rapide: true,
|
||||||
@ -186,9 +188,24 @@ export class RdDItemArme extends Item {
|
|||||||
categorie_parade: 'sans-armes'
|
categorie_parade: 'sans-armes'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (actorData) {
|
mergeObject(corpsACorps.data, actorData ??{}, { overwrite: false });
|
||||||
mergeObject(mainsNues.data, actorData, { overwrite: false });
|
return corpsACorps;
|
||||||
}
|
}
|
||||||
return mainsNues
|
|
||||||
|
static mainsNues(actorData) {
|
||||||
|
const mainsNues = RdDItemArme.corpsACorps(actorData);
|
||||||
|
mainsNues.name = 'Mains nues';
|
||||||
|
mainsNues.data.cac = 'pugilat';
|
||||||
|
mainsNues.data.baseInit = 4;
|
||||||
|
return mainsNues;
|
||||||
|
}
|
||||||
|
|
||||||
|
static empoignade(actorData) {
|
||||||
|
const empoignade = RdDItemArme.corpsACorps(actorData);
|
||||||
|
empoignade.name = 'Empoignade';
|
||||||
|
empoignade.data.cac = 'empoignade';
|
||||||
|
empoignade.data.baseInit = 3;
|
||||||
|
empoignade.data.mortalite = 'empoignade';
|
||||||
|
return empoignade;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,10 @@ export class Misc {
|
|||||||
return text.charAt(0).toUpperCase() + text.slice(1);
|
return text.charAt(0).toUpperCase() + text.slice(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static lowerFirst(text) {
|
||||||
|
return text.charAt(0).toLowerCase() + text.slice(1);
|
||||||
|
}
|
||||||
|
|
||||||
static toSignedString(number) {
|
static toSignedString(number) {
|
||||||
const value = parseInt(number)
|
const value = parseInt(number)
|
||||||
const isPositiveNumber = value != NaN && value > 0;
|
const isPositiveNumber = value != NaN && value > 0;
|
||||||
|
@ -11,23 +11,23 @@ import { ReglesOptionelles } from "./regles-optionelles.js";
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
const premierRoundInit = [
|
const premierRoundInit = [
|
||||||
{ pattern: 'hast', init: 3.90 },
|
{ pattern: 'hast', init: 5.90 },
|
||||||
{ pattern: 'lance', init: 3.85 },
|
{ pattern: 'lance', init: 5.85 },
|
||||||
{ pattern: 'baton', init: 3.80 },
|
{ pattern: 'baton', init: 5.80 },
|
||||||
{ pattern: 'doubledragonne', init: 3.75 },
|
{ pattern: 'doubledragonne', init: 5.75 },
|
||||||
{ pattern: 'esparlongue', init: 3.70 },
|
{ pattern: 'esparlongue', init: 5.70 },
|
||||||
{ pattern: 'epeedragonne', init: 3.65 },
|
{ pattern: 'epeedragonne', init: 5.65 },
|
||||||
{ pattern: 'epeebatarde', init: 3.60 },
|
{ pattern: 'epeebatarde', init: 5.60 },
|
||||||
{ pattern: 'epeecyane', init: 3.55 },
|
{ pattern: 'epeecyane', init: 5.55 },
|
||||||
{ pattern: 'epeesorde', init: 3.50 },
|
{ pattern: 'epeesorde', init: 5.50 },
|
||||||
{ pattern: 'grandehache', init: 3.45 },
|
{ pattern: 'grandehache', init: 5.45 },
|
||||||
{ pattern: 'bataille', init: 3.40 },
|
{ pattern: 'bataille', init: 5.40 },
|
||||||
{ pattern: 'epeegnome', init: 3.35 },
|
{ pattern: 'epeegnome', init: 5.35 },
|
||||||
{ pattern: 'masse', init: 3.30 },
|
{ pattern: 'masse', init: 5.30 },
|
||||||
{ pattern: 'gourdin', init: 3.25 },
|
{ pattern: 'gourdin', init: 5.25 },
|
||||||
{ pattern: 'fléau', init: 3.20 },
|
{ pattern: 'fléau', init: 5.20 },
|
||||||
{ pattern: 'dague', init: 3.15 },
|
{ pattern: 'dague', init: 5.15 },
|
||||||
{ pattern: 'autre', init: 3.10 },
|
{ pattern: 'autre', init: 5.10 },
|
||||||
];
|
];
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -38,6 +38,9 @@ export class RdDCombatManager extends Combat {
|
|||||||
Hooks.on("getCombatTrackerEntryContext", (html, options) => {
|
Hooks.on("getCombatTrackerEntryContext", (html, options) => {
|
||||||
RdDCombatManager.pushInitiativeOptions(html, options);
|
RdDCombatManager.pushInitiativeOptions(html, options);
|
||||||
});
|
});
|
||||||
|
Hooks.on("preDeleteCombat", (combat, html, id) => {
|
||||||
|
combat.onPreDeleteCombat()
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -48,10 +51,22 @@ export class RdDCombatManager extends Combat {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
cleanSonne() {
|
async nextRound() {
|
||||||
|
this.cleanItemUse();
|
||||||
|
await this.finDeRound();
|
||||||
|
return await super.nextRound();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
async onPreDeleteCombat() {
|
||||||
|
await this.finDeRound({ terminer: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
async finDeRound(options = { terminer: false }) {
|
||||||
for (let combatant of this.data.combatants) {
|
for (let combatant of this.data.combatants) {
|
||||||
if (combatant.actor) {
|
if (combatant.actor) {
|
||||||
combatant.actor.verifierSonneRound(this.current.round);
|
await combatant.actor.finDeRound(options);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ui.notifications.warn(`Le combatant ${combatant.name} n'est pas associé à un acteur!`)
|
ui.notifications.warn(`Le combatant ${combatant.name} n'est pas associé à un acteur!`)
|
||||||
@ -59,14 +74,6 @@ export class RdDCombatManager extends Combat {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
|
||||||
async nextRound() {
|
|
||||||
//console.log('New round !');s
|
|
||||||
this.cleanItemUse();
|
|
||||||
this.cleanSonne();
|
|
||||||
return super.nextRound();
|
|
||||||
}
|
|
||||||
|
|
||||||
/************************************************************************************/
|
/************************************************************************************/
|
||||||
async rollInitiative(ids, formula = undefined, messageOptions = {}) {
|
async rollInitiative(ids, formula = undefined, messageOptions = {}) {
|
||||||
console.log(`${game.data.system.data.title} | Combat.rollInitiative()`, ids, formula, messageOptions);
|
console.log(`${game.data.system.data.title} | Combat.rollInitiative()`, ids, formula, messageOptions);
|
||||||
@ -148,7 +155,8 @@ export class RdDCombatManager extends Combat {
|
|||||||
let compData = competences.map(c => Misc.data(c)).find(c => c.name == armeData.data.competence);
|
let compData = competences.map(c => Misc.data(c)).find(c => c.name == armeData.data.competence);
|
||||||
|
|
||||||
armesEquipe.push(armeData);
|
armesEquipe.push(armeData);
|
||||||
armeData.data.initiative = RdDCombatManager.calculInitiative(armeData.data.niveau, carac[compData.data.defaut_carac].value);
|
armeData.data.niveau = compData.data.niveau;
|
||||||
|
armeData.data.initiative = RdDCombatManager.calculInitiative(compData.data.niveau, carac[compData.data.defaut_carac].value);
|
||||||
// Dupliquer les armes pouvant être à 1 main et 2 mains en patchant la compétence
|
// Dupliquer les armes pouvant être à 1 main et 2 mains en patchant la compétence
|
||||||
if (armeData.data.unemain && !armeData.data.deuxmains) {
|
if (armeData.data.unemain && !armeData.data.deuxmains) {
|
||||||
armeData.data.mainInfo = "(1m)";
|
armeData.data.mainInfo = "(1m)";
|
||||||
@ -185,7 +193,8 @@ export class RdDCombatManager extends Combat {
|
|||||||
} else {
|
} else {
|
||||||
// Recupération des items 'arme'
|
// Recupération des items 'arme'
|
||||||
let armes = items.filter(it => RdDItemArme.isArmeUtilisable(it))
|
let armes = items.filter(it => RdDItemArme.isArmeUtilisable(it))
|
||||||
.concat(RdDItemArme.mainsNues());
|
.concat(RdDItemArme.mainsNues())
|
||||||
|
.concat(RdDItemArme.empoignade());
|
||||||
|
|
||||||
let competences = items.filter(it => it.type == 'competence');
|
let competences = items.filter(it => it.type == 'competence');
|
||||||
actions = actions.concat(RdDCombatManager.finalizeArmeList(armes, competences, actorData.data.carac));
|
actions = actions.concat(RdDCombatManager.finalizeArmeList(armes, competences, actorData.data.carac));
|
||||||
@ -277,30 +286,23 @@ export class RdDCombatManager extends Combat {
|
|||||||
initOffset = 2;
|
initOffset = 2;
|
||||||
initInfo = "Autre Action"
|
initInfo = "Autre Action"
|
||||||
} else if (arme.name == "Draconic") {
|
} else if (arme.name == "Draconic") {
|
||||||
initOffset = 7;
|
initOffset = 9;
|
||||||
initInfo = "Draconic"
|
initInfo = "Draconic"
|
||||||
} else {
|
} else {
|
||||||
initOffset = 3; // Melée = 3.XX
|
|
||||||
compData = Misc.data(RdDItemCompetence.findCompetence(combatant.actor.data.items, arme.data.competence));
|
compData = Misc.data(RdDItemCompetence.findCompetence(combatant.actor.data.items, arme.data.competence));
|
||||||
compNiveau = compData.data.niveau;
|
compNiveau = compData.data.niveau;
|
||||||
initInfo = arme.name + " / " + arme.data.competence;
|
initInfo = arme.name + " / " + arme.data.competence;
|
||||||
|
|
||||||
if (combatant.actor.data.type == 'creature' || combatant.actor.data.type == 'entite') {
|
if (combatant.actor.data.type == 'creature' || combatant.actor.data.type == 'entite') {
|
||||||
caracForInit = compData.data.carac_value;
|
caracForInit = compData.data.carac_value;
|
||||||
if (compData.data.categorie == "lancer") {
|
if (compData.data.categorie == "lancer") {
|
||||||
|
initOffset = 7;
|
||||||
|
}
|
||||||
|
else {
|
||||||
initOffset = 5;
|
initOffset = 5;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
caracForInit = Misc.data(combatant.actor).data.carac[compData.data.defaut_carac].value;
|
caracForInit = Misc.data(combatant.actor).data.carac[compData.data.defaut_carac].value;
|
||||||
if (compData.data.categorie == "lancer") { // Offset de principe pour les armes de jet
|
initOffset = RdDCombatManager._baseInitOffset(compData.data.categorie, arme);
|
||||||
initOffset = 4;
|
|
||||||
}
|
|
||||||
if (compData.data.categorie == "tir") { // Offset de principe pour les armes de jet
|
|
||||||
initOffset = 5;
|
|
||||||
}
|
|
||||||
if (compData.data.categorie == "melee") { // Offset de principe pour les armes de jet
|
|
||||||
initOffset = 3;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let malus = combatant.actor.getEtatGeneral(); // Prise en compte état général
|
let malus = combatant.actor.getEtatGeneral(); // Prise en compte état général
|
||||||
@ -311,6 +313,21 @@ export class RdDCombatManager extends Combat {
|
|||||||
game.combat.rollInitiative(combatantId, rollFormula, { initInfo: initInfo });
|
game.combat.rollInitiative(combatantId, rollFormula, { initInfo: initInfo });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static _baseInitOffset(categorie, arme) {
|
||||||
|
if (categorie == "tir") { // Offset de principe pour les armes de jet
|
||||||
|
return 8;
|
||||||
|
}
|
||||||
|
if (categorie == "lancer") { // Offset de principe pour les armes de jet
|
||||||
|
return 7;
|
||||||
|
}
|
||||||
|
// Offset de principe pour les armes de jet
|
||||||
|
switch (arme.data.cac) {
|
||||||
|
case "empoignade": return 3;
|
||||||
|
case "pugilat": return 4;
|
||||||
|
}
|
||||||
|
return 5;
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static displayInitiativeMenu(html, combatantId) {
|
static displayInitiativeMenu(html, combatantId) {
|
||||||
console.log("Combatant ; ", combatantId);
|
console.log("Combatant ; ", combatantId);
|
||||||
@ -706,10 +723,21 @@ export class RdDCombat {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async attaque(competence, arme = undefined) {
|
async attaque(competence, arme) {
|
||||||
if (!await this.accorderEntite('avant-attaque')) {
|
if (!await this.accorderEntite('avant-attaque')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (arme.data.cac == 'empoignade' && this.attacker.isCombatTouche()) {
|
||||||
|
ChatMessage.create({
|
||||||
|
alias: this.attacker.name,
|
||||||
|
whisper: ChatUtility.getWhisperRecipientsAndGMs(this.attacker.name),
|
||||||
|
content: await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-actor-perte-empoignade.html', {
|
||||||
|
attacker: this.attacker,
|
||||||
|
competence: competence
|
||||||
|
})
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let rollData = this._prepareAttaque(competence, arme);
|
let rollData = this._prepareAttaque(competence, arme);
|
||||||
console.log("RdDCombat.attaque >>>", rollData);
|
console.log("RdDCombat.attaque >>>", rollData);
|
||||||
@ -742,6 +770,7 @@ export class RdDCombat {
|
|||||||
_prepareAttaque(competence, arme) {
|
_prepareAttaque(competence, arme) {
|
||||||
let rollData = {
|
let rollData = {
|
||||||
passeArme: randomID(16),
|
passeArme: randomID(16),
|
||||||
|
mortalite: arme?.data.mortalite,
|
||||||
coupsNonMortels: false,
|
coupsNonMortels: false,
|
||||||
competence: competence,
|
competence: competence,
|
||||||
surprise: this.attacker.getSurprise(true),
|
surprise: this.attacker.getSurprise(true),
|
||||||
@ -758,7 +787,9 @@ export class RdDCombat {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// sans armes: à mains nues
|
// sans armes: à mains nues
|
||||||
rollData.arme = RdDItemArme.mainsNues({ niveau: competence.data.niveau });
|
const niveau = competence.data.niveau;
|
||||||
|
const init = RdDCombatManager.calculInitiative(niveau, Misc.templateData(this.attacker).carac['melee'].value);
|
||||||
|
rollData.arme = RdDItemArme.mainsNues({ niveau: niveau, initiative: init });
|
||||||
}
|
}
|
||||||
return rollData;
|
return rollData;
|
||||||
}
|
}
|
||||||
@ -767,8 +798,24 @@ export class RdDCombat {
|
|||||||
async _onAttaqueParticuliere(rollData) {
|
async _onAttaqueParticuliere(rollData) {
|
||||||
RdDCombat._storeAttaque(this.attackerId, rollData);
|
RdDCombat._storeAttaque(this.attackerId, rollData);
|
||||||
|
|
||||||
// Finesse et Rapidité seulement en mêlée et si la difficulté libre est de -1 minimum
|
|
||||||
const isMeleeDiffNegative = (rollData.competence.type == 'competencecreature' || rollData.selectedCarac.label == "Mêlée") && rollData.diffLibre < 0;
|
const isMeleeDiffNegative = (rollData.competence.type == 'competencecreature' || rollData.selectedCarac.label == "Mêlée") && rollData.diffLibre < 0;
|
||||||
|
// force toujours, sauf empoignade
|
||||||
|
// finesse seulement en mélée, pour l'empoignade, ou si la difficulté libre est de -1 minimum
|
||||||
|
// rapidité seulement en mêlée, si l'arme le permet, et si la difficulté libre est de -1 minimum
|
||||||
|
const isForce = !rollData.arme.data.empoignade;
|
||||||
|
const isFinesse = rollData.arme.data.empoignade || isMeleeDiffNegative;
|
||||||
|
const isRapide = !rollData.arme.data.empoignade && isMeleeDiffNegative && rollData.arme.data.rapide;
|
||||||
|
// si un seul choix possible, le prendre
|
||||||
|
if (isForce && !isFinesse && !isRapide) {
|
||||||
|
return await this.choixParticuliere(rollData, "force");
|
||||||
|
}
|
||||||
|
else if (!isForce && isFinesse && !isRapide) {
|
||||||
|
return await this.choixParticuliere(rollData, "finesse");
|
||||||
|
}
|
||||||
|
else if (!isForce && !isFinesse && isRapide) {
|
||||||
|
return await this.choixParticuliere(rollData, "rapidite");
|
||||||
|
}
|
||||||
|
|
||||||
ChatMessage.create({
|
ChatMessage.create({
|
||||||
alias: this.attacker.name,
|
alias: this.attacker.name,
|
||||||
whisper: ChatUtility.getWhisperRecipientsAndGMs(this.attacker.name),
|
whisper: ChatUtility.getWhisperRecipientsAndGMs(this.attacker.name),
|
||||||
@ -776,8 +823,9 @@ export class RdDCombat {
|
|||||||
alias: this.attacker.name,
|
alias: this.attacker.name,
|
||||||
attackerId: this.attackerId,
|
attackerId: this.attackerId,
|
||||||
defenderTokenId: this.defenderTokenId,
|
defenderTokenId: this.defenderTokenId,
|
||||||
isFinesse: isMeleeDiffNegative,
|
isForce: isForce,
|
||||||
isRapide: isMeleeDiffNegative && rollData.arme.data.rapide,
|
isFinesse: isFinesse,
|
||||||
|
isRapide: isRapide,
|
||||||
passeArme: rollData.passeArme
|
passeArme: rollData.passeArme
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
@ -915,7 +963,7 @@ export class RdDCombat {
|
|||||||
console.log("RdDCombat._onEchecTotal >>>", rollData);
|
console.log("RdDCombat._onEchecTotal >>>", rollData);
|
||||||
|
|
||||||
const arme = rollData.arme;
|
const arme = rollData.arme;
|
||||||
const avecArme = arme && arme.data.categorie_parade != 'sans-armes';
|
const avecArme = !['', 'sans-armes', 'armes-naturelles'].includes(arme?.data.categorie_parade ?? '');
|
||||||
const action = (rollData.attackerRoll ? (arme ? "la parade" : "l'esquive") : "l'attaque");
|
const action = (rollData.attackerRoll ? (arme ? "la parade" : "l'esquive") : "l'attaque");
|
||||||
ChatUtility.createChatWithRollMode(this.defender.name, {
|
ChatUtility.createChatWithRollMode(this.defender.name, {
|
||||||
content: `<strong>Maladresse à ${action}!</strong> ` + await RdDRollTables.getMaladresse({ arme: avecArme })
|
content: `<strong>Maladresse à ${action}!</strong> ` + await RdDRollTables.getMaladresse({ arme: avecArme })
|
||||||
@ -1176,7 +1224,7 @@ export class RdDCombat {
|
|||||||
defenderRoll.show.recul = 'encaisse';
|
defenderRoll.show.recul = 'encaisse';
|
||||||
} else if (rollRecul.rolled.isETotal || this._isReculCauseChute(impact)) {
|
} else if (rollRecul.rolled.isETotal || this._isReculCauseChute(impact)) {
|
||||||
defenderRoll.show.recul = 'chute';
|
defenderRoll.show.recul = 'chute';
|
||||||
await this.defender.addStatusEffectById('prone');
|
await this.defender.setStatusEffect("EFFECT.StatusProne", true);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
defenderRoll.show.recul = 'recul';
|
defenderRoll.show.recul = 'recul';
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { Misc } from "./misc.js";
|
||||||
|
|
||||||
export class RdDHotbar {
|
export class RdDHotbar {
|
||||||
|
|
||||||
@ -67,15 +68,14 @@ export class RdDHotbar {
|
|||||||
let actor;
|
let actor;
|
||||||
if (speaker.token) actor = game.actors.tokens[speaker.token];
|
if (speaker.token) actor = game.actors.tokens[speaker.token];
|
||||||
if (!actor) actor = game.actors.get(speaker.actor);
|
if (!actor) actor = game.actors.get(speaker.actor);
|
||||||
let item = actor ? actor.items.find(i => i.name === itemName && i.type == itemType) : null;
|
|
||||||
if (!item) return ui.notifications.warn(`Impossible de trouver l'objet de cette macro`);
|
|
||||||
|
|
||||||
item = item.data;
|
let item = Misc.data(actor?.items.find(it => it.name === itemName && it.type == itemType));
|
||||||
|
if (!item) return ui.notifications.warn(`Impossible de trouver l'objet de cette macro`);
|
||||||
|
|
||||||
// Trigger the item roll
|
// Trigger the item roll
|
||||||
switch (item.type) {
|
switch (item.type) {
|
||||||
case "arme":
|
case "arme":
|
||||||
return actor.rollArme(item.data.competence, itemName);
|
return actor.rollArme(item);
|
||||||
case "competence":
|
case "competence":
|
||||||
return actor.rollCompetence( itemName );
|
return actor.rollCompetence( itemName );
|
||||||
}
|
}
|
||||||
|
@ -8,8 +8,9 @@ export class RdDEncaisser extends Dialog {
|
|||||||
constructor(html, actor) {
|
constructor(html, actor) {
|
||||||
// Common conf
|
// Common conf
|
||||||
const buttonsCreatures = {
|
const buttonsCreatures = {
|
||||||
"mortel": { label: "mortel", callback: html => this.performEncaisser("mortel") },
|
"mortel": { label: "Mortel", callback: html => this.performEncaisser("mortel") },
|
||||||
"non-mortel": { label: "non-mortel", callback: html => this.performEncaisser("non-mortel") },
|
"non-mortel": { label: "Non-mortel", callback: html => this.performEncaisser("non-mortel") },
|
||||||
|
"sonne": { label: "Sonné", callback: html => this.actor.setSonne() },
|
||||||
};
|
};
|
||||||
const buttonsEntitesCauchemar = {
|
const buttonsEntitesCauchemar = {
|
||||||
"cauchemar": { label: "cauchemar", callback: html => this.performEncaisser("cauchemar") }
|
"cauchemar": { label: "cauchemar", callback: html => this.performEncaisser("cauchemar") }
|
||||||
|
@ -221,7 +221,7 @@ export class RdDRoll extends Dialog {
|
|||||||
console.log("RdDRollSelectDialog - Cout reve", ptreve);
|
console.log("RdDRollSelectDialog - Cout reve", ptreve);
|
||||||
this.updateRollResult();
|
this.updateRollResult();
|
||||||
});
|
});
|
||||||
html.find('#coupsNonMortels').change((event) => {
|
html.find("[name='coupsNonMortels']").change((event) => {
|
||||||
this.rollData.dmg.mortalite = event.currentTarget.checked ? "non-mortel" : "mortel";
|
this.rollData.dmg.mortalite = event.currentTarget.checked ? "non-mortel" : "mortel";
|
||||||
this.updateRollResult();
|
this.updateRollResult();
|
||||||
});
|
});
|
||||||
@ -300,12 +300,14 @@ export class RdDRoll extends Dialog {
|
|||||||
|
|
||||||
rollData.dmg = rollData.attackerRoll?.dmg ?? RdDBonus.dmg(rollData, this.actor.getBonusDegat());
|
rollData.dmg = rollData.attackerRoll?.dmg ?? RdDBonus.dmg(rollData, this.actor.getBonusDegat());
|
||||||
rollData.caracValue = parseInt(rollData.selectedCarac.value);
|
rollData.caracValue = parseInt(rollData.selectedCarac.value);
|
||||||
|
rollData.mortalite = rollData.attackerRoll?.dmg.mortalite ?? rollData.dmg.mortalite ?? 'mortel';
|
||||||
rollData.coupsNonMortels = (rollData.attackerRoll?.dmg.mortalite ?? rollData.dmg.mortalite) == 'non-mortel';
|
rollData.coupsNonMortels = (rollData.attackerRoll?.dmg.mortalite ?? rollData.dmg.mortalite) == 'non-mortel';
|
||||||
rollData.use.appelAuMoral = this.actor.isPersonnage() && RdDCarac.isActionPhysique(rollData.selectedCarac);
|
rollData.use.appelAuMoral = this.actor.isPersonnage() && RdDCarac.isActionPhysique(rollData.selectedCarac);
|
||||||
let dmgText = Misc.toSignedString(rollData.dmg.total);
|
let dmgText = Misc.toSignedString(rollData.dmg.total);
|
||||||
|
|
||||||
if (rollData.coupsNonMortels) {
|
switch (rollData.mortalite){
|
||||||
dmgText = `(${dmgText}) non-mortel`
|
case 'non-mortel': dmgText = `(${dmgText}) non-mortel`; break;
|
||||||
|
case 'empoignade': dmgText = `empoignade`; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
RollDataAjustements.calcul(rollData, this.actor);
|
RollDataAjustements.calcul(rollData, this.actor);
|
||||||
@ -318,7 +320,7 @@ export class RdDRoll extends Dialog {
|
|||||||
|
|
||||||
// Mise à jour valeurs
|
// Mise à jour valeurs
|
||||||
$(".dialog-roll-title").text(this._getTitle(rollData));
|
$(".dialog-roll-title").text(this._getTitle(rollData));
|
||||||
$('#coupsNonMortels').prop('checked', rollData.coupsNonMortels);
|
$("[name='coupsNonMortels']").prop('checked', rollData.mortalite == 'non-mortel');
|
||||||
$(".dmg-arme-actor").text(dmgText);
|
$(".dmg-arme-actor").text(dmgText);
|
||||||
$('.table-ajustement').remove();
|
$('.table-ajustement').remove();
|
||||||
$(".table-resolution").remove();
|
$(".table-resolution").remove();
|
||||||
|
@ -274,7 +274,7 @@ export class RdDTMRDialog extends Dialog {
|
|||||||
if ( this.actor.tmrApp ) {
|
if ( this.actor.tmrApp ) {
|
||||||
this.actor.tmrApp = undefined; // Cleanup reference
|
this.actor.tmrApp = undefined; // Cleanup reference
|
||||||
if ( !this.viewOnly ) {
|
if ( !this.viewOnly ) {
|
||||||
this.actor.setStatusDemiReve(false);
|
this.actor.setStatusEffect("EFFECT.StatusDemiReve", false);
|
||||||
this._tellToGM(this.actor.name + " a quitté les terres médianes");
|
this._tellToGM(this.actor.name + " a quitté les terres médianes");
|
||||||
}
|
}
|
||||||
this.actor.santeIncDec("fatigue", this.cumulFatigue).then(super.close()); // moving 1 cell costs 1 fatigue
|
this.actor.santeIncDec("fatigue", this.cumulFatigue).then(super.close()); // moving 1 cell costs 1 fatigue
|
||||||
|
@ -53,8 +53,7 @@ export class RdDTokenHud {
|
|||||||
await RdDTokenHud._configureSubMenu(controlIconTarget, 'systems/foundryvtt-reve-de-dragon/templates/hud-actor-attaque.html', hudData,
|
await RdDTokenHud._configureSubMenu(controlIconTarget, 'systems/foundryvtt-reve-de-dragon/templates/hud-actor-attaque.html', hudData,
|
||||||
(event) => {
|
(event) => {
|
||||||
let armeIndex = event.currentTarget.attributes['data-arme-id'].value;
|
let armeIndex = event.currentTarget.attributes['data-arme-id'].value;
|
||||||
let arme = armesList[armeIndex];
|
actor.rollArme(armesList[armeIndex]);
|
||||||
actor.rollArme(arme.data.competence, arme.name);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,6 +115,7 @@ export class RdDUtility {
|
|||||||
'systems/foundryvtt-reve-de-dragon/templates/actor-vehicule-sheet.html',
|
'systems/foundryvtt-reve-de-dragon/templates/actor-vehicule-sheet.html',
|
||||||
'systems/foundryvtt-reve-de-dragon/templates/actor-sheet-competence-partial.html',
|
'systems/foundryvtt-reve-de-dragon/templates/actor-sheet-competence-partial.html',
|
||||||
'systems/foundryvtt-reve-de-dragon/templates/actor-sheet-categorie-competences-partial.html',
|
'systems/foundryvtt-reve-de-dragon/templates/actor-sheet-categorie-competences-partial.html',
|
||||||
|
'systems/foundryvtt-reve-de-dragon/templates/actor-sheet-effects-partial.html',
|
||||||
'systems/foundryvtt-reve-de-dragon/templates/actor-sheet-oeuvre-partial.html',
|
'systems/foundryvtt-reve-de-dragon/templates/actor-sheet-oeuvre-partial.html',
|
||||||
'systems/foundryvtt-reve-de-dragon/templates/actor-liste-blessures-partial.html',
|
'systems/foundryvtt-reve-de-dragon/templates/actor-liste-blessures-partial.html',
|
||||||
'systems/foundryvtt-reve-de-dragon/templates/actor-blessure-partial.html',
|
'systems/foundryvtt-reve-de-dragon/templates/actor-blessure-partial.html',
|
||||||
|
@ -1,23 +1,31 @@
|
|||||||
|
|
||||||
const demiReveStatusEffect = { id: 'demi-reve', rdd: true, label: 'Demi-rêve', icon: 'systems/foundryvtt-reve-de-dragon/icons/heures/hd12.svg' };
|
|
||||||
const rddStatusEffects = [
|
const rddStatusEffects = [
|
||||||
{ id: 'sonne', rdd: true, label: 'Sonné', icon: 'icons/svg/stoned.svg' },
|
{ rdd: true, id: 'stun', label: 'EFFECT.StatusStunned', icon: 'icons/svg/stoned.svg', "duration.rounds": 1 },
|
||||||
demiReveStatusEffect
|
{ rdd: true, id: 'bleeding', label: 'EFFECT.StatusBleeding', icon: 'icons/svg/blood.svg' },
|
||||||
|
{ rdd: true, id: 'prone', label: 'EFFECT.StatusProne', icon: 'icons/svg/falling.svg' },
|
||||||
|
{ rdd: true, id: 'grappling', tint: '#33cc33', label: 'EFFECT.StatusGrappling', icon: 'systems/foundryvtt-reve-de-dragon/icons/competence_corps_a_corps.webp' },
|
||||||
|
{ rdd: true, id: 'grappled', tint: '#ff9900', label: 'EFFECT.StatusGrappled', icon: 'systems/foundryvtt-reve-de-dragon/icons/competence_corps_a_corps.webp' },
|
||||||
|
{ rdd: true, id: 'restrain', label: 'EFFECT.StatusRestrained', icon: 'icons/svg/net.svg' },
|
||||||
|
{ rdd: true, id: 'unconscious', label: 'EFFECT.StatusUnconscious', icon: 'icons/svg/unconscious.svg' },
|
||||||
|
{ rdd: true, id: 'blind', label: 'EFFECT.StatusBlind', icon: 'icons/svg/blind.svg' },
|
||||||
|
{ rdd: true, id: 'comma', label: 'EFFECT.StatusComma', icon: 'icons/svg/skull.svg' },
|
||||||
|
{ rdd: true, id: 'dead', label: 'EFFECT.StatusDead', icon: 'icons/svg/skull.svg' },
|
||||||
|
{ rdd: true, id: 'demi-reve', label: 'EFFECT.StatusDemiReve', icon: 'systems/foundryvtt-reve-de-dragon/icons/heures/hd12.svg' }
|
||||||
];
|
];
|
||||||
const statusDemiSurprise = new Set(['sonne', 'prone', 'restrain']);
|
const demiReveStatusEffect = rddStatusEffects.find(it => it.label == 'EFFECT.StatusDemiReve');
|
||||||
const statusSurpriseTotale = new Set(['unconscious', 'blind', 'dead']);
|
|
||||||
|
const statusDemiSurprise = new Set(['EFFECT.StatusStunned', 'EFFECT.StatusProne', 'EFFECT.StatusRestrain']);
|
||||||
|
const statusSurpriseTotale = new Set(['EFFECT.StatusUnconscious', 'EFFECT.StatusBlind', 'EFFECT.StatusComma']);
|
||||||
|
|
||||||
export class StatusEffects {
|
export class StatusEffects {
|
||||||
static onReady() {
|
static onReady() {
|
||||||
StatusEffects.setCoreStatusId([demiReveStatusEffect]);
|
const rddStatusIds = rddStatusEffects.map(it => it.id);
|
||||||
StatusEffects.setCoreStatusId(rddStatusEffects);
|
const defaultStatusEffectIds = CONFIG.statusEffects.map(it => it.id);
|
||||||
StatusEffects.setMandatoryRdd();
|
|
||||||
const defaultUseStatusEffect = CONFIG.statusEffects.map(it => it.id).join();
|
|
||||||
game.settings.register("foundryvtt-reve-de-dragon", "use-status-effects", {
|
game.settings.register("foundryvtt-reve-de-dragon", "use-status-effects", {
|
||||||
name: "use-status-effects",
|
name: "use-status-effects",
|
||||||
scope: "world",
|
scope: "world",
|
||||||
config: false,
|
config: false,
|
||||||
default: defaultUseStatusEffect,
|
default: defaultStatusEffectIds.join(),
|
||||||
type: String
|
type: String
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -29,30 +37,21 @@ export class StatusEffects {
|
|||||||
type: StatusEffectsSettings,
|
type: StatusEffectsSettings,
|
||||||
restricted: true
|
restricted: true
|
||||||
});
|
});
|
||||||
CONFIG.RDD.allEffects = rddStatusEffects.concat(CONFIG.statusEffects);
|
|
||||||
|
CONFIG.RDD.allEffects = rddStatusEffects.concat(CONFIG.statusEffects.filter(it => !rddStatusIds.includes(it.id)));
|
||||||
|
|
||||||
StatusEffects._setUseStatusEffects(StatusEffects._getUseStatusEffects());
|
StatusEffects._setUseStatusEffects(StatusEffects._getUseStatusEffects());
|
||||||
console.log('statusEffects', CONFIG.statusEffects);
|
console.log('statusEffects', CONFIG.statusEffects);
|
||||||
}
|
}
|
||||||
|
|
||||||
static valeurSurprise(effect, isCombat) {
|
static valeurSurprise(effect, isCombat) {
|
||||||
const id = StatusEffects.statusId(effect);
|
// const id = StatusEffects.statusId(effect);
|
||||||
if (statusSurpriseTotale.has(id)) {
|
if (statusSurpriseTotale.has(effect.label)) {
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
return statusDemiSurprise.has(id) || (isCombat && id == demiReveStatusEffect.id) ? 1 : 0;
|
return statusDemiSurprise.has(effect.label) || (isCombat && effect.label == demiReveStatusEffect.label) ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static statusId(effectData) {
|
|
||||||
return effectData.flags?.core?.statusId ?? effectData["flags.core.statusId"];
|
|
||||||
}
|
|
||||||
|
|
||||||
static setCoreStatusId(list) {
|
|
||||||
list.forEach(it => {
|
|
||||||
it.flags = { core: { statusId: it.id } };
|
|
||||||
it["flags.core.statusId"] = it.id;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
static setMandatoryRdd() {
|
static setMandatoryRdd() {
|
||||||
CONFIG.statusEffects.filter(it => statusDemiSurprise.has(it.id) || statusSurpriseTotale.has(it.id))
|
CONFIG.statusEffects.filter(it => statusDemiSurprise.has(it.id) || statusSurpriseTotale.has(it.id))
|
||||||
.forEach(it => it.rdd = true);
|
.forEach(it => it.rdd = true);
|
||||||
@ -78,6 +77,9 @@ export class StatusEffects {
|
|||||||
return Array.from(useStatusEffects).join();
|
return Array.from(useStatusEffects).join();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static status(label) {
|
||||||
|
return rddStatusEffects.find(it => it.label == label) ?? { label: label };
|
||||||
|
}
|
||||||
static demiReve() {
|
static demiReve() {
|
||||||
return demiReveStatusEffect;
|
return demiReveStatusEffect;
|
||||||
}
|
}
|
||||||
|
@ -271,6 +271,11 @@ table {border: 1px solid #7a7971;}
|
|||||||
height: 16;
|
height: 16;
|
||||||
border-width: 0;
|
border-width: 0;
|
||||||
}
|
}
|
||||||
|
.button-effect-img:hover {
|
||||||
|
color: rgba(255, 255, 128, 0.7);
|
||||||
|
border: 1px solid rgba(255, 128, 0, 0.8);
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
.small-button-container {
|
.small-button-container {
|
||||||
height: 16px;
|
height: 16px;
|
||||||
|
@ -164,11 +164,6 @@
|
|||||||
"value": 10,
|
"value": 10,
|
||||||
"label": "Endurance",
|
"label": "Endurance",
|
||||||
"derivee": false
|
"derivee": false
|
||||||
},
|
|
||||||
"sonne": {
|
|
||||||
"value": false,
|
|
||||||
"round": -1,
|
|
||||||
"label": "Sonné"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"blessures": {
|
"blessures": {
|
||||||
@ -374,10 +369,6 @@
|
|||||||
"value": 0,
|
"value": 0,
|
||||||
"label": "Fatigue",
|
"label": "Fatigue",
|
||||||
"derivee": true
|
"derivee": true
|
||||||
},
|
|
||||||
"sonne": {
|
|
||||||
"value": false,
|
|
||||||
"label": "Sonné"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"blessures": {
|
"blessures": {
|
||||||
|
@ -18,19 +18,7 @@
|
|||||||
<span>{{calc.resumeBlessures}}</span>
|
<span>{{calc.resumeBlessures}}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="flexrow">
|
<div class="flexrow">
|
||||||
{{#if calc.surprise}}{{calc.surprise}}! {{/if}}
|
{{>"systems/foundryvtt-reve-de-dragon/templates/actor-sheet-effects-partial.html"}}
|
||||||
{{#if effects}}
|
|
||||||
{{#each effects as |effect key|}}
|
|
||||||
<span id="effect-{{effect.flags.core.status.statusId}} ">
|
|
||||||
<img class="button-effect-img" src="{{effect.icon}}" alt="{{effect.label}}" width="24" height="24" />
|
|
||||||
</span>
|
|
||||||
{{/each}}
|
|
||||||
{{#if options.isGM}}
|
|
||||||
<span id="enlever-tous-effets"><a>(enlever tout)</a></span>
|
|
||||||
{{/if}}
|
|
||||||
{{else}}
|
|
||||||
Aucun effet actif
|
|
||||||
{{/if}}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -94,10 +82,6 @@
|
|||||||
<input type="text" name="data.sante.endurance.max" value="{{data.sante.endurance.max}}" data-dtype="Number" />
|
<input type="text" name="data.sante.endurance.max" value="{{data.sante.endurance.max}}" data-dtype="Number" />
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<li class="flexrow list-item" data-attribute="sonne">
|
|
||||||
<span class="competence-label" name="data.sante.sonne.label">Sonné</span>
|
|
||||||
<input type="checkbox" name="data.sante.sonne.value" value="{{data.sante.sonne.value}}" {{#if data.sante.sonne.value}}checked{{/if}} />
|
|
||||||
</li>
|
|
||||||
<li class="flexrow list-item" data-attribute="etat">
|
<li class="flexrow list-item" data-attribute="etat">
|
||||||
<span class="competence-label" name="data.compteurs.etat.label">Etat Général</span>
|
<span class="competence-label" name="data.compteurs.etat.label">Etat Général</span>
|
||||||
<input type="text" value="{{data.compteurs.etat.value}}" disabled />
|
<input type="text" value="{{data.compteurs.etat.value}}" disabled />
|
||||||
|
13
templates/actor-sheet-effects-partial.html
Normal file
13
templates/actor-sheet-effects-partial.html
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{{#if calc.surprise}}{{calc.surprise}}! {{/if}}
|
||||||
|
{{#if effects}}
|
||||||
|
{{#each effects as |effect key|}}
|
||||||
|
<span class="active-effect" data-id="{{effect._id}}">
|
||||||
|
<img class="button-effect-img delete-active-effect" src="{{effect.icon}}" alt="{{localize effect.label}}" width="24" height="24" />
|
||||||
|
</span>
|
||||||
|
{{/each}}
|
||||||
|
{{#if options.isGM}}
|
||||||
|
<span class="enlever-tous-effets"><a>(enlever tout)</a></span>
|
||||||
|
{{/if}}
|
||||||
|
{{else}}
|
||||||
|
Aucun effet actif
|
||||||
|
{{/if}}
|
@ -37,12 +37,6 @@
|
|||||||
<a id="fatigue-plus">+</a>
|
<a id="fatigue-plus">+</a>
|
||||||
</label>
|
</label>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
|
||||||
<label class="ctn-sonne">
|
|
||||||
Sonné :
|
|
||||||
<input class="resource-content data-sante-sonne" type="checkbox" {{#if data.sante.sonne.value}}checked{{/if}} />
|
|
||||||
</label>
|
|
||||||
</li>
|
|
||||||
<li>
|
<li>
|
||||||
<label class="ctn-reve">
|
<label class="ctn-reve">
|
||||||
<span class="ptreve-actuel"><a>Rêve</a></span>
|
<span class="ptreve-actuel"><a>Rêve</a></span>
|
||||||
@ -74,20 +68,8 @@
|
|||||||
<span>{{data.compteurs.etat.label}}: {{data.compteurs.etat.value}}</span>
|
<span>{{data.compteurs.etat.label}}: {{data.compteurs.etat.value}}</span>
|
||||||
<span>{{data.compteurs.surenc.label}}: {{data.compteurs.surenc.value}}</span>
|
<span>{{data.compteurs.surenc.label}}: {{data.compteurs.surenc.value}}</span>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div class="flexrow">
|
||||||
{{#if calc.surprise}}{{calc.surprise}}! {{/if}}
|
{{>"systems/foundryvtt-reve-de-dragon/templates/actor-sheet-effects-partial.html"}}
|
||||||
{{#if effects}}
|
|
||||||
{{#each effects as |effect key|}}
|
|
||||||
<span id="effect-{{effect.flags.core.status.statusId}} ">
|
|
||||||
<img class="button-effect-img" src="{{effect.icon}}" alt="{{effect.label}}" width="24" height="24" />
|
|
||||||
</span>
|
|
||||||
{{/each}}
|
|
||||||
{{#if options.isGM}}
|
|
||||||
<span class="enlever-tous-effets"><a>(enlever tout)</a></span>
|
|
||||||
{{/if}}
|
|
||||||
{{else}}
|
|
||||||
Aucun effet actif
|
|
||||||
{{/if}}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
<div data-passearme="{{passeArme}}">
|
<div data-passearme="{{passeArme}}">
|
||||||
<h4 class="rdd-roll-part">{{alias}} réussit une attaque particulière!</strong></h4>
|
<h4 class="rdd-roll-part">{{alias}} réussit une attaque particulière!</strong></h4>
|
||||||
|
{{#if isForce}}
|
||||||
<br>
|
<br>
|
||||||
<a class="chat-card-button" id="particuliere-attaque" data-mode="force" data-attackerId="{{attackerId}}">
|
<a class="chat-card-button" id="particuliere-attaque" data-mode="force" data-attackerId="{{attackerId}}">
|
||||||
Attaquer en Force
|
Attaquer en Force
|
||||||
</a>
|
</a>
|
||||||
|
{{/if}}
|
||||||
{{#if isRapide}}
|
{{#if isRapide}}
|
||||||
<br>
|
<br>
|
||||||
<a class="chat-card-button" id="particuliere-attaque" data-mode="rapidite" data-attackerId="{{attackerId}}">
|
<a class="chat-card-button" id="particuliere-attaque" data-mode="rapidite" data-attackerId="{{attackerId}}">
|
||||||
|
@ -45,18 +45,18 @@
|
|||||||
<div class="flexrow">
|
<div class="flexrow">
|
||||||
{{#if (eq arme.data.mortalite 'non-mortel')}}
|
{{#if (eq arme.data.mortalite 'non-mortel')}}
|
||||||
<label>Dégats:</label><label class="dmg-arme-actor"></label>
|
<label>Dégats:</label><label class="dmg-arme-actor"></label>
|
||||||
|
{{else if (eq arme.data.mortalite 'empoignade')}}
|
||||||
|
<label>Dégats:</label><label>Empoignade</label>
|
||||||
{{else}}
|
{{else}}
|
||||||
<label>Dégats:
|
<label>Dégats:</label>
|
||||||
</label>
|
|
||||||
<span>
|
<span>
|
||||||
<input class="attribute-value" type="checkbox" id="coupsNonMortels" name="coupsNonMortels" {{#if coupsNonMortels}}checked{{/if}}/>
|
<input class="attribute-value" type="checkbox" name="coupsNonMortels" {{#unless (eq mortalite 'mortel')}}checked{{/unless}} />
|
||||||
<label class="dmg-arme-actor">
|
<label class="dmg-arme-actor"></label>
|
||||||
</label>
|
|
||||||
</span>
|
</span>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
{{/unless}}
|
{{/unless}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-surenc.html"}}
|
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-surenc.html"}}
|
||||||
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-enctotal.html"}}
|
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-enctotal.html"}}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<option value="">Ne peut pas parer</option>
|
<option value="">Ne peut pas parer</option>
|
||||||
<option value="sans-armes">Sans arme / armes naturelles</option>
|
<option value="sans-armes">Sans arme</option>
|
||||||
|
<option value="armes-naturelles">Armes naturelles</option>
|
||||||
<option value="hast">Armes d'hast</option>
|
<option value="hast">Armes d'hast</option>
|
||||||
<option value="batons">Bâtons</option>
|
<option value="batons">Bâtons</option>
|
||||||
<option value="boucliers">Boucliers</option>
|
<option value="boucliers">Boucliers</option>
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
<input class="resource-content select-effect" type="checkbox" name="{{effect.id}}" {{#if effect.active}}checked{{/if}}/>
|
<input class="resource-content select-effect" type="checkbox" name="{{effect.id}}" {{#if effect.active}}checked{{/if}}/>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<img class="button-effect-img" height="16" width="16" src="{{effect.icon}}" alt="{{ localize effect.label}}" />
|
<img class="button-effect-img" height="16" width="16" src="{{effect.icon}}" alt="{{ localize effect.label}}" />
|
||||||
<label>{{ localize effect.label}}</label>
|
<label>{{localize effect.label}}</label>
|
||||||
</li>
|
</li>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</ul>
|
</ul>
|
||||||
|
Loading…
Reference in New Issue
Block a user