ajout du handicap de rareté
This commit is contained in:
@@ -10,7 +10,7 @@ export class VermineItemSheet extends ItemSheet {
|
||||
static get defaultOptions() {
|
||||
return foundry.utils.mergeObject(super.defaultOptions, {
|
||||
classes: ["vermine2047", "sheet", "item"],
|
||||
width: "fit-content",
|
||||
width: 450,
|
||||
height: "auto",
|
||||
tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "description" }]
|
||||
});
|
||||
@@ -19,11 +19,6 @@ export class VermineItemSheet extends ItemSheet {
|
||||
/** @override */
|
||||
get template() {
|
||||
const path = "systems/vermine2047/templates/item";
|
||||
// Return a single sheet for all item types.
|
||||
// return `${path}/item-sheet.html`;
|
||||
|
||||
// Alternatively, you could use the following return statement to do a
|
||||
// unique item sheet by type, like `weapon-sheet.html`.
|
||||
return `${path}/item-${this.item.type}-sheet.html`;
|
||||
}
|
||||
|
||||
|
||||
@@ -156,17 +156,14 @@ export class TraitSelector extends Application {
|
||||
}
|
||||
async validateTraits(html) {
|
||||
let checks = html.find("input.trait-selector");
|
||||
let val = html.find("input.trait-value");
|
||||
for (let inp of [...checks, val]) {
|
||||
for (let inp of checks) {
|
||||
if (this.targetItem.system.traits[inp.dataset.trait]) {
|
||||
if (inp.type == "checkbox") {
|
||||
inp.checked = true
|
||||
}
|
||||
if (inp.type == "value") {
|
||||
inp.value = this.targetItem.system.traits[inp.dataset.trait].value
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
await this.render(true)
|
||||
}
|
||||
|
||||
async onChangeInput(ev) {
|
||||
@@ -195,5 +192,6 @@ export class TraitSelector extends Application {
|
||||
} else {
|
||||
el.closest("label").querySelector('.trait-selector').checked = false;
|
||||
}
|
||||
this.render(true)
|
||||
}
|
||||
}
|
||||
@@ -224,8 +224,8 @@ VERMINE.traits = {
|
||||
description: "L’objet a une portée utile ou maximale de(n) mètres.Les armes de distance disposent de plusieurs Portées, qui peuvent être fixes ou modifiées par la Vigueur de l’attaquant, notamment pour les armes de tir ou de lancer.",
|
||||
value: 1
|
||||
},
|
||||
"pratique.": {
|
||||
name: "Pratique.",
|
||||
"pratique": {
|
||||
name: "Pratique",
|
||||
description: "Le matériel offre une prise en main exceptionnelle, une maniabilité étonnante, une simplicité d’usage remarquable.Utiliser un tel matériel pour une action adéquate accorde un Bonus de 2D au lieu de 1D.Rechercher ce Trait sur un matériel compte comme deux critères de Rareté à lui seul.De plus les réparations, améliorations et fabrications de matériel avec ce Trait souffrent de(I) Handicap en plus de ceux applicables normalement.",
|
||||
value: 0
|
||||
},
|
||||
@@ -251,4 +251,5 @@ VERMINE.damageTypes = [
|
||||
"lame",
|
||||
"feu",
|
||||
"balle"
|
||||
]
|
||||
];
|
||||
|
||||
|
||||
+20
-18
@@ -442,30 +442,13 @@ export class VermineCombatTracker extends CombatTracker {
|
||||
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("[data-attitude]").click(this._setStatut.bind(this));
|
||||
html.find("[data-control='rollInitiative']").click(this.rollVermineInitiative.bind(this))
|
||||
}
|
||||
|
||||
async rollVermineInitiative(ev) {
|
||||
ev.preventDefault();
|
||||
ev.stopPropagation();
|
||||
const btn = ev.currentTarget;
|
||||
const li = btn.closest(".combatant");
|
||||
const combat = this.viewed;
|
||||
const combatant = combat.combatants.get(li.dataset.combatantId);
|
||||
|
||||
console.log(combatant)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -489,4 +472,23 @@ export class VermineCombatTracker extends CombatTracker {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
export class VermineCombatant extends Combatant {
|
||||
constructor(data, context) {
|
||||
super(data, context);
|
||||
this.setDefaultAttitude();
|
||||
console.log(this)
|
||||
|
||||
}
|
||||
setDefaultAttitude() {
|
||||
this.attitude = this.token.flags.world?.attitude || "active"
|
||||
}
|
||||
_getInitiativeFormula() {
|
||||
|
||||
console.log(this);
|
||||
return String(CONFIG.Combat.initiative.formula || game.system.initiative);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -41,6 +41,8 @@ export const preloadHandlebarsTemplates = async function () {
|
||||
//items partials
|
||||
"systems/vermine2047/templates/item/partials/damages.html",
|
||||
"systems/vermine2047/templates/item/partials/traits.html",
|
||||
"systems/vermine2047/templates/item/partials/header.hbs",
|
||||
"systems/vermine2047/templates/item/partials/physicalItems.hbs",
|
||||
|
||||
]);
|
||||
};
|
||||
@@ -84,6 +86,24 @@ export const registerHandlebarsHelpers = function () {
|
||||
Handlebars.registerHelper('toLowerCase', function (str) {
|
||||
return str.toLowerCase();
|
||||
});
|
||||
Handlebars.registerHelper('romanNumber', function (numb) {
|
||||
switch (numb) {
|
||||
case 0:
|
||||
return '';
|
||||
case 1:
|
||||
return 'I';
|
||||
case 2:
|
||||
return 'II';
|
||||
case 3:
|
||||
return 'III';
|
||||
case 4:
|
||||
return 'IV';
|
||||
case 5:
|
||||
return 'V';
|
||||
default:
|
||||
throw new Error('Le handicap rareté doit être comprise entre 0 et 5');
|
||||
}
|
||||
});
|
||||
|
||||
// search translation with variables
|
||||
Handlebars.registerHelper('smarttl', function (arrayLabel, objectLabel, options) {
|
||||
|
||||
@@ -13,7 +13,7 @@ import { VermineItem } from "./documents/item.mjs";
|
||||
import { VermineItemSheet } from "./sheets/item-sheet.mjs";
|
||||
|
||||
import { VermineUtils } from "./system/roll.mjs";
|
||||
import { VermineCombat, VermineCombatTracker } from "./system/fight.mjs";
|
||||
import { VermineCombat, VermineCombatant, VermineCombatTracker } from "./system/fight.mjs";
|
||||
|
||||
// Import helper/utility classes and constants.
|
||||
import { preloadHandlebarsTemplates, registerHandlebarsHelpers } from "./system/handlebars-manager.mjs";
|
||||
@@ -49,7 +49,9 @@ Hooks.once('init', async function () {
|
||||
// Define custom Document classes
|
||||
CONFIG.Actor.documentClass = VermineActor;
|
||||
CONFIG.Item.documentClass = VermineItem;
|
||||
|
||||
CONFIG.ui.combat = VermineCombatTracker;
|
||||
CONFIG.Combatant.documentClass = VermineCombatant;
|
||||
|
||||
// Register sheet application classes
|
||||
Actors.unregisterSheet("core", ActorSheet);
|
||||
|
||||
Reference in New Issue
Block a user