diff --git a/README.md b/README.md index 0486d37..d6122a4 100644 --- a/README.md +++ b/README.md @@ -38,13 +38,16 @@ - [ ] gérer les seuils auto si compétence non maitrisée ### le combat -faut s'y pencher - [ ] modifier la difficulté en fonction de l'état du combatant /offensif/actif/passif/ ### les items +- [X] passer le type d'arme en select/options +- [X] ajouter handicap de rareté +- [ ] ajouter pour items Item "competence nécessaire" - [-] gérer les rolls d'items dans le chat - [-] repasser sur les différents itemTypes et sheets +- [X] verifier le selector de traits (trait pratique cf : msg pretre) - [X] construire une selecteur de traits, traits= CONFIG.VERMINE.traits traits:[ key:{ diff --git a/module/sheets/item-sheet.mjs b/module/sheets/item-sheet.mjs index ab3a292..eb79120 100644 --- a/module/sheets/item-sheet.mjs +++ b/module/sheets/item-sheet.mjs @@ -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`; } diff --git a/module/system/applications.mjs b/module/system/applications.mjs index b127939..9ea40a4 100644 --- a/module/system/applications.mjs +++ b/module/system/applications.mjs @@ -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) } } \ No newline at end of file diff --git a/module/system/config.mjs b/module/system/config.mjs index 317a7d8..0edf843 100644 --- a/module/system/config.mjs +++ b/module/system/config.mjs @@ -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" -] +]; + diff --git a/module/system/fight.mjs b/module/system/fight.mjs index 46b3e75..0ba47ce 100644 --- a/module/system/fight.mjs +++ b/module/system/fight.mjs @@ -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); + } + + } \ No newline at end of file diff --git a/module/system/handlebars-manager.mjs b/module/system/handlebars-manager.mjs index d4e767f..f5db4d3 100644 --- a/module/system/handlebars-manager.mjs +++ b/module/system/handlebars-manager.mjs @@ -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) { diff --git a/module/vermine2047.mjs b/module/vermine2047.mjs index f985760..74db316 100644 --- a/module/vermine2047.mjs +++ b/module/vermine2047.mjs @@ -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); diff --git a/scss/style.scss b/scss/style.scss index af87ad4..0760025 100644 --- a/scss/style.scss +++ b/scss/style.scss @@ -4,6 +4,8 @@ .window-app { font-family: "Roboto", sans-serif; box-shadow: 0px 0px 30px rgb(69, 78, 44); + + } .rollable:hover, diff --git a/template.json b/template.json index acbd0c0..bee7f97 100644 --- a/template.json +++ b/template.json @@ -485,7 +485,10 @@ "templates": { "base": { "description": "", - "rarity": 3, + "rarity": { + "value": 3, + "handicap": 0 + }, "reliability": 3, "handicap": 0, "quantity": 1, diff --git a/templates/actor/group/group-vehicles.hbs b/templates/actor/group/group-vehicles.hbs index be83791..9d50191 100644 --- a/templates/actor/group/group-vehicles.hbs +++ b/templates/actor/group/group-vehicles.hbs @@ -5,23 +5,30 @@
{{ localize 'VERMINE.rarity'}}
{{ localize 'VERMINE.reliability'}}
- +
{{#each vehicles as |item id|}} -
  • -
    -
    - -
    - {{item.name}} +
  • +
    +
    +
    -

    {{item.system.mobility}}

    -

    {{item.system.rarity}}

    -

    {{item.system.reliability}}

    -
    - -
    -
  • + {{item.name}} + +

    {{item.system.mobility}}

    +

    {{item.system.rarity.value}}

    +

    {{item.system.reliability}}

    +
    + +
    + {{/each}} \ No newline at end of file diff --git a/templates/applications/choose-traits.hbs b/templates/applications/choose-traits.hbs index e31b42a..89065ea 100644 --- a/templates/applications/choose-traits.hbs +++ b/templates/applications/choose-traits.hbs @@ -1,17 +1,11 @@
    {{#each traits as |trait ind|}} - {{log @root.item}} - {{log trait}} - {{log ind}}
    -

    {{trait.description}}

    {{/each}} diff --git a/templates/item/item-weapon-sheet.html b/templates/item/item-weapon-sheet.html index e95d396..e936fb2 100644 --- a/templates/item/item-weapon-sheet.html +++ b/templates/item/item-weapon-sheet.html @@ -1,13 +1,12 @@
    -
    - -
    -

    -
    -
    + {{log this}} + {{> "systems/vermine2047/templates/item/partials/header.hbs"}} + +
    {{> "systems/vermine2047/templates/item/partials/traits.html"}} +

    @@ -32,35 +31,26 @@
    - - - - - - - - - +

    -
    -
    - -
    -
    -
    - -
    -
    -

    description

    - {{editor system.description target="system.description" rollData=rollData button=true owner=owner editable=editable}} - {{> "systems/vermine2047/templates/item/partials/damages.html"}} + + + {{> "systems/vermine2047/templates/item/partials/physicalItems.hbs"}} + diff --git a/templates/item/partials/header.hbs b/templates/item/partials/header.hbs new file mode 100644 index 0000000..b93fcf8 --- /dev/null +++ b/templates/item/partials/header.hbs @@ -0,0 +1,16 @@ +
    + +
    +

    + +
    + +
    \ No newline at end of file diff --git a/templates/item/partials/physicalItems.hbs b/templates/item/partials/physicalItems.hbs new file mode 100644 index 0000000..6266929 --- /dev/null +++ b/templates/item/partials/physicalItems.hbs @@ -0,0 +1,44 @@ +

    + +
    + +
    + +
    + +
    + +
    + + +
    +
    +
    + + +
    +
    +
    + + +
    +
    + +

    +

    description

    +{{editor system.description target="system.description" rollData=rollData +button=true owner=owner editable=editable}} +{{> "systems/vermine2047/templates/item/partials/damages.html"}}