Compare commits
7 Commits
foundryvtt
...
v1.5
Author | SHA1 | Date | |
---|---|---|---|
773b3756a6 | |||
d57cdc2af4 | |||
|
f2d1879135 | ||
ea7132468d | |||
2391fbc4bc | |||
|
0d2bb2d9a3 | ||
7198eb621d |
@ -1217,21 +1217,39 @@ export class RdDActor extends Actor {
|
|||||||
if (srcId != destId && itemId != destId) { // déplacement de l'objet
|
if (srcId != destId && itemId != destId) { // déplacement de l'objet
|
||||||
const dest = this.getObjet(destId);
|
const dest = this.getObjet(destId);
|
||||||
const src = this.getObjet(srcId);
|
const src = this.getObjet(srcId);
|
||||||
// changer de conteneur
|
if (dest?.isEquipementSimilaire(item)) {
|
||||||
if (this.conteneurPeutContenir(dest, item)) {
|
|
||||||
await this.enleverDeConteneur(item, src, params.onEnleverConteneur);
|
|
||||||
await this.ajouterDansConteneur(item, dest, params.onAjouterDansConteneur);
|
|
||||||
}
|
|
||||||
else if (dest?.isEquipementSimilaire(item)) {
|
|
||||||
await this.regrouperEquipementsSimilaires(item, dest);
|
await this.regrouperEquipementsSimilaires(item, dest);
|
||||||
result = false;
|
result = false;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const cible = this.getContenantOrParent(dest);
|
||||||
|
// changer de conteneur
|
||||||
|
if (cible == undefined) {
|
||||||
|
await this.enleverDeConteneur(item, src, params.onEnleverConteneur);
|
||||||
|
}
|
||||||
|
else if (this.conteneurPeutContenir(cible, item)) {
|
||||||
|
await this.enleverDeConteneur(item, src, params.onEnleverConteneur);
|
||||||
|
await this.ajouterDansConteneur(item, cible, params.onAjouterDansConteneur);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await this.computeEncombrementTotalEtMalusArmure();
|
await this.computeEncombrementTotalEtMalusArmure();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getContenantOrParent(dest) {
|
||||||
|
if (!dest || dest.isConteneur()) {
|
||||||
|
return dest;
|
||||||
|
}
|
||||||
|
return this.getContenant(dest);
|
||||||
|
}
|
||||||
|
|
||||||
|
getContenant(item) {
|
||||||
|
return this.items.find(it => it.isConteneur() && Misc.templateData(it).contenu.includes(item.id));
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
conteneurPeutContenir(dest, item) {
|
conteneurPeutContenir(dest, item) {
|
||||||
if (!dest) {
|
if (!dest) {
|
||||||
@ -3146,7 +3164,11 @@ export class RdDActor extends Actor {
|
|||||||
case 'chance-actuelle': case 'chance actuelle':
|
case 'chance-actuelle': case 'chance actuelle':
|
||||||
return carac.chance;
|
return carac.chance;
|
||||||
}
|
}
|
||||||
let entry = Misc.findFirstLike(name, Object.entries(carac), { mapper: it => it[1].label, description: 'caractéristique' });
|
const caracList = Object.entries(carac);
|
||||||
|
let entry = Misc.findFirstLike(name, caracList, { mapper: it => it[0], description: 'caractéristique' });
|
||||||
|
if (!entry || entry.length ==0) {
|
||||||
|
entry = Misc.findFirstLike(name, caracList, { mapper: it => it[1].label, description: 'caractéristique' });
|
||||||
|
}
|
||||||
return entry && entry.length > 0 ? carac[entry[0]] : undefined;
|
return entry && entry.length > 0 ? carac[entry[0]] : undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3582,14 +3604,16 @@ export class RdDActor extends Actor {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
isEntite(typeentite = [] ) {
|
isEntite(typeentite = [] ) {
|
||||||
return this.data.type == 'entite' && (typeentite.length == 0 || typeentite.includes(this.data.data.typeentite));
|
return this.data.type == 'entite' && (typeentite.length == 0 || typeentite.includes(this.data.data.definition.typeentite));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
isEntiteAccordee(attaquant) {
|
isEntiteAccordee(attaquant) {
|
||||||
if (!this.isEntite([ENTITE_INCARNE]))
|
if (!this.isEntite([ENTITE_INCARNE])) {
|
||||||
{ return true; }
|
return true;
|
||||||
|
}
|
||||||
let resonnance = Misc.templateData(this).sante.resonnance;
|
let resonnance = Misc.templateData(this).sante.resonnance;
|
||||||
|
console.log("RESONN", resonnance)
|
||||||
return (resonnance.actors.find(it => it == attaquant.id));
|
return (resonnance.actors.find(it => it == attaquant.id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,14 +100,14 @@ export class RdDCombatManager extends Combat {
|
|||||||
const carac = combatant.actor.data.data.carac[competence.data.defaut_carac].value;
|
const carac = combatant.actor.data.data.carac[competence.data.defaut_carac].value;
|
||||||
const niveau = competence.data.niveau;
|
const niveau = competence.data.niveau;
|
||||||
const bonusEcaille = (armeCombat?.data.magique) ? armeCombat.data.ecaille_efficacite : 0;
|
const bonusEcaille = (armeCombat?.data.magique) ? armeCombat.data.ecaille_efficacite : 0;
|
||||||
rollFormula = RdDCombatManager.formuleInitiative(2, carac, niveau, bonusEcaille);
|
rollFormula = RdDCombatManager.formuleInitiative(2, carac, niveau, bonusEcaille);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//console.log("Combatat", c);
|
//console.log("Combatat", c);
|
||||||
const roll = combatant.getInitiativeRoll(rollFormula);
|
const roll = combatant.getInitiativeRoll(rollFormula);
|
||||||
if ( !roll.total) {
|
if (!roll.total) {
|
||||||
roll.evaluate( {async: false});
|
roll.evaluate({ async: false });
|
||||||
}
|
}
|
||||||
if (roll.total <= 0) roll.total = 0.00;
|
if (roll.total <= 0) roll.total = 0.00;
|
||||||
console.log("Compute init for", rollFormula, roll.total, combatant);
|
console.log("Compute init for", rollFormula, roll.total, combatant);
|
||||||
@ -187,7 +187,7 @@ export class RdDCombatManager extends Combat {
|
|||||||
action.data.dommagesReels = Number(tableauDegats[0]);
|
action.data.dommagesReels = Number(tableauDegats[0]);
|
||||||
arme2main.data.dommagesReels = Number(tableauDegats[1]);
|
arme2main.data.dommagesReels = Number(tableauDegats[1]);
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
ui.notifications.info("Les dommages de l'arme à 1/2 mains " + action.name + " ne sont pas corrects (ie sous la forme X/Y)");
|
ui.notifications.info("Les dommages de l'arme à 1/2 mains " + action.name + " ne sont pas corrects (ie sous la forme X/Y)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -197,24 +197,23 @@ export class RdDCombatManager extends Combat {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static listActionsPossessions(actor) {
|
static listActionsPossessions(actor) {
|
||||||
return RdDCombatManager._indexActions(actor.getPossessions().map(p =>
|
return RdDCombatManager._indexActions(actor.getPossessions().map(p => {
|
||||||
{
|
return {
|
||||||
return {
|
name: p.name,
|
||||||
name: p.name,
|
action: 'conjurer',
|
||||||
action: 'conjurer',
|
data: {
|
||||||
data: {
|
competence: p.name,
|
||||||
competence: p.name,
|
possessionid: p.data.data.possessionid,
|
||||||
possessionid: p.data.data.possessionid,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}));
|
}
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static listActionsCombat(combatant) {
|
static listActionsCombat(combatant) {
|
||||||
const actor = combatant.actor;
|
const actor = combatant.actor;
|
||||||
let actions = RdDCombatManager.listActionsPossessions(actor);
|
let actions = RdDCombatManager.listActionsPossessions(actor);
|
||||||
if (actions.length>0) {
|
if (actions.length > 0) {
|
||||||
return actions;
|
return actions;
|
||||||
}
|
}
|
||||||
let items = actor.data.items;
|
let items = actor.data.items;
|
||||||
@ -329,19 +328,19 @@ export class RdDCombatManager extends Combat {
|
|||||||
} else {
|
} else {
|
||||||
compData = Misc.data(RdDItemCompetence.findCompetence(combatant.actor.data.items, action.data.competence));
|
compData = Misc.data(RdDItemCompetence.findCompetence(combatant.actor.data.items, action.data.competence));
|
||||||
compNiveau = compData.data.niveau;
|
compNiveau = compData.data.niveau;
|
||||||
initInfo = action.name + " / " + action.data.competence;
|
initInfo = action.name + " / " + action.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;
|
initOffset = 7;
|
||||||
}
|
}
|
||||||
else {
|
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;
|
||||||
initOffset = RdDCombatManager._baseInitOffset(compData.data.categorie, action);
|
initOffset = RdDCombatManager._baseInitOffset(compData.data.categorie, action);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -372,7 +371,7 @@ export class RdDCombatManager extends Combat {
|
|||||||
static displayInitiativeMenu(html, combatantId) {
|
static displayInitiativeMenu(html, combatantId) {
|
||||||
console.log("Combatant ; ", combatantId);
|
console.log("Combatant ; ", combatantId);
|
||||||
const combatant = game.combat.combatants.get(combatantId);
|
const combatant = game.combat.combatants.get(combatantId);
|
||||||
if (! (combatant?.actor) ) {
|
if (!(combatant?.actor)) {
|
||||||
ui.notifications.warn(`Le combatant ${combatant.name ?? combatantId} n'est pas associé à un acteur, impossible de déterminer ses actions de combat!`)
|
ui.notifications.warn(`Le combatant ${combatant.name ?? combatantId} n'est pas associé à un acteur, impossible de déterminer ses actions de combat!`)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -457,7 +456,7 @@ export class RdDCombat {
|
|||||||
else {
|
else {
|
||||||
const defender = target?.actor;
|
const defender = target?.actor;
|
||||||
const defenderTokenId = target?.data._id;
|
const defenderTokenId = target?.data._id;
|
||||||
if ( defender.type == 'entite' && defender.data.data.definition.typeentite == ENTITE_NONINCARNE) {
|
if (defender.type == 'entite' && defender.data.data.definition.typeentite == ENTITE_NONINCARNE) {
|
||||||
ui.notifications.warn("Vous ne pouvez pas cibler une entité non incarnée !!!!");
|
ui.notifications.warn("Vous ne pouvez pas cibler une entité non incarnée !!!!");
|
||||||
} else {
|
} else {
|
||||||
return this.create(attacker, defender, defenderTokenId, target)
|
return this.create(attacker, defender, defenderTokenId, target)
|
||||||
@ -567,7 +566,7 @@ export class RdDCombat {
|
|||||||
async onEvent(button, event) {
|
async onEvent(button, event) {
|
||||||
const chatMessage = ChatUtility.getChatMessage(event);
|
const chatMessage = ChatUtility.getChatMessage(event);
|
||||||
const defenderRoll = ChatUtility.getMessageData(chatMessage, 'defender-roll');
|
const defenderRoll = ChatUtility.getMessageData(chatMessage, 'defender-roll');
|
||||||
const attackerRoll = defenderRoll?.attackerRoll ?? ChatUtility.getMessageData(chatMessage, 'attacker-roll') ;
|
const attackerRoll = defenderRoll?.attackerRoll ?? ChatUtility.getMessageData(chatMessage, 'attacker-roll');
|
||||||
console.log('RdDCombat', attackerRoll, defenderRoll);
|
console.log('RdDCombat', attackerRoll, defenderRoll);
|
||||||
const defenderTokenId = event.currentTarget.attributes['data-defenderTokenId']?.value;
|
const defenderTokenId = event.currentTarget.attributes['data-defenderTokenId']?.value;
|
||||||
|
|
||||||
@ -760,7 +759,7 @@ export class RdDCombat {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async _onAttaqueParticuliere(rollData) {
|
async _onAttaqueParticuliere(rollData) {
|
||||||
|
|
||||||
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
|
// force toujours, sauf empoignade
|
||||||
// finesse seulement en mélée, pour l'empoignade, ou si la difficulté libre est de -1 minimum
|
// finesse seulement en mélée, pour l'empoignade, ou si la difficulté libre est de -1 minimum
|
||||||
@ -778,7 +777,7 @@ export class RdDCombat {
|
|||||||
else if (!isForce && !isFinesse && isRapide) {
|
else if (!isForce && !isFinesse && isRapide) {
|
||||||
return await this.choixParticuliere(rollData, "rapidite");
|
return await this.choixParticuliere(rollData, "rapidite");
|
||||||
}
|
}
|
||||||
|
|
||||||
const choixParticuliere = await ChatMessage.create({
|
const choixParticuliere = await ChatMessage.create({
|
||||||
alias: this.attacker.name,
|
alias: this.attacker.name,
|
||||||
whisper: ChatUtility.getWhisperRecipientsAndGMs(this.attacker.name),
|
whisper: ChatUtility.getWhisperRecipientsAndGMs(this.attacker.name),
|
||||||
@ -817,7 +816,7 @@ export class RdDCombat {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
isPossession( attackerRoll) {
|
isPossession(attackerRoll) {
|
||||||
return attackerRoll.selectedCarac.label.toLowerCase() == 'possession';
|
return attackerRoll.selectedCarac.label.toLowerCase() == 'possession';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -962,9 +961,8 @@ export class RdDCombat {
|
|||||||
const arme = this.defender.getArmeParade(armeParadeId);
|
const arme = this.defender.getArmeParade(armeParadeId);
|
||||||
console.log("RdDCombat.parade >>>", attackerRoll, armeParadeId, arme);
|
console.log("RdDCombat.parade >>>", attackerRoll, armeParadeId, arme);
|
||||||
const competence = Misc.templateData(arme)?.competence;
|
const competence = Misc.templateData(arme)?.competence;
|
||||||
if (competence == undefined)
|
if (competence == undefined) {
|
||||||
{
|
console.error("Pas de compétence de parade associée à ", arme);
|
||||||
console.error("Pas de compétence de parade associée à ", arme) ;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1247,6 +1245,8 @@ export class RdDCombat {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
/* retourne true si on peut continuer, false si on ne peut pas continuer */
|
/* retourne true si on peut continuer, false si on ne peut pas continuer */
|
||||||
async accorderEntite(when = 'avant-encaissement') {
|
async accorderEntite(when = 'avant-encaissement') {
|
||||||
|
console.log("TETETET", game.settings.get(SYSTEM_RDD, "accorder-entite-cauchemar"), this.defender.isEntite([ENTITE_INCARNE]), this.defender.isEntiteAccordee(this.attacker))
|
||||||
|
|
||||||
if (when != game.settings.get(SYSTEM_RDD, "accorder-entite-cauchemar")
|
if (when != game.settings.get(SYSTEM_RDD, "accorder-entite-cauchemar")
|
||||||
|| this.defender == undefined
|
|| this.defender == undefined
|
||||||
|| !this.defender.isEntite([ENTITE_INCARNE])
|
|| !this.defender.isEntite([ENTITE_INCARNE])
|
||||||
|
@ -158,6 +158,7 @@ export class RdDResolutionTable {
|
|||||||
if (difficulte < -10) {
|
if (difficulte < -10) {
|
||||||
return duplicate(levelDown.find(levelData => levelData.level == difficulte));
|
return duplicate(levelDown.find(levelData => levelData.level == difficulte));
|
||||||
}
|
}
|
||||||
|
console.log("DATA :", caracValue, difficulte)
|
||||||
return duplicate(RdDResolutionTable.resolutionTable[caracValue][difficulte + 10]);
|
return duplicate(RdDResolutionTable.resolutionTable[caracValue][difficulte + 10]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
"url": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/",
|
"url": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/",
|
||||||
"license": "LICENSE.txt",
|
"license": "LICENSE.txt",
|
||||||
"flags": {},
|
"flags": {},
|
||||||
"version": "1.5.87",
|
"version": "1.5.90",
|
||||||
"minimumCoreVersion": "0.8.0",
|
"minimumCoreVersion": "0.8.0",
|
||||||
"compatibleCoreVersion": "9",
|
"compatibleCoreVersion": "9",
|
||||||
"scripts": [],
|
"scripts": [],
|
||||||
@ -500,7 +500,7 @@
|
|||||||
"dependencies": [],
|
"dependencies": [],
|
||||||
"socket": true,
|
"socket": true,
|
||||||
"manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/v1.5/system.json",
|
"manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/v1.5/system.json",
|
||||||
"download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-1.5.87.zip",
|
"download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-1.5.90.zip",
|
||||||
"protected": false,
|
"protected": false,
|
||||||
"gridDistance": 1,
|
"gridDistance": 1,
|
||||||
"gridUnits": "m",
|
"gridUnits": "m",
|
||||||
|
Loading…
Reference in New Issue
Block a user