Fix tactique créatures

les créatures peuvent charger (aligate!)
This commit is contained in:
Vincent Vandemeulebrouck 2021-01-13 23:47:12 +01:00
parent 485809a2d4
commit 23966c1056
4 changed files with 20 additions and 12 deletions

View File

@ -19,6 +19,7 @@ import { RdDItemCompetence } from "./item-competence.js";
import { RdDItemArme } from "./item-arme.js"; import { RdDItemArme } from "./item-arme.js";
import { RdDAlchimie } from "./rdd-alchimie.js"; import { RdDAlchimie } from "./rdd-alchimie.js";
import { StatusEffects } from "./status-effects.js"; import { StatusEffects } from "./status-effects.js";
import { RdDItemCompetenceCreature } from "./item-competencecreature.js";
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -1746,7 +1747,7 @@ export class RdDActor extends Actor {
if (rollData.competence.type == 'competencecreature') { if (rollData.competence.type == 'competencecreature') {
// Fake competence pour créature // Fake competence pour créature
RdDItemCompetence.setRollDataCreature(rollData); RdDItemCompetenceCreature.setRollDataCreature(rollData);
} }
else { else {
rollData.carac = this.data.data.carac; rollData.carac = this.data.data.carac;

View File

@ -31,14 +31,6 @@ export class RdDItemCompetence extends Item {
return competence?.name.toLowerCase().match(/(natation|acrobatie)/); return competence?.name.toLowerCase().match(/(natation|acrobatie)/);
} }
/* -------------------------------------------- */
static setRollDataCreature(rollData) {
rollData.carac = { "carac_creature": { label: rollData.competence.name, value: rollData.competence.data.carac_value } };
rollData.competence = duplicate(rollData.competence);
rollData.competence.data.defaut_carac = "carac_creature";
rollData.competence.data.categorie = "creature";
rollData.selectedCarac = rollData.carac.carac_creature
}
/* -------------------------------------------- */ /* -------------------------------------------- */
static isTronc(compName) { static isTronc(compName) {
for (let troncList of competenceTroncs) { for (let troncList of competenceTroncs) {

View File

@ -1,6 +1,20 @@
/* -------------------------------------------- */ /* -------------------------------------------- */
export class RdDItemCompetenceCreature extends Item { export class RdDItemCompetenceCreature extends Item {
/* -------------------------------------------- */
static setRollDataCreature(rollData) {
rollData.carac = { "carac_creature": { label: rollData.competence.name, value: rollData.competence.data.carac_value } };
rollData.competence = duplicate(rollData.competence);
rollData.competence.data.defaut_carac = "carac_creature";
rollData.competence.data.categorie = "creature";
rollData.selectedCarac = rollData.carac.carac_creature;
if (rollData.competence.data.iscombat) {
rollData.arme = RdDItemCompetenceCreature.toArme(rollData.competence)
}
}
/* -------------------------------------------- */ /* -------------------------------------------- */
static toArme(item) { static toArme(item) {
if (item.type == 'competencecreature' && item.data.iscombat) { if (item.type == 'competencecreature' && item.data.iscombat) {

View File

@ -1,6 +1,7 @@
import { ChatUtility } from "./chat-utility.js"; import { ChatUtility } from "./chat-utility.js";
import { RdDItemArme } from "./item-arme.js"; import { RdDItemArme } from "./item-arme.js";
import { RdDItemCompetence } from "./item-competence.js"; import { RdDItemCompetence } from "./item-competence.js";
import { RdDItemCompetenceCreature } from "./item-competencecreature.js";
import { Misc } from "./misc.js"; import { Misc } from "./misc.js";
import { RdDBonus } from "./rdd-bonus.js"; import { RdDBonus } from "./rdd-bonus.js";
import { RdDResolutionTable } from "./rdd-resolution-table.js"; import { RdDResolutionTable } from "./rdd-resolution-table.js";
@ -394,7 +395,7 @@ export class RdDCombat {
rollData.diviseurSignificative = this._getDiviseurSignificative(rollData); rollData.diviseurSignificative = this._getDiviseurSignificative(rollData);
if (this.attacker.isCreature()) { if (this.attacker.isCreature()) {
RdDItemCompetence.setRollDataCreature(rollData); RdDItemCompetenceCreature.setRollDataCreature(rollData);
} }
else if (arme) { else if (arme) {
// Usual competence // Usual competence
@ -578,7 +579,7 @@ export class RdDCombat {
rollData.diviseurSignificative = this._getDiviseurSignificative(rollData); rollData.diviseurSignificative = this._getDiviseurSignificative(rollData);
if (this.defender.isCreature()) { if (this.defender.isCreature()) {
RdDItemCompetence.setRollDataCreature(rollData); RdDItemCompetenceCreature.setRollDataCreature(rollData);
} }
return rollData; return rollData;
} }
@ -672,7 +673,7 @@ export class RdDCombat {
rollData.diviseurSignificative = this._getDiviseurSignificative(rollData); rollData.diviseurSignificative = this._getDiviseurSignificative(rollData);
if (this.defender.isCreature()) { if (this.defender.isCreature()) {
RdDItemCompetence.setRollDataCreature(rollData); RdDItemCompetenceCreature.setRollDataCreature(rollData);
} }
return rollData; return rollData;
} }