plein de truc

This commit is contained in:
rwanoux
2024-04-21 16:51:13 +02:00
parent 0fe0d530b1
commit 74e11d439c
78 changed files with 9447 additions and 2112 deletions
+20 -6
View File
@@ -1,4 +1,4 @@
import {onManageActiveEffect, prepareActiveEffectCategories} from "../system/effects.mjs";
import { onManageActiveEffect, prepareActiveEffectCategories } from "../system/effects.mjs";
/**
* Extend the basic ActorSheet with some very simple modifications
@@ -40,7 +40,7 @@ export class VermineActorSheet extends ActorSheet {
context.system = actorData.system;
context.flags = actorData.flags;
context.config = CONFIG.VERMINE;
// Add roll data for TinyMCE editors.
context.rollData = context.actor.getRollData();
@@ -56,7 +56,7 @@ export class VermineActorSheet extends ActorSheet {
// Render the item sheet for viewing/editing prior to the editable check.
html.find('.item-edit').click(ev => {
const li = $(ev.currentTarget).parents(".item");
const li = $(ev.currentTarget).parents(".item");
const item = this.actor.items.get(li.data("itemId"));
item.sheet.render(true);
});
@@ -79,7 +79,7 @@ export class VermineActorSheet extends ActorSheet {
// Active Effect management
html.find(".effect-control").click(ev => onManageActiveEffect(ev, this.actor));
// Drag events for macros.
if (this.actor.isOwner) {
let handler = ev => this._onDragStart(ev);
@@ -90,8 +90,22 @@ export class VermineActorSheet extends ActorSheet {
});
}
//click on wound radio
html.find('[type="radio"][data-wound]').click(ev => {
this._onWoundClick(ev)
})
}
_onWoundClick(ev) {
if (!ev.currentTarget.checked) { return }
let woundType = ev.currentTarget.dataset.wound;
let targetProp = "system." + woundType + ".value";
let update = {};
update[targetProp] = ev.currentTarget.value - 1
this.actor.update(update)
}
async _onItemCreate(event) {
event.preventDefault();
const header = event.currentTarget;
@@ -113,6 +127,6 @@ export class VermineActorSheet extends ActorSheet {
delete itemData.system["type"];
// Finally, create the item!
return await Item.create(itemData, {parent: this.actor});
return await Item.create(itemData, { parent: this.actor });
}
}
+1 -3
View File
@@ -14,8 +14,7 @@ export class VermineCharacterSheet extends VermineActorSheet {
return mergeObject(super.defaultOptions, {
classes: ["vermine2047", "sheet", "character", "actor"],
template: "systems/vermine2047/templates/actor/actor-sheet.hbs",
width: 600,
height: 600,
tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "features" }]
});
}
@@ -53,7 +52,6 @@ export class VermineCharacterSheet extends VermineActorSheet {
if (actorData.type == 'npc') {
this._prepareItems(context);
}
// Add roll data for TinyMCE editors.
context.rollData = context.actor.getRollData();
+5 -5
View File
@@ -1,11 +1,11 @@
import {onManageActiveEffect, prepareActiveEffectCategories} from "../system/effects.mjs";
import { onManageActiveEffect, prepareActiveEffectCategories } from "../system/effects.mjs";
import { VermineActorSheet } from "./actor-sheet.mjs";
/**
* Extend the basic ActorSheet with some very simple modifications
* @extends {ActorSheet}
*/
export class VermineCreatureSheet extends ActorSheet {
export class VermineCreatureSheet extends VermineActorSheet {
/** @override */
static get defaultOptions() {
@@ -40,7 +40,7 @@ export class VermineCreatureSheet extends ActorSheet {
context.system = actorData.system;
context.flags = actorData.flags;
context.config = CONFIG.VERMINE;
// Prepare character data and items.
if (actorData.type == 'character') {
this._prepareItems(context);
@@ -94,7 +94,7 @@ export class VermineCreatureSheet extends ActorSheet {
super.activateListeners(html);
html.find('.item-create').click(this._onItemCreate.bind(this));
}
}
async _onItemCreate(event) {
event.preventDefault();
@@ -118,7 +118,7 @@ export class VermineCreatureSheet extends ActorSheet {
delete itemData.system["type"];
// Finally, create the item!
return await Item.create(itemData, {parent: this.actor});
return await Item.create(itemData, { parent: this.actor });
}
}
+83 -80
View File
@@ -6,79 +6,80 @@ export const VERMINE = {};
*/
VERMINE.AgeTypes = {
1:{ "name":"AGE_TYPES.young", "beginning": 0 },
2:{ "name":"AGE_TYPES.adult", "beginning": 18 },
3:{ "name":"AGE_TYPES.old", "beginning": 47 }
1: { "name": "AGE_TYPES.young", "beginning": 0 },
2: { "name": "AGE_TYPES.adult", "beginning": 18 },
3: { "name": "AGE_TYPES.old", "beginning": 47 }
}
VERMINE.SkillLevels = {
1:{ "label":"SKILL_LEVELS.beginner", "dicePool":1, "reroll":0},
2:{ "label":"SKILL_LEVELS.proficient", "dicePool":1, "reroll":1},
3:{ "label":"SKILL_LEVELS.expert", "dicePool":2, "reroll":1},
4:{ "label":"SKILL_LEVELS.master", "dicePool":2, "reroll":2},
5:{ "label":"SKILL_LEVELS.legend", "dicePool":3, "reroll":2}
0: { "label": "SKILL_LEVELS.incompetent", "dicePool": 0, "reroll": 0 },
1: { "label": "SKILL_LEVELS.beginner", "dicePool": 1, "reroll": 0 },
2: { "label": "SKILL_LEVELS.proficient", "dicePool": 1, "reroll": 1 },
3: { "label": "SKILL_LEVELS.expert", "dicePool": 2, "reroll": 1 },
4: { "label": "SKILL_LEVELS.master", "dicePool": 2, "reroll": 2 },
5: { "label": "SKILL_LEVELS.legend", "dicePool": 3, "reroll": 2 }
}
VERMINE.DifficultyLevels = {
1:{ "label":"DIFFICULTY_LEVELS.obvious", "difficulty":3},
2:{ "label":"DIFFICULTY_LEVELS.easy", "difficulty":5},
3:{ "label":"DIFFICULTY_LEVELS.hard", "difficulty":7},
4:{ "label":"DIFFICULTY_LEVELS.very_hard", "difficulty":9},
5:{ "label":"DIFFICULTY_LEVELS.impossible", "difficulty":10}
1: { "label": "DIFFICULTY_LEVELS.obvious", "difficulty": 3 },
2: { "label": "DIFFICULTY_LEVELS.easy", "difficulty": 5 },
3: { "label": "DIFFICULTY_LEVELS.hard", "difficulty": 7 },
4: { "label": "DIFFICULTY_LEVELS.very_hard", "difficulty": 9 },
5: { "label": "DIFFICULTY_LEVELS.impossible", "difficulty": 10 }
},
VERMINE.ThreatLevels = {
1:{ "label":"THREAT_LEVELS.minor", "attack":3, "vigor":1, "minorWound":1, "majorWound":1, "deadlyWound":1},
2:{ "label":"THREAT_LEVELS.serious", "attack":4, "vigor":2, "minorWound":2, "majorWound":1, "deadlyWound":1},
3:{ "label":"THREAT_LEVELS.major", "attack":5, "vigor":3, "minorWound":2, "majorWound":1, "deadlyWound":1},
4:{ "label":"THREAT_LEVELS.deadly", "attack":6, "vigor":4, "minorWound":2, "majorWound":2, "deadlyWound":2},
}
VERMINE.ThreatLevels = {
1: { "label": "THREAT_LEVELS.minor", "attack": 3, "vigor": 1, "minorWound": 1, "majorWound": 1, "deadlyWound": 1 },
2: { "label": "THREAT_LEVELS.serious", "attack": 4, "vigor": 2, "minorWound": 2, "majorWound": 1, "deadlyWound": 1 },
3: { "label": "THREAT_LEVELS.major", "attack": 5, "vigor": 3, "minorWound": 2, "majorWound": 1, "deadlyWound": 1 },
4: { "label": "THREAT_LEVELS.deadly", "attack": 6, "vigor": 4, "minorWound": 2, "majorWound": 2, "deadlyWound": 2 },
}
VERMINE.ExperienceLevels = {
1:{ "label":"SKILL_LEVELS.beginner", "action":3, "specialties":4, "rerolls":0, "contact":"7"},
2:{ "label":"SKILL_LEVELS.proficient", "action":3, "specialties":5, "rerolls":0, "contact":"5 ou 7"},
3:{ "label":"SKILL_LEVELS.expert", "action":4, "specialties":6, "rerolls":1, "contact":"5,7 ou 9"},
4:{ "label":"SKILL_LEVELS.master", "action":4, "specialties":6, "rerolls":2, "contact":"3,5,7 ou 9"},
1: { "label": "SKILL_LEVELS.beginner", "action": 3, "specialties": 4, "rerolls": 0, "contact": "7" },
2: { "label": "SKILL_LEVELS.proficient", "action": 3, "specialties": 5, "rerolls": 0, "contact": "5 ou 7" },
3: { "label": "SKILL_LEVELS.expert", "action": 4, "specialties": 6, "rerolls": 1, "contact": "5,7 ou 9" },
4: { "label": "SKILL_LEVELS.master", "action": 4, "specialties": 6, "rerolls": 2, "contact": "3,5,7 ou 9" },
}
VERMINE.RoleLevels = {
1:{ "label":"ROLE_LEVELS.minor", "reaction":3, "reaction_bonus":0, "pools":0, "gear":9, "gear_hindrance":0, "protection":1},
2:{ "label":"ROLE_LEVELS.secondary", "reaction":3,"reaction_bonus":1, "pools":1, "gear":9,"gear_hindrance":1, "protection":2},
3:{ "label":"ROLE_LEVELS.important", "reaction":3, "reaction_bonus":2, "pools":2, "gear":9,"gear_hindrance":2, "protection":3},
4:{ "label":"ROLE_LEVELS.major", "reaction":4, "reaction_bonus":2, "pools":4, "gear":10, "gear_hindrance":2, "protection":3},
1: { "label": "ROLE_LEVELS.minor", "reaction": 3, "reaction_bonus": 0, "pools": 0, "gear": 9, "gear_hindrance": 0, "protection": 1 },
2: { "label": "ROLE_LEVELS.secondary", "reaction": 3, "reaction_bonus": 1, "pools": 1, "gear": 9, "gear_hindrance": 1, "protection": 2 },
3: { "label": "ROLE_LEVELS.important", "reaction": 3, "reaction_bonus": 2, "pools": 2, "gear": 9, "gear_hindrance": 2, "protection": 3 },
4: { "label": "ROLE_LEVELS.major", "reaction": 4, "reaction_bonus": 2, "pools": 4, "gear": 10, "gear_hindrance": 2, "protection": 3 },
}
VERMINE.PatternLevels = {
1:{ "label":"PATTERN_LEVELS.insect", "attack":2, "damage":0, "minorWound":0, "majorWound":0, "deadlyWound":1},
2:{ "label":"PATTERN_LEVELS.rat", "attack":3, "damage":1, "minorWound":0, "majorWound":1, "deadlyWound":1},
3:{ "label":"PATTERN_LEVELS.dog", "attack":4, "damage":3, "minorWound":1, "majorWound":1, "deadlyWound":1},
4:{ "label":"PATTERN_LEVELS.bear", "attack":6, "damage":6, "minorWound":2, "majorWound":2, "deadlyWound":2},
1: { "label": "PATTERN_LEVELS.insect", "attack": 2, "damage": 0, "minorWound": 0, "majorWound": 0, "deadlyWound": 1 },
2: { "label": "PATTERN_LEVELS.rat", "attack": 3, "damage": 1, "minorWound": 0, "majorWound": 1, "deadlyWound": 1 },
3: { "label": "PATTERN_LEVELS.dog", "attack": 4, "damage": 3, "minorWound": 1, "majorWound": 1, "deadlyWound": 1 },
4: { "label": "PATTERN_LEVELS.bear", "attack": 6, "damage": 6, "minorWound": 2, "majorWound": 2, "deadlyWound": 2 },
}
VERMINE.SizeLevels = {
1:{ "attack":2, "vigor":1, "minorWound":0, "majorWound":0, "deadlyWound":1},
2:{ "attack":3, "vigor":2, "minorWound":0, "majorWound":1, "deadlyWound":1},
3:{ "attack":4, "vigor":3, "minorWound":1, "majorWound":1, "deadlyWound":1}
1: { "attack": 2, "vigor": 1, "minorWound": 0, "majorWound": 0, "deadlyWound": 1 },
2: { "attack": 3, "vigor": 2, "minorWound": 0, "majorWound": 1, "deadlyWound": 1 },
3: { "attack": 4, "vigor": 3, "minorWound": 1, "majorWound": 1, "deadlyWound": 1 }
}
VERMINE.PackLevels = {
1:{ "attack":1, "damage":1, "minorWound":0, "majorWound":0, "deadlyWound":1},
2:{ "attack":2, "damage":2, "minorWound":2, "majorWound":2, "deadlyWound":2},
3:{ "attack":5, "damage":5, "minorWound":3, "majorWound":3, "deadlyWound":3}
1: { "attack": 1, "damage": 1, "minorWound": 0, "majorWound": 0, "deadlyWound": 1 },
2: { "attack": 2, "damage": 2, "minorWound": 2, "majorWound": 2, "deadlyWound": 2 },
3: { "attack": 5, "damage": 5, "minorWound": 3, "majorWound": 3, "deadlyWound": 3 }
}
VERMINE.abilityCategories = {
"physical": {
"label":"VERMINE.ability_category.physical"
"label": "VERMINE.ability_category.physical"
},
"manual": {
"label":"VERMINE.ability_category.manual"
"label": "VERMINE.ability_category.manual"
},
"mental": {
"label":"VERMINE.ability_category.mental"
"label": "VERMINE.ability_category.mental"
},
"social": {
"label":"VERMINE.ability_category.social"
"label": "VERMINE.ability_category.social"
}
}
@@ -95,64 +96,66 @@ VERMINE.abilities = {
VERMINE.skillCategories = {
"man": {
"label":"VERMINE.skill_category.man"
"label": "VERMINE.skill_category.man"
},
"animal": {
"label":"VERMINE.skill_category.animal"
"label": "VERMINE.skill_category.animal"
},
"tool": {
"label":"VERMINE.skill_category.tool"
"label": "VERMINE.skill_category.tool"
},
"weapon": {
"label":"VERMINE.skill_category.weapon"
"label": "VERMINE.skill_category.weapon"
},
"survival": {
"label":"VERMINE.skill_category.survival"
"label": "VERMINE.skill_category.survival"
},
"world": {
"label":"VERMINE.skill_category.world"
"label": "VERMINE.skill_category.world"
}
}
VERMINE.sexes = {"male": "VERMINE.sexes.male", "female": "VERMINE.sexes.female"};
VERMINE.sexes = { "male": "VERMINE.sexes.male", "female": "VERMINE.sexes.female" };
VERMINE.totems = {
"human":"TOTEMS.human.name",
"predator": "TOTEMS.predator.name" ,
"scavenger": "TOTEMS.scavenger.name" ,
"symbiote": "TOTEMS.symbiote.name" ,
"parasite": "TOTEMS.parasite.name" ,
"builder": "TOTEMS.builder.name" ,
"horde": "TOTEMS.horde.name" ,
"hive": "TOTEMS.hive.name" ,
"human": "TOTEMS.human.name",
"predator": "TOTEMS.predator.name",
"scavenger": "TOTEMS.scavenger.name",
"symbiote": "TOTEMS.symbiote.name",
"parasite": "TOTEMS.parasite.name",
"builder": "TOTEMS.builder.name",
"horde": "TOTEMS.horde.name",
"hive": "TOTEMS.hive.name",
"loner": "TOTEMS.loner.name",
"adapted": "TOTEMS.adapted.name"
"adapted": "TOTEMS.adapted.name"
}
VERMINE.totem_opposites = {
"human":"TOTEMS.adapted.name",
"predator": "TOTEMS.scavenger.name" ,
"scavenger": "TOTEMS.predator.name" ,
"symbiote": "TOTEMS.parasite.name" ,
"parasite": "TOTEMS.symbiote.name" ,
"builder": "TOTEMS.horde.name" ,
"horde": "TOTEMS.builder.name" ,
"hive": "TOTEMS.loner.name" ,
"human": "TOTEMS.adapted.name",
"predator": "TOTEMS.scavenger.name",
"scavenger": "TOTEMS.predator.name",
"symbiote": "TOTEMS.parasite.name",
"parasite": "TOTEMS.symbiote.name",
"builder": "TOTEMS.horde.name",
"horde": "TOTEMS.builder.name",
"hive": "TOTEMS.loner.name",
"loner": "TOTEMS.hive.name",
"adapted": "TOTEMS.human.name"
"adapted": "TOTEMS.human.name"
}
VERMINE.origins = {"aon":"Aon",
"avhorae": "Avhorae" ,
"babel": "Babel",
"soleil_noir": "Empire du Soleil Noir",
"fakhar": "Fakhar",
"horde": "Horde",
"khashan": "Khashan",
"ool": "Ool",
"shattered_kingdoms": "Royaumes divisés",
"saeth": "Saeth",
"tegee": "Tégée (Thalos)",
"tuuhle": "Tuuhle",
"vaelor": "Vaelor",
"valdheim": "Valdheim"
VERMINE.origins = {
"aon": "Aon",
"avhorae": "Avhorae",
"babel": "Babel",
"soleil_noir": "Empire du Soleil Noir",
"fakhar": "Fakhar",
"horde": "Horde",
"khashan": "Khashan",
"ool": "Ool",
"shattered_kingdoms": "Royaumes divisés",
"saeth": "Saeth",
"tegee": "Tégée (Thalos)",
"tuuhle": "Tuuhle",
"vaelor": "Vaelor",
"valdheim": "Valdheim"
}
+57 -3
View File
@@ -1,4 +1,4 @@
import { VermineUtils } from "./roll.mjs";
export class CombatResultDialog extends Dialog {
constructor(dialogData, options) {
@@ -34,8 +34,48 @@ export class CombatResultDialog extends Dialog {
}
export class RollDialog extends Dialog {
static async create(rollData) {
let options = { classes: ["vermine-roll"], width: 420, height: 'fit-content', 'z-index': 99999 };
let html = await renderTemplate('systems/vermine2047/templates/roll.hbs', rollData);
return new RollDialog(actor, rollData, html, options);
}
/* -------------------------------------------- */
constructor(data, html, options, close = undefined) {
let conf = {
title: "",
content: html,
buttons: {
roll: {
icon: '<i class="fas fa-check"></i>',
label: "Lancer !",
callback: () => { this.roll(data.actorId, data.label, data.NoD, data.Reroll) }
},
cancel: {
icon: '<i class="fas fa-times"></i>',
label: "Annuler",
callback: () => { this.close() }
}
},
close: close
}
super(conf, options);
this.data = data;
}
roll() {
VermineUtils.roll(actorId, label, NoD, Reroll = 0, params = {})
}
}
export const getRollBox = async function (data) {
console.log(data)
let actor = await game.actors.get(data.actorId)
let html = await renderTemplate('systems/vermine2047/templates/roll.hbs', data);
let dial = new Dialog({
title: game.i18n.localize("ROLLS.tool"),
@@ -43,7 +83,7 @@ export const getRollBox = async function (data) {
buttons: {
roll: {
label: game.i18n.localize('ROLLS.roll_dice'),
callback: (html) => {
callback: async (html) => {
let form = html.find('#dice-pool-form');
if (!form[0].checkValidity()) {
throw "Invalid Data";
@@ -67,6 +107,18 @@ export const getRollBox = async function (data) {
// réserves
if (formData.self_control > 0) {
NoD += parseInt(formData.self_control, 10);
let newSelfControl = actor.system.attributes.self_control.value - parseInt(formData.self_control);
if (newSelfControl < 0) {
return async () => {
await ui.notifications.notify(`vous ne disposez pas d'assez de sang-froid`);
dial.render(true);
}
}
await actor.update({
"system.attributes.self_control.value": newSelfControl
})
}
if (formData.group > 0) {
NoD += parseInt(formData.group, 10);
@@ -83,7 +135,9 @@ export const getRollBox = async function (data) {
}
if (formData.abilityScore == 0 || !formData.abilityScore) {
ui.notifications.notify(`veuillez saisir une caractéristique`);
} else return game.vermine2047.VermineRoll.roll(data.actorId, data.label, NoD, Reroll, data);
dial.render(true);
} else
return VermineUtils.roll(data.actorId, data.label, NoD, Reroll, data);
}
},
close: {
+112 -113
View File
@@ -1,30 +1,30 @@
import { VERMINE } from "./config.mjs";
import { getActorSkillScore,updateActorSkillScore } from "./functions.mjs";
import { getActorSkillScore, updateActorSkillScore } from "./functions.mjs";
export class VermineFight {
async performTest(enemyAchievement, enemyConservation, skillKey, skill, params, actor) {
const dicePool = (params.spleen != undefined || params.purpose != undefined) ? '5' : '4';
const r = new Roll(dicePool +`d6`);
const r = new Roll(dicePool + `d6`);
let diceString = '';
let dicePoolHint = '';
let discardedRoll = false;
let discardedRoll = false;
let bonus = 0;
let bonusText = '/+';
let currentSkillScore = skill;
r.roll(); // dice are rolled
if (params.usure != undefined){
if (params.usure != undefined) {
currentSkillScore += params.usure;
bonus += params.usure;
}
if (params.specialization != undefined){
if (params.specialization != undefined) {
currentSkillScore += 2;
}
if (params.trait != undefined){
if (params.trait != undefined) {
currentSkillScore += params.trait;
bonus += params.trait;
}
@@ -32,28 +32,28 @@ export class VermineFight {
bonusText += bonus;
let targetText = game.i18n.format('VERMINE.Selected') + ' : ' + game.i18n.format(skillKey) + " " + skill + bonusText;
if (params.specialization != undefined){
targetText += " (S)";
if (params.specialization != undefined) {
targetText += " (S)";
}
// tri par ordre croissant
r.terms[0].results.sort((a,b) => a.result - b.result );
if (params.purpose != undefined){
r.terms[0].results.sort((a, b) => a.result - b.result);
if (params.purpose != undefined) {
discardedRoll = r.terms[0].results.shift();
dicePoolHint = ' - ' + game.i18n.format('VERMINE.PurposeTrait');
} else if (params.spleen != undefined){
} else if (params.spleen != undefined) {
discardedRoll = r.terms[0].results.pop();
dicePoolHint = ' - ' + game.i18n.format('VERMINE.SpleenTrait');
}
}
const discardedRollText = (discardedRoll.result != undefined) ? '<div class="discarded-roll">' + discardedRoll.result + '</div>' : "";
for (let i = 0; i < r.terms[0].results.length; i++) {
let result = r.terms[0].results[i].result;
diceString += '<li class="roll die d6 die-'+ i +'">' + result + '</li>';
diceString += '<li class="roll die d6 die-' + i + '">' + result + '</li>';
}
let hintText = game.i18n.format('VERMINE.ConfrontationHint');
// Build a dynamic html using the variables from above.
const html = `
<div class="vermine2047 roll confrontation">
@@ -73,7 +73,7 @@ export class VermineFight {
</div>
</section>
</div>` +
`<p class="step1-text" id="step1">` + hintText + `</p>
`<p class="step1-text" id="step1">` + hintText + `</p>
<div class="row">
<a class="inline-block button add-to-achievement">` + game.i18n.format('VERMINE.Achievement') + `</a>
<a class="inline-block button add-to-conservation">` + game.i18n.format('VERMINE.Conservation') + `</a>
@@ -109,10 +109,10 @@ export class VermineFight {
if (actor)
conf.speaker = ChatMessage.getSpeaker({ actor: actor });
// Send's Chat Message to foundry, if items are missing they will appear as false or undefined and this not be rendered.
ChatMessage.create(conf).then((msg) => {
// Send's Chat Message to foundry, if items are missing they will appear as false or undefined and this not be rendered.
ChatMessage.create(conf).then((msg) => {
return msg;
});
});
}
static instance = null;
@@ -123,7 +123,7 @@ export class VermineFight {
return VermineFight.instance;
}
// data injected to char data
static previousValues = {
dicePool: 4,
@@ -136,34 +136,34 @@ export class VermineFight {
static rollerTemplate = 'systems/vermine2047/templates/fight.html';
static CombatResultTemplate = 'systems/vermine2047/templates/fight-result.html';
static async chatMessageHandler(message, html, data) {
// console.log("accès au fin du fin", message._id);
// sélection du dé actif
html.on("click", '.confrontation .die.d6', event => {
const diceResult = parseInt($(event.target).html(),10);
const diceResult = parseInt($(event.target).html(), 10);
html.find('.confrontation .die.d6').removeClass('active');
$(event.target).addClass('active');
});
// sélection des dés d'accomplissement
html.on("click", '.confrontation .add-to-achievement', event => {
const diceResult = parseInt(html.find('.confrontation .die.d6.active').html(),10);
const diceResult = parseInt(html.find('.confrontation .die.d6.active').html(), 10);
html.find('.confrontation .die.d6.active').removeClass('min').addClass('max');
});
// sélection des dés de conservation
html.on("click", '.confrontation .add-to-conservation', event => {
const diceResult = parseInt(html.find('.confrontation .die.d6.active').html(),10);
const diceResult = parseInt(html.find('.confrontation .die.d6.active').html(), 10);
html.find('.confrontation .die.d6.active').removeClass('max').addClass('min');
});
// reset de la sélection des pools
html.on("click", '.confrontation .reset', event => {
html.find('.confrontation .die.d6')
.removeClass('max')
.removeClass('min');
.removeClass('max')
.removeClass('min');
});
// résolution de la confrontation
@@ -172,10 +172,10 @@ export class VermineFight {
let conservationDice = 0;
let achievementBasis = 0;
let conservationBasis = 0;
html.find('.confrontation .die.d6.max').each(function(index){
html.find('.confrontation .die.d6.max').each(function (index) {
achievementDice += parseInt($(this).html(), 10);
});
html.find('.confrontation .die.d6.min').each(function(index){
html.find('.confrontation .die.d6.min').each(function (index) {
conservationDice += parseInt($(this).html(), 10);
});
@@ -189,8 +189,8 @@ export class VermineFight {
html.find('td.conservation-result').html(conservationBasis + conservationDice);
// calcul des marges
const achievementMargin = achievementBasis + achievementDice - parseInt(html.find('td.adv-achievement-result').html(),10);
const conservationMargin = conservationBasis + conservationDice - parseInt(html.find('td.adv-conservation-result').html(),10);
const achievementMargin = achievementBasis + achievementDice - parseInt(html.find('td.adv-achievement-result').html(), 10);
const conservationMargin = conservationBasis + conservationDice - parseInt(html.find('td.adv-conservation-result').html(), 10);
html.find('td.achievement-margin').html(achievementMargin);
html.find('td.conservation-margin').html(conservationMargin);
@@ -206,7 +206,7 @@ export class VermineFight {
// supprime le masquage des résultats du dé
html.off("click", ".dice-roll");
}
/**
* main class function
* @returns
@@ -217,30 +217,30 @@ export class VermineFight {
// get the actor
try {
actor = game.user.character;
} catch(e){
throw("Aucun personnage défini !");
} catch (e) {
throw ("Aucun personnage défini !");
}
if (actor == null && externalData.speakerId != undefined && externalData.speakerId != null){
if (actor == null && externalData.speakerId != undefined && externalData.speakerId != null) {
// on récupère le speakerId, et de là l'objet actor
actor = game.actors.get(externalData.speakerId);
actor = game.actors.get(externalData.speakerId);
VermineFight.previousValues['speakerName'] = actor.name;
VermineFight.previousValues['speakerImg'] = actor.img;
VermineFight.previousValues['speakerImg'] = actor.img;
} else {
VermineFight.previousValues['speakerName'] = "Anonyme";
}
// get the data
let charData = (externalData) => {
let o = Object.assign({ _template: VermineFight.rollerTemplate }, {...VermineFight.previousValues, ...externalData});
let o = Object.assign({ _template: VermineFight.rollerTemplate }, { ...VermineFight.previousValues, ...externalData });
return o;
};
let data = charData(externalData);
console.log(data);
let data = charData(externalData);
console.log(data);
// render template
let html = await renderTemplate(data._template, data);
let ui = new Dialog({
title: game.i18n.localize("VERMINE.FightTool"),
content: html,
@@ -257,7 +257,7 @@ export class VermineFight {
switch (e.name) {
case "skill":
case "cephalic":
if (e.value !== ''){
if (e.value !== '') {
skillKey = e.value;
}
break;
@@ -270,31 +270,31 @@ export class VermineFight {
case "usure":
params.usure = +e.value;
break;
case "trait":
params.trait = +e.value;
break;
case "purpose":
case "trait":
params.trait = +e.value;
break;
case "purpose":
params.purpose = true;
break;
case "spleen":
params.spleen = true;
break;
break;
case "adv-skill":
enemySkill = +e.value;
break;
case "achievement":
enemySkill = +e.value;
break;
case "achievement":
enemyAchievement = +e.value;
break;
case "conservation":
enemyConservation = +e.value;
break;
}
enemyConservation = +e.value;
break;
}
});
// prise en compte de l'usure sur la feuille de perso
if (params.usure != undefined){
const newSpentScore = getActorSkillScore(actor, skillKey, 'spent') + params.usure;
console.log(newSpentScore);
updateActorSkillScore(actor, skillKey, 'spent', newSpentScore);
if (params.usure != undefined) {
const newSpentScore = getActorSkillScore(actor, skillKey, 'spent') + params.usure;
console.log(newSpentScore);
updateActorSkillScore(actor, skillKey, 'spent', newSpentScore);
}
return VermineFight.get().performTest(enemyAchievement + enemySkill, enemyConservation + enemySkill, skillKey, skill, params, actor);
@@ -309,10 +309,10 @@ export class VermineFight {
h.on("change", 'select[name="skill"]', event => {
const skillLabel = $(event.target).val();
const currentSkillScore = getActorSkillScore(actor, skillLabel) - getActorSkillScore(actor, skillLabel, 'spent');
if (parseInt(currentSkillScore,10) >= 0){
if (parseInt(currentSkillScore, 10) >= 0) {
h.find('input#skillScore').val(currentSkillScore);
}
});
});
}
}, { width: 601, height: 'fit-content' });
ui.render(true);
@@ -321,7 +321,7 @@ export class VermineFight {
}
export class VermineCombat extends Combat {
_encounterCheck(){
_encounterCheck() {
console.log('encounter combat object', this);
}
@@ -338,7 +338,7 @@ export class VermineCombat extends Combat {
}*/
const combatant = this.combatants.get(ids[0]);
let token = canvas.scene.tokens.get(combatant.tokenId);
combatant.type = game.actors.get( combatant.actorId)?.type;
combatant.type = game.actors.get(combatant.actorId)?.type;
combatant.disposition = token.disposition;
let enemies = [];
@@ -346,7 +346,7 @@ export class VermineCombat extends Combat {
let token = canvas.scene.tokens.get(cbt.tokenId);
let enemy = token.actor;
const isEnemy = (token.disposition == -1) ? true : false;
if (isEnemy){
if (isEnemy) {
enemies.push({
id: enemy.id,
name: enemy.name,
@@ -363,12 +363,12 @@ export class VermineCombat extends Combat {
return (token.disposition == 1 && cbt.id != combatant.id) ? true : false;
});
if (combatant.type != 'character'){
let warningDialogHTML = await renderTemplate('systems/vermine2047/templates/dialogs/warning.html', {
if (combatant.type != 'character') {
let warningDialogHTML = await renderTemplate('systems/vermine2047/templates/dialogs/warning.html', {
warningText: "Seuls les PJs peuvent initier des confrontations. Relancer l'opération au tour du PJ actif."
});
Dialog.prompt({
title: "Avertissement",
Dialog.prompt({
title: "Avertissement",
content: warningDialogHTML,
label: 'Okay !',
callback: () => {
@@ -378,10 +378,10 @@ export class VermineCombat extends Combat {
} else {
// étape 2 : on envoie les infos
let fightingActor = game.actors.get(combatant.actorId);
VermineFight.ui({
speakerId: combatant.actorId,
VermineFight.ui({
speakerId: combatant.actorId,
speakerWeapons: fightingActor.items.filter(item => item.type == 'weapon'),
speakerExperience:fightingActor.system.attributes.experience.value,
speakerExperience: fightingActor.system.attributes.experience.value,
speakerEffects: token.actor.effects,
adversaries: enemies,
allies: allies
@@ -409,7 +409,7 @@ export class VermineCombat extends Combat {
return super.startCombat();
}
/************************************************************************************/
_onDelete() {
/*let combatants = this.combatants.contents
@@ -425,30 +425,10 @@ export class VermineCombat extends Combat {
export class VermineCombatTracker extends CombatTracker {
get template() {
return "systems/vermine2047/templates/combat-tracker.hbs";
return "systems/vermine2047/templates/combat-tracker.hbs";
}
async getData(options) {
const context = await super.getData(options);
if (!context.hasCombat) {
return context;
}
for (let [i, combatant] of context.combat.turns.entries()) {
context.turns[i].hasActed = combatant.getFlag("world", "hasActed");
context.turns[i].isPlayer = combatant.actor.type == "player";
context.turns[i].isNpc = combatant.actor.type == "npc";
}
return context;
}
/* -------------------------------------------- */
get template() {
return "systems/gods-system/templates/combat/tracker.hbs";
}
async getData(options) {
const context = await super.getData(options);
if (!context.hasCombat) {
@@ -456,39 +436,58 @@ async getData(options) {
}
for (let [i, combatant] of context.combat.turns.entries()) {
context.turns[i].attitude = combatant.getFlag("world", "attitude");
context.turns[i].isPlayer = combatant.actor.type == "character";
context.turns[i].isNpc = combatant.actor.type == "npc";
context.turns[i].isCreature = combatant.actor.type == "creature";
context.turns[i].hasActed = combatant.getFlag("world", "hasActed");
context.turns[i].isPlayer = combatant.actor.type == "player";
context.turns[i].isNpc = combatant.actor.type == "npc";
}
return context;
}
}
activateListeners(html) {
/* -------------------------------------------- */
get template() {
return "systems/vermine2047/templates/combat-tracker.hbs";
}
async getData(options) {
const context = await super.getData(options);
if (!context.hasCombat) {
return context;
}
for (let [i, combatant] of context.combat.turns.entries()) {
context.turns[i].attitude = combatant.getFlag("world", "attitude");
context.turns[i].isPlayer = combatant.actor.type == "character";
context.turns[i].isNpc = combatant.actor.type == "npc";
context.turns[i].isCreature = combatant.actor.type == "creature";
}
return context;
}
activateListeners(html) {
super.activateListeners(html);
html.find(".status").click(this._setStatut.bind(this));
}
html.find("[data-attitude]").click(this._setStatut.bind(this));
}
/**
* @description Use to put an attitude to an actor
* @param {*} event
*/
async _setStatut(event) {
/**
* @description Use to put an attitude to an actor
* @param {*} event
*/
async _setStatut(event) {
event.preventDefault();
event.stopPropagation();
const btn = event.currentTarget;
const attitude = btn.dataset.attitude;
const li = btn.closest(".combatant");
const combat = this.viewed;
const combatant = combat.combatants.get(li.dataset.combatantId);
if ($(btn).hasClass('offensive'))
await combatant.setFlag("world", "attitude", "offensive");
else if ($(btn).hasClass('active'))
await combatant.setFlag("world", "attitude", "active");
else if ($(btn).hasClass('passive'))
await combatant.setFlag("world", "attitude", "passive");
else
await combatant.setFlag("world", "attitude", null);
}
let flag = combatant.getFlag("world", "attitude");
if (flag == attitude) {
return await combatant.setFlag("world", "attitude", null);
} else {
return await combatant.setFlag("world", "attitude", attitude);
}
}
}
+148 -122
View File
@@ -3,7 +3,7 @@
* Pre-loaded templates are compiled and cached for fast access when rendering
* @return {Promise}
*/
export const preloadHandlebarsTemplates = async function() {
export const preloadHandlebarsTemplates = async function () {
return loadTemplates([
@@ -57,16 +57,16 @@ function range(start, end, step) {
step = step == null ? 1 : Number(step);
if (end == null) {
end = start;
start = 0;
end = start;
start = 0;
}
var length = Math.max(Math.ceil((end - start) / (step || 1)), 0);
var result = new Array(length);
for (var i = 0; i < length; i += 1) {
result[i] = start;
start += step;
result[i] = start;
start += step;
}
return result;
@@ -76,162 +76,188 @@ export const registerHandlebarsHelpers = function () {
Handlebars.registerHelper('concat', (...args) => args.slice(0, -1).join(''));
Handlebars.registerHelper('lower', e => e.toLocaleLowerCase());
Handlebars.registerHelper('toLowerCase', function(str) {
return str.toLowerCase();
Handlebars.registerHelper('toLowerCase', function (str) {
return str.toLowerCase();
});
// search translation with variables
Handlebars.registerHelper('smarttl', function (arrayLabel,objectLabel, options) {
return game.i18n.localize(arrayLabel +"."+objectLabel+".name");
Handlebars.registerHelper('smarttl', function (arrayLabel, objectLabel, options) {
return game.i18n.localize(arrayLabel + "." + objectLabel + ".name");
});
Handlebars.registerHelper('smarttlk', function (arrayLabel,objectLabel, key) {
return game.i18n.localize(arrayLabel +"."+objectLabel+"."+key);
Handlebars.registerHelper('smarttlk', function (arrayLabel, objectLabel, key) {
return game.i18n.localize(arrayLabel + "." + objectLabel + "." + key);
});
Handlebars.registerHelper('smartcfg', function (configLabel, objectLabel) {
let text = "";
text = game.i18n.localize(CONFIG.VERMINE[configLabel][objectLabel]);
if (text == null){
if (text == null) {
text = CONFIG.VERMINE[configLabel][objectLabel];
}
return text;
});
// return threat level information
Handlebars.registerHelper('threatLevel', function (property, level, options) {
if (level < 1 || level > 4)
return "";
let levelData = CONFIG.VERMINE.ThreatLevels[level];
if (property == 'label'){
return (levelData !== undefined) ? game.i18n.localize(levelData[property]) : "";
} else {
return (levelData !== undefined) ? levelData[property] : "";
}
});
// return experience level information
Handlebars.registerHelper('experienceLevel', function (property, level, options) {
if (level < 1 || level > 4)
return "";
let levelData = CONFIG.VERMINE.ExperienceLevels[level];
if (property == 'label'){
return (levelData !== undefined) ? game.i18n.localize(levelData[property]) : "";
} else {
return (levelData !== undefined) ? levelData[property] : "";
}
});
// return role level information
Handlebars.registerHelper('roleLevel', function (property, level, options) {
if (level < 1 || level > 4)
return "";
let levelData = CONFIG.VERMINE.RoleLevels[level];
if (property == 'label'){
return (levelData !== undefined) ? game.i18n.localize(levelData[property]) : "";
} else {
return (levelData !== undefined) ? levelData[property] : "";
}
});
// return pattern level information
Handlebars.registerHelper('patternLevel', function (property, level, options) {
if (level < 1 || level > 4)
return "";
let levelData = CONFIG.VERMINE.PatternLevels[level];
if (property == 'label'){
return (levelData !== undefined) ? game.i18n.localize(levelData[property]) : "";
} else {
return (levelData !== undefined) ? levelData[property] : "";
}
});
// return size level information
Handlebars.registerHelper('sizeLevel', function (property, level, options) {
if (level < 1 || level > 4)
// return threat level information
Handlebars.registerHelper('threatLevel', function (property, level, options) {
if (level < 1 || level > 4)
return "";
let levelData = CONFIG.VERMINE.SizeLevels[level];
if (property == 'label'){
let levelData = CONFIG.VERMINE.ThreatLevels[level];
if (property == 'label') {
return (levelData !== undefined) ? game.i18n.localize(levelData[property]) : "";
} else {
return (levelData !== undefined) ? levelData[property] : "";
}
});
// return pack level information
Handlebars.registerHelper('packLevel', function (property, level, options) {
if (level < 0 || level > 3)
return "";
let levelData = CONFIG.VERMINE.PackLevels[level];
if (property == 'label'){
return (levelData !== undefined) ? game.i18n.localize(levelData[property]) : "";
} else {
return (levelData !== undefined) ? levelData[property] : "";
}
});
// return experience level information
Handlebars.registerHelper('experienceLevel', function (property, level, options) {
if (level < 1 || level > 4)
return "";
let levelData = CONFIG.VERMINE.ExperienceLevels[level];
if (property == 'label') {
return (levelData !== undefined) ? game.i18n.localize(levelData[property]) : "";
} else {
return (levelData !== undefined) ? levelData[property] : "";
}
});
// return role level information
Handlebars.registerHelper('roleLevel', function (property, level, options) {
if (level < 1 || level > 4)
return "";
let levelData = CONFIG.VERMINE.RoleLevels[level];
if (property == 'label') {
return (levelData !== undefined) ? game.i18n.localize(levelData[property]) : "";
} else {
return (levelData !== undefined) ? levelData[property] : "";
}
});
// return pattern level information
Handlebars.registerHelper('patternLevel', function (property, level, options) {
if (level < 1 || level > 4)
return "";
let levelData = CONFIG.VERMINE.PatternLevels[level];
if (property == 'label') {
return (levelData !== undefined) ? game.i18n.localize(levelData[property]) : "";
} else {
return (levelData !== undefined) ? levelData[property] : "";
}
});
// return size level information
Handlebars.registerHelper('sizeLevel', function (property, level, options) {
if (level < 1 || level > 4)
return "";
let levelData = CONFIG.VERMINE.SizeLevels[level];
if (property == 'label') {
return (levelData !== undefined) ? game.i18n.localize(levelData[property]) : "";
} else {
return (levelData !== undefined) ? levelData[property] : "";
}
});
// return pack level information
Handlebars.registerHelper('packLevel', function (property, level, options) {
if (level < 0 || level > 3)
return "";
let levelData = CONFIG.VERMINE.PackLevels[level];
if (property == 'label') {
return (levelData !== undefined) ? game.i18n.localize(levelData[property]) : "";
} else {
return (levelData !== undefined) ? levelData[property] : "";
}
});
// return skill level information
Handlebars.registerHelper('skillLevel', function (property, level, options) {
if (level < 1 || level > 5)
if (level < 1 || level > 5)
return "";
let levelData = CONFIG.VERMINE.SkillLevels[level];
if (property == 'label'){
let levelData = CONFIG.VERMINE.SkillLevels[level];
if (property == 'label') {
return (levelData !== undefined) ? game.i18n.localize(levelData[property]) : "";
} else {
return (levelData !== undefined) ? levelData[property] : "";
}
});
// return diff level information
Handlebars.registerHelper('diffLevel', function (property, level, options) {
if (level < 1 || level > 5)
return "";
let levelData = CONFIG.VERMINE.DifficultyLevels[level];
if (property == 'label'){
return (levelData !== undefined) ? game.i18n.localize(levelData[property]) : "";
} else {
return (levelData !== undefined) ? levelData[property] : "";
}
});
// return diff level information
Handlebars.registerHelper('diffLevel', function (property, level, options) {
if (level < 1 || level > 5)
return "";
let levelData = CONFIG.VERMINE.DifficultyLevels[level];
if (property == 'label') {
return (levelData !== undefined) ? game.i18n.localize(levelData[property]) : "";
} else {
return (levelData !== undefined) ? levelData[property] : "";
}
// return age type information
Handlebars.registerHelper('ageType', function (property, level, options) {
if (level < 1 || level > 3)
return "";
let ageData = CONFIG.VERMINE.AgeTypes[level];
if (property == 'name'){
return (ageData !== undefined) ? game.i18n.localize(ageData[property]) : "";
} else {
return (ageData !== undefined) ? ageData[property] : "";
}
});
Handlebars.registerHelper('getCombatTrackerColor', function (isPlayer, isNpc) {
if (isPlayer) return "player";
if (isNpc) return "npc";
});
Handlebars.registerHelper('range', function() {
// return age type information
Handlebars.registerHelper('ageType', function (property, level, options) {
if (level < 1 || level > 3)
return "";
let ageData = CONFIG.VERMINE.AgeTypes[level];
if (property == 'name') {
return (ageData !== undefined) ? game.i18n.localize(ageData[property]) : "";
} else {
return (ageData !== undefined) ? ageData[property] : "";
}
});
Handlebars.registerHelper('getCombatTrackerColor', function (isPlayer, isNpc) {
if (isPlayer) return "player";
if (isNpc) return "npc";
});
Handlebars.registerHelper('range', function () {
var args = Array.prototype.slice.call(arguments),
rangeArgs = args.slice(0, -1),
options = args[args.length - 1];
rangeArgs = args.slice(0, -1),
options = args[args.length - 1];
return range.apply(null, rangeArgs)
.map(function(num) { return options.fn(num); })
.join('');
.map(function (num) { return options.fn(num); })
.join('');
});
// return age type information
Handlebars.registerHelper('ife', function (arg1, arg2, options) {
return (arg1 == arg2) ? options.fn(this) : options.inverse(this);
});
Handlebars.registerHelper('ifgt', function (a, b, options) {
if (a > b) { return options.fn(this); }
return options.inverse(this);
});
Handlebars.registerHelper('iflt', function (a, b, options) {
if (a < b) { return options.fn(this); }
return options.inverse(this);
});
Handlebars.registerHelper('ifgteq', function (a, b, options) {
if (a >= b) { return options.fn(this); }
return options.inverse(this);
});
Handlebars.registerHelper('iflteq', function (a, b, options) {
if (a <= b) { return options.fn(this); }
return options.inverse(this);
});
Handlebars.registerHelper('repeat', function (times, start, block) {
var accum = '';
if (!start) { start = 0; }
for (var i = start; i < times + start; ++i) {
block.data.index = i;
block.data.first = i === start;
block.data.last = i === (times + start - 1);
accum += block.fn(this);
}
return accum;
});
// return age type information
Handlebars.registerHelper('ife', function(arg1, arg2, options) {
return (arg1 == arg2) ? options.fn(this) : options.inverse(this);
});
}
+54 -15
View File
@@ -1,20 +1,59 @@
export class VermineRoll {
export class VermineUtils {
static roll(actorId, label, NoD, Reroll = 0, params = {}){
const actor = game.actors.get(actorId);
let formula = '' + (parseInt(NoD,10) + parseInt(Reroll,10)) + "d10";
if (Reroll > 0 && params.difficulty != undefined){
formula += 'kh' + NoD;
static roll(actorId, label, NoD, Reroll = 0, params = {}) {
const actor = game.actors.get(actorId);
let formula = '' + NoD + "d10";
formula += (params.difficulty != undefined) ? "cs>=" + params.difficulty : "cs>=7";
let roll = new Roll(formula, actor.getRollData());
roll.toMessage({
speaker: ChatMessage.getSpeaker({ actor: actor }),
flavor: label,
rollMode: game.settings.get('core', 'rollMode'),
});
return roll;
}
/* -------------------------------------------- */
static async showDiceSoNice(roll, rollMode) {
if (game.modules.get("dice-so-nice")?.active) {
if (game.dice3d) {
let whisper = null;
let blind = false;
rollMode = rollMode ?? game.settings.get("core", "rollMode");
switch (rollMode) {
case "blindroll": //GM only
blind = true;
case "gmroll": //GM + rolling player
whisper = this.getUsers(user => user.isGM);
break;
case "roll": //everybody
whisper = this.getUsers(user => user.active);
break;
case "selfroll":
whisper = [game.user.id];
break;
}
formula += (params.difficulty != undefined) ? "cs>" + params.difficulty : "cs>7";
let roll = new Roll(formula, actor.getRollData());
roll.toMessage({
speaker: ChatMessage.getSpeaker({ actor: actor }),
flavor: label,
rollMode: game.settings.get('core', 'rollMode'),
});
return roll;
}
await game.dice3d.showForRoll(roll, game.user, true, whisper, blind);
}
}
}
/* -------------------------------------------- */
static async chatListeners(html) {
html.on("click", '.roll-dice-bonus', event => {
let rollData = this.getRollDataFromMessage(event)
let msgId = VermineRoll.findChatMessageId(event.currentTarget)
nocUtility.removeChatMessageId(msgId)
let nbDice = $(event.target).data('nb-dice')
console.log(">>>>>", nbDice)
this.rollBonus(rollData, nbDice)
})
}
}
+17 -4
View File
@@ -6,13 +6,26 @@ export const registerSettings = function () {
config: true,
type: String,
choices: {
"1": "Survie",
"2": "Cauchemar",
"3": "Apocalypse"
"1": "Survie",
"2": "Cauchemar",
"3": "Apocalypse"
},
default: 'e',
onChange: value => {
// console.log(value);
let el = document.querySelector('.game-mode');
el.id = 'game-mode-' + game.settings.get('vermine2047', 'game-mode')
switch (game.settings.get('vermine2047', 'game-mode')) {
case '1':
el.innerText = 'mode survie';
break;
case '2':
el.innerText = 'mode cauchemard'
break;
case '3':
el.innerText = 'mode apocalypse'
break;
}
}
});
+31 -12
View File
@@ -12,7 +12,7 @@ import { VermineCreatureSheet } from "./sheets/creature-sheet.mjs";
import { VermineItem } from "./documents/item.mjs";
import { VermineItemSheet } from "./sheets/item-sheet.mjs";
import { VermineRoll } from "./system/roll.mjs";
import { VermineUtils } from "./system/roll.mjs";
import { VermineCombat, VermineCombatTracker } from "./system/fight.mjs";
// Import helper/utility classes and constants.
@@ -23,20 +23,21 @@ import { VERMINE } from "./system/config.mjs";
/* Init Hook */
/* -------------------------------------------- */
Hooks.once('init', async function() {
Hooks.once('init', async function () {
// Add utility classes to the global game object so that they're more easily
// accessible in global contexts.
game.vermine2047 = {
VermineActor,
VermineItem,
VermineRoll,
VermineUtils,
VermineCombat
};
// Add custom constants for configuration.
CONFIG.VERMINE = VERMINE;
CONFIG.VERMINE.model = game.system.model
console.log('__________________', CONFIG.VERMINE)
/**
* Set an initiative formula for the system
* @type {String}
@@ -54,24 +55,24 @@ Hooks.once('init', async function() {
// Register sheet application classes
Actors.unregisterSheet("core", ActorSheet);
Actors.registerSheet('vermine2047', VermineCharacterSheet, {
types: ['character'],
makeDefault: true,
});
types: ['character'],
makeDefault: true,
});
Actors.registerSheet('vermine2047', VermineNpcSheet, {
types: ['npc'],
makeDefault: true,
});
types: ['npc'],
makeDefault: true,
});
Actors.registerSheet('vermine2047', VermineCreatureSheet, {
types: ['creature'],
makeDefault: true,
});
});
Actors.registerSheet('vermine2047', VermineGroupSheet, {
types: ['group'],
makeDefault: true,
});
});
Items.unregisterSheet("core", ItemSheet);
Items.registerSheet("vermine2047", VermineItemSheet, { makeDefault: true });
@@ -79,6 +80,24 @@ Hooks.once('init', async function() {
registerHooks(); // register Hooks
registerSettings(); // register Vermine Settings
//afficher le mode de jeu
let mode = game.settings.get('vermine2047', 'game-mode');
let el = document.createElement('SPAN');
switch (mode) {
case '1':
el.innerText = 'mode survie';
break;
case '2':
el.innerText = 'mode cauchemard';
break;
case '3':
el.innerText = 'mode apocalypse';
break;
}
el.classList.add('game-mode');
el.id = 'game-mode-' + mode;
document.querySelector('#ui-left').prepend(el);
// Preload Handlebars templates.
return preloadHandlebarsTemplates();
});