attitudes
This commit is contained in:
@@ -39,6 +39,11 @@
|
||||
"ToursContent": "<p>Tu t'en sors pas si mal ! Moi je vais te laisser là, mais si tu as d'autres questions, tu peux venir me trouver. Si ca concerne la mécanique, inscris-toi dans notre groupe de parole, par là <a href=\"https://discord.gg/FqGHYvXg\">Totem Foundry Discord</a>. Sinon, tu peux rejoindre la place centrale par ici <a href=\"https://discord.gg/qejqmSxr\">Vermine Discord</a></p><p>Enjoy!</p>"
|
||||
}
|
||||
},
|
||||
"ATTITUDES": {
|
||||
"offensive": { "name": "Offensif"},
|
||||
"active": { "name": "Actif"},
|
||||
"passive": { "name": "Passif"}
|
||||
},
|
||||
|
||||
"IDENTITY": {
|
||||
"name": "Nom",
|
||||
|
||||
@@ -421,4 +421,75 @@ export class VermineCombat extends Combat {
|
||||
}
|
||||
super._onDelete()*/
|
||||
}
|
||||
}
|
||||
|
||||
export class VermineCombatTracker extends CombatTracker {
|
||||
|
||||
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].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) {
|
||||
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));
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Use to put an attitude to an actor
|
||||
* @param {*} event
|
||||
*/
|
||||
async _setStatut(event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
const btn = event.currentTarget;
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -46,12 +46,18 @@ export const registerHandlebarsHelpers = function () {
|
||||
return game.i18n.localize(arrayLabel +"."+objectLabel+".name");
|
||||
});
|
||||
|
||||
// return skill level information
|
||||
Handlebars.registerHelper('skillLevel', function (property, level, options) {
|
||||
if (level < 1 || level > 5)
|
||||
return "";
|
||||
let levelData = CONFIG.VERMINE.SkillLevels[level];
|
||||
|
||||
return (levelData !== undefined) ? levelData[property] : "";
|
||||
});
|
||||
// return skill level information
|
||||
Handlebars.registerHelper('skillLevel', function (property, level, options) {
|
||||
if (level < 1 || level > 5)
|
||||
return "";
|
||||
let levelData = CONFIG.VERMINE.SkillLevels[level];
|
||||
|
||||
return (levelData !== undefined) ? levelData[property] : "";
|
||||
});
|
||||
|
||||
Handlebars.registerHelper('getCombatTrackerColor', function (isPlayer, isNpc) {
|
||||
if (isPlayer) return "player";
|
||||
if (isNpc) return "npc";
|
||||
});
|
||||
|
||||
}
|
||||
@@ -13,7 +13,7 @@ import { VermineItem } from "./documents/item.mjs";
|
||||
import { VermineItemSheet } from "./sheets/item-sheet.mjs";
|
||||
|
||||
import { VermineRoll } from "./system/roll.mjs";
|
||||
import { VermineCombat } from "./system/fight.mjs";
|
||||
import { VermineCombat, VermineCombatTracker } from "./system/fight.mjs";
|
||||
|
||||
// Import helper/utility classes and constants.
|
||||
import { preloadHandlebarsTemplates, registerHandlebarsHelpers } from "./system/handlebars-manager.mjs";
|
||||
@@ -42,13 +42,14 @@ Hooks.once('init', async function() {
|
||||
* @type {String}
|
||||
*/
|
||||
CONFIG.Combat.initiative = {
|
||||
formula: "1d10 + @abilities.dex.mod",
|
||||
formula: "(@abilities.reflexes.value + @skills.alertness.value)d10cs>=7",
|
||||
decimals: 2
|
||||
};
|
||||
|
||||
// Define custom Document classes
|
||||
CONFIG.Actor.documentClass = VermineActor;
|
||||
CONFIG.Item.documentClass = VermineItem;
|
||||
CONFIG.ui.combat = VermineCombatTracker;
|
||||
|
||||
// Register sheet application classes
|
||||
Actors.unregisterSheet("core", ActorSheet);
|
||||
|
||||
@@ -0,0 +1,132 @@
|
||||
<section class="{{cssClass}} directory flexcol" id="{{cssId}}" data-tab="{{tabName}}">
|
||||
<header class="combat-tracker-header">
|
||||
{{#if user.isGM}}
|
||||
<nav class="encounters flexrow" aria-label="COMBAT.NavLabel">
|
||||
<a class="combat-button combat-create" data-tooltip="COMBAT.Create">
|
||||
<i class="fas fa-plus"></i>
|
||||
</a>
|
||||
{{#if combatCount}}
|
||||
<a class="combat-button combat-cycle" data-tooltip="COMBAT.EncounterPrevious"
|
||||
{{#if previousId}}data-document-id="{{previousId}}"{{else}}disabled{{/if}}>
|
||||
<i class="fas fa-caret-left"></i>
|
||||
</a>
|
||||
<h4 class="encounter">{{localize "COMBAT.Encounter"}} {{currentIndex}} / {{combatCount}}</h4>
|
||||
<a class="combat-button combat-cycle" data-tooltip="COMBAT.EncounterNext"
|
||||
{{#if nextId}}data-document-id="{{nextId}}"{{else}}disabled{{/if}}>
|
||||
<i class="fas fa-caret-right"></i>
|
||||
</a>
|
||||
{{/if}}
|
||||
<a class="combat-button combat-control" data-tooltip="COMBAT.Delete" data-control="endCombat" {{#unless combatCount}}disabled{{/unless}}>
|
||||
<i class="fas fa-trash"></i>
|
||||
</a>
|
||||
</nav>
|
||||
{{/if}}
|
||||
|
||||
<div class="encounter-controls flexrow {{#if hasCombat}}combat{{/if}}">
|
||||
{{#if user.isGM}}
|
||||
<a class="combat-button combat-control" data-tooltip="COMBAT.RollAll" data-control="rollAll" {{#unless turns}}disabled{{/unless}}>
|
||||
<i class="fas fa-users"></i>
|
||||
</a>
|
||||
<a class="combat-button combat-control" data-tooltip="COMBAT.RollNPC" data-control="rollNPC" {{#unless turns}}disabled{{/unless}}>
|
||||
<i class="fas fa-users-cog"></i>
|
||||
</a>
|
||||
{{/if}}
|
||||
|
||||
{{#if combatCount}}
|
||||
{{#if combat.round}}
|
||||
<h3 class="encounter-title noborder">{{localize 'COMBAT.Round'}} {{combat.round}}</h3>
|
||||
{{else}}
|
||||
<h3 class="encounter-title noborder">{{localize 'COMBAT.NotStarted'}}</h3>
|
||||
{{/if}}
|
||||
{{else}}
|
||||
<h3 class="encounter-title noborder">{{localize "COMBAT.None"}}</h3>
|
||||
{{/if}}
|
||||
|
||||
{{#if user.isGM}}
|
||||
<a class="combat-button combat-control" data-tooltip="COMBAT.InitiativeReset" data-control="resetAll"
|
||||
{{#unless hasCombat}}disabled{{/unless}}>
|
||||
<i class="fas fa-undo"></i>
|
||||
</a>
|
||||
<a class="combat-button combat-control" data-tooltip="{{labels.scope}}"
|
||||
data-control="toggleSceneLink" {{#unless hasCombat}}disabled{{/unless}}>
|
||||
<i class="fas fa-{{#unless linked}}un{{/unless}}link"></i>
|
||||
</a>
|
||||
<a class="combat-button combat-settings" data-tooltip="COMBAT.Settings" data-control="trackerSettings">
|
||||
<i class="fas fa-cog"></i>
|
||||
</a>
|
||||
{{/if}}
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<ol id="combat-tracker" class="directory-list">
|
||||
{{#each turns}}
|
||||
<li class="combatant actor directory-item flexrow {{this.css}}" data-combatant-id="{{this.id}}">
|
||||
<img class="token-image" data-src="{{this.img}}" alt="{{this.name}}"/>
|
||||
<div class="token-name flexcol">
|
||||
<h4 class="{{getCombatTrackerColor this.isPlayer this.isNpc}}">{{this.name}}</h4>
|
||||
<div class="combatant-controls flexrow">
|
||||
<a class="combatant-control {{#if this.hidden}}active{{/if}}" data-tooltip="COMBAT.ToggleVis" data-control="toggleHidden">
|
||||
<i class="fas fa-eye-slash"></i>
|
||||
</a>
|
||||
<a class="combatant-control {{#if this.defeated}}active{{/if}}" data-tooltip="COMBAT.ToggleDead" data-control="toggleDefeated">
|
||||
<i class="fas fa-skull"></i>
|
||||
</a>
|
||||
<a class="combatant-control offensive status" {{#if (eq this.attitude "offensive")}} data-tooltip="{{localize 'ATTITUDES.offensive.name'}}" {{else}} data-tooltip="{{localize 'ATTITUDES.offensive.name'}}" {{/if}}>
|
||||
<i {{#if (eq this.attitude "offensive")}} class="fas fa-fist-raised" style="color:white" {{else}} class="fas fa-fist-raised" style="color:gray" {{/if}}></i>
|
||||
</a>
|
||||
<a class="combatant-control active status" {{#if (eq this.attitude "active")}} data-tooltip="{{localize 'ATTITUDES.active.name'}}" {{else}} data-tooltip="{{localize 'ATTITUDES.active.name'}}" {{/if}}>
|
||||
<i {{#if (eq this.attitude "active")}} class="fas fa-bow-arrow" style="color:white" {{else}} class="fas fa-bow-arrow" style="color:gray" {{/if}}></i>
|
||||
</a>
|
||||
<a class="combatant-control passive status" {{#if (eq this.attitude "passive")}} data-tooltip="{{localize 'ATTITUDES.passive.name'}}" {{else}} data-tooltip="{{localize 'ATTITUDES.passive.name'}}" {{/if}}>
|
||||
<i {{#if (eq this.attitude "passive")}} class="fas fa-shield-cross" style="color:white" {{else}} class="fas fa-shield-cross" style="color:gray" {{/if}}></i>
|
||||
</a>
|
||||
{{#if this.canPing}}
|
||||
<a class="combatant-control" data-tooltip="COMBAT.PingCombatant" data-control="pingCombatant">
|
||||
<i class="fa-solid fa-bullseye-arrow"></i>
|
||||
</a>
|
||||
{{/if}}
|
||||
<div class="token-effects">
|
||||
{{#each this.effects}}
|
||||
<img class="token-effect" src="{{this}}"/>
|
||||
{{/each}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{#if this.hasResource}}
|
||||
<div class="token-resource">
|
||||
<span class="resource">{{this.resource}}</span>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
<div class="token-initiative">
|
||||
{{#if this.hasRolled}}
|
||||
<span class="initiative">{{this.initiative}}</span>
|
||||
{{else if this.owner}}
|
||||
<a class="combatant-control roll" data-tooltip="COMBAT.InitiativeRoll" data-control="rollInitiative"></a>
|
||||
{{/if}}
|
||||
</div>
|
||||
</li>
|
||||
{{/each}}
|
||||
</ol>
|
||||
|
||||
<nav id="combat-controls" class="directory-footer flexrow" data-tooltip-direction="UP">
|
||||
{{#if hasCombat}}
|
||||
{{#if user.isGM}}
|
||||
{{#if round}}
|
||||
<a class="combat-control" data-tooltip="COMBAT.RoundPrev" data-control="previousRound"><i class="fas fa-step-backward"></i></a>
|
||||
<a class="combat-control" data-tooltip="COMBAT.TurnPrev" data-control="previousTurn"><i class="fas fa-arrow-left"></i></a>
|
||||
<a class="combat-control center" data-control="endCombat">{{localize 'COMBAT.End'}}</a>
|
||||
<a class="combat-control" data-tooltip="COMBAT.TurnNext" data-control="nextTurn"><i class="fas fa-arrow-right"></i></a>
|
||||
<a class="combat-control" data-tooltip="COMBAT.RoundNext" data-control="nextRound"><i class="fas fa-step-forward"></i></a>
|
||||
{{else}}
|
||||
<a class="combat-control center" data-control="startCombat">{{localize 'COMBAT.Begin'}}</a>
|
||||
{{/if}}
|
||||
{{else if control}}
|
||||
<a class="combat-control" data-tooltip="COMBAT.TurnPrev" data-control="previousTurn"><i class="fas fa-arrow-left"></i></a>
|
||||
<a class="combat-control center" data-control="nextTurn">{{localize 'COMBAT.TurnEnd'}}</a>
|
||||
<a class="combat-control" data-tooltip="COMBAT.TurnNext" data-control="nextTurn"><i class="fas fa-arrow-right"></i></a>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
</nav>
|
||||
</section>
|
||||
Reference in New Issue
Block a user