Gestion des @Condition
This commit is contained in:
@ -3,6 +3,23 @@ import statParserFR from "./modules/import-stat-2.js";
|
||||
|
||||
/************************************************************************************/
|
||||
var compmod = "wfrp4e";
|
||||
const vo_conditions = {
|
||||
"ablaze": "Ablaze",
|
||||
"bleeding": "Bleeding",
|
||||
"blinded": "Blinded",
|
||||
"broken": "Broken",
|
||||
"deafened": "Deafened",
|
||||
"entangled": "Entangled",
|
||||
"fatigued": "Fatigued",
|
||||
"poisoned": "Poisoned",
|
||||
"prone": "Prone",
|
||||
"stunned": "Stunned",
|
||||
"surprised": "Surprised",
|
||||
"unconscious": "Unconscious",
|
||||
"grappling": "Grappling",
|
||||
"fear": "Fear",
|
||||
"defeated": "Defeated"
|
||||
}
|
||||
|
||||
/************************************************************************************/
|
||||
Hooks.once('init', () => {
|
||||
@ -13,15 +30,40 @@ Hooks.once('init', () => {
|
||||
compmod = "wfrp4e-core";
|
||||
}
|
||||
} );
|
||||
game.wfrp4efr = { compmod: compmod };
|
||||
game.wfrp4efr = { compmod: compmod,
|
||||
vo_conditions: vo_conditions }
|
||||
|
||||
game.wfrp4e.apps.StatBlockParser.parseStatBlock = async function( statString, type = "npc") {
|
||||
return statParserFR( statString, type);
|
||||
}
|
||||
|
||||
//WFRP_Tables = game.wfrp4e.tables;
|
||||
//WFRP4E = game.wfrp4e.config;
|
||||
//CONFIG.Actor.entityClass = ActorWfrp4e_fr;
|
||||
/*---------------------------------------------------------------------*/
|
||||
game.wfrp4e.utility.handleConditionClick = function(event) {
|
||||
let cond = $(event.currentTarget).attr("data-cond")
|
||||
if (!cond)
|
||||
cond = event.target.text;
|
||||
cond = cond.trim();
|
||||
let condkey
|
||||
// En vo, les noms d'états sont égaux aux clés en minuscules
|
||||
if ( game.wfrp4e.config.conditions[cond.toLowerCase()] ) {
|
||||
condkey = cond.toLowerCase();
|
||||
} else {
|
||||
try {
|
||||
condkey = game.wfrp4e.utility.findKey(cond.toLowerCase(), game.wfrp4e.config.conditions, {caseInsensitive: true});
|
||||
}
|
||||
catch {
|
||||
ui.notifications.error("L'état eéta inconnu : " + cond);
|
||||
}
|
||||
}
|
||||
let condName = game.wfrp4e.config.conditions[condkey];
|
||||
let condDescr = game.wfrp4e.config.conditionDescriptions[condkey];
|
||||
let messageContent = `<b>${condName}</b><br>${condDescr}`
|
||||
|
||||
let chatData = game.wfrp4e.utility.chatDataSetup(messageContent)
|
||||
ChatMessage.create(chatData);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
game.wfrp4e.entities.ActorWfrp4e.prototype.calculateRangeOrDamage = function(formula)
|
||||
{
|
||||
//console.log("FR function calculateRangeOrDamage !", formula);
|
||||
@ -53,6 +95,8 @@ Hooks.once('init', () => {
|
||||
return formula
|
||||
}
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
game.wfrp4e.entities.ActorWfrp4e.prototype.calculateSpellDamage = function(formula, isMagicMissile) {
|
||||
//console.log("Compute FR")
|
||||
let actorData = this.data
|
||||
@ -93,7 +137,8 @@ Hooks.once('init', () => {
|
||||
//console.log("calculateSpellDamage -> " + formula );
|
||||
return eval(formula);
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
game.wfrp4e.entities.ActorWfrp4e.prototype.calculateSpellAttributes = function(formula, aoe=false) {
|
||||
//console.log("Compute FR")
|
||||
let actorData = this.data
|
||||
@ -142,9 +187,9 @@ Hooks.once('init', () => {
|
||||
//console.log("calculateSpellAttributes -> " + formula );
|
||||
return formula.capitalize();
|
||||
}
|
||||
//1console.log("PROTO", game.wfrp4e.entities.ActorWfrp4e.prototype);
|
||||
|
||||
// Babele stuff
|
||||
/*---------------------------------------------------------------------*/
|
||||
// Converters area
|
||||
if(typeof Babele !== 'undefined') {
|
||||
|
||||
Babele.get().register({
|
||||
|
Reference in New Issue
Block a user