Possession start

This commit is contained in:
sladecraven 2021-11-11 09:18:25 +01:00
parent 2e83cbd366
commit fb03f7a719
4 changed files with 19 additions and 15 deletions

View File

@ -32,6 +32,8 @@ 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";
import { RdDPossession } from "./rdd-possession.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.
@ -3148,7 +3150,11 @@ export class RdDActor extends Actor {
rollArme(arme) { rollArme(arme) {
let competence = Misc.data(this.getCompetence(arme.data.competence)); let competence = Misc.data(this.getCompetence(arme.data.competence));
if (arme || (competence.type == 'competencecreature' && competence.data.iscombat)) { if (arme || (competence.type == 'competencecreature' && competence.data.iscombat)) {
RdDCombat.createUsingTarget(this)?.attaque(competence, arme); if ( competence.data.ispossession ) {
RdDPossession.managePosession(this, competence);
} else {
RdDCombat.createUsingTarget(this)?.attaque(competence, arme);
}
} else { } else {
this.rollCompetence(competence.name); this.rollCompetence(competence.name);
} }

View File

@ -434,7 +434,6 @@ export class RdDCombat {
else { else {
const defender = target?.actor; const defender = target?.actor;
const defenderTokenId = target?.data._id; const defenderTokenId = target?.data._id;
console.log("Defender: ", defender);
if ( defender.data._id == attacker.data._id) { if ( defender.data._id == attacker.data._id) {
ui.notifications.warn("Vous vous attaquez vous-même !!!!"); ui.notifications.warn("Vous vous attaquez vous-même !!!!");
} else if ( defender.type == 'entite' && defender.data.data.definition.typeentite == 'nonincarne') { } else if ( defender.type == 'entite' && defender.data.data.definition.typeentite == 'nonincarne') {
@ -455,11 +454,13 @@ export class RdDCombat {
return undefined; return undefined;
} }
/* -------------------------------------------- */
static messagePasseArme(data) { static messagePasseArme(data) {
game.socket.emit("system.foundryvtt-reve-de-dragon", { msg: "msg_combat_passearme", data: data }); game.socket.emit("system.foundryvtt-reve-de-dragon", { msg: "msg_combat_passearme", data: data });
RdDCombat.onMsgPasseArme(data); RdDCombat.onMsgPasseArme(data);
} }
/* -------------------------------------------- */
static onMsgPasseArme(data) { static onMsgPasseArme(data) {
switch (data.actionPasseArme) { switch (data.actionPasseArme) {
case "store-attaque": case "store-attaque":

View File

@ -31,6 +31,7 @@ import { EffetsDraconiques } from "./tmr/effets-draconiques.js";
import { RdDHerbes } from "./rdd-herbes.js"; import { RdDHerbes } from "./rdd-herbes.js";
import { RdDItem } from "./item.js"; import { RdDItem } from "./item.js";
import { RdDDice } from "./rdd-dice.js"; import { RdDDice } from "./rdd-dice.js";
import { RdDPossession } from "./rdd-possession.js";
import { RdDSigneDraconiqueItemSheet } from "./item-signedraconique-sheet.js"; import { RdDSigneDraconiqueItemSheet } from "./item-signedraconique-sheet.js";
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -49,7 +50,8 @@ Hooks.once("init", async function () {
game.system.rdd = { game.system.rdd = {
TMRUtility, TMRUtility,
RdDUtility, RdDUtility,
RdDHotbar RdDHotbar,
RdDPossession,
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -197,6 +199,7 @@ Hooks.once("init", async function () {
TMRUtility.init(); TMRUtility.init();
TMRRencontres.init(); TMRRencontres.init();
RdDHotbar.initDropbar(); RdDHotbar.initDropbar();
RdDPossession.init();
}); });
/* -------------------------------------------- */ /* -------------------------------------------- */

File diff suppressed because one or more lines are too long